/** * Retrieves the OpenNLP version which was used * to create the model. * * @return the version */ public final Version getVersion() { String version = getManifestProperty(VERSION_PROPERTY); return Version.parse(version); }
/** * Retrieves the current version of the OpenNlp Tools library. * * @return the current version */ public static Version currentVersion() { Properties manifest = new Properties(); // Try to read the version from the version file if it is available, // otherwise set the version to the development version try (InputStream versionIn = Version.class.getResourceAsStream("opennlp.version")) { if (versionIn != null) { manifest.load(versionIn); } } catch (IOException e) { // ignore error } String versionString = manifest.getProperty("OpenNLP-Version", DEV_VERSION_STRING); if (versionString.equals("${pom.version}")) versionString = DEV_VERSION_STRING; return Version.parse(versionString); } }
public POSContextGenerator getPOSContextGenerator(int cacheSize) { if (artifactProvider != null) { Properties manifest = (Properties) artifactProvider.getArtifact("manifest.properties"); String version = manifest.getProperty("OpenNLP-Version"); if (Version.parse(version).getMinor() < 8) { return new DefaultPOSContextGenerator(cacheSize, getDictionary()); } } return new ConfigurablePOSContextGenerator(cacheSize, createFeatureGenerators()); }
@Test public void testParseInvalidVersion() { try { Version.parse("1.5."); } catch (NumberFormatException e) { return; } Assert.assertFalse(false); }
@Test public void testParseInvalidVersion2() { try { Version.parse("1.5"); } catch (NumberFormatException e) { return; } Assert.assertTrue(false); } }
@Test public void testParse() { Version referenceVersion = Version.currentVersion(); Assert.assertEquals(referenceVersion, Version.parse(referenceVersion.toString())); Assert.assertEquals(new Version(1,5,2, false), Version.parse("1.5.2-incubating")); Assert.assertEquals(new Version(1,5,2, false), Version.parse("1.5.2")); }
/** * Retrieves the OpenNLP version which was used * to create the model. * * @return the version */ public final Version getVersion() { String version = getManifestProperty(VERSION_PROPERTY); return Version.parse(version); }
/** * Retrieves the OpenNLP version which was used * to create the model. * * @return the version */ public final Version getVersion() { String version = getManifestProperty(VERSION_PROPERTY); return Version.parse(version); }
/** * Retrieves the current version of the OpenNlp Tools library. * * @return the current version */ public static Version currentVersion() { Properties manifest = new Properties(); // Try to read the version from the version file if it is available, // otherwise set the version to the development version try (InputStream versionIn = Version.class.getResourceAsStream("opennlp.version")) { if (versionIn != null) { manifest.load(versionIn); } } catch (IOException e) { // ignore error } String versionString = manifest.getProperty("OpenNLP-Version", DEV_VERSION_STRING); if (versionString.equals("${pom.version}")) versionString = DEV_VERSION_STRING; return Version.parse(versionString); } }
/** * Retrieves the current version of the OpenNlp Tools library. * * @return the current version */ public static Version currentVersion() { Properties manifest = new Properties(); // Try to read the version from the version file if it is available, // otherwise set the version to the development version try (InputStream versionIn = Version.class.getResourceAsStream("opennlp.version")) { if (versionIn != null) { manifest.load(versionIn); } } catch (IOException e) { // ignore error } String versionString = manifest.getProperty("OpenNLP-Version", DEV_VERSION_STRING); if (versionString.equals("${pom.version}")) versionString = DEV_VERSION_STRING; return Version.parse(versionString); } }
version = Version.parse(versionString);
public POSContextGenerator getPOSContextGenerator(int cacheSize) { if (artifactProvider != null) { Properties manifest = (Properties) artifactProvider.getArtifact("manifest.properties"); String version = manifest.getProperty("OpenNLP-Version"); if (Version.parse(version).getMinor() < 8) { return new DefaultPOSContextGenerator(cacheSize, getDictionary()); } } return new ConfigurablePOSContextGenerator(cacheSize, createFeatureGenerators()); }
public POSContextGenerator getPOSContextGenerator(int cacheSize) { if (artifactProvider != null) { Properties manifest = (Properties) artifactProvider.getArtifact("manifest.properties"); String version = manifest.getProperty("OpenNLP-Version"); if (Version.parse(version).getMinor() < 8) { return new DefaultPOSContextGenerator(cacheSize, getDictionary()); } } return new ConfigurablePOSContextGenerator(cacheSize, createFeatureGenerators()); }
version = Version.parse(versionString);
version = Version.parse(versionString);