APISonar


fig.basic.LogInfo.log

> fig > basic > LogInfo > log
fig APIs basic APIs LogInfo APIs log APIs

Example 1
public static Map<String, String> loadMid2NameMap(String filename) throws IOException {

    LogInfo.log("Loading mid to name file...");

    Map<String, String> res = new HashMap<String, String>();
    BufferedReader reader = IOUtils.getBufferedFileReader(filename);
    String line;
    while ((line = reader.readLine()) != null) {
      String[] tokens = line.split("\t");
      res.put(tokens[0], tokens[1]);
    }
    LogInfo.log("Loaded " + res.keySet().size() + " MIDs");
    return res;
  }
Example 2
public static <K, V> void logMap(Map<K, V> map, String desc) {
    LogInfo.begin_track("Logging %s map", desc);
    for (K key : map.keySet())
      LogInfo.log(key + "\t" + map.get(key));
    LogInfo.end_track();
  }
Example 3
public static void compareLogs(String log1, String log2, String field) {
    List<Double> correctnessList1 = computeCorrectnessList(log1, field);
    List<Double> correctnessList2 = computeCorrectnessList(log2, field);

    if (correctnessList1.size() != correctnessList2.size())
      throw new RuntimeException("lists are not same size");
    LogInfo.logs("Size of correctness: %s", correctnessList1.size());

    for (int i = 0; i < correctnessList1.size(); ++i) {
      if (!correctnessList1.get(i).equals(correctnessList2.get(i))) {
        LogInfo.log("example: " + i + " log1: " + correctnessList1.get(i) + " log2: " + correctnessList2.get(i));
      }
    }
  }
Example 4
private void read() {
    LogInfo.begin_track("Loading unary lexicon file " + opts.unaryLexiconFilePath);
    for (String line : IOUtils.readLines(opts.unaryLexiconFilePath)) {
      LexiconValue lv = Json.readValueHard(line, LexiconValue.class);
      addEntry(lv.lexeme, lv.source, lv.formula, lv.features);
    }
    LogInfo.log("Number of lexemes: " + lexemeToEntryList.size());
    LogInfo.end_track();
  }
Example 5
private boolean cmdSet(Derivation def, int start, int end) {
    if (opts.verbose > 0)
      LogInfo.log("In exactPlusBig");
    // match only beginning and end
    boolean cmdSet = (end == headTokens.size()) && (start > 0) && def.end == defTokens.size() && def.start > 0;
    if (cmdSet && headTokens.subList(0, start).equals(defTokens.subList(0, start)))
      return true;

    return false;
  }