Package org.maltparserx.core.feature

Examples of org.maltparserx.core.feature.FeatureException


    setFeatureValue(new SingleFeatureValue(this));
  }
 
  public void initialize(Object[] arguments) throws MaltChainedException {
    if (arguments.length != 2) {
      throw new FeatureException("Could not initialize InputArcDirFeature: number of arguments are not correct. ");
    }
    if (!(arguments[0] instanceof String)) {
      throw new FeatureException("Could not initialize InputArcDirFeature: the first argument is not a string. ");
    }
    if (!(arguments[1] instanceof AddressFunction)) {
      throw new FeatureException("Could not initialize InputArcDirFeature: the second argument is not an address function. ");
    }
    setColumn(dataFormatInstance.getColumnDescriptionByName((String)arguments[0]));
    setSymbolTable(tableHandler.addSymbolTable("ARCDIR_"+column.getName(),ColumnDescription.INPUT, "one"));
    table.addSymbol("LEFT");
    table.addSymbol("RIGHT");
View Full Code Here


          featureValue.setIndexCode(table.getSymbolStringToCode("RIGHT"));
          featureValue.setSymbol("RIGHT");
          featureValue.setNullValue(false);
        }
      } catch (NumberFormatException e) {
        throw new FeatureException("The index of the feature must be an integer value. ", e);
      }
    } else {
      featureValue.setIndexCode(table.getNullValueCode(NullValueId.NO_NODE));
      featureValue.setSymbol(table.getNullValueSymbol(NullValueId.NO_NODE));
      featureValue.setNullValue(true);
View Full Code Here

    return column;
  }

  public void setColumn(ColumnDescription column) throws MaltChainedException {
    if (column.getType() != ColumnDescription.INTEGER) {
      throw new FeatureException("InputArc feature column must be of type integer. ");
    }
    this.column = column;
  }
View Full Code Here

     for (Plugin plugin : plugins) {
      URL url = null;
      try {
        url = new URL("jar:"+plugin.getUrl() + "!/appdata/plugin.xml");
      } catch (MalformedURLException e) {
        throw new FeatureException("Malformed URL: 'jar:"+plugin.getUrl() + "!plugin.xml'", e);
      }
      try {
        InputStream is = url.openStream();
        is.close();
      } catch (IOException e) {
View Full Code Here

     for (Plugin plugin : plugins) {
      URL url = null;
      try {
        url = new URL("jar:"+plugin.getUrl() + "!/appdata/plugin.xml");
      } catch (MalformedURLException e) {
        throw new FeatureException("Malformed URL: 'jar:"+plugin.getUrl() + "!plugin.xml'", e);
      }
      try {
        InputStream is = url.openStream();
        is.close();
      } catch (IOException e) {
View Full Code Here

     for (Plugin plugin : plugins) {
      URL url = null;
      try {
        url = new URL("jar:"+plugin.getUrl() + "!/appdata/plugin.xml");
      } catch (MalformedURLException e) {
        throw new FeatureException("Malformed URL: 'jar:"+plugin.getUrl() + "!plugin.xml'", e);
      }
      try {
        InputStream is = url.openStream();
        is.close();
      } catch (IOException e) {
View Full Code Here

            Element root = null;

            root = db.parse(specModelURL.openStream()).getDocumentElement();

            if (root == null) {
              throw new FeatureException("The feature system file '"+specModelURL.getFile()+"' cannot be found. ");
            }
           
            readFeatureSystem(root);
        } catch (IOException e) {
          throw new FeatureException("The feature system file '"+specModelURL.getFile()+"' cannot be found. ", e);
        } catch (ParserConfigurationException e) {
          throw new FeatureException("Problem parsing the file "+specModelURL.getFile()+". ", e);
        } catch (SAXException e) {
          throw new FeatureException("Problem parsing the file "+specModelURL.getFile()+". ", e);
        }
  }
View Full Code Here

      }
      if (clazz == null) {
        clazz = Class.forName(function.getAttribute("class"));
      }
    } catch (ClassNotFoundException e) {
      throw new FeatureException("The feature system could not find the function class"+function.getAttribute("class")+".", e);
    }
    if (hasSubFunctions) {
      NodeList subfunctions = function.getElementsByTagName("subfunction");
      for (int i = 0; i < subfunctions.getLength(); i++) {
        readSubFunction((Element)subfunctions.item(i), clazz, hasFactory);
View Full Code Here

    Constructor<?>[] constructors = functionClass.getConstructors();
    if (constructors.length == 0) {
      try {
        return (Function)functionClass.newInstance();
      } catch (InstantiationException e) {
        throw new FeatureException("The function '"+functionClass.getName()+"' cannot be initialized. ", e);
      } catch (IllegalAccessException e) {
        throw new FeatureException("The function '"+functionClass.getName()+"' cannot be initialized. ", e);
      }
    }
    Class<?>[] params = constructors[0].getParameterTypes();
    if (params.length == 0) {
      try {
        return (Function)functionClass.newInstance();
      } catch (InstantiationException e) {
        throw new FeatureException("The function '"+functionClass.getName()+"' cannot be initialized. ", e);
      } catch (IllegalAccessException e) {
        throw new FeatureException("The function '"+functionClass.getName()+"' cannot be initialized. ", e);
      }
    }
    Object[] arguments = new Object[params.length];
    for (int i = 0; i < params.length; i++) {
      if (hasSubfunctions && params[i] == java.lang.String.class) {
        arguments[i] = name;
      } else {
        arguments[i] = registry.get(params[i]);
        if (arguments[i] == null) {
          return null;
        }
      }
    }
    try {
      return (Function)constructors[0].newInstance(arguments);
    } catch (InstantiationException e) {
      throw new FeatureException("The function '"+functionClass.getName()+"' cannot be initialized. ", e);
    } catch (IllegalAccessException e) {
      throw new FeatureException("The function '"+functionClass.getName()+"' cannot be initialized. ", e);
    } catch (InvocationTargetException e) {
      throw new FeatureException("The function '"+functionClass.getName()+"' cannot be initialized. ", e);
    }
  }
View Full Code Here

TOP

Related Classes of org.maltparserx.core.feature.FeatureException

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.