net.sf.okapi.common.Util.fillInputRootDirectoryVariable()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(203)

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

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

  1. /**
  2. * Expand all supported variables and canonicalize (resolve ".." and ".")
  3. * a path. If the input path has no variables, it is returned unchanged.
  4. * rootDir and inputRootDir can be null.
  5. * @param path The path to expand
  6. * @param rootDir The directory to expand ${rootDir} into
  7. * @param inputRootDir The directory to expand ${inputRootDir} into
  8. * @return The expanded path
  9. * @throws IOException If canonicalizing fails
  10. */
  11. public static String expandPath (String path, String rootDir, String inputRootDir)
  12. throws IOException {
  13. if (!path.contains("${")) return path;
  14. path = Util.fillSystemEnvars(path);
  15. path = Util.fillRootDirectoryVariable(path, rootDir);
  16. path = Util.fillInputRootDirectoryVariable(path, inputRootDir);
  17. path = new File(path).getCanonicalPath();
  18. return path;
  19. }

代码示例来源:origin: net.sf.okapi.steps/okapi-step-termextraction

  1. /**
  2. * Generates the report file with the results.
  3. */
  4. private void generateReport () {
  5. // Output the report
  6. PrintWriter writer = null;
  7. try {
  8. String finalPath = Util.fillRootDirectoryVariable(params.getOutputPath(), rootDir);
  9. finalPath = Util.fillInputRootDirectoryVariable(finalPath, inputRootDir);
  10. Util.createDirectories(finalPath);
  11. writer = new PrintWriter(finalPath, "UTF-8");
  12. for ( Entry<String, Integer> entry : terms.entrySet() ) {
  13. writer.println(String.format("%d\t%s", entry.getValue(), entry.getKey()));
  14. }
  15. }
  16. catch ( IOException e ) {
  17. throw new OkapiException("Error when writing output file.", e);
  18. }
  19. finally {
  20. if ( writer != null ) {
  21. writer.close();
  22. writer = null;
  23. }
  24. }
  25. }

代码示例来源:origin: net.sf.okapi.steps/okapi-step-searchandreplace

  1. private void generateReport (String text) {
  2. // Output the report
  3. PrintWriter writer = null;
  4. try {
  5. String finalPath = Util.fillRootDirectoryVariable(params.getLogPath(), rootDir);
  6. finalPath = Util.fillInputRootDirectoryVariable(finalPath, inputRootDir);
  7. Util.createDirectories(finalPath);
  8. writer = new PrintWriter(finalPath, "UTF-8");
  9. writer.println(text);
  10. }
  11. catch ( IOException e ) {
  12. throw new OkapiException("Error when writing output file.", e);
  13. }
  14. finally {
  15. if ( writer != null ) {
  16. writer.close();
  17. writer = null;
  18. }
  19. }
  20. }

代码示例来源:origin: net.sf.okapi.steps/okapi-step-msbatchtranslation

  1. propFile = propFile.trim();
  2. propFile = Util.fillRootDirectoryVariable(propFile, rootDir);
  3. propFile = Util.fillInputRootDirectoryVariable(propFile, inputRootDir);
  4. propFile = LocaleId.replaceVariables(propFile, sourceLocale, targetLocale);

代码示例来源:origin: net.sf.okapi.steps/okapi-step-searchandreplace

  1. finalPath = Util.fillInputRootDirectoryVariable(finalPath, inputRootDir);
  2. replacementWords = loadList(finalPath);

代码示例来源:origin: net.sf.okapi.steps/okapi-step-rainbowkit

  1. origin = Util.fillInputRootDirectoryVariable(origin, inputRootDir);
  2. origin = LocaleId.replaceVariables(origin, manifest.getSourceLocale(), manifest.getTargetLocale());

代码示例来源:origin: net.sf.okapi.steps/okapi-step-leveraging

  1. tmxOutputPath = Util.fillInputRootDirectoryVariable(tmxOutputPath, inputRootDir);
  2. tmxOutputPath = LocaleId.replaceVariables(tmxOutputPath, srcLoc, trgLoc);
  3. existingTMPath = Util.fillInputRootDirectoryVariable(existingTMPath, inputRootDir);
  4. existingTMPath = LocaleId.replaceVariables(existingTMPath, srcLoc, trgLoc);
  5. existingTm = TmSeekerFactory.createFileBasedTmSeeker(existingTMPath);
  6. SRXDocument srxDoc = new SRXDocument();
  7. String srxPath = Util.fillRootDirectoryVariable(params.getSrxPath(), rootDir);
  8. srxPath = Util.fillInputRootDirectoryVariable(srxPath, inputRootDir);
  9. srxPath = LocaleId.replaceVariables(srxPath, srcLoc, trgLoc);
  10. srxDoc.loadRules(srxPath);

代码示例来源:origin: net.sf.okapi.steps/okapi-step-rainbowkit

  1. resolvedOutputDir = Util.fillInputRootDirectoryVariable(resolvedOutputDir, inputRootDir);
  2. resolvedOutputDir = LocaleId.replaceVariables(resolvedOutputDir, srcLoc, trgLoc);

代码示例来源:origin: net.sf.okapi.steps/okapi-step-translationcomparison

  1. resolvedPath = Util.fillInputRootDirectoryVariable(resolvedPath, inputRootDir);
  2. resolvedPath = LocaleId.replaceVariables(resolvedPath, sourceLocale, targetLocale);
  3. tmx = new TMXWriter(resolvedPath);

代码示例来源:origin: net.sf.okapi.steps/okapi-step-msbatchtranslation

  1. tmxOutputPath = Util.fillInputRootDirectoryVariable(tmxOutputPath, inputRootDir);
  2. tmxOutputPath = LocaleId.replaceVariables(tmxOutputPath, sourceLocale, targetLocale);
  3. tmxWriter = new TMXWriter(tmxOutputPath);

代码示例来源:origin: net.sf.okapi.steps/okapi-step-leveraging

  1. tmDir = Util.fillInputRootDirectoryVariable(tmDir, inputRootDir);
  2. tmDir = LocaleId.replaceVariables(tmDir, srcLoc, trgLoc);
  3. Util.createDirectories(tmDir+File.separator);

代码示例来源:origin: net.sf.okapi.steps/okapi-step-leveraging

  1. realPath = Util.fillInputRootDirectoryVariable(realPath, inputRootDir);
  2. realPath = LocaleId.replaceVariables(realPath, sourceLocale, targetLocale);

代码示例来源:origin: net.sf.okapi.steps/okapi-step-segmentation

  1. src = Util.fillInputRootDirectoryVariable(src, inputRootDir);
  2. srxDoc.loadRules(src);
  3. } else {
  4. trg = Util.fillInputRootDirectoryVariable(trg, inputRootDir);

相关文章