You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by co...@apache.org on 2016/11/09 21:10:57 UTC
[03/16] opennlp git commit: OPENNLP-622 Updated to OpenNLP 1.6.0 and
Morfologik 2.1.0
OPENNLP-622 Updated to OpenNLP 1.6.0 and Morfologik 2.1.0
Project: http://git-wip-us.apache.org/repos/asf/opennlp/repo
Commit: http://git-wip-us.apache.org/repos/asf/opennlp/commit/15c3fb72
Tree: http://git-wip-us.apache.org/repos/asf/opennlp/tree/15c3fb72
Diff: http://git-wip-us.apache.org/repos/asf/opennlp/diff/15c3fb72
Branch: refs/heads/trunk
Commit: 15c3fb720fcde96328e5c20e6a8994b7d4f7abc8
Parents: 78dd579
Author: William Colen <co...@apache.org>
Authored: Wed Jul 6 21:22:38 2016 +0000
Committer: William Colen <co...@apache.org>
Committed: Wed Jul 6 21:22:38 2016 +0000
----------------------------------------------------------------------
pom.xml | 6 +-
.../builder/MorfologikDictionayBuilder.java | 52 ++++----
.../java/opennlp/morfologik/cmdline/CLI.java | 128 +++++++++----------
.../MorfologikDictionaryBuilderParams.java | 13 +-
.../MorfologikDictionaryBuilderTool.java | 12 +-
.../tagdict/MorfologikPOSTaggerFactory.java | 8 +-
.../opennlp/morfologik/util/MorfologikUtil.java | 36 ++++++
.../builder/POSDictionayBuilderTest.java | 42 +++---
.../lemmatizer/MorfologikLemmatizerTest.java | 4 +-
.../tagdict/MorfologikTagDictionaryTest.java | 4 +-
10 files changed, 158 insertions(+), 147 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/opennlp/blob/15c3fb72/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 51854f6..60f201e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,20 +30,20 @@
<dependency>
<groupId>org.carrot2</groupId>
<artifactId>morfologik-stemming</artifactId>
- <version>1.6.0</version>
+ <version>2.1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.carrot2</groupId>
<artifactId>morfologik-tools</artifactId>
- <version>1.6.0</version>
+ <version>2.1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.opennlp</groupId>
<artifactId>opennlp-tools</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/opennlp/blob/15c3fb72/src/main/java/opennlp/morfologik/builder/MorfologikDictionayBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/opennlp/morfologik/builder/MorfologikDictionayBuilder.java b/src/main/java/opennlp/morfologik/builder/MorfologikDictionayBuilder.java
index b8bcfbf..0131318 100644
--- a/src/main/java/opennlp/morfologik/builder/MorfologikDictionayBuilder.java
+++ b/src/main/java/opennlp/morfologik/builder/MorfologikDictionayBuilder.java
@@ -23,12 +23,14 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.Charset;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
-import morfologik.stemming.Dictionary;
-import morfologik.tools.FSABuildTool;
+import morfologik.stemming.DictionaryMetadata;
+import morfologik.stemming.EncoderType;
+import morfologik.tools.FSACompile;
import morfologik.tools.Launcher;
/**
@@ -50,20 +52,20 @@ public class MorfologikDictionayBuilder {
* @param separator
* a field separator, the default is '+'. If your tags contains '+'
* change to something else
- * @param isUsePrefixes
- * if to compact using prefixes
+ * @param encoderType
+ * the Morfologik enconder type
* @param isUseInfixes
* if to compact using infixes
* @throws Exception
*/
public void build(File dictInFile, File dictOutFile, Charset encoding,
- String separator, boolean isUsePrefixes, boolean isUseInfixes)
+ String separator, EncoderType encoderType)
throws Exception {
-
- File propertiesFile = new File(
- Dictionary.getExpectedFeaturesName(dictOutFile.getAbsolutePath()));
- this.build(dictInFile, dictOutFile, propertiesFile, encoding, separator,
- isUsePrefixes, isUseInfixes);
+ Path propertiesPath = DictionaryMetadata
+ .getExpectedMetadataLocation(dictOutFile.toPath());
+
+ this.build(dictInFile, dictOutFile, propertiesPath.toFile(), encoding, separator,
+ encoderType);
}
/**
@@ -87,33 +89,29 @@ public class MorfologikDictionayBuilder {
* @throws Exception
*/
public void build(File dictInFile, File dictOutFile, File propertiesOutFile,
- Charset encoding, String separator, boolean isUsePrefixes,
- boolean isUseInfixes) throws Exception {
+ Charset encoding, String separator, EncoderType encoderType) throws Exception {
// we need to execute tab2morph followed by fsa_build
- File morph = tab2morph(dictInFile, separator, isUsePrefixes, isUseInfixes);
+ File morph = tab2morph(dictInFile, separator, encoderType);
fsaBuild(morph, dictOutFile);
morph.delete();
// now we create the properties files using the passed parameters
- createProperties(encoding, separator, isUsePrefixes, isUseInfixes,
+ createProperties(encoding, separator, encoderType,
propertiesOutFile);
}
void createProperties(Charset encoding, String separator,
- boolean isUsePrefixes, boolean isUseInfixes, File propertiesFile)
+ EncoderType encoderType, File propertiesFile)
throws FileNotFoundException, IOException {
Properties properties = new Properties();
properties.setProperty("fsa.dict.separator", separator);
properties.setProperty("fsa.dict.encoding", encoding.name());
- properties.setProperty("fsa.dict.uses-prefixes",
- Boolean.toString(isUsePrefixes));
- properties.setProperty("fsa.dict.uses-infixes",
- Boolean.toString(isUseInfixes));
+ properties.setProperty("fsa.dict.encoder", encoderType.name());
OutputStream os = new FileOutputStream(propertiesFile);
properties.store(os, "Morfologik POS Dictionary properties");
@@ -124,11 +122,12 @@ public class MorfologikDictionayBuilder {
private void fsaBuild(File morph, File dictOutFile) throws Exception {
String[] params = { "-f", "cfsa2", "-i", morph.getAbsolutePath(), "-o",
dictOutFile.getAbsolutePath() };
- FSABuildTool.main(params);
+ FSACompile.main(params);
+ // FSABuildTool.main(params);
}
private File tab2morph(File dictInFile, String separator,
- boolean isUsePrefixes, boolean isUseInfixes) throws Exception {
+ EncoderType encoderType) throws Exception {
// create tab2morph parameters
List<String> tag2morphParams = new ArrayList<String>();
@@ -136,14 +135,9 @@ public class MorfologikDictionayBuilder {
tag2morphParams.add("--annotation");
tag2morphParams.add(separator);
-
- if (isUsePrefixes) {
- tag2morphParams.add("-pre");
- }
-
- if (isUseInfixes) {
- tag2morphParams.add("-inf");
- }
+
+ tag2morphParams.add("--e");
+ tag2morphParams.add(encoderType.name());
tag2morphParams.add("-i");
tag2morphParams.add(dictInFile.getAbsolutePath());
http://git-wip-us.apache.org/repos/asf/opennlp/blob/15c3fb72/src/main/java/opennlp/morfologik/cmdline/CLI.java
----------------------------------------------------------------------
diff --git a/src/main/java/opennlp/morfologik/cmdline/CLI.java b/src/main/java/opennlp/morfologik/cmdline/CLI.java
index 66a5151..f92d178 100644
--- a/src/main/java/opennlp/morfologik/cmdline/CLI.java
+++ b/src/main/java/opennlp/morfologik/cmdline/CLI.java
@@ -94,71 +94,71 @@ public final class CLI {
.println("Example: opennlp-morfologik-addon POSDictionaryBuilder help");
}
- public static void main(String[] args) {
- if (args.length == 0) {
- usage();
- System.exit(0);
- }
-
- String toolArguments[] = new String[args.length - 1];
- System.arraycopy(args, 1, toolArguments, 0, toolArguments.length);
-
- String toolName = args[0];
-
- // check for format
- String formatName = StreamFactoryRegistry.DEFAULT_FORMAT;
- int idx = toolName.indexOf(".");
- if (-1 < idx) {
- formatName = toolName.substring(idx + 1);
- toolName = toolName.substring(0, idx);
- }
- CmdLineTool tool = toolLookupMap.get(toolName);
-
- try {
- if (null == tool) {
- throw new TerminateToolException(1, "Tool " + toolName
- + " is not found.");
- }
-
- if ((0 == toolArguments.length && tool.hasParams())
- || 0 < toolArguments.length
- && "help".equals(toolArguments[0])) {
- if (tool instanceof TypedCmdLineTool) {
- System.out.println(((TypedCmdLineTool) tool)
- .getHelp(formatName));
- } else if (tool instanceof BasicCmdLineTool) {
- System.out.println(tool.getHelp());
- }
-
- System.exit(0);
- }
-
- if (tool instanceof TypedCmdLineTool) {
- ((TypedCmdLineTool) tool).run(formatName, toolArguments);
- } else if (tool instanceof BasicCmdLineTool) {
- if (-1 == idx) {
- ((BasicCmdLineTool) tool).run(toolArguments);
- } else {
- throw new TerminateToolException(1, "Tool " + toolName
- + " does not support formats.");
- }
- } else {
- throw new TerminateToolException(1, "Tool " + toolName
- + " is not supported.");
- }
- } catch (TerminateToolException e) {
-
- if (e.getMessage() != null) {
- System.err.println(e.getMessage());
- }
+ @SuppressWarnings("rawtypes")
+ public static void main(String[] args) {
+
+ if (args.length == 0) {
+ usage();
+ System.exit(0);
+ }
+
+ String toolArguments[] = new String[args.length -1];
+ System.arraycopy(args, 1, toolArguments, 0, toolArguments.length);
+
+ String toolName = args[0];
+
+ //check for format
+ String formatName = StreamFactoryRegistry.DEFAULT_FORMAT;
+ int idx = toolName.indexOf(".");
+ if (-1 < idx) {
+ formatName = toolName.substring(idx + 1);
+ toolName = toolName.substring(0, idx);
+ }
+ CmdLineTool tool = toolLookupMap.get(toolName);
+
+ try {
+ if (null == tool) {
+ throw new TerminateToolException(1, "Tool " + toolName + " is not found.");
+ }
+
+ if ((0 == toolArguments.length && tool.hasParams()) ||
+ 0 < toolArguments.length && "help".equals(toolArguments[0])) {
+ if (tool instanceof TypedCmdLineTool) {
+ System.out.println(((TypedCmdLineTool) tool).getHelp(formatName));
+ } else if (tool instanceof BasicCmdLineTool) {
+ System.out.println(tool.getHelp());
+ }
+
+ System.exit(0);
+ }
+
+ if (tool instanceof TypedCmdLineTool) {
+ ((TypedCmdLineTool) tool).run(formatName, toolArguments);
+ } else if (tool instanceof BasicCmdLineTool) {
+ if (-1 == idx) {
+ ((BasicCmdLineTool) tool).run(toolArguments);
+ } else {
+ throw new TerminateToolException(1, "Tool " + toolName + " does not support formats.");
+ }
+ } else {
+ throw new TerminateToolException(1, "Tool " + toolName + " is not supported.");
+ }
+ }
+ catch (TerminateToolException e) {
+
+ if (e.getMessage() != null) {
+ System.err.println(e.getMessage());
+ }
+
+ if (e.getCause() != null) {
+ System.err.println(e.getCause().getMessage());
+ e.getCause().printStackTrace(System.err);
+ }
+
+ System.exit(e.getCode());
+ }
+ }
- if (e.getCause() != null) {
- System.err.println(e.getCause().getMessage());
- e.getCause().printStackTrace(System.err);
- }
- System.exit(e.getCode());
- }
- }
}
http://git-wip-us.apache.org/repos/asf/opennlp/blob/15c3fb72/src/main/java/opennlp/morfologik/cmdline/builder/MorfologikDictionaryBuilderParams.java
----------------------------------------------------------------------
diff --git a/src/main/java/opennlp/morfologik/cmdline/builder/MorfologikDictionaryBuilderParams.java b/src/main/java/opennlp/morfologik/cmdline/builder/MorfologikDictionaryBuilderParams.java
index 0b1e896..193599b 100644
--- a/src/main/java/opennlp/morfologik/cmdline/builder/MorfologikDictionaryBuilderParams.java
+++ b/src/main/java/opennlp/morfologik/cmdline/builder/MorfologikDictionaryBuilderParams.java
@@ -19,6 +19,7 @@ package opennlp.morfologik.cmdline.builder;
import java.io.File;
+import morfologik.stemming.EncoderType;
import opennlp.tools.cmdline.ArgumentParser.OptionalParameter;
import opennlp.tools.cmdline.ArgumentParser.ParameterDescription;
import opennlp.tools.cmdline.params.EncodingParameter;
@@ -37,13 +38,9 @@ interface MorfologikDictionaryBuilderParams extends EncodingParameter {
@ParameterDescription(valueName = "sep", description = "The FSA dictionary separator. Default is '+'.")
@OptionalParameter(defaultValue = "+")
String getFSADictSeparator();
-
- @ParameterDescription(valueName = "true|false", description = "Compact using prefixes.")
- @OptionalParameter(defaultValue = "true")
- Boolean getUsesPrefixes();
-
- @ParameterDescription(valueName = "true|false", description = "Compact using infixes.")
- @OptionalParameter(defaultValue = "true")
- Boolean getUsesInfixes();
+
+ @ParameterDescription(valueName = "sep", description = "The type of lemma-inflected form encoding compression that precedes automaton construction. Allowed values: [suffix, infix, prefix, none]. Details are in Daciuk's paper and in the code. ")
+ @OptionalParameter(defaultValue = "prefix")
+ EncoderType getEncoderType();
}
http://git-wip-us.apache.org/repos/asf/opennlp/blob/15c3fb72/src/main/java/opennlp/morfologik/cmdline/builder/MorfologikDictionaryBuilderTool.java
----------------------------------------------------------------------
diff --git a/src/main/java/opennlp/morfologik/cmdline/builder/MorfologikDictionaryBuilderTool.java b/src/main/java/opennlp/morfologik/cmdline/builder/MorfologikDictionaryBuilderTool.java
index 9da7e7d..741515e 100644
--- a/src/main/java/opennlp/morfologik/cmdline/builder/MorfologikDictionaryBuilderTool.java
+++ b/src/main/java/opennlp/morfologik/cmdline/builder/MorfologikDictionaryBuilderTool.java
@@ -17,10 +17,11 @@
package opennlp.morfologik.cmdline.builder;
+import static opennlp.morfologik.util.MorfologikUtil.getExpectedPropertiesFile;
+
import java.io.File;
import java.nio.charset.Charset;
-import morfologik.stemming.Dictionary;
import opennlp.morfologik.builder.MorfologikDictionayBuilder;
import opennlp.tools.cmdline.BasicCmdLineTool;
import opennlp.tools.cmdline.CmdLineUtil;
@@ -54,18 +55,11 @@ public class MorfologikDictionaryBuilderTool extends BasicCmdLineTool {
MorfologikDictionayBuilder builder = new MorfologikDictionayBuilder();
try {
builder.build(dictInFile, dictOutFile, propertiesFile, encoding,
- params.getFSADictSeparator(), params.getUsesPrefixes(),
- params.getUsesInfixes());
+ params.getFSADictSeparator(), params.getEncoderType());
} catch (Exception e) {
throw new TerminateToolException(-1,
"Error while creating Morfologik POS Dictionay: " + e.getMessage(), e);
}
}
-
- private File getExpectedPropertiesFile(File dictFile) {
- return new File(Dictionary.getExpectedFeaturesName(dictFile
- .getAbsolutePath()));
- }
-
}
http://git-wip-us.apache.org/repos/asf/opennlp/blob/15c3fb72/src/main/java/opennlp/morfologik/tagdict/MorfologikPOSTaggerFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/opennlp/morfologik/tagdict/MorfologikPOSTaggerFactory.java b/src/main/java/opennlp/morfologik/tagdict/MorfologikPOSTaggerFactory.java
index 9b74ae5..f022a86 100644
--- a/src/main/java/opennlp/morfologik/tagdict/MorfologikPOSTaggerFactory.java
+++ b/src/main/java/opennlp/morfologik/tagdict/MorfologikPOSTaggerFactory.java
@@ -17,6 +17,8 @@
package opennlp.morfologik.tagdict;
+import static opennlp.morfologik.util.MorfologikUtil.getExpectedPropertiesFile;
+
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
@@ -72,8 +74,8 @@ public class MorfologikPOSTaggerFactory extends POSTaggerFactory {
// now we try to load it...
try {
this.dictData = Files.readAllBytes(Paths.get(path));
- this.dictInfo = Files.readAllBytes(Paths
- .get(morfologik.stemming.Dictionary.getExpectedFeaturesName(path)));
+ this.dictInfo = Files.readAllBytes(getExpectedPropertiesFile(path)
+ .toPath());
this.dict = createMorfologikDictionary(dictData, dictInfo);
@@ -163,7 +165,7 @@ public class MorfologikPOSTaggerFactory extends POSTaggerFactory {
private TagDictionary createMorfologikDictionary(byte[] data, byte[] info)
throws IOException {
morfologik.stemming.Dictionary dict = morfologik.stemming.Dictionary
- .readAndClose(new ByteArrayInputStream(data), new ByteArrayInputStream(
+ .read(new ByteArrayInputStream(data), new ByteArrayInputStream(
info));
return new MorfologikTagDictionary(dict);
}
http://git-wip-us.apache.org/repos/asf/opennlp/blob/15c3fb72/src/main/java/opennlp/morfologik/util/MorfologikUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/opennlp/morfologik/util/MorfologikUtil.java b/src/main/java/opennlp/morfologik/util/MorfologikUtil.java
new file mode 100644
index 0000000..bd4d1a4
--- /dev/null
+++ b/src/main/java/opennlp/morfologik/util/MorfologikUtil.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package opennlp.morfologik.util;
+
+import java.io.File;
+
+import morfologik.stemming.DictionaryMetadata;
+
+public class MorfologikUtil {
+
+ public static File getExpectedPropertiesFile(File dictFile) {
+ return DictionaryMetadata.getExpectedMetadataLocation(dictFile.toPath())
+ .toFile();
+ }
+
+ public static File getExpectedPropertiesFile(String dictFile) {
+ File f = new File(dictFile);
+ return getExpectedPropertiesFile(f);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/opennlp/blob/15c3fb72/src/test/java/opennlp/morfologik/builder/POSDictionayBuilderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/opennlp/morfologik/builder/POSDictionayBuilderTest.java b/src/test/java/opennlp/morfologik/builder/POSDictionayBuilderTest.java
index 16d1dac..730025c 100644
--- a/src/test/java/opennlp/morfologik/builder/POSDictionayBuilderTest.java
+++ b/src/test/java/opennlp/morfologik/builder/POSDictionayBuilderTest.java
@@ -25,6 +25,7 @@ import java.nio.charset.Charset;
import java.util.Properties;
import junit.framework.TestCase;
+import morfologik.stemming.EncoderType;
import opennlp.morfologik.lemmatizer.MorfologikLemmatizer;
import org.junit.Test;
@@ -40,8 +41,7 @@ public class POSDictionayBuilderTest extends TestCase {
File dictOutFile = File.createTempFile(
POSDictionayBuilderTest.class.getName(), ".dict");
- builder.build(dictInFile, dictOutFile, Charset.forName("UTF-8"), "+", true,
- true);
+ builder.build(dictInFile, dictOutFile, Charset.forName("UTF-8"), "+", EncoderType.PREFIX);
MorfologikLemmatizer ml = new MorfologikLemmatizer(dictOutFile.toURI()
.toURL());
@@ -54,40 +54,28 @@ public class POSDictionayBuilderTest extends TestCase {
Charset c = Charset.forName("iso-8859-1");
String sep = "_";
- boolean pref = true;
- boolean inf = true;
- Properties p = createPropertiesHelper(c, sep, pref, inf);
+
+ EncoderType encoderType = EncoderType.PREFIX;
+ Properties p = createPropertiesHelper(c, sep, encoderType);
assertEquals(c.name(), p.getProperty("fsa.dict.encoding"));
assertEquals(sep, p.getProperty("fsa.dict.separator"));
- assertEquals(pref,
- Boolean.parseBoolean(p.getProperty("fsa.dict.uses-prefixes")));
- assertEquals(inf,
- Boolean.parseBoolean(p.getProperty("fsa.dict.uses-infixes")));
-
- pref = false;
- inf = true;
- p = createPropertiesHelper(c, sep, pref, inf);
- assertEquals(pref,
- Boolean.parseBoolean(p.getProperty("fsa.dict.uses-prefixes")));
- assertEquals(inf,
- Boolean.parseBoolean(p.getProperty("fsa.dict.uses-infixes")));
-
- pref = true;
- inf = false;
- p = createPropertiesHelper(c, sep, pref, inf);
- assertEquals(pref,
- Boolean.parseBoolean(p.getProperty("fsa.dict.uses-prefixes")));
- assertEquals(inf,
- Boolean.parseBoolean(p.getProperty("fsa.dict.uses-infixes")));
+ assertEquals(encoderType,
+ EncoderType.valueOf(p.getProperty("fsa.dict.encoder")));
+
+ encoderType = EncoderType.SUFFIX;
+ p = createPropertiesHelper(c, sep, encoderType);
+ assertEquals(encoderType,
+ EncoderType.valueOf(p.getProperty("fsa.dict.encoder")));
+
}
private Properties createPropertiesHelper(Charset c, String sep,
- boolean pref, boolean inf) throws IOException {
+ EncoderType encoderType) throws IOException {
MorfologikDictionayBuilder builder = new MorfologikDictionayBuilder();
File f = File.createTempFile(POSDictionayBuilderTest.class.getName(),
".info");
- builder.createProperties(c, sep, pref, inf, f);
+ builder.createProperties(c, sep, encoderType, f);
InputStream is = new FileInputStream(f);
http://git-wip-us.apache.org/repos/asf/opennlp/blob/15c3fb72/src/test/java/opennlp/morfologik/lemmatizer/MorfologikLemmatizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/opennlp/morfologik/lemmatizer/MorfologikLemmatizerTest.java b/src/test/java/opennlp/morfologik/lemmatizer/MorfologikLemmatizerTest.java
index 6fd6ec1..87fc2cc 100644
--- a/src/test/java/opennlp/morfologik/lemmatizer/MorfologikLemmatizerTest.java
+++ b/src/test/java/opennlp/morfologik/lemmatizer/MorfologikLemmatizerTest.java
@@ -5,6 +5,7 @@ import static org.junit.Assert.assertEquals;
import java.io.File;
import java.nio.charset.Charset;
+import morfologik.stemming.EncoderType;
import opennlp.morfologik.builder.MorfologikDictionayBuilder;
import opennlp.morfologik.builder.POSDictionayBuilderTest;
import opennlp.tools.lemmatizer.DictionaryLemmatizer;
@@ -34,8 +35,7 @@ public class MorfologikLemmatizerTest {
File dictOutFile = File.createTempFile(
POSDictionayBuilderTest.class.getName(), ".dict");
- builder.build(dictInFile, dictOutFile, Charset.forName("UTF-8"), "+", true,
- true);
+ builder.build(dictInFile, dictOutFile, Charset.forName("UTF-8"), "+", EncoderType.PREFIX);
MorfologikLemmatizer ml = new MorfologikLemmatizer(dictOutFile.toURI()
.toURL());
http://git-wip-us.apache.org/repos/asf/opennlp/blob/15c3fb72/src/test/java/opennlp/morfologik/tagdict/MorfologikTagDictionaryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/opennlp/morfologik/tagdict/MorfologikTagDictionaryTest.java b/src/test/java/opennlp/morfologik/tagdict/MorfologikTagDictionaryTest.java
index def97b6..d605e15 100644
--- a/src/test/java/opennlp/morfologik/tagdict/MorfologikTagDictionaryTest.java
+++ b/src/test/java/opennlp/morfologik/tagdict/MorfologikTagDictionaryTest.java
@@ -9,6 +9,7 @@ import java.util.Arrays;
import java.util.List;
import morfologik.stemming.Dictionary;
+import morfologik.stemming.EncoderType;
import opennlp.morfologik.builder.MorfologikDictionayBuilder;
import opennlp.morfologik.builder.POSDictionayBuilderTest;
import opennlp.morfologik.tagdict.MorfologikTagDictionary;
@@ -80,8 +81,7 @@ public class MorfologikTagDictionaryTest {
File dictOutFile = File.createTempFile(
POSDictionayBuilderTest.class.getName(), ".dict");
- builder.build(dictInFile, dictOutFile, Charset.forName("UTF-8"), "+", true,
- true);
+ builder.build(dictInFile, dictOutFile, Charset.forName("UTF-8"), "+", EncoderType.PREFIX);
MorfologikTagDictionary ml = new MorfologikTagDictionary(
Dictionary.read(dictOutFile.toURI().toURL()), caseSensitive);