Package org.maltparserx.core.syntaxgraph.node

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


 
  public Sentence(SymbolTableHandler symbolTables) throws MaltChainedException {
    super(symbolTables);
    terminalNodes = new TreeMap<Integer,Token>();
    terminalPool = new ObjectPoolList<Token>() {
      protected Token create() throws MaltChainedException { return new Token(); }
      public void resetObject(Token o) throws MaltChainedException { o.clear(); }
    };
  }
View Full Code Here


    return !terminalNodes.isEmpty();
  }
 
 
  protected Token getOrAddTerminalNode(int index) throws MaltChainedException {
    Token node = terminalNodes.get(index);
    if (node == null) {
//    if (!terminalNodes.containsKey(index)) {
      if (index > 0){
        node = terminalPool.checkOut();
        node.setIndex(index);
        node.setBelongsToGraph(this);
       
        if (index > 1) {
          Token prev = terminalNodes.get(index-1);
          if (prev == null) {
            try {
              prev = terminalNodes.get(terminalNodes.headMap(index).lastKey());
            } catch (NoSuchElementException e) {
             
            }
          }
          if (prev != null) {
            prev.setSuccessor(node);
            node.setPredecessor(prev);
          }
         
          if (terminalNodes.lastKey() > index) {
            Token succ = terminalNodes.get(index+1);
            if (succ == null) {
              try {
                succ = terminalNodes.get(terminalNodes.tailMap(index).firstKey());
              } catch (NoSuchElementException e) {
               
              }
            }
            if (succ != null) {
              succ.setPredecessor(node);
              node.setSuccessor(succ);
            }
          }
        }
      }
View Full Code Here

TOP

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

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.