public class POSTagger extends Object implements Serializable
| Constructor and Description |
|---|
POSTagger()
default constructor
|
POSTagger(File featureConfigFile)
constructor for feature config file
|
| Modifier and Type | Method and Description |
|---|---|
Properties |
getFeatureConfig() |
Object |
getModel()
return the model
|
int |
getNumber_Iterations() |
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
|
ArrayList<String> |
predictForCLI(ArrayList<Sentence> sentences)
predict the entity labels by means of a previously learned model.
|
void |
predictForUIMA(Sentence sentence)
predicts the entity labels by means of a model.
|
static POSTagger |
readModel(File modelFile)
load a previously trained FeatureSubsetModel (CRF4+Properties) which was
stored as serialized object to disk.
|
static POSTagger |
readModel(InputStream is)
load a previously trained FeatureSubsetModel (CRF4+Properties) which was
stored as serialized object to disk.
|
void |
set_Number_Iterations(int number_iter) |
void |
setFeatureConfig(Properties featureConfig) |
Sentence |
textToUnits(String sentence) |
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 POSTagger()
public POSTagger(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 predictForUIMA(Sentence sentence)
sentence - a Sentence object containing all units (= tokens) of that
sentencepublic ArrayList<String> predictForCLI(ArrayList<Sentence> sentences)
sentences - an ArrayList of Sentence objectspublic void writeModel(String filename)
filename - where to write it (full path!)public static POSTagger readModel(InputStream is) throws IOException, FileNotFoundException, ClassNotFoundException
is - InputStream for a serialized featureSubsetModelIOExceptionFileNotFoundExceptionClassNotFoundExceptionpublic static POSTagger readModel(File modelFile) throws IOException, FileNotFoundException, ClassNotFoundException
filename - where to find the serialized featureSubsetModel (full path!)IOExceptionFileNotFoundExceptionClassNotFoundExceptionpublic 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)
Copyright © 2018 JULIE Lab, Germany. All Rights Reserved.