Package org.maltparserx.core.syntaxgraph

Examples of org.maltparserx.core.syntaxgraph.SyntaxGraphException


    if (!(arguments[0] instanceof String)) {
      throw new FeatureException("Could not initialize OutputArcFeature: the first argument is not a string. ");
    }
    if (!(arguments[1] instanceof AddressFunction)) {
      throw new SyntaxGraphException("Could not initialize OutputArcFeature: the second argument is not an address function. ");
    }
    if (!(arguments[2] instanceof AddressFunction)) {
      throw new SyntaxGraphException("Could not initialize OutputArcFeature: the third argument is not an address function. ");
    }
    setAddressFunction1((AddressFunction)arguments[1]);
    setAddressFunction2((AddressFunction)arguments[2]);
   
    setColumn(dataFormatInstance.getColumnDescriptionByName((String)arguments[0]));
View Full Code Here


    children = new TreeSet<PhraseStructureNode>();
    clear();
  }
 
  public void addIncomingEdge(Edge in) throws MaltChainedException {
    throw new SyntaxGraphException("It is not allowed for a root node to have an incoming edge");
  }
View Full Code Here

   * @param arguments an array of arguments with the type returned by getParameterTypes()
   * @throws MaltChainedException
   */
  public void initialize(Object[] arguments) throws MaltChainedException {
    if (arguments.length != 1) {
      throw new SyntaxGraphException("Could not initialize ArcDirFeature: number of arguments are not correct. ");
    }
    // Checks that the two arguments are address functions
    if (!(arguments[0] instanceof AddressFunction)) {
      throw new SyntaxGraphException("Could not initialize ArcDirFeature: the first argument is not an address function. ");
    }

    setAddressFunction((AddressFunction)arguments[0]);
   
    // Creates a symbol table called "ARCDIR" using one null value
View Full Code Here

    outgoingEdges = new TreeSet<Edge>();
  }
 
  public void addIncomingEdge(Edge in) throws MaltChainedException {
    if (in.getTarget() != this) {
      throw new SyntaxGraphException("The incoming edge's 'to' reference is not correct.");
    }
    incomingEdges.add(in);
  }
View Full Code Here

    incomingEdges.add(in);
  }
 
  public void addOutgoingEdge(Edge out) throws MaltChainedException {
    if (out.getSource() != this) {
      throw new SyntaxGraphException("The outgoing edge's 'from' reference is not correct");
    }
    outgoingEdges.add(out);
  }
View Full Code Here

    outgoingEdges.add(out);
  }

  public void removeIncomingEdge(Edge in) throws MaltChainedException {
    if (in.getTarget() != this) {
      throw new SyntaxGraphException("The incoming edge's 'to' reference is not correct");
    }
    incomingEdges.remove(in);
  }
View Full Code Here

   * @param arguments an array of arguments with the type returned by getParameterTypes()
   * @throws MaltChainedException
   */
  public void initialize(Object[] arguments) throws MaltChainedException {
    if (arguments.length != 1) {
      throw new SyntaxGraphException("Could not initialize ExistsFeature: number of arguments are not correct. ");
    }
    // Checks that the two arguments are address functions
    if (!(arguments[0] instanceof AddressFunction)) {
      throw new SyntaxGraphException("Could not initialize ExistsFeature: the first argument is not an address function. ");
    }

    setAddressFunction((AddressFunction)arguments[0]);
   
    // Creates a symbol table called "EXISTS" using one null value
View Full Code Here

    incomingEdges.remove(in);
  }

  public void removeOutgoingEdge(Edge out) throws MaltChainedException {
    if (out.getSource() != this) {
      throw new SyntaxGraphException("The outgoing edge's 'from' reference is not correct");
    }
    outgoingEdges.remove(out);
  }
View Full Code Here

   * @param arguments an array of arguments with the type returned by getParameterTypes()
   * @throws MaltChainedException
   */
  public void initialize(Object[] arguments) throws MaltChainedException {
    if (arguments.length != 3) {
      throw new SyntaxGraphException("Could not initialize DistanceFeature: number of arguments is not correct. ");
    }
    // Checks that the two arguments are address functions
    if (!(arguments[0] instanceof AddressFunction)) {
      throw new SyntaxGraphException("Could not initialize DistanceFeature: the first argument is not an address function. ");
    }
    if (!(arguments[1] instanceof AddressFunction)) {
      throw new SyntaxGraphException("Could not initialize DistanceFeature: the second argument is not an address function. ");
    }
    if (!(arguments[2] instanceof java.lang.String)) {
      throw new SyntaxGraphException("Could not initialize DistanceFeature: the third argument is not a string. ");
    }
    setAddressFunction1((AddressFunction)arguments[0]);
    setAddressFunction2((AddressFunction)arguments[1]);
   
    normalizationString = (String)arguments[2];
    // Creates a symbol table called "DISTANCE" using one null value
    setSymbolTable(tableHandler.addSymbolTable("DISTANCE_"+normalizationString, ColumnDescription.INPUT, "one"));
   
    String[] items  = normalizationString.split("\\|");
   
    if (items.length <= 0 || !items[0].equals("0")) {
      throw new SyntaxGraphException("Could not initialize DistanceFeature ("+this+"): the third argument (normalization) must contain a list of integer values separated with | and the first element must be 0.");
    }
    int tmp = -1;
    for (int i = 0; i < items.length; i++) {
      int v;
      try {
        v = Integer.parseInt(items[i]);
      } catch (NumberFormatException e) {
        throw new SyntaxGraphException("Could not initialize DistanceFeature ("+this+"): the third argument (normalization) must contain a sorted list of integer values separated with |", e);
      }
      normalization.put(v, ">="+v);
      table.addSymbol(">="+v);
      if (tmp != -1 && tmp >= v) {
        throw new SyntaxGraphException("Could not initialize DistanceFeature ("+this+"): the third argument (normalization) must contain a sorted list of integer values separated with |");
      }
      tmp = v;
    }
  }
View Full Code Here

    this.dataFormatInstance = dataFormatInstance;
  }
 
  public void initialize(Object[] arguments) throws MaltChainedException {
    if (arguments.length != 2) {
      throw new SyntaxGraphException("Could not initialize OutputColumnFeature: number of arguments are not correct. ");
    }
    if (!(arguments[0] instanceof String)) {
      throw new SyntaxGraphException("Could not initialize OutputColumnFeature: the first argument is not a string. ");
    }
    if (!(arguments[1] instanceof AddressFunction)) {
      throw new SyntaxGraphException("Could not initialize OutputColumnFeature: the second argument is not an address function. ");
    }
    ColumnDescription column = dataFormatInstance.getColumnDescriptionByName((String)arguments[0]);
    if (column == null) {
      throw new SyntaxGraphException("Could not initialize OutputColumnFeature: the output column type '"+(String)arguments[0]+"' could not be found in the data format specification. ' ");
    }
    setColumn(column);
    setAddressFunction((AddressFunction)arguments[1]);
  }
View Full Code Here

TOP

Related Classes of org.maltparserx.core.syntaxgraph.SyntaxGraphException

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.