Package org.maltparserx.core.syntaxgraph.node

Examples of org.maltparserx.core.syntaxgraph.node.NonTerminalNode


      int h = 1;
      while (!done) {
        done = true;
        for (int index : phraseStructure.getNonTerminalIndices()) {
          if (heights.get(index) == h) {
            NonTerminalNode nt = (NonTerminalNode)phraseStructure.getNonTerminalNode(index);
            tmpID.setLength(0);
            tmpID.append(sentenceID);
            tmpID.append('_');
            tmpID.append(Integer.toString(nt.getIndex()+START_ID_OF_NONTERMINALS-1));
            writeNonTerminal(nt, tmpID.toString());
            done = false;
          }
        }
        h++;
View Full Code Here


    }
  }
 
  public boolean isContinuous() {
    for (int index : nonTerminalNodes.keySet()) {
      NonTerminalNode node = nonTerminalNodes.get(index);

      if (!node.isContinuous()) {
        return false;
      }
    }
    return true;
  }
View Full Code Here

    return true;
  }
 
  public boolean isContinuousExcludeTerminalsAttachToRoot() {
    for (int index : nonTerminalNodes.keySet()) {
      NonTerminalNode node = nonTerminalNodes.get(index);
      if (!node.isContinuousExcludeTerminalsAttachToRoot()) {
        return false;
      }
    }
    return true;
  }
View Full Code Here

    nonTerminalIndexMap.clear();
    while (!done) {
      done = true;
      for (int index : phraseStructure.getNonTerminalIndices()) {
        if (heights.get(index) == h) {
          NonTerminalNode nt = (NonTerminalNode)phraseStructure.getNonTerminalNode(index);
          nonTerminalIndexMap.put(nt.getIndex(), ntid++);
//          nonTerminalIndexMap.put(nt.getIndex(), nt.getIndex()+START_ID_OF_NONTERMINALS-1);
          done = false;
        }
      }
      h++;
View Full Code Here

  }
 
  private void writeNonTerminals(PhraseStructure phraseStructure) throws MaltChainedException {
    for (int index : nonTerminalIndexMap.keySet()) {
//    for (int index : phraseStructure.getNonTerminalIndices()) {
      NonTerminalNode nonTerminal = (NonTerminalNode)phraseStructure.getNonTerminalNode(index);
 
      if (nonTerminal == null || nonTerminal.isRoot()) {
        return;
      }
      try {
        writer.write('#');
//        writer.write(Integer.toString(index+START_ID_OF_NONTERMINALS-1));
        writer.write(Integer.toString(nonTerminalIndexMap.get(index)));
        writer.write("\t\t\t--\t\t\t");
        if (nonTerminal.hasLabel(dataFormatInstance.getColumnDescriptionByName("CAT").getSymbolTable())) {
          writer.write(nonTerminal.getLabelSymbol(dataFormatInstance.getColumnDescriptionByName("CAT").getSymbolTable()));
        } else {
          writer.write("--");
        }
        writer.write("\t--\t\t");
        if (nonTerminal.hasParentEdgeLabel(dataFormatInstance.getColumnDescriptionByName("LABEL").getSymbolTable())) {
          writer.write(nonTerminal.getParentEdgeLabelSymbol(dataFormatInstance.getColumnDescriptionByName("LABEL").getSymbolTable()));
        } else {
          writer.write("--");
        }
        writer.write('\t');
        if (nonTerminal.getParent() == null || nonTerminal.getParent().isRoot()) {
          writer.write('0');
        } else {
//          writer.write(Integer.toString(nonTerminal.getParent().getIndex()+START_ID_OF_NONTERMINALS-1));
          writer.write(Integer.toString(nonTerminalIndexMap.get(nonTerminal.getParent().getIndex())));
        }
        for (Edge e : nonTerminal.getIncomingSecondaryEdges()) {
          if (e.hasLabel(dataFormatInstance.getColumnDescriptionByName("SECEDGELABEL").getSymbolTable())) {
            writer.write('\t');
            writer.write(e.getLabelSymbol(dataFormatInstance.getColumnDescriptionByName("SECEDGELABEL").getSymbolTable()));
            writer.write('\t');
            if (e.getSource() instanceof NonTerminalNode) {
View Full Code Here

    return graphEdges;
  }
 
  public boolean isContinuous() {
    for (int index : nonTerminalNodes.keySet()) {
      NonTerminalNode node = nonTerminalNodes.get(index);
      if (!node.isContinuous()) {
        return false;
      }
    }
    return true;
  }
View Full Code Here

    return true;
  }
 
  public boolean isContinuousExcludeTerminalsAttachToRoot() {
    for (int index : nonTerminalNodes.keySet()) {
      NonTerminalNode node = nonTerminalNodes.get(index);
      if (!node.isContinuousExcludeTerminalsAttachToRoot()) {
        return false;
      }
    }
    return true;
  }
View Full Code Here

          }
          i++;
        }
        writer.write(CLOSING_BRACKET);
      } else {
        NonTerminalNode nt = (NonTerminalNode)element;
        writer.write(STARTING_BRACKET);
        SymbolTable table = null;
        int i = 0;
        for (String phraseLabelColumn : phraseLabelColumns.keySet()) {
          if (i != 0) {
            writer.write(INPUT_SEPARATOR);
          }
          table = phraseLabelColumns.get(phraseLabelColumn).getSymbolTable();
          if (nt.hasLabel(table)) {
            writer.write(nt.getLabelSymbol(table));
          }
          if (i == 0) {
            for (String edgeLabelColumn : edgeLabelColumns.keySet()) {
              table = edgeLabelColumns.get(edgeLabelColumn).getSymbolTable();
              if (nt.hasParentEdgeLabel(table) && !nt.getParent().isRoot() && !nt.getParentEdgeLabelSymbol(table).equals(EMPTY_EDGELABEL)) {
                writer.write(EDGELABEL_SEPARATOR);
                writer.write(nt.getParentEdgeLabelSymbol(table));
              }
            }
          }
          i++;
        }
View Full Code Here

          }
          i++;
        }
        writer.write(CLOSING_BRACKET);
      } else {
        NonTerminalNode nt = (NonTerminalNode)element;
        writer.write("\n" + getIndentation(depth) + STARTING_BRACKET);
        SymbolTable table = null;
        int i = 0;
        for (String phraseLabelColumn : phraseLabelColumns.keySet()) {
          if (i != 0) {
            writer.write(INPUT_SEPARATOR);
          }
          table = phraseLabelColumns.get(phraseLabelColumn).getSymbolTable();
          if (nt.hasLabel(table)) {
            writer.write(nt.getLabelSymbol(table));
          }
          if (i == 0) {
            for (String edgeLabelColumn : edgeLabelColumns.keySet()) {
              table = edgeLabelColumns.get(edgeLabelColumn).getSymbolTable();
              if (nt.hasParentEdgeLabel(table) && !nt.getParent().isRoot() && !nt.getParentEdgeLabelSymbol(table).equals(EMPTY_EDGELABEL)) {
                writer.write(EDGELABEL_SEPARATOR);
                writer.write(nt.getParentEdgeLabelSymbol(table));
              }
            }
          }
          i++;
        }
View Full Code Here

TOP

Related Classes of org.maltparserx.core.syntaxgraph.node.NonTerminalNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.