本文整理了Java中net.sf.okapi.common.Util.fillInputRootDirectoryVariable()
方法的一些代码示例,展示了Util.fillInputRootDirectoryVariable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.fillInputRootDirectoryVariable()
方法的具体详情如下:
包路径:net.sf.okapi.common.Util
类名称:Util
方法名:fillInputRootDirectoryVariable
[英]Replaces in a given original string, a potential variable INPUT_ROOT_DIRECTORY_VAR by a given root directory.
[中]在给定的原始字符串中,用给定的根目录替换潜在变量INPUT_ROOT_DIRECTORY_VAR。
代码示例来源:origin: net.sf.okapi/okapi-core
/**
* Expand all supported variables and canonicalize (resolve ".." and ".")
* a path. If the input path has no variables, it is returned unchanged.
* rootDir and inputRootDir can be null.
* @param path The path to expand
* @param rootDir The directory to expand ${rootDir} into
* @param inputRootDir The directory to expand ${inputRootDir} into
* @return The expanded path
* @throws IOException If canonicalizing fails
*/
public static String expandPath (String path, String rootDir, String inputRootDir)
throws IOException {
if (!path.contains("${")) return path;
path = Util.fillSystemEnvars(path);
path = Util.fillRootDirectoryVariable(path, rootDir);
path = Util.fillInputRootDirectoryVariable(path, inputRootDir);
path = new File(path).getCanonicalPath();
return path;
}
代码示例来源:origin: net.sf.okapi.steps/okapi-step-termextraction
/**
* Generates the report file with the results.
*/
private void generateReport () {
// Output the report
PrintWriter writer = null;
try {
String finalPath = Util.fillRootDirectoryVariable(params.getOutputPath(), rootDir);
finalPath = Util.fillInputRootDirectoryVariable(finalPath, inputRootDir);
Util.createDirectories(finalPath);
writer = new PrintWriter(finalPath, "UTF-8");
for ( Entry<String, Integer> entry : terms.entrySet() ) {
writer.println(String.format("%d\t%s", entry.getValue(), entry.getKey()));
}
}
catch ( IOException e ) {
throw new OkapiException("Error when writing output file.", e);
}
finally {
if ( writer != null ) {
writer.close();
writer = null;
}
}
}
代码示例来源:origin: net.sf.okapi.steps/okapi-step-searchandreplace
private void generateReport (String text) {
// Output the report
PrintWriter writer = null;
try {
String finalPath = Util.fillRootDirectoryVariable(params.getLogPath(), rootDir);
finalPath = Util.fillInputRootDirectoryVariable(finalPath, inputRootDir);
Util.createDirectories(finalPath);
writer = new PrintWriter(finalPath, "UTF-8");
writer.println(text);
}
catch ( IOException e ) {
throw new OkapiException("Error when writing output file.", e);
}
finally {
if ( writer != null ) {
writer.close();
writer = null;
}
}
}
代码示例来源:origin: net.sf.okapi.steps/okapi-step-msbatchtranslation
propFile = propFile.trim();
propFile = Util.fillRootDirectoryVariable(propFile, rootDir);
propFile = Util.fillInputRootDirectoryVariable(propFile, inputRootDir);
propFile = LocaleId.replaceVariables(propFile, sourceLocale, targetLocale);
代码示例来源:origin: net.sf.okapi.steps/okapi-step-searchandreplace
finalPath = Util.fillInputRootDirectoryVariable(finalPath, inputRootDir);
replacementWords = loadList(finalPath);
代码示例来源:origin: net.sf.okapi.steps/okapi-step-rainbowkit
origin = Util.fillInputRootDirectoryVariable(origin, inputRootDir);
origin = LocaleId.replaceVariables(origin, manifest.getSourceLocale(), manifest.getTargetLocale());
代码示例来源:origin: net.sf.okapi.steps/okapi-step-leveraging
tmxOutputPath = Util.fillInputRootDirectoryVariable(tmxOutputPath, inputRootDir);
tmxOutputPath = LocaleId.replaceVariables(tmxOutputPath, srcLoc, trgLoc);
existingTMPath = Util.fillInputRootDirectoryVariable(existingTMPath, inputRootDir);
existingTMPath = LocaleId.replaceVariables(existingTMPath, srcLoc, trgLoc);
existingTm = TmSeekerFactory.createFileBasedTmSeeker(existingTMPath);
SRXDocument srxDoc = new SRXDocument();
String srxPath = Util.fillRootDirectoryVariable(params.getSrxPath(), rootDir);
srxPath = Util.fillInputRootDirectoryVariable(srxPath, inputRootDir);
srxPath = LocaleId.replaceVariables(srxPath, srcLoc, trgLoc);
srxDoc.loadRules(srxPath);
代码示例来源:origin: net.sf.okapi.steps/okapi-step-rainbowkit
resolvedOutputDir = Util.fillInputRootDirectoryVariable(resolvedOutputDir, inputRootDir);
resolvedOutputDir = LocaleId.replaceVariables(resolvedOutputDir, srcLoc, trgLoc);
代码示例来源:origin: net.sf.okapi.steps/okapi-step-translationcomparison
resolvedPath = Util.fillInputRootDirectoryVariable(resolvedPath, inputRootDir);
resolvedPath = LocaleId.replaceVariables(resolvedPath, sourceLocale, targetLocale);
tmx = new TMXWriter(resolvedPath);
代码示例来源:origin: net.sf.okapi.steps/okapi-step-msbatchtranslation
tmxOutputPath = Util.fillInputRootDirectoryVariable(tmxOutputPath, inputRootDir);
tmxOutputPath = LocaleId.replaceVariables(tmxOutputPath, sourceLocale, targetLocale);
tmxWriter = new TMXWriter(tmxOutputPath);
代码示例来源:origin: net.sf.okapi.steps/okapi-step-leveraging
tmDir = Util.fillInputRootDirectoryVariable(tmDir, inputRootDir);
tmDir = LocaleId.replaceVariables(tmDir, srcLoc, trgLoc);
Util.createDirectories(tmDir+File.separator);
代码示例来源:origin: net.sf.okapi.steps/okapi-step-leveraging
realPath = Util.fillInputRootDirectoryVariable(realPath, inputRootDir);
realPath = LocaleId.replaceVariables(realPath, sourceLocale, targetLocale);
代码示例来源:origin: net.sf.okapi.steps/okapi-step-segmentation
src = Util.fillInputRootDirectoryVariable(src, inputRootDir);
srxDoc.loadRules(src);
} else {
trg = Util.fillInputRootDirectoryVariable(trg, inputRootDir);
内容来源于网络,如有侵权,请联系作者删除!