public class NETagger extends Object
| Constructor and Description |
|---|
NETagger()
default constructor
|
NETagger(File featureConfigFile)
constructor for feature config file
|
| Modifier and Type | Method and Description |
|---|---|
Properties |
getFeatureConfig() |
Object |
getModel()
return the model
|
int |
getNumber_Iterations() |
boolean |
is_Max_Ent() |
boolean |
isTrained()
returns true when model has been successfully trained.
|
Sentence |
PPDtoUnits(String sentence)
takes a sentence in piped format and returns the corresponding unit sentence as a Sentence object
|
void |
predict(Sentence sentence,
boolean showSegmentConfidence)
predicts the entity labels by means of a model.
|
ArrayList<String> |
predictIOB(ArrayList<Sentence> sentences,
boolean showSegmentConfidence)
predict the entity labels by means of a previously learned model.
|
void |
readModel(File f)
load a previously trained FeatureSubsetModel (CRF4+Properties) which was stored as serialized object to disk.
|
void |
readModel(InputStream is)
load a previously trained FeatureSubsetModel (CRF4+Properties) which was stored as serialized object to disk.
|
void |
set_Max_Ent(boolean me_train) |
void |
set_Number_Iterations(int number_iter) |
void |
setFeatureConfig(Properties featureConfig) |
void |
train(ArrayList<Sentence> sentences)
this is to train a NE model (based on CRF); when trained, the model is stored internally.
|
void |
writeModel(String filename)
Save the model learned to disk.
|
public NETagger()
public NETagger(File featureConfigFile)
featureConfigFile - public boolean isTrained()
public void train(ArrayList<Sentence> sentences)
sentences - training data, an ArrayList of Sentence objects, File which contains the feature subset to be used in
a text formatpublic void predict(Sentence sentence, boolean showSegmentConfidence)
sentence - a Sentence object containing all units (= tokens) of that sentenceshowSegmentConfidence - when this flag is set to true for all found entities a confidence is estimated. The confidence is
stored in Unit object.public ArrayList<String> predictIOB(ArrayList<Sentence> sentences, boolean showSegmentConfidence)
sentences - an ArrayList of Sentence objectsshowSegmentConfidence - when this flag is set to true for all found entities a confidence is estimated. Confidence is written
to IOB outputfile.public void writeModel(String filename)
filename - where to write it (full path!)public void readModel(File f) throws IOException, FileNotFoundException, ClassNotFoundException
is - input stream of the serialized featureSubsetModelIOExceptionFileNotFoundExceptionClassNotFoundExceptionpublic void readModel(InputStream is) throws IOException, FileNotFoundException, ClassNotFoundException
is - input stream of the serialized featureSubsetModelIOExceptionFileNotFoundExceptionClassNotFoundExceptionpublic Object getModel()
public void setFeatureConfig(Properties featureConfig)
public Properties getFeatureConfig()
public Sentence PPDtoUnits(String sentence)
sentence - in piped format to be convertedpublic int getNumber_Iterations()
public void set_Number_Iterations(int number_iter)
public boolean is_Max_Ent()
public void set_Max_Ent(boolean me_train)
Copyright © 2019 JULIE Lab Jena, Germany. All rights reserved.