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

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


The following commit(s) were added to refs/heads/NLPCRAFT-469 by this push:
     new 90cabae  WIP.
90cabae is described below

commit 90cabaead9a50421bff920472f3084734859ae0d
Author: Sergey Kamov <[email protected]>
AuthorDate: Fri Dec 24 18:36:04 2021 +0300

    WIP.
---
 .../internal/nlp/token/enricher/impl/NCEnQuotesImpl.scala      | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/nlp/token/enricher/impl/NCEnQuotesImpl.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/nlp/token/enricher/impl/NCEnQuotesImpl.scala
index 7adc02c..b3d8893 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/nlp/token/enricher/impl/NCEnQuotesImpl.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/nlp/token/enricher/impl/NCEnQuotesImpl.scala
@@ -25,7 +25,7 @@ object NCEnQuotesImpl:
     private final val Q_POS: Set[String] = Set("``", "''")
     private def isQuote(t: NCToken): Boolean = Q_POS.contains(t.getPos)
 
-import org.apache.nlpcraft.internal.nlp.token.enricher.impl.NCEnQuotesImpl.*
+import NCEnQuotesImpl.*
 /**
   *
   */
@@ -38,18 +38,18 @@ class NCEnQuotesImpl extends NCTokenEnricher:
       * @param toks
       */
     def enrich(req: NCRequest, cfg: NCModelConfig, toks: 
java.util.List[NCToken]): Unit =
-        val toksScala = toks.asScala
-        val quotes = toksScala.filter(isQuote)
+        val toksSeq = toks.asScala
+        val quotes = toksSeq.filter(isQuote)
 
         // TODO:
         if quotes.size % 2 != 0 then throw new NCException(s"Invalid quotes in 
text: ${req.getOriginalText}")
 
-        val m = toksScala.zipWithIndex.toMap
+        val m = toksSeq.zipWithIndex.toMap
         val pairs = quotes.zipWithIndex.drop(1).flatMap {
             case (t, idx) => if idx % 2 != 0 then Some(m(t) -> m(quotes(idx - 
1))) else None
         }
 
         // Do not rewrite it with case, it works only such way, with tuples 
(scala 3.1 error?)
-        toksScala.zipWithIndex.foreach(p =>
+        toksSeq.zipWithIndex.foreach(p =>
             p._1.put("quoted:en", pairs.exists { case (from, to) => from > 
p._2 && to < p._2 })
         )
\ No newline at end of file

Reply via email to