热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.cogcomp.Datastore.getFile()方法的使用及代码示例

本文整理了Java中org.cogcomp.Datastore.getFile()方法的一些代码示例,展示了Datastore.getFile()

本文整理了Java中org.cogcomp.Datastore.getFile()方法的一些代码示例,展示了Datastore.getFile()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Datastore.getFile()方法的具体详情如下:
包路径:org.cogcomp.Datastore
类名称:Datastore
方法名:getFile

Datastore.getFile介绍

暂无

代码示例

代码示例来源:origin: CogComp/cogcomp-nlp

private Map> getLegalSensesMap() {
Map> map = new HashMap<>();
Datastore ds = null;
File senseFile = null;
try {
ds = new Datastore(new ResourceConfigurator().getDefaultConfig());
senseFile =
ds.getFile("edu.illinois.cs.cogcomp.verbsense", "sense-list.txt", 1.0, false);
} catch (InvalidPortException | InvalidEndpointException | DatastoreException e) {
e.printStackTrace();
}
try {
for (String line : LineIO.read(senseFile.getAbsolutePath())) {
String predicate = line.split("\t")[0];
String[] senseArray = line.split("\t")[1].split(",");
Set senseSet = new HashSet<>(Arrays.asList(senseArray));
map.put(predicate, senseSet);
}
} catch (FileNotFoundException e) {
log.error("Unable to load list of legal senses: ", e);
System.exit(-1);
}
return map;
}

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-verbsense

private Map> getLegalSensesMap() {
Map> map = new HashMap<>();
Datastore ds = null;
File senseFile = null;
try {
ds = new Datastore(new ResourceConfigurator().getDefaultConfig());
senseFile =
ds.getFile("edu.illinois.cs.cogcomp.verbsense", "sense-list.txt", 1.0, false);
} catch (InvalidPortException | InvalidEndpointException | DatastoreException e) {
e.printStackTrace();
}
try {
for (String line : LineIO.read(senseFile.getAbsolutePath())) {
String predicate = line.split("\t")[0];
String[] senseArray = line.split("\t")[1].split(",");
Set senseSet = new HashSet<>(Arrays.asList(senseArray));
map.put(predicate, senseSet);
}
} catch (FileNotFoundException e) {
log.error("Unable to load list of legal senses: ", e);
System.exit(-1);
}
return map;
}

代码示例来源:origin: CogComp/cogcomp-nlp

ds.getFile("org.cogcomp.mate-tools",
"CoNLL2009-ST-English-ALL.anna.lemmatizer.model", 3.3, false);
File parserModel =
ds.getFile("org.cogcomp.mate-tools",
"CoNLL2009-ST-English-ALL.anna.parser.model", 3.3, false);
File posModel =
ds.getFile("org.cogcomp.mate-tools",
"CoNLL2009-ST-English-ALL.anna.postagger.model", 3.3, false);
File pathLSTM = ds.getFile("uk.ac.ed.inf", "pathLSTM.model", 1.0, false);

代码示例来源:origin: CogComp/cogcomp-nlp

/**
* Retrieves the relevant file from the DataStore
*/
private File getFile(FileType type) throws DatastoreException {
ResourceManager rm = new ResourceConfigurator().getDefaultConfig();
Datastore ds = new Datastore(rm.getString("datastoreEndpoint"));
if (type.equals(FileType.Embedding)) {
File f = ds.getFile("org.cogcomp.dataless", "memorybasedESA.txt", 1.0);
return f;
} else {
File f = ds.getFile("org.cogcomp.dataless", "pageIDMapping.txt", 1.0);
return f;
}
}

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-datalessclassification

/**
* Retrieves the relevant file from the DataStore
*/
private File getFile(FileType type) throws DatastoreException {
ResourceManager rm = new ResourceConfigurator().getDefaultConfig();
Datastore ds = new Datastore(rm.getString("datastoreEndpoint"));
if (type.equals(FileType.Embedding)) {
File f = ds.getFile("org.cogcomp.dataless", "memorybasedESA.txt", 1.0);
return f;
} else {
File f = ds.getFile("org.cogcomp.dataless", "pageIDMapping.txt", 1.0);
return f;
}
}

代码示例来源:origin: CogComp/cogcomp-nlp

private synchronized void loadFromDatastore() throws Exception {
if (loaded)
return;
Datastore dsNoCredentials = new Datastore(new ResourceConfigurator().getDefaultConfig());
File f = dsNoCredentials.getFile("org.cogcomp.roget.thesaurus", "rogetThesaurus", 1.3);
loadWithURL(f.toURI().toURL());
}

代码示例来源:origin: CogComp/cogcomp-nlp

if (method.equals(EmbeddingConstant.word2vec)) {
try {
f = ds.getFile("org.cogcomp.wordembedding", "word2vec.txt", 1.5);
} catch (DatastoreException e) {
e.printStackTrace();
f = ds.getFile("org.cogcomp.wordembedding", "glove.txt", 1.5);
} catch (DatastoreException e) {
f = ds.getFile("org.cogcomp.wordembedding", "phrase2vec.txt", 1.5);
} catch (DatastoreException e) {
f = ds.getFile("org.cogcomp.wordembedding", "memorybasedESA.txt", 1.5);
} catch (DatastoreException e) {
f = ds.getFile("org.cogcomp.wordembedding", "pageIDMapping.txt", 1.5);
} catch (DatastoreException e) {

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-edison

private synchronized void loadFromDatastore() throws Exception {
if (loaded)
return;
Datastore dsNoCredentials = new Datastore(new ResourceConfigurator().getDefaultConfig());
File f = dsNoCredentials.getFile("org.cogcomp.roget.thesaurus", "rogetThesaurus", 1.3);
loadWithURL(f.toURI().toURL());
}

代码示例来源:origin: CogComp/cogcomp-nlp

public static VerbClassDictionary getDictionaryFromDatastore() {
if (verbClassDictiOnary== null) {
synchronized (LevinVerbClassFeature.class) {
if (verbClassDictiOnary== null) {
log.info("Reading verb class dictionary. Looking for " + verbClassFile + " in the datastore");
try {
Datastore dsNoCredentials = new Datastore(new ResourceConfigurator().getDefaultConfig());
File f = dsNoCredentials.getFile("org.cogcomp.levin.verb.class", "levin-verbClass", 1.6);
InputStream resource = new FileInputStream(f);
verbClassDictiOnary= new VerbClassDictionary(resource);
} catch (Exception e) {
e.printStackTrace();
log.error("Unable to read the verb class dictionary", e);
System.exit(-1);
}
List strings = verbClassDictionary.getClass("give");
log.info("Loaded verb class dictionary. Test: classes for 'give' are {}", strings);
}
}
}
return verbClassDictionary;
}

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-edison

public static VerbClassDictionary getDictionaryFromDatastore() {
if (verbClassDictiOnary== null) {
synchronized (LevinVerbClassFeature.class) {
if (verbClassDictiOnary== null) {
log.info("Reading verb class dictionary. Looking for " + verbClassFile + " in the datastore");
try {
Datastore dsNoCredentials = new Datastore(new ResourceConfigurator().getDefaultConfig());
File f = dsNoCredentials.getFile("org.cogcomp.levin.verb.class", "levin-verbClass", 1.6);
InputStream resource = new FileInputStream(f);
verbClassDictiOnary= new VerbClassDictionary(resource);
} catch (Exception e) {
e.printStackTrace();
log.error("Unable to read the verb class dictionary", e);
System.exit(-1);
}
List strings = verbClassDictionary.getClass("give");
log.info("Loaded verb class dictionary. Test: classes for 'give' are {}", strings);
}
}
}
return verbClassDictionary;
}

代码示例来源:origin: CogComp/cogcomp-nlp

/**
* Retrieves the relevant file from the DataStore
*/
private File getFile() throws DatastoreException {
ResourceManager rm = new ResourceConfigurator().getDefaultConfig();
Datastore ds = new Datastore(rm.getString("datastoreEndpoint"));
File f = ds.getFile("org.cogcomp.dataless", "word2vec.txt", 1.0);
return f;
}

代码示例来源:origin: CogComp/cogcomp-nlp

public void loadFromDataStore() throws Exception {
Datastore dsNoCredentials = new Datastore(new ResourceConfigurator().getDefaultConfig());
File f = dsNoCredentials.getFile("org.cogcomp.brown-clusters", file, 1.3);
InputStream is = new FileInputStream(f);
loadFromInputStream(is);
}

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-edison

public void loadFromDataStore() throws Exception {
Datastore dsNoCredentials = new Datastore(new ResourceConfigurator().getDefaultConfig());
File f = dsNoCredentials.getFile("org.cogcomp.brown-clusters", file, 1.3);
InputStream is = new FileInputStream(f);
loadFromInputStream(is);
}

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-datalessclassification

/**
* Retrieves the relevant file from the DataStore
*/
private File getFile() throws DatastoreException {
ResourceManager rm = new ResourceConfigurator().getDefaultConfig();
Datastore ds = new Datastore(rm.getString("datastoreEndpoint"));
File f = ds.getFile("org.cogcomp.dataless", "word2vec.txt", 1.0);
return f;
}

推荐阅读
author-avatar
文武2602897197
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有