edu.illinois.cs.cogcomp.core.io.IOUtils.exists()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(126)

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

IOUtils.exists介绍

[英]Check if a file exists.
[中]检查文件是否存在。

代码示例

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

public static boolean dbFileExists(String dbFile) {
  boolean create = false;
  if (!IOUtils.exists(dbFile + ".mv.db"))
    create = true;
  return create;
}

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

private static boolean dbFileExists(String dbFile) {
  boolean create = false;
  if (!IOUtils.exists(dbFile + ".h2.db"))
    create = true;
  return create;
}

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

public static boolean dbFileExists(String dbFile) {
  boolean create = false;
  if (!IOUtils.exists(dbFile + ".h2.db") && !IOUtils.exists(dbFile + ".mv.db"))
    create = true;
  return create;
}

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

public static boolean dbFileExists(String dbFile) {
  boolean create = false;
  if (!IOUtils.exists(dbFile + ".mv.db"))
    create = true;
  return create;
}

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

public static boolean dbFileExists(String dbFile) {
  boolean create = false;
  if (!IOUtils.exists(dbFile + ".h2.db"))
    create = true;
  return create;
}

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

private static boolean dbFileExists(String dbFile) {
  boolean create = false;
  if (!IOUtils.exists(dbFile + ".h2.db"))
    create = true;
  return create;
}

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

public static boolean dbFileExists(String dbFile) {
  boolean create = false;
  if (!IOUtils.exists(dbFile + ".h2.db") && !IOUtils.exists(dbFile + ".mv.db"))
    create = true;
  return create;
}

代码示例来源:origin: edu.illinois.cs.cogcomp/big-data-utils

public static boolean dbFileExists(String dbFile) {
  boolean create = false;
  if (!IOUtils.exists(dbFile + ".mv.db"))
    create = true;
  return create;
}

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

/**
 * Create a new empty file.
 */
public static boolean touch(String file) throws IOException {
  return !exists(file) && (new File(file)).createNewFile();
}

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

/**
 * Create a new empty file.
 */
public static boolean touch(String file) throws IOException {
  return !exists(file) && (new File(file)).createNewFile();
}

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

/**
 * Checks if the dataset is cached in the DB.
 *
 * @param dataset The name of the dataset (e.g. "train", "test")
 * @param dbFile The name of the MapDB file
 * @return Whether the dataset exists in the DB
 */
public boolean isCached(String dataset, String dbFile) {
  return IOUtils.exists(dbFile) && getMap(dataset).size() > 0;
}

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

public static boolean rmDir(String directory) throws IOException {
  if (!exists(directory))
    return false;
  if (!isDirectory(directory))
    throw new IOException(directory + " is not a directory!");
  return (new File(directory)).delete();
}

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

/**
 * Create a directory, if it does not exist.
 */
public static boolean mkdir(String dir) {
  if (!exists(dir)) {
    return (new File(dir)).mkdirs();
  } else {
    return isDirectory(dir);
  }
}

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

/**
 * Delete a file
 *
 * @return true only if the delete was successful
 */
public static boolean rm(String file) throws IOException {
  if (!exists(file))
    return false;
  if (!isFile(file))
    throw new IOException(file + " is not a file!");
  return (new File(file)).delete();
}

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

/**
 * Delete a file
 *
 * @return true only if the delete was successful
 */
public static boolean rm(String file) throws IOException {
  if (!exists(file))
    return false;
  if (!isFile(file))
    throw new IOException(file + " is not a file!");
  return (new File(file)).delete();
}

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

/**
 * Checks if the dataset is cached in the DB.
 *
 * @param dataset The name of the dataset (e.g. "train", "test")
 * @param dbFile The name of the MapDB file
 * @return Whether the dataset exists in the DB
 */
public boolean isCached(String dataset, String dbFile) {
  return IOUtils.exists(dbFile) && getMap(dataset).size() > 0;
}

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

/**
 * Create a directory, if it does not exist.
 */
public static boolean mkdir(String dir) {
  if (!exists(dir)) {
    return (new File(dir)).mkdirs();
  } else {
    return isDirectory(dir);
  }
}

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

public static boolean rmDir(String directory) throws IOException {
  if (!exists(directory))
    return false;
  if (!isDirectory(directory))
    throw new IOException(directory + " is not a directory!");
  return (new File(directory)).delete();
}

代码示例来源: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: 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();
}

相关文章