Package org.maltparserx.core.feature.spec.reader

Examples of org.maltparserx.core.feature.spec.reader.FeatureSpecReader


 
  public void loadParReader(URL specModelURL, String markingStrategy, String coveredRoot) throws MaltChainedException {
    if (specModelURL == null) {
      throw new FeatureException("The URL to the feature specification model is missing or not well-formed. ");
    }
    FeatureSpecReader specReader = null;
    String urlSuffix = specModelURL.toString().substring(specModelURL.toString().length()-3);
    urlSuffix = Character.toUpperCase(urlSuffix.charAt(0)) + urlSuffix.substring(1);
    try {
      Class<?> clazz = Class.forName("org.maltparserx.core.feature.spec.reader."+urlSuffix+"Reader");
      specReader = (FeatureSpecReader)clazz.newInstance();
    } catch (InstantiationException e) {
      throw new FeatureException("Could not initialize the feature specification reader to read the specification file: "+specModelURL.toString(), e);
    } catch (IllegalAccessException e) {
      throw new FeatureException("Could not initialize the feature specification reader to read the specification file: "+specModelURL.toString(), e);
    } catch (ClassNotFoundException e) {
      throw new FeatureException("Could not find the feature specification reader to read the specification file: "+specModelURL.toString(), e);
    }
    specReaderMap.put(specModelURL, specReader);
   
    if (specReader instanceof ParReader) {
      if (markingStrategy.equalsIgnoreCase("head") || markingStrategy.equalsIgnoreCase("path") || markingStrategy.equalsIgnoreCase("head+path")) {
        ((ParReader)specReader).setPplifted(true);
      }
      if (markingStrategy.equalsIgnoreCase("path") || markingStrategy.equalsIgnoreCase("head+path")) {
        ((ParReader)specReader).setPppath(true);
      }
      if (!coveredRoot.equalsIgnoreCase("none")) {
        ((ParReader)specReader).setPpcoveredRoot(true);
      }
    }
    currentSpecModelURL = new ArrayList<SpecificationModel>();
    specModelKeyMap.put(specModelURL, currentSpecModelURL);
    specReader.load(specModelURL, this);
  }
View Full Code Here


 
  public void load(URL specModelURL) throws MaltChainedException {
    if (specModelURL == null) {
      throw new FeatureException("The URL to the feature specification model is missing or not well-formed. ");
    }
    FeatureSpecReader specReader = null;
    String urlSuffix = specModelURL.toString().substring(specModelURL.toString().length()-3);
    urlSuffix = Character.toUpperCase(urlSuffix.charAt(0)) + urlSuffix.substring(1);
    try {
      Class<?> clazz = Class.forName("org.maltparserx.core.feature.spec.reader."+urlSuffix+"Reader");
      specReader = (FeatureSpecReader)clazz.newInstance();
    } catch (InstantiationException e) {
      throw new FeatureException("Could not initialize the feature specification reader to read the specification file: "+specModelURL.toString(), e);
    } catch (IllegalAccessException e) {
      throw new FeatureException("Could not initialize the feature specification reader to read the specification file: "+specModelURL.toString(), e);
    } catch (ClassNotFoundException e) {
      throw new FeatureException("Could not find the feature specification reader to read the specification file: "+specModelURL.toString(), e);
    }
    specReaderMap.put(specModelURL, specReader);
   
    currentSpecModelURL = new ArrayList<SpecificationModel>();
    specModelKeyMap.put(specModelURL, currentSpecModelURL);
    specReader.load(specModelURL, this);
  }
View Full Code Here

TOP

Related Classes of org.maltparserx.core.feature.spec.reader.FeatureSpecReader

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.