This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-472
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-472 by this push:
new a52cc44 WIP.
a52cc44 is described below
commit a52cc444cdb7e735f6e719ff90d7fb9dd67f4b51
Author: Sergey Kamov <[email protected]>
AuthorDate: Thu Dec 30 00:37:25 2021 +0300
WIP.
---
.../semantic/en/NCEnSemanticEntityParser.java | 47 ++++++++++++++++++++++
...xtStemmer.java => NCEnSemanticTextStemmer.java} | 2 +-
.../semantic/NCSemanticEntityParserSpec.scala | 4 +-
3 files changed, 50 insertions(+), 3 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/en/NCEnSemanticEntityParser.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/en/NCEnSemanticEntityParser.java
new file mode 100644
index 0000000..6452938
--- /dev/null
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/en/NCEnSemanticEntityParser.java
@@ -0,0 +1,47 @@
+package org.apache.nlpcraft.nlp.entity.parser.semantic.en;
+
+import org.apache.nlpcraft.nlp.entity.parser.semantic.NCSemanticElement;
+import org.apache.nlpcraft.nlp.entity.parser.semantic.NCSemanticEntityParser;
+import
org.apache.nlpcraft.nlp.entity.parser.semantic.impl.en.NCEnSemanticTextStemmer;
+
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * TODO: Do we need it?
+ */
+public class NCEnSemanticEntityParser extends NCSemanticEntityParser {
+ /**
+ *
+ * @param elems
+ */
+ public NCEnSemanticEntityParser(List<NCSemanticElement> elems) {
+ super(new NCEnSemanticTextStemmer(), elems);
+ }
+
+ /**
+ *
+ * @param macros
+ * @param elems
+ */
+ public NCEnSemanticEntityParser(Map<String, String> macros,
List<NCSemanticElement> elems) {
+ super(new NCEnSemanticTextStemmer(), macros, elems);
+ }
+
+ /**
+ *
+ * @param mdlFile
+ */
+ public NCEnSemanticEntityParser(File mdlFile) {
+ super(new NCEnSemanticTextStemmer(), mdlFile);
+ }
+
+ /**
+ *
+ * @param mdlSrc
+ */
+ public NCEnSemanticEntityParser(String mdlSrc) {
+ super(new NCEnSemanticTextStemmer(), mdlSrc);
+ }
+}
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/impl/en/NCENSemanticTextStemmer.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/impl/en/NCEnSemanticTextStemmer.java
similarity index 94%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/impl/en/NCENSemanticTextStemmer.java
rename to
nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/impl/en/NCEnSemanticTextStemmer.java
index c70d246..4571053 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/impl/en/NCENSemanticTextStemmer.java
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/impl/en/NCEnSemanticTextStemmer.java
@@ -20,7 +20,7 @@ package
org.apache.nlpcraft.nlp.entity.parser.semantic.impl.en;
import opennlp.tools.stemmer.PorterStemmer;
import org.apache.nlpcraft.nlp.entity.parser.semantic.NCSemanticTextStemmer;
-public class NCENSemanticTextStemmer implements NCSemanticTextStemmer {
+public class NCEnSemanticTextStemmer implements NCSemanticTextStemmer {
private final PorterStemmer s = new PorterStemmer();
@Override
diff --git
a/nlpcraft/src/test/java/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticEntityParserSpec.scala
b/nlpcraft/src/test/java/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticEntityParserSpec.scala
index b567cd2..09fc3b4 100644
---
a/nlpcraft/src/test/java/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticEntityParserSpec.scala
+++
b/nlpcraft/src/test/java/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticEntityParserSpec.scala
@@ -20,7 +20,7 @@ package org.apache.nlpcraft.nlp.entity.parser.semantic
import org.apache.nlpcraft.*
import org.apache.nlpcraft.internal.util.NCUtils
import org.apache.nlpcraft.nlp.entity.parser.opennlp.NCOpenNlpEntityParser
-import
org.apache.nlpcraft.nlp.entity.parser.semantic.impl.en.NCENSemanticTextStemmer
+import org.apache.nlpcraft.nlp.entity.parser.semantic.impl.en.*
import org.apache.nlpcraft.nlp.token.parser.opennlp.en.NCEnOpenNlpTokenParser
import org.apache.nlpcraft.nlp.util.*
import org.apache.nlpcraft.nlp.util.NCTestConfig.*
@@ -58,7 +58,7 @@ class NCSemanticEntityParserSpec:
parser =
NCTestUtils.makeAndStart(
new NCSemanticEntityParser(
- new NCENSemanticTextStemmer,
+ new NCEnSemanticTextStemmer,
Seq(Element("testId", synonyms = Seq("test"))).asJava
)
)