public abstract class Model extends Object
| Modifier and Type | Field and Description |
|---|---|
int |
allFeatureCount |
protected Config |
config |
protected org.nlpcn.commons.lang.tire.domain.SmartForest<float[]> |
featureTree |
static org.nlpcn.commons.lang.util.logging.Log |
logger |
protected float[][] |
status |
| Constructor and Description |
|---|
Model() |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
checkModel(String modelPath)
判断当前数据流是否是本实例
|
Config |
getConfig() |
float[] |
getFeature(char... chars)
获得特征所在权重数组
|
static Model |
load(Class<? extends Model> c,
InputStream is)
模型读取
|
static Model |
load(String modelPath)
模型读取
|
abstract Model |
loadModel(InputStream is) |
abstract Model |
loadModel(String modelPath)
不同的模型实现自己的加载模型类
|
protected static void |
printFeatureTree(String cs,
float[] tempW)
增加特征到特征数中
|
float |
tagRate(int s1,
int s2)
tag转移率
|
void |
writeModel(String path)
将model序列化到硬盘
|
public static final org.nlpcn.commons.lang.util.logging.Log logger
protected Config config
protected org.nlpcn.commons.lang.tire.domain.SmartForest<float[]> featureTree
protected float[][] status
public int allFeatureCount
public abstract boolean checkModel(String modelPath) throws IOException
is - IOExceptionpublic static Model load(String modelPath) throws Exception
path - Exceptionpublic static Model load(Class<? extends Model> c, InputStream is) throws Exception
path - Exceptionpublic abstract Model loadModel(String modelPath) throws Exception
Exceptionpublic abstract Model loadModel(InputStream is) throws Exception
Exceptionpublic float[] getFeature(char... chars)
featureStr - public Config getConfig()
public float tagRate(int s1,
int s2)
s1 - s2 - protected static void printFeatureTree(String cs, float[] tempW)
cs - tempW - public void writeModel(String path)
path - IOExceptionFileNotFoundExceptionCopyright © 2017. All rights reserved.