本文整理了Java中org.cogcomp.Datastore.getDirectory()
方法的一些代码示例,展示了Datastore.getDirectory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Datastore.getDirectory()
方法的具体详情如下:
包路径:org.cogcomp.Datastore
类名称:Datastore
方法名:getDirectory
暂无
代码示例来源:origin: CogComp/cogcomp-nlp
/**
* @param withPropBankData if false, it will use nomBank data
*/
public FramesManager(Boolean withPropBankData) throws InvalidPortException, InvalidEndpointException, DatastoreException {
Datastore dsNoCredentials = new Datastore(new ResourceConfigurator().getDefaultConfig());
String dir = "";
if(withPropBankData) {
File f = dsNoCredentials.getDirectory("org.cogcomp.propbank", "propbank-frames", 3.1, false);
dir = f.getAbsolutePath() + File.separator + "propbank-frames-3.1" + File.separator + "frames";
}
else {
File f = dsNoCredentials.getDirectory("org.cogcomp.nombank", "nombank-frames", 1.0, false);
dir = f.getAbsolutePath() + File.separator + "nombank.1.0" + File.separator + "frames";
}
log.info("Loading frames from {}", dir);
try {
readFrameData(dir);
} catch (Exception e) {
log.error("Unable to load frames from {}", dir);
throw new RuntimeException(e);
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-edison
/**
* @param withPropBankData if false, it will use nomBank data
*/
public FramesManager(Boolean withPropBankData) throws InvalidPortException, InvalidEndpointException, DatastoreException {
Datastore dsNoCredentials = new Datastore(new ResourceConfigurator().getDefaultConfig());
String dir = "";
if(withPropBankData) {
File f = dsNoCredentials.getDirectory("org.cogcomp.propbank", "propbank-frames", 3.1, false);
dir = f.getAbsolutePath() + File.separator + "propbank-frames-3.1" + File.separator + "frames";
}
else {
File f = dsNoCredentials.getDirectory("org.cogcomp.nombank", "nombank-frames", 1.0, false);
dir = f.getAbsolutePath() + File.separator + "nombank.1.0" + File.separator + "frames";
}
log.info("Loading frames from {}", dir);
try {
readFrameData(dir);
} catch (Exception e) {
log.error("Unable to load frames from {}", dir);
throw new RuntimeException(e);
}
}
代码示例来源:origin: CogComp/cogcomp-nlp
@Override
public void initialize(ResourceManager rm) {
System.out.println("loading . . . ");
try {
Datastore dsNoCredentials = new Datastore(new ResourceConfigurator().getDefaultConfig());
File f = dsNoCredentials.getDirectory("org.cogcomp.question-typer", "question-typer-models", 1.0, false);
this.modelsFolder = f.getPath() + "/question-typer-models/";
System.out.println(modelsFolder + "QuestionFineTyper.lc");
} catch (InvalidPortException | DatastoreException | InvalidEndpointException e) {
e.printStackTrace();
}
fine = new QuestionFineTyper(modelsFolder + "QuestionFineTyper.lc", modelsFolder + "QuestionFineTyper.lex");
coarse = new QuestionCoarseTyper(modelsFolder + "QuestionCoarseTyper.lc", modelsFolder + "QuestionCoarseTyper.lex");
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-question-typer
@Override
public void initialize(ResourceManager rm) {
System.out.println("loading . . . ");
try {
Datastore dsNoCredentials = new Datastore(new ResourceConfigurator().getDefaultConfig());
File f = dsNoCredentials.getDirectory("org.cogcomp.question-typer", "question-typer-models", 1.0, false);
this.modelsFolder = f.getPath() + "/question-typer-models/";
System.out.println(modelsFolder + "QuestionFineTyper.lc");
} catch (InvalidPortException | DatastoreException | InvalidEndpointException e) {
e.printStackTrace();
}
fine = new QuestionFineTyper(modelsFolder + "QuestionFineTyper.lc", modelsFolder + "QuestionFineTyper.lex");
coarse = new QuestionCoarseTyper(modelsFolder + "QuestionCoarseTyper.lc", modelsFolder + "QuestionCoarseTyper.lex");
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-transliteration
@Override
public void initialize(ResourceManager rm) {
try {
Datastore dsNoCredentials = new Datastore(new ResourceConfigurator().getDefaultConfig());
File f = dsNoCredentials.getDirectory("org.cogcomp.transliteration", "transliteration-models", 1.3, false);
String modelPath = f.getAbsolutePath() + File.separator + "transliteration-models-oct-2017" + File.separator + "probs-" + lang.getCode() + ".txt";
if(new File(modelPath).exists()) {
logger.info("Loading transliteration models for language: " + lang + " from " + modelPath);
model = new SPModel(modelPath);
model.setMaxCandidates(1);
}
else {
logger.error("Model for language: " + lang + " don't exist: " + modelPath);
}
} catch (IOException | InvalidEndpointException | DatastoreException | InvalidPortException e) {
e.printStackTrace();
}
}
代码示例来源:origin: CogComp/cogcomp-nlp
@Override
public void initialize(ResourceManager rm) {
try {
Datastore dsNoCredentials = new Datastore(new ResourceConfigurator().getDefaultConfig());
File f = dsNoCredentials.getDirectory("org.cogcomp.transliteration", "transliteration-models", 1.3, false);
String modelPath = f.getAbsolutePath() + File.separator + "transliteration-models-oct-2017" + File.separator + "probs-" + lang.getCode() + ".txt";
if(new File(modelPath).exists()) {
logger.info("Loading transliteration models for language: " + lang + " from " + modelPath);
model = new SPModel(modelPath);
model.setMaxCandidates(1);
}
else {
logger.error("Model for language: " + lang + " don't exist: " + modelPath);
}
} catch (IOException | InvalidEndpointException | DatastoreException | InvalidPortException e) {
e.printStackTrace();
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/md
Datastore ds = new Datastore(new ResourceConfigurator().getDefaultConfig());
if (mode.contains("ACE")) {
File extentFlie = ds.getDirectory("org.cogcomp.mention", "ACE_EXTENT", 1.0, false);
fileName_EXTENT = extentFlie.getPath() + File.separator + "ACE_EXTENT" + File.separator + "EXTENT_ACE";
if (mode.contains("NON")){
File headFile = ds.getDirectory("org.cogcomp.mention", "ACE_HEAD_NONTYPE", 1.0, false);
fileName_NAM = headFile.getPath() + File.separator + "ACE_HEAD_NONTYPE" + File.separator + "ACE_NAM";
fileName_NOM = headFile.getPath() + File.separator + "ACE_HEAD_NONTYPE" + File.separator + "ACE_NOM";
File headFile = ds.getDirectory("org.cogcomp.mention", "ACE_HEAD_TYPE", 1.0, false);
fileName_NAM = headFile.getPath() + File.separator + "ACE_HEAD_TYPE" + File.separator + "ACE_NAM_TYPE";
fileName_NOM = headFile.getPath() + File.separator + "ACE_HEAD_TYPE" + File.separator + "ACE_NOM_TYPE";
File extentFlie = ds.getDirectory("org.cogcomp.mention", "ERE_EXTENT", 1.0, false);
fileName_EXTENT = extentFlie.getPath() + File.separator + "ERE_EXTENT" + File.separator + "EXTENT_ERE";
if (mode.contains("NON")){
File headFile = ds.getDirectory("org.cogcomp.mention", "ERE_HEAD_NONTYPE", 1.0, false);
fileName_NAM = headFile.getPath() + File.separator + "ERE_HEAD_NONTYPE" + File.separator + "ERE_NAM";
fileName_NOM = headFile.getPath() + File.separator + "ERE_HEAD_NONTYPE" + File.separator + "ERE_NOM";
File headFile = ds.getDirectory("org.cogcomp.mention", "ERE_HEAD_TYPE", 1.0, false);
fileName_NAM = headFile.getPath() + File.separator + "ERE_HEAD_TYPE" + File.separator + "ERE_NAM_TYPE";
fileName_NOM = headFile.getPath() + File.separator + "ERE_HEAD_TYPE" + File.separator + "ERE_NOM_TYPE";
File gazetteersResource = ds.getDirectory("org.cogcomp.gazetteers", "gazetteers", 1.3, false);
GazetteersFactory.init(5, gazetteersResource.getPath() + File.separator + "gazetteers", true);
gazetteers = (FlatGazetteers) GazetteersFactory.get();
代码示例来源:origin: CogComp/cogcomp-nlp
File bcDirectory = dsNoCredentials.getDirectory("org.cogcomp.brown-clusters", "brown-clusters", 1.5, false);
for (int i = 0; i < pathsToClusterFiles.size(); i++) {
THashMap<String, String> h = new THashMap<>();
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-relation-extraction
@Override
public void initialize(ResourceManager rm) {
try {
Datastore ds = new Datastore(new ResourceConfigurator().getDefaultConfig());
File modelDir = ds.getDirectory("org.cogcomp.re", "ACE_GOLD_BI", 1.0, false);
String modelFile = modelDir.getPath() + File.separator + "ACE_GOLD_BI" + File.separator + "ACE_GOLD_BI.lc";
String lexFile = modelDir.getPath() + File.separator + "ACE_GOLD_BI" + File.separator + "ACE_GOLD_BI.lex";
relationClassifier = new relation_classifier();
relationClassifier.readModel(modelFile);
relationClassifier.readLexicon(lexFile);
constrainedClassifier = new ACERelationConstrainedClassifier(relationClassifier);
File gazetteersResource = ds.getDirectory("org.cogcomp.gazetteers", "gazetteers", 1.6, false);
gazetteers = GazetteersFactory.get(5, gazetteersResource.getPath() + File.separator + "gazetteers",
true, Language.English);
WordNetManager.loadConfigAsClasspathResource(true);
wordNet = WordNetManager.getInstance();
} catch (Exception e) {
e.printStackTrace();
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-comma
@Override
public void initialize(ResourceManager resourceManager) {
try {
classifier = new LocalCommaClassifier();
Datastore ds = new Datastore(new ResourceConfigurator().getDefaultConfig());
File f = ds.getDirectory("org.cogcomp.comma-srl", "comma-srl-models", 2.2, false);
String folder = f.toString() + File.separator + "comma-srl-models" + File.separator;
classifier.readLexicon(folder + "LocalCommaClassifier.lex");
classifier.readModel(folder + "LocalCommaClassifier.lc");
} catch (Exception e) {
e.printStackTrace();
}
assert classifier.getPrunedLexiconSize() > 1000;
assert classifier.getLabelLexicon().size() > 5;
}
代码示例来源:origin: CogComp/cogcomp-nlp
public ModelInfo(SenseManager manager) throws Exception {
this.manager = manager;
String file = "features.fex";
log.info("Loading feature extractor from {}", file);
featureManifest = new FeatureManifest(file);
featureManifest.useCompressedName();
fex = featureManifest.createFex();
if (Boolean.valueOf(rm.getString(VerbSenseConfigurator.LOAD_MODELS_FROM_DATASTORE.key))) {
try {
ds = new Datastore(new ResourceConfigurator().getDefaultConfig());
datastoreModels =
ds.getDirectory("edu.illinois.cs.cogcomp.verbsense", "verbsense-models",
1.0, false);
} catch (InvalidPortException | InvalidEndpointException e) {
e.printStackTrace();
}
}
}
代码示例来源:origin: CogComp/cogcomp-nlp
@Override
public void initialize(ResourceManager resourceManager) {
try {
classifier = new LocalCommaClassifier();
Datastore ds = new Datastore(new ResourceConfigurator().getDefaultConfig());
File f = ds.getDirectory("org.cogcomp.comma-srl", "comma-srl-models", 2.2, false);
String folder = f.toString() + File.separator + "comma-srl-models" + File.separator;
classifier.readLexicon(folder + "LocalCommaClassifier.lex");
classifier.readModel(folder + "LocalCommaClassifier.lc");
} catch (Exception e) {
e.printStackTrace();
}
assert classifier.getPrunedLexiconSize() > 1000;
assert classifier.getLabelLexicon().size() > 5;
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-verbsense
public ModelInfo(SenseManager manager) throws Exception {
this.manager = manager;
String file = "features.fex";
log.info("Loading feature extractor from {}", file);
featureManifest = new FeatureManifest(file);
featureManifest.useCompressedName();
fex = featureManifest.createFex();
if (Boolean.valueOf(rm.getString(VerbSenseConfigurator.LOAD_MODELS_FROM_DATASTORE.key))) {
try {
ds = new Datastore(new ResourceConfigurator().getDefaultConfig());
datastoreModels =
ds.getDirectory("edu.illinois.cs.cogcomp.verbsense", "verbsense-models",
1.0, false);
} catch (InvalidPortException | InvalidEndpointException e) {
e.printStackTrace();
}
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-relation-extraction
public void initExternalTools(){
try {
_posAnnotator = new POSAnnotator();
Datastore ds = new Datastore(new ResourceConfigurator().getDefaultConfig());
File gazetteersResource = ds.getDirectory("org.cogcomp.gazetteers", "gazetteers", 1.3, false);
_gazetteers = (FlatGazetteers)GazetteersFactory.get(5, gazetteersResource.getPath() + File.separator +
"gazetteers", true, Language.English);
WordNetManager.loadConfigAsClasspathResource(true);
_wordnet = WordNetManager.getInstance();
__chunker = new ChunkerAnnotator(true);
__chunker.initialize(new ChunkerConfigurator().getDefaultConfig());
Properties stanfordProps = new Properties();
stanfordProps.put("annotators", "pos, parse");
stanfordProps.put("parse.originalDependencies", true);
stanfordProps.put("parse.maxlen", Stanford331Configurator.STFRD_MAX_SENTENCE_LENGTH);
stanfordProps.put("parse.maxtime", Stanford331Configurator.STFRD_TIME_PER_SENTENCE);
POSTaggerAnnotator posAnnotator = new POSTaggerAnnotator("pos", stanfordProps);
ParserAnnotator parseAnnotator = new ParserAnnotator("parse", stanfordProps);
__stanfordDep = new StanfordDepHandler(posAnnotator, parseAnnotator);
__mentionAnnotator = new MentionAnnotator("ACE_TYPE");
}
catch (Exception e){
e.printStackTrace();
}
}
代码示例来源:origin: CogComp/cogcomp-nlp
posAnnotator = new POSAnnotator();
Datastore ds = new Datastore(new ResourceConfigurator().getDefaultConfig());
File gazetteersResource = ds.getDirectory("org.cogcomp.gazetteers", "gazetteers", 1.3, false);
gazetteers = GazetteersFactory.get(5, gazetteersResource.getPath() + File.separator + "gazetteers", true, Language.English);
Vector<String> bcs = new Vector<>();
代码示例来源:origin: edu.illinois.cs.cogcomp/md
posAnnotator = new POSAnnotator();
Datastore ds = new Datastore(new ResourceConfigurator().getDefaultConfig());
File gazetteersResource = ds.getDirectory("org.cogcomp.gazetteers", "gazetteers", 1.3, false);
GazetteersFactory.init(5, gazetteersResource.getPath() + File.separator + "gazetteers", true);
Vector<String> bcs = new Vector<>();
代码示例来源:origin: CogComp/cogcomp-nlp
wordNet = WordNetManager.getInstance();
Datastore ds = new Datastore(new ResourceConfigurator().getDefaultConfig());
File gazetteersResource = ds.getDirectory("org.cogcomp.gazetteers", "gazetteers", 1.3, false);
gazetteers = GazetteersFactory.get(5, gazetteersResource.getPath() + File.separator + "gazetteers", true, Language.English);
Vector<String> bcs = new Vector<>();
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-md
wordNet = WordNetManager.getInstance();
Datastore ds = new Datastore(new ResourceConfigurator().getDefaultConfig());
File gazetteersResource = ds.getDirectory("org.cogcomp.gazetteers", "gazetteers", 1.3, false);
gazetteers = GazetteersFactory.get(5, gazetteersResource.getPath() + File.separator + "gazetteers", true, Language.English);
Vector<String> bcs = new Vector<>();
代码示例来源:origin: edu.illinois.cs.cogcomp/md
wordNet = WordNetManager.getInstance();
Datastore ds = new Datastore(new ResourceConfigurator().getDefaultConfig());
File gazetteersResource = ds.getDirectory("org.cogcomp.gazetteers", "gazetteers", 1.3, false);
GazetteersFactory.init(5, gazetteersResource.getPath() + File.separator + "gazetteers", true);
Vector<String> bcs = new Vector<>();
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-relation-extraction
stanfordDepHandler.addView(ta);
Datastore ds = new Datastore(new ResourceConfigurator().getDefaultConfig());
File model = ds.getDirectory("org.cogcomp.re", "SEMEVAL", 1.1, false);
modelPath = model.getPath();
File gazetteersResource = ds.getDirectory("org.cogcomp.gazetteers", "gazetteers", 1.3, false);
gazetteers = (FlatGazetteers) GazetteersFactory.get(5, gazetteersResource.getPath() + File.separator + "gazetteers",
true, Language.English);
内容来源于网络,如有侵权,请联系作者删除!