This is an automated email from the ASF dual-hosted git repository.

sergeykamov pushed a commit to branch NLPCRAFT-483-1-1
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git


The following commit(s) were added to refs/heads/NLPCRAFT-483-1-1 by this push:
     new 57e4d69  WIP.
57e4d69 is described below

commit 57e4d695ef0c104fcf794a715c5da7a78669ba52
Author: Sergey Kamov <[email protected]>
AuthorDate: Fri Mar 11 14:08:15 2022 +0300

    WIP.
---
 .../mult/entity/parser/impl/NCSemanticEntityParserImpl.scala  | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/mult/entity/parser/impl/NCSemanticEntityParserImpl.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/mult/entity/parser/impl/NCSemanticEntityParserImpl.scala
index d49ffd5..9fdad68 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/mult/entity/parser/impl/NCSemanticEntityParserImpl.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/mult/entity/parser/impl/NCSemanticEntityParserImpl.scala
@@ -202,10 +202,17 @@ class NCSemanticEntityParserImpl(
         this.synsHolder = NCSemanticSynonymsProcessor.prepare(stemmer, parser, 
macros, elements)
         this.elemsMap = elemsMap
 
+    /**
+      *
+      * @param name
+      */
+    private def warnMissedProperty(name: String): Unit = logger.warn(s"'$name' 
property not found. Is proper token enricher configured?")
+
     override def parse(req: NCRequest, cfg: NCModelConfig, toksList: 
JList[NCToken]): JList[NCEntity] =
         val toks = toksList.asScala.toSeq
-        val stems = toks.map(p => p -> stemmer.stem(p.getText)).toMap
+        if toks.exists(_.get[String]("stopword") == null) then 
warnMissedProperty("stopword")
 
+        val stems = toks.map(p => p -> stemmer.stem(p.getText)).toMap
         val stems4Lemms =
             var ok = true
             val seq =
@@ -217,7 +224,7 @@ class NCSemanticEntityParserImpl(
             if ok then
                 seq.toMap.map { (tok, lemma) => tok -> stemmer.stem(lemma) }
             else
-                logger.warn("'lemma' property not found. Is proper token 
enricher configured?")
+                warnMissedProperty("lemma")
                 Map.empty
 
         val cache = mutable.HashSet.empty[Seq[Int]] // Variants (tokens 
without stopwords) can be repeated.

Reply via email to