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


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

commit cd53445d5e19f90710277623820d40758b64bff3
Author: Sergey Kamov <[email protected]>
AuthorDate: Fri Apr 2 17:09:02 2021 +0300

    WIP.
---
 .../NCJiggleSpec.scala => sparse/NCSparseSpec.scala}        | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/jiggle/NCJiggleSpec.scala 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/sparse/NCSparseSpec.scala
similarity index 92%
rename from 
nlpcraft/src/test/scala/org/apache/nlpcraft/model/jiggle/NCJiggleSpec.scala
rename to 
nlpcraft/src/test/scala/org/apache/nlpcraft/model/sparse/NCSparseSpec.scala
index 9c60c2d..b1d3a9b 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/jiggle/NCJiggleSpec.scala
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/sparse/NCSparseSpec.scala
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.nlpcraft.model.jiggle
+package org.apache.nlpcraft.model.sparse
 
 import org.apache.nlpcraft.model.`abstract`.NCAbstractTokensModel
 import org.apache.nlpcraft.model.{NCContext, NCElement, NCResult, NCToken}
@@ -26,15 +26,13 @@ import java.util
 import scala.collection.JavaConverters._
 import scala.collection.mutable
 
-class NJiggleModel extends NCAbstractTokensModel {
+class NCSparseModel extends NCAbstractTokensModel {
     override def getElements: util.Set[NCElement] = Set(NCTestElement("xyz", 
"x y z"))
 
     // Default values.
     override def isPermutateSynonyms: Boolean = true
     override def isSparse: Boolean = true
 
-    // TODO:
-
     override def onContext(ctx: NCContext): NCResult = {
         val variants = ctx.getVariants.asScala
 
@@ -51,7 +49,7 @@ class NJiggleModel extends NCAbstractTokensModel {
         def checkSparsity(sparsity: Int, toks: mutable.Buffer[NCToken]): Unit =
             
require(toks.forall(_.getMetadata.get("nlpcraft:nlp:sparsity").asInstanceOf[Int]
 == sparsity))
 
-        def checkExists(sparsity: Int): Unit = {
+        def checkExists(sparsity: Int): Unit =
             require(
                 variants.exists(v ⇒ {
                     val toks = v.asScala.filter(_.getId == "xyz")
@@ -65,7 +63,6 @@ class NJiggleModel extends NCAbstractTokensModel {
                     }
                 })
             )
-        }
 
         ctx.getRequest.getNormalizedText match {
             case "x y z x y z x y z" ⇒ checkOneVariant(0)
@@ -82,8 +79,8 @@ class NJiggleModel extends NCAbstractTokensModel {
     }
 }
 
-@NCTestEnvironment(model = classOf[NJiggleModel], startClient = true)
-class NCJiggleSpec extends NCTestContext {
+@NCTestEnvironment(model = classOf[NCSparseModel], startClient = true)
+class NCSparseSpec extends NCTestContext {
     @Test
     def test(): Unit = {
         checkResult("x y z x y z x y z", "OK")

Reply via email to