示例#1
0
 private void dumpMetadata(String group, List<Example> examples) {
   LispTree tree = LispTree.proto.newList();
   tree.addChild("metadata");
   tree.addChild(LispTree.proto.newList("group", group));
   tree.addChild(LispTree.proto.newList("size", "" + examples.size()));
   tree.print(out);
   out.println();
 }
示例#2
0
 private void dumpExample(LispTree tree) {
   out.println("(example");
   for (LispTree subtree : tree.children.subList(1, tree.children.size())) {
     if (!subtree.isLeaf() && "derivations".equals(subtree.children.get(0).value)) {
       if (subtree.children.size() == 1) {
         out.println("  (derivations)");
       } else {
         out.println("  (derivations");
         for (LispTree derivation : subtree.children.subList(1, subtree.children.size())) {
           out.write("    ");
           derivation.print(Integer.MAX_VALUE, Integer.MAX_VALUE, out);
           out.write("\n");
         }
         out.println("  )");
       }
     } else {
       out.write("  ");
       subtree.print(Integer.MAX_VALUE, Integer.MAX_VALUE, out);
       out.write("\n");
     }
   }
   out.println(")");
 }