Examples of DependencyGraph


Examples of org.maltparserx.core.syntaxgraph.DependencyGraph

    super();
    firstStack = new Stack<DependencyNode>();
    secondStack = new Stack<DependencyNode>();
    activeStack = FIRST_STACK;
    input = new Stack<DependencyNode>();
    dependencyGraph = new DependencyGraph(symbolTableHandler);
    setRootHandling(rootHandling);
    setNoCoveredRoots(Boolean.valueOf(noCoveredRoots));
    setAcyclicity(Boolean.valueOf(acyclicity));
    setReduceAfterSwitch(Boolean.valueOf(reduceAfterSwitch));
  }
View Full Code Here

Examples of org.maltparserx.core.syntaxgraph.DependencyGraph

    }
    if (tokens == null || tokens.length == 0) {
      throw new MaltChainedException("Nothing to parse. ");
    }

    DependencyStructure outputGraph = new DependencyGraph(singleMalt.getSymbolTables());
   
    for (int i = 0; i < tokens.length; i++) {
      Iterator<ColumnDescription> columns = dataFormatInstance.iterator();
      DependencyNode node = outputGraph.addDependencyNode(i+1);
      String[] items = tokens[i].split("\t");
      for (int j = 0; j < items.length; j++) {
        if (columns.hasNext()) {
          ColumnDescription column = columns.next();
          if (column.getCategory() == ColumnDescription.INPUT && node != null) {
            outputGraph.addLabel(node, column.getName(), items[j]);
          }
        }
      }
    }
    outputGraph.setDefaultRootEdgeLabel(outputGraph.getSymbolTables().getSymbolTable("DEPREL"), "ROOT");
    // Invoke parse with the output graph
    singleMalt.parse(outputGraph);
    return outputGraph;
  }
View Full Code Here

Examples of org.maltparserx.core.syntaxgraph.DependencyGraph

      throw new MaltChainedException("No parser model has been initialized. Please use the method initializeParserModel() before invoking this method.");
    }
    if (tokens == null || tokens.length == 0) {
      throw new MaltChainedException("Nothing to convert. ");
    }
    DependencyStructure outputGraph = new DependencyGraph(singleMalt.getSymbolTables());
   
    for (int i = 0; i < tokens.length; i++) {
      Iterator<ColumnDescription> columns = dataFormatInstance.iterator();
      DependencyNode node = outputGraph.addDependencyNode(i+1);
      String[] items = tokens[i].split("\t");
      Edge edge = null;
      for (int j = 0; j < items.length; j++) {
        if (columns.hasNext()) {
          ColumnDescription column = columns.next();
          if (column.getCategory() == ColumnDescription.INPUT && node != null) {
            outputGraph.addLabel(node, column.getName(), items[j]);
          } else if (column.getCategory() == ColumnDescription.HEAD) {
            if (column.getCategory() != ColumnDescription.IGNORE && !items[j].equals("_")) {
              edge = ((DependencyStructure)outputGraph).addDependencyEdge(Integer.parseInt(items[j]), i+1);
            }
          } else if (column.getCategory() == ColumnDescription.DEPENDENCY_EDGE_LABEL && edge != null) {
            outputGraph.addLabel(edge, column.getName(), items[j]);
          }
        }
      }
    }
    outputGraph.setDefaultRootEdgeLabel(outputGraph.getSymbolTables().getSymbolTable("DEPREL"), "ROOT");
    return outputGraph;
  }
View Full Code Here

Examples of org.maltparserx.core.syntaxgraph.DependencyGraph

    // Creates a dependency graph
    if (tokens == null || tokens.length == 0) {
      throw new MaltChainedException("Nothing to convert. ");
    }
    DependencyStructure outputGraph = new DependencyGraph(symbolTables);
   
    for (int i = 0; i < tokens.length; i++) {
      Iterator<ColumnDescription> columns = dataFormatInstance.iterator();
      DependencyNode node = outputGraph.addDependencyNode(i+1);
      String[] items = tokens[i].split("\t");
      Edge edge = null;
      for (int j = 0; j < items.length; j++) {
        if (columns.hasNext()) {
          ColumnDescription column = columns.next();
          if (column.getCategory() == ColumnDescription.INPUT && node != null) {
            outputGraph.addLabel(node, column.getName(), items[j]);
          } else if (column.getCategory() == ColumnDescription.HEAD) {
            if (column.getCategory() != ColumnDescription.IGNORE && !items[j].equals("_")) {
              edge = ((DependencyStructure)outputGraph).addDependencyEdge(Integer.parseInt(items[j]), i+1);
            }
          } else if (column.getCategory() == ColumnDescription.DEPENDENCY_EDGE_LABEL && edge != null) {
            outputGraph.addLabel(edge, column.getName(), items[j]);
          }
        }
      }
    }
    outputGraph.setDefaultRootEdgeLabel(outputGraph.getSymbolTables().getSymbolTable("DEPREL"), "ROOT");
    return outputGraph;
  }
View Full Code Here

Examples of org.objectweb.perseus.dependency.api.DependencyGraph

        Cache c = new Cache(ca, um, cm, getPMF(), getJormFactory());
        server.registerMBean(c, new ObjectName("speedo:name=cache"));
    }
   
    public void addTxMBeans() throws Exception {
        DependencyGraph dg = (DependencyGraph) FractalHelper.getSubComponent(
                speedo, AbstractSpeedo.DEPENDENCY_GRAPH_PATH, logger)
                  .getFcInterface("dependency-graph");
        Tx p = new Tx(getPMF(), dg);
        server.registerMBean(p, new ObjectName("speedo:name=tx"));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.