• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LogInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中fig.basic.LogInfo的典型用法代码示例。如果您正苦于以下问题:Java LogInfo类的具体用法?Java LogInfo怎么用?Java LogInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LogInfo类属于fig.basic包,在下文中一共展示了LogInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: log

import fig.basic.LogInfo; //导入依赖的package包/类
public void log() {
  LogInfo.begin_track("Example: %s", utterance);
  LogInfo.logs("Tokens: %s", getTokens());
  LogInfo.logs("Lemmatized tokens: %s", getLemmaTokens());
  LogInfo.logs("POS tags: %s", languageInfo.posTags);
  LogInfo.logs("NER tags: %s", languageInfo.nerTags);
  LogInfo.logs("NER values: %s", languageInfo.nerValues);
  if (context != null)
    LogInfo.logs("context: %s", context);
  if (targetFormula != null)
    LogInfo.logs("targetFormula: %s", targetFormula);
  if (targetValue != null)
    LogInfo.logs("targetValue: %s", targetValue);
  LogInfo.logs("Dependency children: %s", languageInfo.dependencyChildren);
  LogInfo.end_track();
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:17,代码来源:Example.java


示例2: expandDerivRightwards

import fig.basic.LogInfo; //导入依赖的package包/类
private void expandDerivRightwards(Derivation leftChild) {
  if (parser.verbose(6))
    LogInfo.begin_track("Expanding rightward");
  Map<String, List<Rule>> rhsCategoriesToRules = parser.leftToRightSiblingMap.get(leftChild.cat);
  if (rhsCategoriesToRules != null) {
    for (int i = 1; leftChild.end + i <= numTokens; ++i) {
      Set<String> intersection = Sets.intersection(rhsCategoriesToRules.keySet(), chart[leftChild.end][leftChild.end + i].keySet());

      for (String rhsCategory : intersection) {
        List<Rule> compatibleRules = rhsCategoriesToRules.get(rhsCategory);
        List<Derivation> rightChildren = chart[leftChild.end][leftChild.end + i].get(rhsCategory);
        generateParentDerivations(leftChild, rightChildren, true, compatibleRules);
      }
    }
    // handle terminals
    if (leftChild.end < numTokens)
      handleTerminalExpansion(leftChild, false, rhsCategoriesToRules);
  }
  if (parser.verbose(6))
    LogInfo.end_track();
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:22,代码来源:AbstractReinforcementParserState.java


示例3: expandDerivLeftwards

import fig.basic.LogInfo; //导入依赖的package包/类
private void expandDerivLeftwards(Derivation rightChild) {
  if (parser.verbose(5))
    LogInfo.begin_track("Expanding leftward");
  Map<String, List<Rule>> lhsCategorisToRules = parser.rightToLeftSiblingMap.get(rightChild.cat);
  if (lhsCategorisToRules != null) {
    for (int i = 1; rightChild.start - i >= 0; ++i) {
      Set<String> intersection = Sets.intersection(lhsCategorisToRules.keySet(), chart[rightChild.start - i][rightChild.start].keySet());

      for (String lhsCategory : intersection) {
        List<Rule> compatibleRules = lhsCategorisToRules.get(lhsCategory);
        List<Derivation> leftChildren = chart[rightChild.start - i][rightChild.start].get(lhsCategory);
        generateParentDerivations(rightChild, leftChildren, false, compatibleRules);
      }
    }
    // handle terminals
    if (rightChild.start > 0)
      handleTerminalExpansion(rightChild, true, lhsCategorisToRules);
  }
  if (parser.verbose(5))
    LogInfo.end_track();
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:22,代码来源:AbstractReinforcementParserState.java


示例4: applyRule

import fig.basic.LogInfo; //导入依赖的package包/类
private DerivationStream applyRule(int start, int end, Rule rule, List<Derivation> children) {
  try {
    if (Parser.opts.verbose >= 5)
      LogInfo.logs("applyRule %s %s %s %s", start, end, rule, children);
    StopWatchSet.begin(rule.getSemRepn()); // measuring time
    StopWatchSet.begin(rule.toString());
    DerivationStream results = rule.sem.call(ex,
            new SemanticFn.CallInfo(rule.lhs, start, end, rule, com.google.common.collect.ImmutableList.copyOf(children)));
    StopWatchSet.end();
    StopWatchSet.end();
    return results;
  } catch (Exception e) {
    LogInfo.errors("Composition failed: rule = %s, children = %s", rule, children);
    e.printStackTrace();
    throw new RuntimeException(e);
  }
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:18,代码来源:AbstractReinforcementParserState.java


示例5: run

import fig.basic.LogInfo; //导入依赖的package包/类
public void run() {
  LogInfo.logs("[%s] Starting server on port %d", new Date(), port);

  try {
    ServerSocket server = new ServerSocket(port);
    while (!terminated) {
      Socket client = server.accept();
      LogInfo.logs("[%s] Opened connection from %s", new Date(), client);
      Thread t = new Thread(new ClientHandler(client));
      t.start();
    }
    LogInfo.log("Done");
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:17,代码来源:StringCacheServer.java


示例6: featurizeAndScoreDerivation

import fig.basic.LogInfo; //导入依赖的package包/类
protected void featurizeAndScoreDerivation(Derivation deriv) {
  if (deriv.isFeaturizedAndScored()) {
    LogInfo.warnings("Derivation already featurized: %s", deriv);
    return;
  }

  // Compute features
  parser.extractor.extractLocal(ex, deriv);

  // Compute score
  deriv.computeScoreLocal(params);

  if (parser.verbose(5)) {
    LogInfo.logs("featurizeAndScoreDerivation(score=%s) %s %s: %s [rule: %s]",
            Fmt.D(deriv.score), deriv.cat, ex.spanString(deriv.start, deriv.end), deriv, deriv.rule);
  }
  numOfFeaturizedDerivs++;
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:19,代码来源:ParserState.java


示例7: getIdToExtractionsMap

import fig.basic.LogInfo; //导入依赖的package包/类
public Map<String, Set<String>> getIdToExtractionsMap() throws IOException {

    LogInfo.log("Uploading id-to-extraction-set map");
    Map<String, Set<String>> res = new HashMap<String, Set<String>>();

    BufferedReader reader = IOUtils.getBufferedFileReader(extractionFile);
    String line;
    while ((line = reader.readLine()) != null) {

      String[] tokens = DELIMITER_PATTERN.split(line);

      Set<String> extractionSet = res.get(tokens[MID_INDEX]);
      if (extractionSet == null) {
        extractionSet = new HashSet<String>();
        res.put(tokens[MID_INDEX], extractionSet);
      }
      extractionSet.add(tokens[ARG1_INDEX] + DELIMITER_PATTERN + tokens[PREDICATE_INDEX] + DELIMITER_PATTERN + DELIMITER_PATTERN + tokens[ARG2_INDEX]);
    }
    reader.close();
    LogInfo.log("Done uploading id-to-extraction-set map");
    return res;
  }
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:23,代码来源:LinkedExtractionFileUtils.java


示例8: getLinkedIdSet

import fig.basic.LogInfo; //导入依赖的package包/类
public Set<String> getLinkedIdSet() throws IOException {

    LogInfo.log("Uploading linked MIDs set");
    Set<String> res = new HashSet<String>();

    BufferedReader reader = IOUtils.getBufferedFileReader(extractionFile);
    String line;
    while ((line = reader.readLine()) != null) {

      String[] tokens = DELIMITER_PATTERN.split(line);
      res.add(tokens[MID_INDEX]);
    }
    reader.close();
    LogInfo.log("Done uploading linked IDs set");
    return res;
  }
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:17,代码来源:LinkedExtractionFileUtils.java


示例9: loadStringToStringMap

import fig.basic.LogInfo; //导入依赖的package包/类
public static Map<String, String> loadStringToStringMap(String file) throws IOException {

    Map<String, String> res = new HashMap<String, String>();
    BufferedReader reader = IOUtils.getBufferedFileReader(file);
    String line;
    int i = 0;
    while ((line = reader.readLine()) != null) {
      String[] tokens = line.split("\t");
      res.put(tokens[0], tokens[1]);
      i++;
      if (i % 1000000 == 0)
        LogInfo.logs("Uploaing line %s: %s", i, line);
    }
    reader.close();
    return res;
  }
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:17,代码来源:FileUtils.java


示例10: loadSetFromTabDelimitedFile

import fig.basic.LogInfo; //导入依赖的package包/类
public static Set<String> loadSetFromTabDelimitedFile(String file, int column) throws IOException {

    Set<String> res = new HashSet<String>();
    BufferedReader reader = IOUtils.getBufferedFileReader(file);
    String line;
    int i = 0;
    while ((line = reader.readLine()) != null) {
      String[] tokens = line.split("\t");
      res.add(tokens[column]);
      i++;
      if (i % 1000000 == 0) {
        LogInfo.log("Number of lines: " + i);
      }
    }

    reader.readLine();
    return res;

  }
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:20,代码来源:FileUtils.java


示例11: createDerivation

import fig.basic.LogInfo; //导入依赖的package包/类
@Override
public Derivation createDerivation() {
  if (currIndex == bridgingInfoList.size())
    return null;
  Derivation res;
  switch (description) {
    case "unary":
      res = nextUnary();
      break;
    case "inject":
      res = nextInject();
      break;
    case "entity":
      res = nextEntity();
      break;
    default:
      throw new RuntimeException("Bad description " + description);
  }
  if (opts.verbose >= 2)
    LogInfo.logs("mode=%s,deriv=%s", description, res);
  return res;
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:23,代码来源:BridgeFn.java


示例12: FbEntitySearcher

import fig.basic.LogInfo; //导入依赖的package包/类
public FbEntitySearcher(String indexDir, int numOfDocs, String searchingStrategy) throws IOException {

    LogInfo.begin_track("Constructing Searcher");
    if (!searchingStrategy.equals("exact") && !searchingStrategy.equals("inexact"))
      throw new RuntimeException("Bad searching strategy: " + searchingStrategy);
    this.searchStrategy = searchingStrategy;

    queryParser = new QueryParser(
        Version.LUCENE_44,
        FbIndexField.TEXT.fieldName(),
        searchingStrategy.equals("exact") ? new KeywordAnalyzer() : new StandardAnalyzer(Version.LUCENE_44));
    LogInfo.log("Opening index dir: " + indexDir);
    IndexReader indexReader = DirectoryReader.open(SimpleFSDirectory.open(new File(indexDir)));
    indexSearcher = new IndexSearcher(indexReader);
    LogInfo.log("Opened index with " + indexReader.numDocs() + " documents.");

    this.numOfDocs = numOfDocs;
    LogInfo.end_track();
  }
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:20,代码来源:FbEntitySearcher.java


示例13: computeAllowableIds

import fig.basic.LogInfo; //导入依赖的package包/类
void computeAllowableIds() {
  // Compute allowable ids
  LogInfo.begin_track("Compute allowable ids");
  try {
    BufferedReader in = IOUtils.openIn(rawPath);
    String line;
    int numInputLines = 0;
    while (numInputLines < maxInputLines && (line = in.readLine()) != null) {
      numInputLines++;
      if (numInputLines % 10000000 == 0)
        LogInfo.logs("Read %s lines, %d allowable ids", numInputLines, allowableIds.size());
      String[] tokens = Utils.parseTriple(line);
      if (tokens == null) continue;
      String arg1 = tokens[0];
      if (!arg1.startsWith("fb:g.") && !arg1.startsWith("fb:m."))
        allowableIds.add(arg1);
    }
    LogInfo.logs("%d allowable ids", allowableIds.size());
    in.close();
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
  LogInfo.end_track();
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:25,代码来源:BuildCanonicalIdMap.java


示例14: queryReturnsResults

import fig.basic.LogInfo; //导入依赖的package包/类
private boolean queryReturnsResults(Formula formula) {
  // If counting, look inside to make sure the actual set is non-empty.
  if (formula instanceof AggregateFormula)
    formula = ((AggregateFormula) formula).child;

  Executor.Response response = cache.get(formula);
  if (response == null)
    cache.put(formula, response = executor.execute(formula, null));
  if (!(response.value instanceof ListValue) ||
      ((ListValue) response.value).values.size() == 0) {
    LogInfo.logs("BAD QUERY: %s => %s", formula, response.value);
    return false;
  } else {
    LogInfo.logs("GOOD QUERY: %s => %s", formula, response.value);
    return true;
  }
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:18,代码来源:ExecuteExamples.java


示例15: extractTokenMatchFeatures

import fig.basic.LogInfo; //导入依赖的package包/类
private void extractTokenMatchFeatures(List<String> exampleTokens, List<String> exampleLemmas, Set<String> fbDescs, FeatureVector vector) {
  if (!FeatureExtractor.containsDomain("tokenMatch")) return;

  // generate stems
  List<String> exampleStems = new ArrayList<>();
  for (String token : exampleTokens)
    exampleStems.add(stemmer.stem(token));

  Counter<String> tokenFeatures = new ClassicCounter<>();
  Counter<String> stemFeatures = new ClassicCounter<>();
  for (String fbDescription : fbDescs) {
    List<String> fbDescTokens = FbFormulasInfo.BinaryFormulaInfo.tokenizeFbDescription(fbDescription);
    List<String> fbDescStems = new ArrayList<>();
    for (String fbDescToken : fbDescTokens)
      fbDescStems.add(stemmer.stem(fbDescToken));

    Counters.maxInPlace(tokenFeatures, TokenLevelMatchFeatures.extractTokenMatchFeatures(exampleTokens, fbDescTokens, true));
    Counters.maxInPlace(tokenFeatures, TokenLevelMatchFeatures.extractTokenMatchFeatures(exampleLemmas, fbDescTokens, true));
    Counters.maxInPlace(stemFeatures, TokenLevelMatchFeatures.extractTokenMatchFeatures(exampleStems, fbDescStems, false));
  }
  if (opts.verbose >= 3) {
    LogInfo.logs("Binary formula desc: %s, token match: %s, stem match: %s", fbDescs, tokenFeatures, stemFeatures);
  }
  addFeaturesToVector(tokenFeatures, "binary_token", vector);
  addFeaturesToVector(stemFeatures, "binary_stem", vector);
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:27,代码来源:TextToTextMatcher.java


示例16: binary

import fig.basic.LogInfo; //导入依赖的package包/类
@Test
public void binary() throws IOException {
  BinaryLexicon.opts.binaryLexiconFilesPath = "unittest-files/binaryInfoStringAndAlignment.txt";
  BinaryLexicon.opts.keyToSortBy = BinaryLexicon.INTERSECTION;

  BinaryLexicon lexicon = BinaryLexicon.getInstance();
  List<BinaryLexicalEntry> entries = lexicon.lookupEntries("bear in");
  LogInfo.logs("Num of binary entries for 'bear in': %s", entries.size());
  BinaryLexicalEntry top = entries.get(0);
  assertEquals("people born here", top.fbDescriptions.iterator().next());
  assertEquals("!fb:location.location.people_born_here", top.formula.toString());
  assertEquals("ALIGNMENT", top.source.toString());
  assertEquals(759773.0, top.popularity, 0.00001);  // Based on 93.exec (full Freebase)
  assertEquals("fb:people.person", top.expectedType1);
  assertEquals("fb:location.location", top.expectedType2);
  assertEquals(16184.0, top.alignmentScores.get("FB_typed_size"), 0.0001);
  assertEquals(13856.0, top.alignmentScores.get("Intersection_size_typed"), 0.0001);
  assertEquals(15765.0, top.alignmentScores.get("NL_typed_size"), 0.0001);
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:20,代码来源:LexiconTest.java


示例17: computeReverseFormulaInfo

import fig.basic.LogInfo; //导入依赖的package包/类
private void computeReverseFormulaInfo() {
  List<BinaryFormulaInfo> entriesToAdd = new LinkedList<>();
  for (Formula formula : binaryFormulaInfoMap.keySet()) {
    BinaryFormulaInfo info = binaryFormulaInfoMap.get(formula);
    Formula reverseFormula = Formulas.reverseFormula(formula);

    if (!binaryFormulaInfoMap.containsKey(reverseFormula)) {
      entriesToAdd.add(
              new BinaryFormulaInfo(
                      reverseFormula,
                      info.expectedType2, info.expectedType1, info.unitId, info.unitDesc, info.descriptions, info.popularity));
    }
  }
  LogInfo.log("Adding reverse formulas: " + entriesToAdd.size());
  for (BinaryFormulaInfo e : entriesToAdd) {
    binaryFormulaInfoMap.put(e.formula, e);
  }
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:19,代码来源:FbFormulasInfo.java


示例18: sortLexiconByFeedback

import fig.basic.LogInfo; //导入依赖的package包/类
public void sortLexiconByFeedback(Params params) {
  StopWatchSet.begin("UnaryLexicon.sortLexiconByFeedback");
  LogInfo.log("Number of entries: " + lexemeToEntryList.size());
  UnaryLexEntrybyFeaturesComparator comparator = new UnaryLexEntrybyFeaturesComparator(params);
  for (String lexeme : lexemeToEntryList.keySet()) {
    Collections.sort(lexemeToEntryList.get(lexeme), comparator);
    if (LexiconFn.opts.verbose > 0) {
      LogInfo.logs("Sorted list for lexeme=%s", lexeme);
      for (UnaryLexicalEntry uEntry : lexemeToEntryList.get(lexeme)) {
        FeatureVector fv = new FeatureVector();
        LexiconFn.getUnaryEntryFeatures(uEntry, fv);
        LogInfo.logs("Entry=%s, dotprod=%s", uEntry, fv.dotProduct(comparator.params));
      }
    }
  }
  StopWatchSet.end();
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:18,代码来源:UnaryLexicon.java


示例19: readCanonicalIdMap

import fig.basic.LogInfo; //导入依赖的package包/类
public static Map<String, String> readCanonicalIdMap(String canonicalIdMapPath, int maxInputLines) {
  Map<String, String> canonicalIdMap = new HashMap<String, String>();
  LogInfo.begin_track("Read %s", canonicalIdMapPath);
  try {
    BufferedReader in = IOUtils.openIn(canonicalIdMapPath);
    String line;
    int numInputLines = 0;
    while (numInputLines < maxInputLines && (line = in.readLine()) != null) {
      numInputLines++;
      if (numInputLines % 10000000 == 0)
        LogInfo.logs("Read %s lines", numInputLines);
      String[] tokens = line.split("\t");
      if (tokens.length != 2)
        throw new RuntimeException("Bad format: " + line);
      canonicalIdMap.put(tokens[0], tokens[1]);
    }
    in.close();
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
  LogInfo.end_track();
  return canonicalIdMap;
}
 
开发者ID:cgraywang,项目名称:TextHIN,代码行数:24,代码来源:Utils.java


示例20: readFromSingleFileMrg

import fig.basic.LogInfo; //导入依赖的package包/类
private void readFromSingleFileMrg(File[] inputLists, FileOutputStream fos)
    {
        for(File file : inputLists)
        {            
            try
            {
                List<Tree<String>> trees = Utils.loadTrees(file.getAbsolutePath(), removePunctuation);
                for(Tree tree : trees)
                {
                    fos.write((tree.toSurfaceStringLowerCase() + "\n").getBytes());
//                        readExample(tree, Integer.MAX_VALUE);
                }
            }
            catch(IOException ioe)
            {
                LogInfo.error("Error loading file " + file);
            }                
        } // for
    }
 
开发者ID:sinantie,项目名称:Generator,代码行数:20,代码来源:ExportMrgToString.java



注:本文中的fig.basic.LogInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultTuple类代码示例发布时间:2022-05-23
下一篇:
Java Visitor类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap