This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-520
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-520 by this push:
new 007082c3 WIP.
007082c3 is described below
commit 007082c3d307f9fc897cd79cbb3902cd3231c24d
Author: Sergey Kamov <[email protected]>
AuthorDate: Mon Dec 19 16:08:43 2022 +0400
WIP.
---
.../resources/stopwords/{stop_words.txt => en_stop_words.txt} | 0
.../nlpcraft/nlp/enrichers/NCEnStopWordsTokenEnricher.scala | 2 +-
.../internal/conversation/NCConversationManagerSpec.scala | 4 ++--
.../internal/impl/scan/NCModelIntentsInvalidArgsSpec.scala | 2 +-
.../internal/intent/compiler/functions/NCIDLFunctions.scala | 4 ++--
.../test/scala/org/apache/nlpcraft/nlp/util/NCTestEntity.scala | 9 ++++++++-
6 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/nlpcraft/src/main/resources/stopwords/stop_words.txt
b/nlpcraft/src/main/resources/stopwords/en_stop_words.txt
similarity index 100%
rename from nlpcraft/src/main/resources/stopwords/stop_words.txt
rename to nlpcraft/src/main/resources/stopwords/en_stop_words.txt
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/enrichers/NCEnStopWordsTokenEnricher.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/enrichers/NCEnStopWordsTokenEnricher.scala
index 0d4fa418..3eaa7f6e 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/enrichers/NCEnStopWordsTokenEnricher.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/enrichers/NCEnStopWordsTokenEnricher.scala
@@ -326,7 +326,7 @@ class NCEnStopWordsTokenEnricher(
percents = PERCENTS.map(getStem)
// Case sensitive.
- val m = readStopWords(U.readLines(res = "stopwords/stop_words.txt",
filterText = true, log = logger))
+ val m = readStopWords(U.readLines(res = "stopwords/en_stop_words.txt",
filterText = true, log = logger))
stopWords = m(false)
exceptions = m(true)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationManagerSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationManagerSpec.scala
index 747d1e90..7af99aa6 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationManagerSpec.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/conversation/NCConversationManagerSpec.scala
@@ -51,7 +51,7 @@ class NCConversationManagerSpec extends AnyFunSuite:
checkSize(0)
// Added. Still empty.
- conv.addEntities(reqId, List(NCTestEntity("e1", reqId, tokens = t),
NCTestEntity("e2", reqId, tokens = t)))
+ conv.addEntities(reqId, List(NCTestEntity("e1", reqId, t),
NCTestEntity("e2", reqId, t)))
checkSize(0)
// Updated. Not empty.
@@ -80,7 +80,7 @@ class NCConversationManagerSpec extends AnyFunSuite:
checkSize(0)
// Added. Still empty.
- conv.addEntities(reqId, List(NCTestEntity("e1", reqId, tokens = t),
NCTestEntity("e2", reqId, tokens = t)))
+ conv.addEntities(reqId, List(NCTestEntity("e1", reqId, t),
NCTestEntity("e2", reqId, t)))
checkSize(0)
// Updated. Not empty.
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/scan/NCModelIntentsInvalidArgsSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/scan/NCModelIntentsInvalidArgsSpec.scala
index c8fddab5..42bf2ae0 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/scan/NCModelIntentsInvalidArgsSpec.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/scan/NCModelIntentsInvalidArgsSpec.scala
@@ -81,7 +81,7 @@ class NCModelIntentsInvalidArgsSpec extends AnyFunSuite:
def invalidOpt(ctx: NCContext, im: NCIntentMatch,
@NCIntentTerm("opt") opt: Option[Int]): NCResult = processOptInt(opt)
private val INPUT =
- val e = NCTestEntity("id", "reqId", tokens = NCTestToken())
+ val e = NCTestEntity("id", "reqId", NCTestToken())
def col[T](t: T): List[T] = List(t)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/intent/compiler/functions/NCIDLFunctions.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/intent/compiler/functions/NCIDLFunctions.scala
index e6c5ba48..e2de685c 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/intent/compiler/functions/NCIDLFunctions.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/intent/compiler/functions/NCIDLFunctions.scala
@@ -144,11 +144,11 @@ private[functions] object NCIDLFunctions:
value: String = null,
groups: Set[String] = null,
meta: Map[String, AnyRef] = Map.empty[String, AnyRef],
- tokens: NCTestToken*
+ tokens: Seq[NCTestToken]
): NCEntity =
require(tokens.nonEmpty)
- NCTestEntity(id, reqId, groups, meta, tokens*)
+ NCTestEntity(id, reqId, groups, meta, tokens)
import org.apache.nlpcraft.internal.intent.compiler.functions.NCIDLFunctions.*
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/util/NCTestEntity.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/util/NCTestEntity.scala
index 6ae37be5..203e35ec 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/util/NCTestEntity.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/util/NCTestEntity.scala
@@ -20,6 +20,13 @@ package org.apache.nlpcraft.nlp.util
import org.apache.nlpcraft.*
import org.apache.nlpcraft.nlp.util.NCTestPipeline.*
+/**
+ *
+ */
+object NCTestEntity:
+ def apply(id: String, token: NCTestToken) = new NCTestEntity(id, tokens =
Seq(token))
+ def apply(id: String, reqId: String, token: NCTestToken) = new
NCTestEntity(id, reqId, tokens = Seq(token))
+
/**
* Entity test implementation.
*
@@ -34,7 +41,7 @@ case class NCTestEntity(
reqId: String = null,
groups: Set[String] = null,
meta: Map[String, AnyRef] = null,
- tokens: NCTestToken*
+ tokens: Seq[NCTestToken]
) extends NCPropertyMapAdapter with NCEntity:
if meta != null then meta.foreach { (k, v) => put(k, v) }