Package org.maltparserx.core.syntaxgraph

Examples of org.maltparserx.core.syntaxgraph.SyntaxGraphException


    setTableHandler(dataFormatInstance.getSymbolTables());
  }
 
  public void initialize(Object[] arguments) throws MaltChainedException {
    if (arguments.length != 2) {
      throw new SyntaxGraphException("Could not initialize InputTableFeature: number of arguments are not correct. ");
    }
    if (!(arguments[0] instanceof String)) {
      throw new SyntaxGraphException("Could not initialize InputTableFeature: the first argument is not a string. ");
    }
    if (!(arguments[1] instanceof AddressFunction)) {
      throw new SyntaxGraphException("Could not initialize InputTableFeature: the second argument is not an address function. ");
    }
    setTableName((String)arguments[0]);
    setSymbolTable(tableHandler.getSymbolTable(getTableName()));
    setAddressFunction((AddressFunction)arguments[1]);
    setType(ColumnDescription.STRING); // TODO Probably it could possible to vary the type
View Full Code Here


  @Override
  public void setIndex(int index) throws MaltChainedException {
    if (index > 0) {
      this.index = index; //INDEX_OFFSET+index;
    } else {
      throw new SyntaxGraphException("The index must be a positive index");
    }
   
  }
View Full Code Here

    setTableHandler(dataFormatInstance.getSymbolTables());
  }
 
  public void initialize(Object[] arguments) throws MaltChainedException {
    if (arguments.length != 2) {
      throw new SyntaxGraphException("Could not initialize OutputTableFeature: number of arguments are not correct. ");
    }
    if (!(arguments[0] instanceof String)) {
      throw new SyntaxGraphException("Could not initialize OutputTableFeature: the first argument is not a string. ");
    }
    if (!(arguments[1] instanceof AddressFunction)) {
      throw new SyntaxGraphException("Could not initialize OutputTableFeature: the second argument is not an address function. ");
    }
    setSymbolTable(tableHandler.getSymbolTable((String)arguments[0]));
    setAddressFunction((AddressFunction)arguments[1]);
    setType(ColumnDescription.STRING); // TODO Probably it could possible to vary the type
  }
View Full Code Here

    if (!(arguments[0] instanceof String)) {
      throw new FeatureException("Could not initialize InputArcFeature: the first argument is not a string. ");
    }
    if (!(arguments[1] instanceof AddressFunction)) {
      throw new SyntaxGraphException("Could not initialize InputArcFeature: the second argument is not an address function. ");
    }
    if (!(arguments[2] instanceof AddressFunction)) {
      throw new SyntaxGraphException("Could not initialize InputArcFeature: 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

    this.dataFormatInstance = dataFormatInstance;
  }

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

    setSubFunctionName(subFunctionName);
  }
 
  public void initialize(Object[] arguments) throws MaltChainedException {
    if (arguments.length != 1) {
      throw new SyntaxGraphException("Could not initialize NodeAddressFunction: number of arguments are not correct. ");
    }
    if (!(arguments[0] instanceof AddressFunction)) {
      throw new SyntaxGraphException("Could not initialize NodeAddressFunction: the second argument is not an addres function. ");
    }
    setAddressFunction((AddressFunction)arguments[0]);
  }
View Full Code Here

                  childid = Integer.parseInt(reader.getAttributeValue(null, "idref").substring(indexSep+1));
                } else {
                  childid = Integer.parseInt(reader.getAttributeValue(null, "idref"));
                }
                if (childid == -1) {
                  throw new SyntaxGraphException("The tiger reader couldn't recognize the idref attribute '"+reader.getAttributeValue(null, "idref")+"' of the edge element. ");
                }
              } catch (NumberFormatException e) {
                throw new SyntaxGraphException("The tiger reader couldn't recognize the idref attribute '"+reader.getAttributeValue(null, "idref")+"' of the edge element. ");
              }

              if (childid < START_ID_OF_NONTERMINALS) {
                child = phraseStructure.getTokenNode(childid);
              } else {
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 NumOfFeature: 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 NumOfFeature: the first argument is not an address function. ");
    }
    if (!(arguments[1] instanceof java.lang.String)) {
      throw new SyntaxGraphException("Could not initialize NumOfFeature: the second argument (relation) is not a string. ");
    }
    if (!(arguments[2] instanceof java.lang.String)) {
      throw new SyntaxGraphException("Could not initialize NumOfFeature: the third argument (normalization) is not a string. ");
    }
    setAddressFunction((AddressFunction)arguments[0]);
    setNumOfRelation((String)arguments[1]);
    normalizationString = (String)arguments[2];
    // Creates a symbol table called "NUMOF" using one null value
    setSymbolTable(tableHandler.addSymbolTable("NUMOF"+normalizationString, ColumnDescription.INPUT, "one"));
   
    String[] items  = normalizationString.split("\\|");
   
    if (items.length <= 0 || !items[0].equals("0")) {
      throw new SyntaxGraphException("Could not initialize NumOfFeature ("+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 NumOfFeature ("+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 NumOfFeature ("+this+"): the third argument (normalization) must contain a sorted list of integer values separated with |");
      }
      tmp = v;
    }
  }
View Full Code Here

 
  public void setIndex(int index) throws MaltChainedException {
    if (index > 0) {
      this.index = index;
    } else {
      throw new SyntaxGraphException("A terminal node must have a positive integer value and not index "+index+". ");
    }
  }
View Full Code Here

        return head;
      }
    }

    if (heads.size() > 1) {
      throw new SyntaxGraphException("The dependency node is multi-headed and it is ambigious to return a single-head dependency node. ");
    }
    // heads.first();

    return null;
  }
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.