Exemplo n.º 1
0
  private static void chunkWords(FeatureNode fn, LexChunk chunk) {
    while (fn != null) {
      FeatureNode wd = fn.get("phr-word");
      if (wd != null) chunk.addWord(wd);

      // Quit when a subprhase is seen.
      FeatureNode subf = fn.get("phr-head");
      if (subf != null) return;

      fn = fn.get("phr-next");
    }
  }
Exemplo n.º 2
0
    public Boolean BinaryRelationCB(String relName, FeatureNode srcNode, FeatureNode tgtNode) {
      String srcName = srcNode.get("name").getValue();
      FeatureNode tgt = tgtNode.get("name");
      if (tgt == null) {
        System.out.println("Error: No target! rel=" + relName + " and src=" + srcName);
        return false;
      }
      String tgtName = tgt.getValue();

      if (id_map != null) {
        srcName = id_map.get(srcNode);
        tgtName = id_map.get(tgtNode);
      }
      if (show_uuid) {
        // fabricio: Do not replace the _qVar variables
        if (srcName.indexOf("_$qVar") == -1)
          srcName = srcNode.get("nameSource").get("uuid").getValue();

        if (tgtName.indexOf("_$qVar") == -1)
          tgtName = tgtNode.get("nameSource").get("uuid").getValue();
      }
      str += relName + "(" + srcName + ", " + tgtName + ")\n";

      return false;
    }
Exemplo n.º 3
0
    public Boolean UnaryRelationCB(FeatureNode srcNode, String attrName) {
      FeatureNode attr = srcNode.get(attrName);
      if (!attr.isValued()) return false;
      String value = attr.getValue();
      String srcName = srcNode.get("name").getValue();

      if (id_map != null) {
        srcName = id_map.get(srcNode);
      }
      if (show_uuid) {
        srcName = srcNode.get("nameSource").get("uuid").getValue();
      }
      if (unaryStyle) {
        if (attrName.endsWith("-FLAG")) value = attrName.replaceAll("-FLAG", "").toLowerCase();

        if (attrName.equals("HYP")) value = attrName.toLowerCase();

        str += value + "(" + srcName + ")\n";
      } else {
        str += attrName + "(" + srcName + ", " + value + ")\n";
      }

      return false;
    }