This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-474
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-474 by this push:
new 8d072be Renaming...
8d072be is described below
commit 8d072beb630f6f722d2c5a5ea9aba6355181e184
Author: Aaron Radzinski <[email protected]>
AuthorDate: Wed Jan 19 11:29:02 2022 -0800
Renaming...
---
.../nlp/entity/parser/nlp/NCNlpEntityParser.java | 4 +--
...NCNlpImpl.scala => NCNlpEntityParserImpl.scala} | 6 ++--
.../parser/opennlp/NCOpenNlpEntityParser.java | 8 +++---
...pImpl.scala => NCOpenNlpEntityParserImpl.scala} | 2 +-
.../entity/parser/semantic/NCSemanticElement.java | 1 +
.../semantic/impl/NCSemanticEntityParserImpl.scala | 32 ++++++++--------------
.../parser/semantic/impl/NCSemanticSynonym.scala | 5 ++++
...Stemmer.java => NCEnSemanticPorterStemmer.java} | 2 +-
.../token/enricher/en/NCBracketsTokenEnricher.java | 4 +--
.../enricher/en/NCDictionaryTokenEnricher.java | 4 +--
.../token/enricher/en/NCQuotesTokenEnricher.java | 4 +--
.../enricher/en/NCStopWordsTokenEnricher.java | 8 +++---
.../en/N\320\241SwearWordsTokenEnricher.java" | 6 ++--
...mpl.scala => NCBracketsTokenEnricherImpl.scala} | 2 +-
...l.scala => NCDictionaryTokenEnricherImpl.scala} | 2 +-
...sImpl.scala => NCQuotesTokenEnricherImpl.scala} | 2 +-
...pl.scala => NCStopWordsTokenEnricherImpl.scala} | 6 ++--
...l.scala => NCSwearWordsTokenEnricherImpl.scala} | 2 +-
.../token/parser/opennlp/NCOpenNlpTokenParser.java | 6 ++--
...lpImpl.scala => NCOpenNlpTokenParserImpl.scala} | 2 +-
.../internal/NCModelPipelineProcessorSpec.scala | 6 ++--
.../semantic/NCSemanticEntityParserJsonSpec.scala | 4 +--
.../semantic/NCSemanticEntityParserSpec.scala | 4 +--
.../semantic/NCSemanticEntityParserYamlSpec.scala | 4 +--
.../enricher/en/impl/NCStopWordsImplSpec.scala | 4 +--
25 files changed, 64 insertions(+), 66 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/nlp/NCNlpEntityParser.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/nlp/NCNlpEntityParser.java
index 2e57674..28aefe3 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/nlp/NCNlpEntityParser.java
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/nlp/NCNlpEntityParser.java
@@ -22,7 +22,7 @@ import org.apache.nlpcraft.NCEntityParser;
import org.apache.nlpcraft.NCModelConfig;
import org.apache.nlpcraft.NCRequest;
import org.apache.nlpcraft.NCToken;
-import org.apache.nlpcraft.nlp.entity.parser.nlp.impl.NCNlpImpl;
+import org.apache.nlpcraft.nlp.entity.parser.nlp.impl.NCNlpEntityParserImpl;
import java.util.List;
@@ -32,7 +32,7 @@ import java.util.List;
* Component is language independent.
*/
public class NCNlpEntityParser implements NCEntityParser {
- private final NCNlpImpl impl = new NCNlpImpl();
+ private final NCNlpEntityParserImpl impl = new NCNlpEntityParserImpl();
@Override
public List<NCEntity> parse(NCRequest req, NCModelConfig cfg,
List<NCToken> toks) {
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/nlp/impl/NCNlpImpl.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/nlp/impl/NCNlpEntityParserImpl.scala
similarity index 91%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/nlp/impl/NCNlpImpl.scala
rename to
nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/nlp/impl/NCNlpEntityParserImpl.scala
index c60aa9f..5cb1f97 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/nlp/impl/NCNlpImpl.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/nlp/impl/NCNlpEntityParserImpl.scala
@@ -26,15 +26,15 @@ import java.util.stream.Collectors
/**
*
*/
-object NCNlpImpl:
+object NCNlpEntityParserImpl:
private def id = "nlp:token"
-import org.apache.nlpcraft.nlp.entity.parser.nlp.impl.NCNlpImpl.*
+import org.apache.nlpcraft.nlp.entity.parser.nlp.impl.NCNlpEntityParserImpl.*
/**
*
*/
-class NCNlpImpl extends NCEntityParser:
+class NCNlpEntityParserImpl extends NCEntityParser:
override def parse(req: NCRequest, cfg: NCModelConfig, toks:
JList[NCToken]): JList[NCEntity] =
toks.stream().map(t =>
new NCPropertyMapAdapter with NCEntity:
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/opennlp/NCOpenNlpEntityParser.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/opennlp/NCOpenNlpEntityParser.java
index d82cb42..b6db3ed 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/opennlp/NCOpenNlpEntityParser.java
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/opennlp/NCOpenNlpEntityParser.java
@@ -18,7 +18,7 @@
package org.apache.nlpcraft.nlp.entity.parser.opennlp;
import org.apache.nlpcraft.*;
-import org.apache.nlpcraft.nlp.entity.parser.opennlp.impl.NCOpenNlpImpl;
+import
org.apache.nlpcraft.nlp.entity.parser.opennlp.impl.NCOpenNlpEntityParserImpl;
import java.util.List;
import java.util.Objects;
@@ -37,7 +37,7 @@ import java.util.Objects;
* <p>
*/
public class NCOpenNlpEntityParser implements NCEntityParser {
- private final NCOpenNlpImpl impl;
+ private final NCOpenNlpEntityParserImpl impl;
/**
* @param mdlSrc
@@ -45,7 +45,7 @@ public class NCOpenNlpEntityParser implements NCEntityParser {
public NCOpenNlpEntityParser(String mdlSrc) {
Objects.requireNonNull(mdlSrc, "Model source cannot be null.");
- this.impl = new
NCOpenNlpImpl(java.util.Collections.singletonList(mdlSrc));
+ this.impl = new
NCOpenNlpEntityParserImpl(java.util.Collections.singletonList(mdlSrc));
}
/**
@@ -55,7 +55,7 @@ public class NCOpenNlpEntityParser implements NCEntityParser {
Objects.requireNonNull(mdlSrcs, "Model sources cannot be null.");
if (mdlSrcs.size() == 0) throw new NCException("Model sources cannot
be empty.");
- this.impl = new NCOpenNlpImpl(mdlSrcs);
+ this.impl = new NCOpenNlpEntityParserImpl(mdlSrcs);
}
@Override
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/opennlp/impl/NCOpenNlpImpl.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/opennlp/impl/NCOpenNlpEntityParserImpl.scala
similarity index 96%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/opennlp/impl/NCOpenNlpImpl.scala
rename to
nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/opennlp/impl/NCOpenNlpEntityParserImpl.scala
index fd26880..1e44850 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/opennlp/impl/NCOpenNlpImpl.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/opennlp/impl/NCOpenNlpEntityParserImpl.scala
@@ -36,7 +36,7 @@ import scala.util.Using
*
* @param srcs
*/
-class NCOpenNlpImpl(srcs: JList[String]) extends NCEntityParser with
LazyLogging :
+class NCOpenNlpEntityParserImpl(srcs: JList[String]) extends NCEntityParser
with LazyLogging :
require(srcs != null)
private var finders: Seq[NameFinderME] = _
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticElement.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticElement.java
index 135502e..6e052b0 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticElement.java
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticElement.java
@@ -18,6 +18,7 @@
package org.apache.nlpcraft.nlp.entity.parser.semantic;
import java.util.*;
+
/**
*
*/
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/impl/NCSemanticEntityParserImpl.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/impl/NCSemanticEntityParserImpl.scala
index 13402c0..7ab716f 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/impl/NCSemanticEntityParserImpl.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/impl/NCSemanticEntityParserImpl.scala
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.nlpcraft.nlp.entity.parser.semantic.impl
@@ -170,9 +171,7 @@ class NCSemanticEntityParserImpl(
if mdlSrc != null then
val src = NCSemanticSourceReader.read(new
BufferedInputStream(NCUtils.getStream(mdlSrc)), scrType)
-
logger.trace(s"Loaded resource: $mdlSrc")
-
(src.macros, src.elements, toMap(src.elements))
else
(this.macros, this.elements, toMap(this.elements))
@@ -188,39 +187,32 @@ class NCSemanticEntityParserImpl(
logger.warn("'stopword' property not found. Is stopword token
enricher configured?")
val cache = mutable.HashSet.empty[Seq[Int]] // Variants (tokens
without stopwords) can be repeated.
-
case class Holder(elemId: String, tokens: Seq[NCToken], value:
Option[String]):
private val idxs = tokens.map(_.getIndex).toSet
def isSuperSet(toks: Seq[NCToken]): Boolean = idxs.size >
toks.size && toks.map(_.getIndex).toSet.subsetOf(idxs)
-
val hs = mutable.ArrayBuffer.empty[Holder]
- for (
- piece <- getPieces(toks) if
!hs.exists(_.isSuperSet(piece.baseTokens));
- variant <- Seq(piece.baseTokens) ++ piece.variants
- )
+ for (piece <- getPieces(toks) if
!hs.exists(_.isSuperSet(piece.baseTokens));
+ variant <- Seq(piece.baseTokens) ++ piece.variants)
def add(elemId: String, value: Option[String]): Unit = hs +=
Holder(elemId, variant, value)
val idxs = variant.map(_.getIndex)
-
if cache.add(idxs) then
synsHolder.textSynonyms.get(variant.map(t =>
stems(t)).mkString(" ")) match
case Some(elems) => elems.foreach(elem =>
add(elem.elementId, elem.value))
case None =>
for ((elemId, syns) <-
synsHolder.mixedSynonyms.getOrElse(variant.size, Seq.empty))
var found = false
-
for (s <- syns if !found)
- found =
- s.chunks.zip(variant).
- sortBy { (chunk, _) => if chunk.isText
then 0 else 1 }.
- forall { (chunk, tok) =>
- if chunk.isText then
- chunk.stem == stems(tok)
- else
- def match0(txt: String) =
chunk.regex.matcher(txt).matches()
- match0(tok.getText) ||
match0(tok.getText.toLowerCase)
- }
+ found = s.chunks.zip(variant).
+ sortBy { (chunk, _) => if chunk.isText
then 0 else 1 }.
+ forall { (chunk, tok) =>
+ if chunk.isText then
+ chunk.stem == stems(tok)
+ else
+ def match0(txt: String) =
chunk.regex.matcher(txt).matches()
+ match0(tok.getText) ||
match0(tok.getText.toLowerCase)
+ }
if found then add(elemId, Option.when(s.value
!= null)(s.value))
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/impl/NCSemanticSynonym.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/impl/NCSemanticSynonym.scala
index 923a89a..7057507 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/impl/NCSemanticSynonym.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/impl/NCSemanticSynonym.scala
@@ -45,6 +45,11 @@ private[impl] case class NCSemanticSynonymChunk(
override def toString = s"($text|$kind)"
}
+/**
+ *
+ * @param chunks
+ * @param value
+ */
private[impl] case class NCSemanticSynonym(
chunks: Seq[NCSemanticSynonymChunk], value: String = null
) extends Comparable[NCSemanticSynonym]:
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/impl/en/NCEnPorterStemmer.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/impl/en/NCEnSemanticPorterStemmer.java
similarity index 94%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/impl/en/NCEnPorterStemmer.java
rename to
nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/impl/en/NCEnSemanticPorterStemmer.java
index 8ec7f2a..811882f 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/impl/en/NCEnPorterStemmer.java
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/impl/en/NCEnSemanticPorterStemmer.java
@@ -23,7 +23,7 @@ import
org.apache.nlpcraft.nlp.entity.parser.semantic.NCSemanticStemmer;
/**
*
*/
-public class NCEnPorterStemmer implements NCSemanticStemmer {
+public class NCEnSemanticPorterStemmer implements NCSemanticStemmer {
/** */
private final PorterStemmer stemmer = new PorterStemmer();
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/NCBracketsTokenEnricher.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/NCBracketsTokenEnricher.java
index 4de1e7f..d458591 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/NCBracketsTokenEnricher.java
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/NCBracketsTokenEnricher.java
@@ -21,7 +21,7 @@ import org.apache.nlpcraft.NCModelConfig;
import org.apache.nlpcraft.NCRequest;
import org.apache.nlpcraft.NCToken;
import org.apache.nlpcraft.NCTokenEnricher;
-import org.apache.nlpcraft.nlp.token.enricher.en.impl.NCBracketsImpl;
+import
org.apache.nlpcraft.nlp.token.enricher.en.impl.NCBracketsTokenEnricherImpl;
import java.util.List;
@@ -29,7 +29,7 @@ import java.util.List;
* TODO: enriches with <code>brackets</code> property.
*/
public class NCBracketsTokenEnricher implements NCTokenEnricher {
- private final NCBracketsImpl impl = new NCBracketsImpl();
+ private final NCBracketsTokenEnricherImpl impl = new
NCBracketsTokenEnricherImpl();
@Override
public void enrich(NCRequest req, NCModelConfig cfg, List<NCToken> toks) {
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/NCDictionaryTokenEnricher.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/NCDictionaryTokenEnricher.java
index 11d3bd7..cf76943 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/NCDictionaryTokenEnricher.java
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/NCDictionaryTokenEnricher.java
@@ -21,7 +21,7 @@ import org.apache.nlpcraft.NCModelConfig;
import org.apache.nlpcraft.NCRequest;
import org.apache.nlpcraft.NCToken;
import org.apache.nlpcraft.NCTokenEnricher;
-import org.apache.nlpcraft.nlp.token.enricher.en.impl.NCDictionaryImpl;
+import
org.apache.nlpcraft.nlp.token.enricher.en.impl.NCDictionaryTokenEnricherImpl;
import java.util.List;
@@ -29,7 +29,7 @@ import java.util.List;
* TODO: enriches with <code>dict</code> property.
*/
public class NCDictionaryTokenEnricher implements NCTokenEnricher {
- private final NCDictionaryImpl impl = new NCDictionaryImpl();
+ private final NCDictionaryTokenEnricherImpl impl = new
NCDictionaryTokenEnricherImpl();
@Override
public void enrich(NCRequest req, NCModelConfig cfg, List<NCToken> toks) {
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/NCQuotesTokenEnricher.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/NCQuotesTokenEnricher.java
index 9e30ae9..e5a6c5b 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/NCQuotesTokenEnricher.java
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/NCQuotesTokenEnricher.java
@@ -21,7 +21,7 @@ import org.apache.nlpcraft.NCModelConfig;
import org.apache.nlpcraft.NCRequest;
import org.apache.nlpcraft.NCToken;
import org.apache.nlpcraft.NCTokenEnricher;
-import org.apache.nlpcraft.nlp.token.enricher.en.impl.NCQuotesImpl;
+import
org.apache.nlpcraft.nlp.token.enricher.en.impl.NCQuotesTokenEnricherImpl;
import java.util.List;
@@ -29,7 +29,7 @@ import java.util.List;
* TODO: enriches with <code>quoted</code> property.
*/
public class NCQuotesTokenEnricher implements NCTokenEnricher {
- private final NCQuotesImpl impl = new NCQuotesImpl();
+ private final NCQuotesTokenEnricherImpl impl = new
NCQuotesTokenEnricherImpl();
@Override
public void enrich(NCRequest req, NCModelConfig cfg, List<NCToken> toks) {
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/NCStopWordsTokenEnricher.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/NCStopWordsTokenEnricher.java
index c861e27..c91ed82 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/NCStopWordsTokenEnricher.java
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/NCStopWordsTokenEnricher.java
@@ -21,7 +21,7 @@ import org.apache.nlpcraft.NCModelConfig;
import org.apache.nlpcraft.NCRequest;
import org.apache.nlpcraft.NCToken;
import org.apache.nlpcraft.NCTokenEnricher;
-import org.apache.nlpcraft.nlp.token.enricher.en.impl.NCStopWordsImpl;
+import
org.apache.nlpcraft.nlp.token.enricher.en.impl.NCStopWordsTokenEnricherImpl;
import java.util.List;
import java.util.Set;
@@ -30,17 +30,17 @@ import java.util.Set;
* TODO: enriches with <code>stopword</code> property.
*/
public class NCStopWordsTokenEnricher implements NCTokenEnricher {
- private final NCStopWordsImpl impl;
+ private final NCStopWordsTokenEnricherImpl impl;
/**
*
*/
public NCStopWordsTokenEnricher(Set<String> addSw, Set<String> exclSw) {
- impl = new NCStopWordsImpl(addSw, exclSw);
+ impl = new NCStopWordsTokenEnricherImpl(addSw, exclSw);
}
public NCStopWordsTokenEnricher() {
- impl = new NCStopWordsImpl(null, null);
+ impl = new NCStopWordsTokenEnricherImpl(null, null);
}
@Override
diff --git
"a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/N\320\241SwearWordsTokenEnricher.java"
"b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/N\320\241SwearWordsTokenEnricher.java"
index 544cb1c..70c4286 100644
---
"a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/N\320\241SwearWordsTokenEnricher.java"
+++
"b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/N\320\241SwearWordsTokenEnricher.java"
@@ -21,7 +21,7 @@ import org.apache.nlpcraft.NCModelConfig;
import org.apache.nlpcraft.NCRequest;
import org.apache.nlpcraft.NCToken;
import org.apache.nlpcraft.NCTokenEnricher;
-import org.apache.nlpcraft.nlp.token.enricher.en.impl.NCSwearWordsImpl;
+import
org.apache.nlpcraft.nlp.token.enricher.en.impl.NCSwearWordsTokenEnricherImpl;
import java.util.List;
import java.util.Objects;
@@ -30,7 +30,7 @@ import java.util.Objects;
* TODO: enriches with <code>swear</code> property.
*/
public class NСSwearWordsTokenEnricher implements NCTokenEnricher {
- private final NCSwearWordsImpl impl;
+ private final NCSwearWordsTokenEnricherImpl impl;
/**
* TODO: swear_words.txt - describe where it can be downloaded.
@@ -40,7 +40,7 @@ public class NСSwearWordsTokenEnricher implements
NCTokenEnricher {
public NСSwearWordsTokenEnricher(String mdlSrc) {
Objects.requireNonNull(mdlSrc, "Swear words model file cannot be
null.");
- impl = new NCSwearWordsImpl(mdlSrc);
+ impl = new NCSwearWordsTokenEnricherImpl(mdlSrc);
}
@Override
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCBracketsImpl.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCBracketsTokenEnricherImpl.scala
similarity index 95%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCBracketsImpl.scala
rename to
nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCBracketsTokenEnricherImpl.scala
index eab32c3..3a88225 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCBracketsImpl.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCBracketsTokenEnricherImpl.scala
@@ -28,7 +28,7 @@ import scala.jdk.CollectionConverters.CollectionHasAsScala
/**
*
*/
-class NCBracketsImpl extends NCTokenEnricher with LazyLogging:
+class NCBracketsTokenEnricherImpl extends NCTokenEnricher with LazyLogging:
override def enrich(req: NCRequest, cfg: NCModelConfig, toks:
JList[NCToken]): Unit =
val stack = new java.util.Stack[String]()
val map = mutable.HashMap.empty[NCToken, Boolean]
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCDictionaryImpl.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCDictionaryTokenEnricherImpl.scala
similarity index 95%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCDictionaryImpl.scala
rename to
nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCDictionaryTokenEnricherImpl.scala
index e581184..59c1847 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCDictionaryImpl.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCDictionaryTokenEnricherImpl.scala
@@ -25,7 +25,7 @@ import java.util.List as JList
/**
*
*/
-class NCDictionaryImpl extends NCTokenEnricher:
+class NCDictionaryTokenEnricherImpl extends NCTokenEnricher:
private var dict: Set[String] = _
init()
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCQuotesImpl.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCQuotesTokenEnricherImpl.scala
similarity index 95%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCQuotesImpl.scala
rename to
nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCQuotesTokenEnricherImpl.scala
index 970719d..886e7bb 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCQuotesImpl.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCQuotesTokenEnricherImpl.scala
@@ -26,7 +26,7 @@ import scala.jdk.CollectionConverters.*
/**
*
*/
-class NCQuotesImpl extends NCTokenEnricher with LazyLogging:
+class NCQuotesTokenEnricherImpl extends NCTokenEnricher with LazyLogging:
private final val Q_POS: Set[String] = Set("``", "''")
private def isQuote(t: NCToken): Boolean = Q_POS.contains(t.getPos)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCStopWordsImpl.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCStopWordsTokenEnricherImpl.scala
similarity index 99%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCStopWordsImpl.scala
rename to
nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCStopWordsTokenEnricherImpl.scala
index 2ac3d3f..e2a3dda 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCStopWordsImpl.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCStopWordsTokenEnricherImpl.scala
@@ -34,7 +34,7 @@ import scala.jdk.CollectionConverters.*
/**
*
*/
-object NCStopWordsImpl:
+object NCStopWordsTokenEnricherImpl:
// Condition types.
type Wildcard = (String, String)
type Word = String
@@ -162,14 +162,14 @@ object NCStopWordsImpl:
private def tokenMix(toks: Seq[NCToken], maxLen: Int = Integer.MAX_VALUE):
Seq[Seq[NCToken]] =
(for (n <- toks.length until 0 by -1 if n <= maxLen) yield
toks.sliding(n)).flatten
-import org.apache.nlpcraft.nlp.token.enricher.en.impl.NCStopWordsImpl.*
+import
org.apache.nlpcraft.nlp.token.enricher.en.impl.NCStopWordsTokenEnricherImpl.*
/**
*
* @param addStopsSet
* @param exclStopsSet
*/
-class NCStopWordsImpl(addStopsSet: JSet[String], exclStopsSet: JSet[String])
extends NCTokenEnricher with LazyLogging:
+class NCStopWordsTokenEnricherImpl(addStopsSet: JSet[String], exclStopsSet:
JSet[String]) extends NCTokenEnricher with LazyLogging:
private final val stemmer = new PorterStemmer
private var addStems: Set[String] = _
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCSwearWordsImpl.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCSwearWordsTokenEnricherImpl.scala
similarity index 94%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCSwearWordsImpl.scala
rename to
nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCSwearWordsTokenEnricherImpl.scala
index 54ac0e6..9bb2ea1 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCSwearWordsImpl.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCSwearWordsTokenEnricherImpl.scala
@@ -29,7 +29,7 @@ import java.util.List as JList
*
* @param res
*/
-class NCSwearWordsImpl(res: String) extends NCTokenEnricher with LazyLogging:
+class NCSwearWordsTokenEnricherImpl(res: String) extends NCTokenEnricher with
LazyLogging:
require(res != null)
private final val stemmer = new PorterStemmer
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/parser/opennlp/NCOpenNlpTokenParser.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/parser/opennlp/NCOpenNlpTokenParser.java
index 1c0bcfa..7181756 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/parser/opennlp/NCOpenNlpTokenParser.java
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/parser/opennlp/NCOpenNlpTokenParser.java
@@ -20,7 +20,7 @@ package org.apache.nlpcraft.nlp.token.parser.opennlp;
import org.apache.nlpcraft.NCException;
import org.apache.nlpcraft.NCToken;
import org.apache.nlpcraft.NCTokenParser;
-import org.apache.nlpcraft.nlp.token.parser.opennlp.impl.NCOpenNlpImpl;
+import
org.apache.nlpcraft.nlp.token.parser.opennlp.impl.NCOpenNlpTokenParserImpl;
import java.util.List;
import java.util.Objects;
@@ -33,7 +33,7 @@ import java.util.Objects;
* - lemmatizer:
https://raw.githubusercontent.com/richardwilly98/elasticsearch-opennlp-auto-tagging/master/src/main/resources/models/en-lemmatizer.dict
*/
public class NCOpenNlpTokenParser implements NCTokenParser {
- private final NCOpenNlpImpl impl;
+ private final NCOpenNlpTokenParserImpl impl;
/**
*
@@ -48,7 +48,7 @@ public class NCOpenNlpTokenParser implements NCTokenParser {
Objects.requireNonNull(posMdlSrc, "POS model path cannot be null.");
Objects.requireNonNull(lemmaDicSrc, "Lemmatizer model path cannot be
null.");
- impl = new NCOpenNlpImpl(tokMdlSrc, posMdlSrc, lemmaDicSrc);
+ impl = new NCOpenNlpTokenParserImpl(tokMdlSrc, posMdlSrc, lemmaDicSrc);
}
@Override
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/parser/opennlp/impl/NCOpenNlpImpl.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/parser/opennlp/impl/NCOpenNlpTokenParserImpl.scala
similarity index 97%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/parser/opennlp/impl/NCOpenNlpImpl.scala
rename to
nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/parser/opennlp/impl/NCOpenNlpTokenParserImpl.scala
index bbf4457..78fc7a9 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/parser/opennlp/impl/NCOpenNlpImpl.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/token/parser/opennlp/impl/NCOpenNlpTokenParserImpl.scala
@@ -38,7 +38,7 @@ import scala.jdk.CollectionConverters.*
* @param posMdlSrc
* @param lemmaDicSrc
*/
-class NCOpenNlpImpl(tokMdl: String, posMdlSrc: String, lemmaDicSrc: String)
extends NCTokenParser with LazyLogging:
+class NCOpenNlpTokenParserImpl(tokMdl: String, posMdlSrc: String,
lemmaDicSrc: String) extends NCTokenParser with LazyLogging:
require(tokMdl != null)
require(posMdlSrc != null)
require(lemmaDicSrc != null)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/NCModelPipelineProcessorSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/NCModelPipelineProcessorSpec.scala
index 24db423..f486d03 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/NCModelPipelineProcessorSpec.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/NCModelPipelineProcessorSpec.scala
@@ -19,9 +19,9 @@ package org.apache.nlpcraft.internal
import org.apache.nlpcraft.*
import org.apache.nlpcraft.internal.impl.NCModelPipelineProcessor
-import org.apache.nlpcraft.nlp.entity.parser.nlp.impl.NCNlpImpl
+import org.apache.nlpcraft.nlp.entity.parser.nlp.impl.NCNlpEntityParserImpl
import org.apache.nlpcraft.nlp.entity.parser.semantic.*
-import org.apache.nlpcraft.nlp.entity.parser.semantic.impl.en.NCEnPorterStemmer
+import
org.apache.nlpcraft.nlp.entity.parser.semantic.impl.en.NCEnSemanticPorterStemmer
import org.apache.nlpcraft.nlp.util.*
import org.apache.nlpcraft.nlp.util.opennlp.*
import org.junit.jupiter.api.*
@@ -45,7 +45,7 @@ class NCModelPipelineProcessorSpec:
def test(txt: String, variantCnt: Int, elements: NCSemanticElement*):
Unit =
val pipeline = EN_PIPELINE.clone()
- val parser = new NCSemanticEntityParser(new NCEnPorterStemmer,
pipeline.getTokenParser, elements.asJava)
+ val parser = new NCSemanticEntityParser(new
NCEnSemanticPorterStemmer, pipeline.getTokenParser, elements.asJava)
pipeline.getEntityParsers.clear()
pipeline.getEntityParsers.add(parser)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticEntityParserJsonSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticEntityParserJsonSpec.scala
index a9bdde7..30b1779 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticEntityParserJsonSpec.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticEntityParserJsonSpec.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.NCEnPorterStemmer
+import
org.apache.nlpcraft.nlp.entity.parser.semantic.impl.en.NCEnSemanticPorterStemmer
import org.apache.nlpcraft.nlp.token.parser.opennlp.NCOpenNlpTokenParser
import org.apache.nlpcraft.nlp.util.*
import org.apache.nlpcraft.nlp.util.opennlp.*
@@ -37,7 +37,7 @@ import scala.jdk.OptionConverters.RichOptional
*/
class NCSemanticEntityParserJsonSpec:
private val parser = new NCSemanticEntityParser(
- new NCEnPorterStemmer(),
+ new NCEnSemanticPorterStemmer(),
EN_PIPELINE.getTokenParser,
"models/alarm_model.json"
)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticEntityParserSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticEntityParserSpec.scala
index fb8bbaf..d5743dd 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticEntityParserSpec.scala
+++
b/nlpcraft/src/test/scala/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.NCEnPorterStemmer
+import
org.apache.nlpcraft.nlp.entity.parser.semantic.impl.en.NCEnSemanticPorterStemmer
import org.apache.nlpcraft.nlp.token.enricher.en.NCStopWordsTokenEnricher
import org.apache.nlpcraft.nlp.util.*
import org.apache.nlpcraft.nlp.util.opennlp.*
@@ -65,7 +65,7 @@ object NCSemanticTestElement:
class NCSemanticEntityParserSpec:
private val parser =
new NCSemanticEntityParser(
- new NCEnPorterStemmer,
+ new NCEnSemanticPorterStemmer,
EN_PIPELINE.getTokenParser,
Seq(
// Standard.
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticEntityParserYamlSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticEntityParserYamlSpec.scala
index 2e40c1c..85a05e4 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticEntityParserYamlSpec.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticEntityParserYamlSpec.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.NCEnPorterStemmer
+import
org.apache.nlpcraft.nlp.entity.parser.semantic.impl.en.NCEnSemanticPorterStemmer
import org.apache.nlpcraft.nlp.util.*
import org.apache.nlpcraft.nlp.util.opennlp.*
import org.junit.jupiter.api.*
@@ -35,7 +35,7 @@ import scala.jdk.OptionConverters.RichOptional
*/
class NCSemanticEntityParserYamlSpec:
private val parser = new NCSemanticEntityParser(
- new NCEnPorterStemmer,
+ new NCEnSemanticPorterStemmer,
EN_PIPELINE.getTokenParser,
"models/lightswitch_model.yaml"
)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCStopWordsImplSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCStopWordsImplSpec.scala
index ca4eaee..144f08a 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCStopWordsImplSpec.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/token/enricher/en/impl/NCStopWordsImplSpec.scala
@@ -19,7 +19,7 @@ package org.apache.nlpcraft.nlp.token.enricher.en.impl
import org.apache.nlpcraft.*
import org.apache.nlpcraft.nlp.token.enricher.en.*
-import org.apache.nlpcraft.nlp.token.enricher.en.impl.NCStopWordsImpl
+import
org.apache.nlpcraft.nlp.token.enricher.en.impl.NCStopWordsTokenEnricherImpl
import org.apache.nlpcraft.nlp.util.*
import org.apache.nlpcraft.nlp.util.opennlp.*
import org.junit.jupiter.api.*
@@ -45,7 +45,7 @@ class NCStopWordsImplSpec:
toks.zip(words).foreach { (t, w) => t.put("stopword", w.stop) }
- val mix = NCStopWordsImpl.tokenMixWithStopWords(toks)
+ val mix = NCStopWordsTokenEnricherImpl.tokenMixWithStopWords(toks)
val resSorted = mix.map(_.map(_.getText).mkString).sorted
val expectedSorted = expected.sorted