本文整理了Java中edu.illinois.cs.cogcomp.core.io.IOUtils.lsFiles()
方法的一些代码示例,展示了IOUtils.lsFiles()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtils.lsFiles()
方法的具体详情如下:
包路径:edu.illinois.cs.cogcomp.core.io.IOUtils
类名称:IOUtils
方法名:lsFiles
[英]List the files contained in a directory.
[中]列出目录中包含的文件。
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-core-utilities
/**
* List the files contained in a directory.
*/
public static String[] lsFiles(String directory) throws IOException {
return lsFiles(directory, new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return true;
}
});
}
代码示例来源:origin: CogComp/cogcomp-nlp
/**
* List the files contained in a directory.
*/
public static String[] lsFiles(String directory) throws IOException {
return lsFiles(directory, new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return true;
}
});
}
代码示例来源:origin: edu.illinois.cs.cogcomp/saul-examples
private void readPropbankFrameData(String dir) throws Exception {
frameData = new HashMap<>();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(false);
dbf.setValidating(false);
for (String file : IOUtils.lsFiles(dir, (dir1, name) -> name.endsWith("xml"))) {
// IOUtils.getFileName(file) doesn't work in Windows
int slashIndex = file.lastIndexOf(File.separator);
String fileName = file.substring(slashIndex + 1);
// A hack to deal with percent-sign in nombank. There is another
// file called perc-sign that will fill this void.
if (fileName.contains("percent-sign.xml"))
continue;
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(file);
NodeList predicateElements = doc.getElementsByTagName("predicate");
for (int i = 0; i < predicateElements.getLength(); i++) {
String lemma = IOUtils.stripFileExtension(fileName);
FrameData fData = new FrameData(lemma);
frameData.put(lemma, fData);
NodeList roleSets = doc.getElementsByTagName("roleset");
addRoleSets(fileName, lemma, fData, roleSets);
}
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/saul-examples
String[] files;
try {
files = IOUtils.lsFiles(dataFolder);
} catch (Exception e) {
e.printStackTrace();
代码示例来源:origin: CogComp/cogcomp-nlp
inFiles = IOUtils.lsFiles(inDir);
} catch (IOException e) {
e.printStackTrace();
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-corpusreaders
inFiles = IOUtils.lsFiles(inDir);
} catch (IOException e) {
e.printStackTrace();
代码示例来源:origin: edu.illinois.cs.cogcomp/esrl-core
files = IOUtils.lsFiles(directory, new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
代码示例来源:origin: CogComp/cogcomp-nlp
/**
* A table is built from either a given source corpus file or source corpus directory by simply
* counting the number of times that each form-POS association appear in a source corpus.
*
* @param home file name or directory name of the source corpus
* @throws Exception
**/
public void buildTable(String home) throws Exception {
if (IOUtils.isFile(home))
this.buildTableHelper(home);
else if (IOUtils.isDirectory(home)) {
String[] files = IOUtils.lsFiles(home);
for (String file : files) {
// logger.info(file);
this.buildTableHelper(home + "\\" + file);
}
}
}
代码示例来源:origin: CogComp/cogcomp-nlp
/**
* A table is built from either a given source corpus file or source corpus directory by
* counting the number of times that each suffix-POS association in a source corpus.
*
* @param home file name or directory name of the source corpus
* @throws Exception
**/
public void buildTable(String home) throws Exception {
if (IOUtils.isFile(home))
this.buildTableHelper(home);
else if (IOUtils.isDirectory(home)) {
String[] files = IOUtils.lsFiles(home);
for (String file : files) {
// logger.info(file);
this.buildTableHelper(home + "\\" + file);
}
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-edison
/**
* A table is built from either a given source corpus file or source corpus directory by
* counting the number of times that each suffix-POS association in a source corpus.
*
* @param home file name or directory name of the source corpus
* @throws Exception
**/
public void buildTable(String home) throws Exception {
if (IOUtils.isFile(home))
this.buildTableHelper(home);
else if (IOUtils.isDirectory(home)) {
String[] files = IOUtils.lsFiles(home);
for (String file : files) {
// logger.info(file);
this.buildTableHelper(home + "\\" + file);
}
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-edison
/**
* A table is built from either a given source corpus file or source corpus directory by simply
* counting the number of times that each form-POS association appear in a source corpus.
*
* @param home file name or directory name of the source corpus
* @throws Exception
**/
public void buildTable(String home) throws Exception {
if (IOUtils.isFile(home))
this.buildTableHelper(home);
else if (IOUtils.isDirectory(home)) {
String[] files = IOUtils.lsFiles(home);
for (String file : files) {
// logger.info(file);
this.buildTableHelper(home + "\\" + file);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!