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

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


The following commit(s) were added to refs/heads/NLPCRAFT-477 by this push:
     new b5a6c76  NCIntentSolverEngine initial version added.
b5a6c76 is described below

commit b5a6c76285f61609490e48d6d0ee2dc615ecf518
Author: Sergey Kamov <skhdlem...@gmail.com>
AuthorDate: Tue Feb 15 14:50:02 2022 +0300

    NCIntentSolverEngine initial version added.
---
 .../nlpcraft/internal/intent/matcher/NCIntentSolverEngine.scala  | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/matcher/NCIntentSolverEngine.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/matcher/NCIntentSolverEngine.scala
index 6053244..a76b5f4 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/matcher/NCIntentSolverEngine.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/matcher/NCIntentSolverEngine.scala
@@ -38,7 +38,7 @@ case class NCIntentSolverEngine(dialog: NCDialogFlowManager) 
extends LazyLogging
      * NOTE: not thread-safe.
      */
     private class Weight(ws: Int*) extends Ordered[Weight]:
-        private var buf = mutable.ArrayBuffer[Int]() ++ ws
+        private val buf = mutable.ArrayBuffer[Int]() ++ ws
 
         /**
          * Adds given weight to this weight.
@@ -47,12 +47,13 @@ case class NCIntentSolverEngine(dialog: 
NCDialogFlowManager) extends LazyLogging
          * @return
          */
         def +=(that: Weight): Weight =
-            val buf2 = mutable.ArrayBuffer[Int]()
+            val tmp = mutable.ArrayBuffer[Int]()
 
             for (i <- 0 until Math.max(buf.size, that.buf.size))
-                buf2.append(norm(i, buf) + norm(i, that.buf))
+                tmp.append(norm(i, buf) + norm(i, that.buf))
 
-            buf = buf2
+            buf.clear()
+            buf ++= tmp
 
             this
 

Reply via email to