public static String getFileStem(String path) { return stripFileExtension(getFileName(path)); }
public static String getFileStem(String path) { return stripFileExtension(getFileName(path)); }
/** * A workaround for the unit tests in Maven that move the relative path of the root directory in * {@link ESRLConfigurator} to the directory of each module. <b>NB:</b> This code assumes the * default data directory to be <i>$ROOT_DIR/data/</i>. * * @param file The file/directory to be used * @return The same file/directory moved to the root dir of the main project */ protected String getCorrectPath(String file) { if (file.contains("data") && !IOUtils.exists(new File(file).getParent())) { int dataIndex = file.indexOf("data") - 1; int prevSlashIndex = file.lastIndexOf(File.separator, dataIndex - 1); String fileWithParentDir = file.substring(0, prevSlashIndex) + file.substring(dataIndex, file.length()); logger.warn("{} doesn't exist, trying parent directory: {}.", IOUtils.getFileName(file), fileWithParentDir); file = fileWithParentDir; } return file; }
public void readFile(String fileName) { try { List<String> lines = LineIO.read(fileName); for (int i = 0; i < lines.size(); i++) { String line = lines.get(i); String sentId = IOUtils.getFileName(fileName) + ":" + i; textAnnotations.add(createTextAnnotation(line, sentId)); } } catch (FileNotFoundException e) { logger.error("Could not read {}; unable to continue.", fileName); throw new RuntimeException(e); } }
public void readFile(String fileName) { try { List<String> lines = LineIO.read(fileName); for (int i = 0; i < lines.size(); i++) { String line = lines.get(i); String sentId = IOUtils.getFileName(fileName) + ":" + i; textAnnotations.add(createTextAnnotation(line, sentId)); } } catch (FileNotFoundException e) { logger.error("Could not read {}; unable to continue.", fileName); throw new RuntimeException(e); } }
/** * A workaround for the unit tests in Maven that move the relative path of the root directory * in {@link ESRLConfigurator} to the directory of each module. <b>NB:</b> This code assumes * the default data directory to be <i>$ROOT_DIR/data/</i>. * * @param file The file/directory to be used * @return The same file/directory moved to the root dir of the main project */ protected String getCorrectPath(String file) { if (file.contains("data") && !IOUtils.exists(new File(file).getParent())) { int dataIndex = file.indexOf("data") - 1; int prevSlashIndex = file.lastIndexOf(File.separator, dataIndex - 1); String fileWithParentDir = file.substring(0, prevSlashIndex) + file.substring(dataIndex, file.length()); logger.warn("{} doesn't exist, trying parent directory: {}.", IOUtils.getFileName(file), fileWithParentDir); file = fileWithParentDir; } return file; }
/** * A workaround for the unit tests in Maven that move the relative path of the root directory in * {@link ESRLConfigurator} to the directory of each module. <b>NB:</b> This code assumes the * default data directory to be <i>$ROOT_DIR/data/</i>. * * @param file The file/directory to be used * @return The same file/directory moved to the root dir of the main project */ protected String getCorrectPath(String file) { if (file.contains("data") && !IOUtils.exists(new File(file).getParent())) { int dataIndex = file.indexOf("data") - 1; int prevSlashIndex = file.lastIndexOf(File.separator, dataIndex - 1); String fileWithParentDir = file.substring(0, prevSlashIndex) + file.substring(dataIndex, file.length()); logger.warn("{} doesn't exist, trying parent directory: {}.", IOUtils.getFileName(file), fileWithParentDir); file = fileWithParentDir; } return file; }
String file = IOUtils.getFileName(url.getPath());
public List<TextAnnotation> readData() { String corpusId = IOUtils.getFileName(file); List<String> lines; try {
String file = IOUtils.getFileName(url.getPath());
public List<TextAnnotation> readData() { String corpusId = IOUtils.getFileName(file); List<String> lines; try {
throw new RuntimeException("Couldn't read " + dataFile); String corpusId = IOUtils.getFileName(dataFile); List<String> labels = new ArrayList<>(); List<String> tokens = new ArrayList<>();
(files.length + failed.size()), failed.size()); for (String file : files) { String taHashStr = IOUtils.stripFileExtension(IOUtils.getFileName(file));
gaz.readDictionary(IOUtils.getFileName(file.getPath()), "", is); } catch (IOException e) { throw new RuntimeException(e); gazIC.readDictionary(IOUtils.getFileName(file.getPath()), "(IC)", is); } catch (IOException e) { throw new RuntimeException(e);
gaz.readDictionary(IOUtils.getFileName(file.getPath()), "", is); } catch (IOException e) { throw new RuntimeException(e); gazIC.readDictionary(IOUtils.getFileName(file.getPath()), "(IC)", is); } catch (IOException e) { throw new RuntimeException(e);
String filenameonly = IOUtils.getFileName(filename); List<String[]> tokenizedSentences = Collections.singletonList(text.toString().split(" ")); TextAnnotation ta =
String filenameonly = IOUtils.getFileName(filename); List<String[]> tokenizedSentences = Collections.singletonList(text.toString().split(" ")); TextAnnotation ta =
String filenameonly = IOUtils.getFileName(filename); List<String[]> tokenizedSentences = Collections.singletonList(text.toString().split(" ")); TextAnnotation ta =