Package org.maltparserx.core.syntaxgraph.node

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


        ColumnDescription column = null;
        while (columns.hasNext()) {
          column = columns.next();

          if (column.getCategory() == ColumnDescription.INPUT) { // && column.getType() != ColumnDescription.IGNORE) {
            TokenNode node = syntaxGraph.getTokenNode(i);
            if (!column.getName().equals("ID")) {
              if (node.hasLabel(column.getSymbolTable())) {
                output.append(node.getLabelSymbol(column.getSymbolTable()));
                if (output.length() != 0) {
                  writer.write(output.toString());
                } else {
                  writer.write('_');
                }
View Full Code Here


        index = i;
        break;
      }
    }
    if (index == -1) {
      TokenNode t = phraseStructure.addTokenNode(terminalCounter);
      if (t == null) {
        close();
        throw new MaltChainedException("Bracket Reader error: could not create a terminal node. ");
      }

      terminalCounter++;
      Edge e = null;

      if (parent != null) {
        e = phraseStructure.addPhraseStructureEdge(parent, (PhraseStructureNode)t);
      } else {
        close();
        throw new MaltChainedException("Bracket Reader error: could not find the parent node. ");
      }

      int start = begin;

      Iterator<String> inputColumnsIterator = inputColumns.keySet().iterator();
      Iterator<String> edgeLabelsColumnsIterator = edgeLabelColumns.keySet().iterator();
      boolean noneNode = false;
      boolean edgeLabels = false;
      for (int i = begin; i < end; i++) {
        if (input.charAt(i) == EDGELABEL_SEPARATOR || (input.charAt(i) == INPUT_SEPARATOR
            // Start BracketProgLangReader
            && (i == begin || input.charAt(i - 1) != '\\')
            // end BracketProgLangReader 
          ) || i == end - 1) {
          if (i == begin && input.charAt(i) == EDGELABEL_SEPARATOR) {
            noneNode = true;
          } else if (start == begin) {
            if ((noneNode && input.charAt(i) != EDGELABEL_SEPARATOR) || !noneNode) {
              if (inputColumnsIterator.hasNext()) {
                t.addLabel(inputColumns.get(inputColumnsIterator.next()).getSymbolTable(),
                   
                    // Start BracketProgLangReader
                    decodeString(
                    // end BracketProgLangReader
                    (i == end - 1)?input.substring(start,end):input.substring(start, i)
                    // Start BracketProgLangReader
                    )
                    // end BracketProgLangReader   
                    );
              }
              start = i + 1;
              if (input.charAt(i) == EDGELABEL_SEPARATOR) {
                edgeLabels = true;
              }
            }
          } else if (edgeLabels && e != null) {
            if (edgeLabelsColumnsIterator.hasNext()) {
              e.addLabel(edgeLabelColumns.get(edgeLabelsColumnsIterator.next()).getSymbolTable(), (i == end - 1)?input.substring(start,end):input.substring(start, i));
            }
            start = i + 1;
            if (input.charAt(i) == INPUT_SEPARATOR
                // Start BracketProgLangReader
                && (i == begin || input.charAt(i - 1) != '\\')
                // end BracketProgLangReader   
            ) {
              edgeLabels = false;
            }
          } else if (input.charAt(i) == EDGELABEL_SEPARATOR && i != end - 1 && (input.charAt(i+1) != INPUT_SEPARATOR
              // Start BracketProgLangReader
              && (i == begin || input.charAt(i - 1) != '\\')
              // end BracketProgLangReader
              )
          ) { 
          } else {
            if (inputColumnsIterator.hasNext()) {
              t.addLabel(inputColumns.get(inputColumnsIterator.next()).getSymbolTable(), (i == end - 1)?input.substring(start,end):input.substring(start, i));
            }
            start = i + 1;
          }
        }
      }
View Full Code Here

        } else if (subFunction == DGraphSubFunction.LSIB) {
          address.setAddress(node.getSameSideLeftSibling());
        } else if (subFunction == DGraphSubFunction.RSIB) {
          address.setAddress(node.getSameSideRightSibling());
        } else if ((subFunction == DGraphSubFunction.PRED || subFunction == DGraphSubFunction.SUCC) && node instanceof TokenNode) {
          final TokenNode tokenNode = (TokenNode)node;
          if (subFunction == DGraphSubFunction.PRED) {
            address.setAddress(tokenNode.getPredecessor());
          } else if (subFunction == DGraphSubFunction.SUCC) {
            address.setAddress(tokenNode.getSuccessor());
          }
        } else if (subFunction == DGraphSubFunction.ANC) {
          address.setAddress(node.getAncestor());
        } else if (subFunction == DGraphSubFunction.PANC) {
          address.setAddress(node.getProperAncestor());
View Full Code Here

TOP

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

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.