public class MachineReading extends Object
Modifier and Type | Field and Description |
---|---|
GenericDataSetReader |
auxReader |
Extractor |
consistencyChecker |
static int |
ENTITY_LEVEL |
Extractor |
entityExtractor |
static int |
EVENT_LEVEL |
Extractor |
eventExtractor |
boolean |
forceParseSentences |
protected boolean |
forceRetraining |
GenericDataSetReader |
reader |
static int |
RELATION_LEVEL |
Extractor |
relationExtractionPostProcessor |
Extractor |
relationExtractor |
Modifier | Constructor and Description |
---|---|
protected |
MachineReading() |
Modifier and Type | Method and Description |
---|---|
Annotation |
annotate(Annotation testing) |
protected Annotation |
annotate(Annotation testing,
int partition) |
GenericDataSetReader |
getAuxReader() |
Pair<Annotation,Annotation>[] |
getDatasets() |
Set<ResultsPrinter> |
getEntityResultsPrinterSet() |
Annotation[][] |
getPredictions() |
GenericDataSetReader |
getReader() |
Set<ResultsPrinter> |
getRelationResultsPrinterSet() |
protected Annotation |
loadOrMakeSerializedSentences(String sentencesPath,
GenericDataSetReader reader,
File serializedSentences)
Gets the serialized sentences for a data set.
|
static void |
main(String[] args) |
protected void |
makeDataSets(Annotation training,
Annotation testing,
Annotation auxDataset) |
static Extractor |
makeEntityExtractor(Class<? extends BasicEntityExtractor> entityExtractorClass,
String gazetteerPath) |
static Extractor |
makeExtractor(Class<Extractor> extractorClass) |
static MachineReading |
makeMachineReading(String[] args) |
static MachineReading |
makeMachineReadingForAnnotation(GenericDataSetReader reader,
Extractor entityExtractor,
Extractor relationExtractor,
Extractor eventExtractor,
Extractor consistencyChecker,
Extractor relationPostProcessor,
boolean testRelationsUsingPredictedEntities,
boolean verbose)
Creates a MR object to be used only for annotation purposes (no training)
This is needed in order to integrate MachineReading with BaselineNLProcessor
|
static Extractor |
makeRelationExtractor(Class<? extends BasicRelationExtractor> relationExtractorClass,
RelationFeatureFactory featureFac,
boolean createUnrelatedRelations,
RelationMentionFactory factory) |
static RelationFeatureFactory |
makeRelationFeatureFactory(Class<? extends RelationFeatureFactory> relationFeatureFactoryClass,
String relationFeatureList,
boolean doNotLexicalizeFirstArg) |
static RelationMentionFactory |
makeRelationMentionFactory(Class<RelationMentionFactory> relationMentionFactoryClass) |
protected List<String> |
printTask(String taskName,
Set<ResultsPrinter> printers,
Annotation gold,
Annotation pred) |
List<String> |
run()
Performs extraction.
|
protected boolean |
serializedModelExists(String prefix) |
void |
setAuxReader(GenericDataSetReader auxReader) |
static void |
setConsoleLevel(Level level) |
void |
setDatasets(Pair<Annotation,Annotation>[] datasets) |
void |
setEntityResultsPrinterSet(Set<ResultsPrinter> entityResultsPrinterSet) |
void |
setExtractEntities(boolean extractEntities) |
void |
setExtractEvents(boolean extractEvents) |
void |
setExtractRelations(boolean extractRelations) |
void |
setForceParseSentences(boolean forceParseSentences) |
static void |
setLoggerLevel(Level level) |
void |
setPredictions(Annotation[][] predictions) |
void |
setReader(GenericDataSetReader reader) |
void |
setRelationResultsPrinterSet(Set<ResultsPrinter> relationResultsPrinterSet) |
protected void |
train(Annotation training,
int partition) |
public GenericDataSetReader reader
public GenericDataSetReader auxReader
public Extractor entityExtractor
public Extractor relationExtractor
public Extractor relationExtractionPostProcessor
public Extractor eventExtractor
public Extractor consistencyChecker
protected boolean forceRetraining
public boolean forceParseSentences
public static final int ENTITY_LEVEL
public static final int RELATION_LEVEL
public static final int EVENT_LEVEL
public static void setLoggerLevel(Level level)
public static void setConsoleLevel(Level level)
public static MachineReading makeMachineReadingForAnnotation(GenericDataSetReader reader, Extractor entityExtractor, Extractor relationExtractor, Extractor eventExtractor, Extractor consistencyChecker, Extractor relationPostProcessor, boolean testRelationsUsingPredictedEntities, boolean verbose)
public static MachineReading makeMachineReading(String[] args) throws IOException
IOException
public List<String> run() throws Exception
Exception
protected List<String> printTask(String taskName, Set<ResultsPrinter> printers, Annotation gold, Annotation pred)
protected void train(Annotation training, int partition) throws Exception
Exception
public Annotation annotate(Annotation testing)
protected Annotation annotate(Annotation testing, int partition)
protected void makeDataSets(Annotation training, Annotation testing, Annotation auxDataset)
protected boolean serializedModelExists(String prefix)
public static Extractor makeEntityExtractor(Class<? extends BasicEntityExtractor> entityExtractorClass, String gazetteerPath)
public static Extractor makeRelationExtractor(Class<? extends BasicRelationExtractor> relationExtractorClass, RelationFeatureFactory featureFac, boolean createUnrelatedRelations, RelationMentionFactory factory)
public static RelationFeatureFactory makeRelationFeatureFactory(Class<? extends RelationFeatureFactory> relationFeatureFactoryClass, String relationFeatureList, boolean doNotLexicalizeFirstArg)
public static RelationMentionFactory makeRelationMentionFactory(Class<RelationMentionFactory> relationMentionFactoryClass)
protected Annotation loadOrMakeSerializedSentences(String sentencesPath, GenericDataSetReader reader, File serializedSentences) throws IOException, ClassNotFoundException
sentencesPath
- location of the raw data setreader
- the corpus readerserializedSentences
- where the serialized sentences should be stored on diskIOException
ClassNotFoundException
public void setExtractEntities(boolean extractEntities)
public void setExtractRelations(boolean extractRelations)
public void setExtractEvents(boolean extractEvents)
public void setForceParseSentences(boolean forceParseSentences)
public void setDatasets(Pair<Annotation,Annotation>[] datasets)
public Pair<Annotation,Annotation>[] getDatasets()
public void setPredictions(Annotation[][] predictions)
public Annotation[][] getPredictions()
public void setReader(GenericDataSetReader reader)
public GenericDataSetReader getReader()
public void setAuxReader(GenericDataSetReader auxReader)
public GenericDataSetReader getAuxReader()
public void setEntityResultsPrinterSet(Set<ResultsPrinter> entityResultsPrinterSet)
public Set<ResultsPrinter> getEntityResultsPrinterSet()
public void setRelationResultsPrinterSet(Set<ResultsPrinter> relationResultsPrinterSet)
public Set<ResultsPrinter> getRelationResultsPrinterSet()