public class BasicRelationExtractor extends Object implements Extractor
| Modifier and Type | Field and Description |
|---|---|
int |
featureCountThreshold |
RelationFeatureFactory |
featureFactory |
String |
relationExtractorClassifierType
which classifier to use (can be 'linear' or 'svm')
|
double |
sigma
strength of the prior on the linear classifier (passed to LinearClassifierFactory) or the C constant if relationExtractorClassifierType=svm
|
| Constructor and Description |
|---|
BasicRelationExtractor(RelationFeatureFactory featureFac,
boolean createUnrelatedRelations,
RelationMentionFactory factory) |
| Modifier and Type | Method and Description |
|---|---|
void |
annotate(Annotation dataset)
Annotates the given dataset with the current model This works in place,
i.e., it adds ExtractionObject objects to the sentences in the dataset To
make sure you are not messing with gold annotation create a copy of the
ExtractionDataSet first!
|
List<String> |
annotateMulticlass(List<Datum<String,String>> testDatums) |
void |
annotateSentence(CoreMap sentence) |
protected Datum<String,String> |
createDatum(RelationMention rel) |
protected Datum<String,String> |
createDatum(RelationMention rel,
String label) |
static BasicRelationExtractor |
load(String modelPath) |
void |
save(String modelpath)
Serializes this extractor to a file
|
void |
setCreateUnrelatedRelations(boolean b) |
void |
setFeatureCountThreshold(int i) |
void |
setLoggerLevel(Level level) |
void |
setRelationExtractorClassifierType(String s) |
void |
setSigma(double d) |
void |
setValidator(LabelValidator lv) |
void |
train(Annotation sentences)
Train on a list of ExtractionSentence containing labeled RelationMention objects
|
void |
trainMulticlass(GeneralDataset<String,String> trainSet) |
@Execution.Option(name="featureCountThreshold", gloss="feature count threshold to apply to dataset") public int featureCountThreshold
@Execution.Option(name="featureFactory", gloss="Feature factory for the relation extractor") public RelationFeatureFactory featureFactory
@Execution.Option(name="sigma", gloss="strength of the prior on the linear classifier (passed to LinearClassifierFactory) or the C constant if relationExtractorClassifierType=svm") public double sigma
public String relationExtractorClassifierType
public BasicRelationExtractor(RelationFeatureFactory featureFac, boolean createUnrelatedRelations, RelationMentionFactory factory)
public void setValidator(LabelValidator lv)
public void setRelationExtractorClassifierType(String s)
public void setFeatureCountThreshold(int i)
public void setSigma(double d)
public void setCreateUnrelatedRelations(boolean b)
public static BasicRelationExtractor load(String modelPath) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic void save(String modelpath) throws IOException
Extractorsave in interface Extractormodelpath - where to save the extractorIOExceptionpublic void train(Annotation sentences)
public void trainMulticlass(GeneralDataset<String,String> trainSet)
public void annotateSentence(CoreMap sentence)
public void annotate(Annotation dataset)
Extractorprotected Datum<String,String> createDatum(RelationMention rel)
protected Datum<String,String> createDatum(RelationMention rel, String label)
public void setLoggerLevel(Level level)
setLoggerLevel in interface Extractor