Package opennlp.tools.util

Examples of opennlp.tools.util.Version


    // First check version, everything else might change in the future
    String versionString = getManifestProperty(VERSION_PROPERTY);
   
    if (versionString != null) {
      Version version;
     
      try {
        version = Version.parse(versionString);
      }
      catch (NumberFormatException e) {
        throw new InvalidFormatException("Unable to parse model version!, e");
      }
     
      // Major and minor version must match, revision might be
      if (Version.currentVersion().getMajor() != version.getMajor() ||
          Version.currentVersion().getMinor() != version.getMinor()) {
        throw new InvalidFormatException("Model version " + version + " is not supported by this ("
            + Version.currentVersion() +") version of OpenNLP!");
      }
     
      // Reject loading a snapshot model with a non-snapshot version
      if (!Version.currentVersion().isSnapshot() && version.isSnapshot()) {
        throw new InvalidFormatException("Model is a snapshot models are not" +
            "supported by release versions!");
      }
    }
    else {
View Full Code Here


    // First check version, everything else might change in the future
    String versionString = getManifestProperty(VERSION_PROPERTY);
   
    if (versionString != null) {
      Version version;
     
      try {
        version = Version.parse(versionString);
      }
      catch (NumberFormatException e) {
        throw new InvalidFormatException("Unable to parse model version '" + versionString + "'!", e);
      }
     
      // Version check is only performed if current version is not the dev/debug version
      if (!Version.currentVersion().equals(Version.DEV_VERSION)) {
        // Major and minor version must match, revision might be
        if (Version.currentVersion().getMajor() != version.getMajor() ||
            Version.currentVersion().getMinor() != version.getMinor()) {
          throw new InvalidFormatException("Model version " + version + " is not supported by this ("
              + Version.currentVersion() +") version of OpenNLP!");
        }
       
        // Reject loading a snapshot model with a non-snapshot version
        if (!Version.currentVersion().isSnapshot() && version.isSnapshot()) {
          throw new InvalidFormatException("Model version " + version + " is a snapshot - snapshot models are not " +
              "supported by this non-snapshot version (" + Version.currentVersion() + ") of OpenNLP!");
        }
      }
    }
View Full Code Here

    // First check version, everything else might change in the future
    String versionString = getManifestProperty(VERSION_PROPERTY);

    if (versionString != null) {
      Version version;

      try {
        version = Version.parse(versionString);
      }
      catch (NumberFormatException e) {
        throw new InvalidFormatException("Unable to parse model version '" + versionString + "'!", e);
      }

      // Version check is only performed if current version is not the dev/debug version
      if (!Version.currentVersion().equals(Version.DEV_VERSION)) {
        // Major and minor version must match, revision might be
        if (Version.currentVersion().getMajor() != version.getMajor() ||
            Version.currentVersion().getMinor() != version.getMinor()) {
          //this check allows for the use of models one minor release behind current minor release
          if(Version.currentVersion().getMajor() == version.getMajor() && (Version.currentVersion().getMinor()-1) != version.getMinor()){
          throw new InvalidFormatException("Model version " + version + " is not supported by this ("
              + Version.currentVersion() +") version of OpenNLP!");
          }
        }

        // Reject loading a snapshot model with a non-snapshot version
        if (!Version.currentVersion().isSnapshot() && version.isSnapshot()) {
          throw new InvalidFormatException("Model version " + version + " is a snapshot - snapshot models are not " +
              "supported by this non-snapshot version (" + Version.currentVersion() + ") of OpenNLP!");
        }
      }
    }
View Full Code Here

TOP

Related Classes of opennlp.tools.util.Version

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.