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

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

commit 644608a0ec5fcfe620e9d5719d46f161db5005f4
Author: Sergey Kamov <[email protected]>
AuthorDate: Tue Apr 13 13:29:30 2021 +0300

    WIP.
---
 .../mgrs/nlp/enrichers/model/NCModelEnricher.scala     | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCModelEnricher.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCModelEnricher.scala
index f2aa542..d1ec4e5 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCModelEnricher.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCModelEnricher.scala
@@ -540,24 +540,23 @@ object NCModelEnricher extends NCProbeEnricher with 
DecorateAsScala {
                 // Attempt to match each element.
                 for (
                     elm ← mdl.elements.values;
-                        elemId = elm.getId
-                        if
-                        !contCache(elemId).exists(_.containsSlice(tokIdxs)) &&
-                            // Checks whole tokens slice.
-                            !alreadyMarked(toks, tokIdxs, continuous = true, 
elemId)
+                    elemId = elm.getId
+                    if
+                    !contCache(elemId).exists(_.containsSlice(tokIdxs)) &&
+                    !alreadyMarked(toks, tokIdxs, continuous = true, elemId)   
// Checks whole tokens slice.
                 ) {
                     // 1. SIMPLE.
-                    found = false
-
-                    val simpleEnabled: Boolean =
+                    val simpleEnabled =
                         state match {
                             case SIMPLE ⇒ !mdl.hasDslSynonyms(elemId)
                             case DSL_FIRST ⇒ mdl.hasDslSynonyms(elemId)
                             case _ ⇒ false
                         }
 
+                    found = false
+
                     // 1.1 Continuous.
-                    if (simpleEnabled && !found)
+                    if (simpleEnabled)
                         fastAccess(mdl.continuousSynonyms, elemId, 
toks.length) match {
                             case Some(h) ⇒
                                 def tryMap(syns: Map[String, Synonym], 
notFound: () ⇒ Unit): Unit =
@@ -601,6 +600,7 @@ object NCModelEnricher extends NCProbeEnricher with 
DecorateAsScala {
                                 s.trySparseMatch(comb.map(_.data), req) match {
                                     case Some(res) ⇒
                                         add("DSL sparse", elm, toTokens(res, 
ns), tokIdxs, s, toParts(res, s))
+
                                         dslCache += comb
                                     case None ⇒ // No-op.
                                 }

Reply via email to