use of edu.stanford.nlp.trees.PennTreeReaderFactory in project CoreNLP by stanfordnlp.
the class Preferences method lookupTreeReaderFactory.
static TreeReaderFactory lookupTreeReaderFactory(String trfName) {
if (trfName.equalsIgnoreCase("ArabicTreeReaderFactory")) {
return new ArabicTreeReaderFactory();
} else if (trfName.equalsIgnoreCase("ArabicTreeReaderFactory.ArabicRawTreeReaderFactory")) {
return new ArabicTreeReaderFactory.ArabicRawTreeReaderFactory();
} else if (trfName.equalsIgnoreCase("CTBTreeReaderFactory")) {
return new CTBTreeReaderFactory();
} else if (trfName.equalsIgnoreCase("NoEmptiesCTBTreeReaderFactory")) {
return new NoEmptiesCTBTreeReaderFactory();
} else if (trfName.equalsIgnoreCase("Basic categories only (LabeledScoredTreeReaderFactory)")) {
return new LabeledScoredTreeReaderFactory();
} else if (trfName.equalsIgnoreCase("FrenchTreeReaderFactory")) {
//PTB format
return new FrenchTreeReaderFactory();
} else if (trfName.equalsIgnoreCase("PennTreeReaderFactory")) {
return new PennTreeReaderFactory();
} else if (trfName.equalsIgnoreCase("StringLabeledScoredTreeReaderFactory")) {
return new StringLabeledScoredTreeReaderFactory();
} else if (trfName.equalsIgnoreCase("TregexTreeReaderFactory")) {
return new TregexPattern.TRegexTreeReaderFactory();
} else {
//try to find the class
try {
Class<?> trfClass = Class.forName(trfName);
TreeReaderFactory trf = (TreeReaderFactory) trfClass.newInstance();
return trf;
} catch (Exception e) {
return new PennTreeReaderFactory();
}
}
}
Aggregations