本文整理了Java中edu.illinois.cs.cogcomp.core.io.IOUtils.mkdir()
方法的一些代码示例,展示了IOUtils.mkdir()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtils.mkdir()
方法的具体详情如下:
包路径:edu.illinois.cs.cogcomp.core.io.IOUtils
类名称:IOUtils
方法名:mkdir
[英]Create a directory, if it does not exist.
[中]创建一个目录(如果它不存在)。
代码示例来源:origin: CogComp/cogcomp-nlp
public void writeModelsToDisk(String dir, String modelName){
IOUtils.mkdir(dir);
chunker.write(dir + File.separator + modelName + ".lc", dir + File.separator + modelName + ".lex");
logger.info("Done training, models are in " + dir+File.separator+modelName+".lc (.lex)");
}
public static void main(String[] args) {
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-chunker
public void writeModelsToDisk(String dir, String modelName){
IOUtils.mkdir(dir);
chunker.write(dir + File.separator + modelName + ".lc", dir + File.separator + modelName + ".lex");
logger.info("Done training, models are in " + dir+File.separator+modelName+".lc (.lex)");
}
public static void main(String[] args) {
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-nlp-readers
/**
* print output into a file in directory specified, with name based on annotationFile.
* Should not create an empty file (i.e., if columnOutput is empty).
*
* @param nerOutputDir directory to write output file
* @param annotationFile used as prefix for the name of the new file
* @param columnOutput a list of strings to be printed to the output file
* @throws IOException
*/
private static void printOut(String nerOutputDir, String annotationFile, List<String> columnOutput) throws IOException {
String outFile = nerOutputDir + "/" + annotationFile + ".ner.column.txt" ;
if ( !columnOutput.isEmpty() ) {
if ( !IOUtils.exists( nerOutputDir ) )
IOUtils.mkdir( nerOutputDir );
LineIO.write(outFile, columnOutput);
}
}
代码示例来源:origin: CogComp/cogcomp-nlp
/**
* Saves the ".lc" and ".lex" models to disk in the modelPath specified by the constructor The
* modelName ("Chunker", as specified in ChunkerConfigurator) is fixed
*/
public void writeModelsToDisk() {
IOUtils.mkdir(rm.getString("modelDirPath"));
chunker.save();
logger.info("Done training, models are in " + rm.getString("modelDirPath"));
}
public void writeModelsToDisk(String dir, String modelName){
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-chunker
/**
* Saves the ".lc" and ".lex" models to disk in the modelPath specified by the constructor The
* modelName ("Chunker", as specified in ChunkerConfigurator) is fixed
*/
public void writeModelsToDisk() {
IOUtils.mkdir(rm.getString("modelDirPath"));
chunker.save();
logger.info("Done training, models are in " + rm.getString("modelDirPath"));
}
public void writeModelsToDisk(String dir, String modelName){
代码示例来源:origin: CogComp/cogcomp-nlp
IOUtils.mkdir(outDir);
代码示例来源:origin: CogComp/cogcomp-nlp
String tmpFile = tmpDir + "/google.ngrams.get1t" + (new Random()).nextInt();
IOUtils.mkdir(tmpDir);
代码示例来源:origin: CogComp/talen
/**
* This saves an individual TextAnnotation to the desired output folder.
* @param foldertype
* @param path
* @param ta
* @throws IOException
*/
public static void save(String foldertype, String path, TextAnnotation ta) throws IOException {
if(!IOUtils.exists(path)) {
IOUtils.mkdir(path);
}
if(foldertype.equals(Common.FOLDERTA)) {
SerializationHelper.serializeTextAnnotationToFile(ta, path + "/" + ta.getId(), true);
}else if(foldertype.equals(Common.FOLDERTAJSON)) {
SerializationHelper.serializeTextAnnotationToFile(ta, path + "/" + ta.getId(), true, true);
}else if(foldertype.equals(Common.FOLDERCONLL)) {
CoNLLNerReader.TaToConll(Collections.singletonList(ta), path);
}else if(foldertype.equals(Common.FOLDERCOLUMN)) {
ColumnReader.TaToColumn(Collections.singletonList(ta), path);
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-core-utilities
String tmpFile = tmpDir + "/google.ngrams.get1t" + (new Random()).nextInt();
IOUtils.mkdir(tmpDir);
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-corpusreaders
IOUtils.mkdir(outDir);
代码示例来源:origin: CogComp/cogcomp-nlp
IOUtils.mkdir(outDir);
代码示例来源:origin: CogComp/cogcomp-nlp
String cacheDBDir = "data-cached";
if (!IOUtils.exists(cacheDBDir))
IOUtils.mkdir(cacheDBDir);
String cacheDB = cacheDBDir + File.separator + viewName + "-cache.db";
dbHandler = new TextAnnotationMapDBHandler(cacheDB);
代码示例来源:origin: edu.illinois.cs.cogcomp/LBJava-NLP-tools
String cacheDBDir = "data-cached";
if (!IOUtils.exists(cacheDBDir))
IOUtils.mkdir(cacheDBDir);
String cacheDB = cacheDBDir + File.separator + viewName + "-cache.db";
dbHandler = new TextAnnotationMapDBHandler(cacheDB);
代码示例来源:origin: CogComp/cogcomp-nlp
String outDir = args[1];
IOUtils.mkdir(outDir);
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-corpusreaders
System.exit(-1);
} else
IOUtils.mkdir(conllDir);
代码示例来源:origin: CogComp/cogcomp-nlp
System.exit(-1);
} else
IOUtils.mkdir(conllDir);
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-prep-srl
public void train() {
if (!IOUtils.exists(modelsDir))
IOUtils.mkdir(modelsDir);
Learner classifier = new PrepSRLClassifier(modelName + ".lc", modelName + ".lex");
Parser trainDataReader = new PrepSRLDataReader(dataDir, "train");
BatchTrainer trainer = new BatchTrainer(classifier, trainDataReader, 1000);
trainer.train(20);
classifier.save();
trainDataReader.close();
}
代码示例来源:origin: CogComp/cogcomp-nlp
public void train() {
if (!IOUtils.exists(modelsDir))
IOUtils.mkdir(modelsDir);
Learner classifier = new PrepSRLClassifier(modelName + ".lc", modelName + ".lex");
Parser trainDataReader = new PrepSRLDataReader(dataDir, "train");
BatchTrainer trainer = new BatchTrainer(classifier, trainDataReader, 1000);
trainer.train(20);
classifier.save();
trainDataReader.close();
}
代码示例来源:origin: CogComp/cogcomp-nlp
@CommandDescription(
description = "Pre-extracts the features for the verb-sense model. Run this before training.",
usage = "preExtract")
public static void preExtract() throws Exception {
SenseManager manager = getManager(true);
ResourceManager conf = new VerbSenseConfigurator().getDefaultConfig();
// If models directory doesn't exist create it
if (!IOUtils.isDirectory(conf.getString(conf
.getString(VerbSenseConfigurator.MODELS_DIRECTORY))))
IOUtils.mkdir(conf.getString(conf.getString(VerbSenseConfigurator.MODELS_DIRECTORY)));
int numConsumers = Runtime.getRuntime().availableProcessors();
Dataset dataset = Dataset.PTBTrainDev;
log.info("Pre-extracting features");
ModelInfo modelInfo = manager.getModelInfo();
String featureSet = "" + modelInfo.featureManifest.getIncludedFeatures().hashCode();
String allDataCacheFile =
VerbSenseConfigurator.getFeatureCacheFile(featureSet, dataset, rm);
FeatureVectorCacheFile featureCache =
preExtract(numConsumers, manager, dataset, allDataCacheFile);
pruneFeatures(numConsumers, manager, featureCache,
VerbSenseConfigurator.getPrunedFeatureCacheFile(featureSet, rm));
Lexicon lexicon = modelInfo.getLexicon().getPrunedLexicon(manager.getPruneSize());
log.info("Saving lexicon with {} features to {}", lexicon.size(),
manager.getLexiconFileName());
log.info(lexicon.size() + " features in the lexicon");
lexicon.save(manager.getLexiconFileName());
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-verbsense
@CommandDescription(
description = "Pre-extracts the features for the verb-sense model. Run this before training.",
usage = "preExtract")
public static void preExtract() throws Exception {
SenseManager manager = getManager(true);
ResourceManager conf = new VerbSenseConfigurator().getDefaultConfig();
// If models directory doesn't exist create it
if (!IOUtils.isDirectory(conf.getString(conf
.getString(VerbSenseConfigurator.MODELS_DIRECTORY))))
IOUtils.mkdir(conf.getString(conf.getString(VerbSenseConfigurator.MODELS_DIRECTORY)));
int numConsumers = Runtime.getRuntime().availableProcessors();
Dataset dataset = Dataset.PTBTrainDev;
log.info("Pre-extracting features");
ModelInfo modelInfo = manager.getModelInfo();
String featureSet = "" + modelInfo.featureManifest.getIncludedFeatures().hashCode();
String allDataCacheFile =
VerbSenseConfigurator.getFeatureCacheFile(featureSet, dataset, rm);
FeatureVectorCacheFile featureCache =
preExtract(numConsumers, manager, dataset, allDataCacheFile);
pruneFeatures(numConsumers, manager, featureCache,
VerbSenseConfigurator.getPrunedFeatureCacheFile(featureSet, rm));
Lexicon lexicon = modelInfo.getLexicon().getPrunedLexicon(manager.getPruneSize());
log.info("Saving lexicon with {} features to {}", lexicon.size(),
manager.getLexiconFileName());
log.info(lexicon.size() + " features in the lexicon");
lexicon.save(manager.getLexiconFileName());
}
内容来源于网络,如有侵权,请联系作者删除!