You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by ar...@apache.org on 2022/08/20 18:50:05 UTC

[incubator-nlpcraft] 03/04: Repackaging.

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

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

commit c3327286e3ee32319ea7a2e3b54ca90f2203d02c
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Sat Aug 20 11:47:10 2022 -0700

    Repackaging.
---
 .../apache/nlpcraft/internal/ascii/NCAsciiTable.scala   |  4 ++--
 .../nlp/enrichers/tools/NCEnStopWordGenerator.scala     | 17 +++++++++++++++++
 .../nlp/parsers/impl/NCSemanticSourceReader.scala       |  1 +
 .../nlpcraft/nlp/parsers/impl/NCSemanticSynonym.scala   |  1 +
 .../nlp/parsers/impl/NCSemanticSynonymsProcessor.scala  |  1 +
 .../nlpcraft/internal/impl/NCModelPingPongSpec.scala    |  6 +++++-
 .../impl/scan/NCModelIntentsInvalidIntentsSpec.scala    |  1 +
 .../nlp/enrichers/NCStopWordsEnricherSpec.scala         |  3 ++-
 .../nlp/parsers/NCOpenNLPEntityParserSpec.scala         |  1 +
 .../nlp/parsers/NCSemanticEntityParserLemmaSpec.scala   |  7 ++++---
 .../nlp/parsers/NCSemanticEntityParserSpec.scala        | 16 ++++++++--------
 11 files changed, 43 insertions(+), 15 deletions(-)

diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/ascii/NCAsciiTable.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/ascii/NCAsciiTable.scala
index d318db2b..3a586fe6 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/ascii/NCAsciiTable.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/ascii/NCAsciiTable.scala
@@ -19,8 +19,8 @@ package org.apache.nlpcraft.internal.ascii
 
 import com.typesafe.scalalogging.Logger
 import org.apache.nlpcraft.*
-import org.apache.nlpcraft.internal.ascii.NCAsciiTable.*
-import org.apache.nlpcraft.internal.util.NCUtils
+import internal.ascii.NCAsciiTable.*
+import internal.util.NCUtils
 
 import java.io.*
 import scala.collection.mutable
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/enrichers/tools/NCEnStopWordGenerator.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/enrichers/tools/NCEnStopWordGenerator.scala
index 2b9fe730..410edcba 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/enrichers/tools/NCEnStopWordGenerator.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/enrichers/tools/NCEnStopWordGenerator.scala
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.nlpcraft.nlp.enrichers.tools
 
 import opennlp.tools.stemmer.PorterStemmer
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/impl/NCSemanticSourceReader.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/impl/NCSemanticSourceReader.scala
index 15601666..667409a4 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/impl/NCSemanticSourceReader.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/impl/NCSemanticSourceReader.scala
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.nlpcraft.nlp.parsers.impl
 
 import com.fasterxml.jackson.core.JsonParser
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/impl/NCSemanticSynonym.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/impl/NCSemanticSynonym.scala
index c50a227b..d6672ae1 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/impl/NCSemanticSynonym.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/impl/NCSemanticSynonym.scala
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.nlpcraft.nlp.parsers.impl
 
 import org.apache.nlpcraft.NCToken
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/impl/NCSemanticSynonymsProcessor.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/impl/NCSemanticSynonymsProcessor.scala
index e0618287..1408fa87 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/impl/NCSemanticSynonymsProcessor.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/impl/NCSemanticSynonymsProcessor.scala
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.nlpcraft.nlp.parsers.impl
 
 import com.fasterxml.jackson.databind.*
diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelPingPongSpec.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelPingPongSpec.scala
index 08bcef58..a8d58a75 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelPingPongSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelPingPongSpec.scala
@@ -65,7 +65,11 @@ class NCModelPingPongSpec:
             def onOther(ctx: NCContext, im: NCIntentMatch, @NCIntentTerm("other") other: NCEntity): NCResult =
                 mkResult(ASK_RESULT, s"Some request by: ${other.mkText}")
 
-    MDL.pipeline.entParsers += NCTestUtils.mkEnSemanticParser(List(STE("command"), STE("confirm"), STE("other")))
+    MDL.pipeline.entParsers += NCTestUtils.mkEnSemanticParser(List(
+        NCSemanticTestElement("command"),
+        NCSemanticTestElement("confirm"),
+        NCSemanticTestElement("other")
+    ))
 
     @BeforeEach
     def setUp(): Unit = client = new NCModelClient(MDL)
diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/scan/NCModelIntentsInvalidIntentsSpec.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/scan/NCModelIntentsInvalidIntentsSpec.scala
index 42a10ca1..24c02f15 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/scan/NCModelIntentsInvalidIntentsSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/scan/NCModelIntentsInvalidIntentsSpec.scala
@@ -19,6 +19,7 @@ package org.apache.nlpcraft.internal.impl.scan
 
 import org.apache.nlpcraft.*
 import annotations.*
+import nlp.util.*
 import internal.impl.NCModelScanner
 
 import org.junit.jupiter.api.Test
diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/enrichers/NCStopWordsEnricherSpec.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/enrichers/NCStopWordsEnricherSpec.scala
index a6a9fc9c..bf295066 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/enrichers/NCStopWordsEnricherSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/enrichers/NCStopWordsEnricherSpec.scala
@@ -19,9 +19,10 @@ package org.apache.nlpcraft.nlp.enrichers
 
 import org.apache.nlpcraft.*
 import internal.util.NCResourceReader
+import nlp.util.*
 import nlp.enrichers.NCEnStopWordsTokenEnricher
-import org.junit.jupiter.api.*
 
+import org.junit.jupiter.api.*
 import java.util
 import scala.jdk.CollectionConverters.*
 
diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/parsers/NCOpenNLPEntityParserSpec.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/parsers/NCOpenNLPEntityParserSpec.scala
index a8a34212..802cf372 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/parsers/NCOpenNLPEntityParserSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/parsers/NCOpenNLPEntityParserSpec.scala
@@ -18,6 +18,7 @@
 package org.apache.nlpcraft.nlp.parsers
 
 import org.apache.nlpcraft.*
+import internal.util.*
 import nlp.parsers.*
 import nlp.util.*
 
diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/parsers/NCSemanticEntityParserLemmaSpec.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/parsers/NCSemanticEntityParserLemmaSpec.scala
index 9c83244d..15e9fd47 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/parsers/NCSemanticEntityParserLemmaSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/parsers/NCSemanticEntityParserLemmaSpec.scala
@@ -20,6 +20,7 @@ package org.apache.nlpcraft.nlp.parsers
 import org.apache.nlpcraft.*
 import annotations.*
 import nlp.parsers.*
+import internal.impl.*
 import nlp.util.*
 import org.junit.jupiter.api.*
 
@@ -96,20 +97,20 @@ class NCSemanticEntityParserLemmaSpec:
         // Lemma.
         ask(
             "my test",
-            List(E("X", synonyms = Set(deepWrap("my test")))),
+            List(NCSemanticTestElement("X", synonyms = Set(deepWrap("my test")))),
             List(List(Data("my test", "X")))
         )
 
         // Regex.
         ask(
             "my test",
-            List(E("X", synonyms = Set(wrap("my //[a-z]+//")))),
+            List(NCSemanticTestElement("X", synonyms = Set(wrap("my //[a-z]+//")))),
             List(List(Data("my test", "X")))
         )
 
         // Both.
         ask(
             "my test",
-            List(E("X", synonyms = Set(deepWrap("my test"), wrap("my //[a-z]+//")))),
+            List(NCSemanticTestElement("X", synonyms = Set(deepWrap("my test"), wrap("my //[a-z]+//")))),
             List(List(Data("my test", "X")))
         )
\ No newline at end of file
diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/parsers/NCSemanticEntityParserSpec.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/parsers/NCSemanticEntityParserSpec.scala
index 512b9dd9..5be1b2f5 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/parsers/NCSemanticEntityParserSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/parsers/NCSemanticEntityParserSpec.scala
@@ -35,21 +35,21 @@ class NCSemanticEntityParserSpec:
         NCTestUtils.mkEnSemanticParser(
             List(
                 // Standard.
-                E("t1", synonyms = Set("t1")),
+                NCSemanticTestElement("t1", synonyms = Set("t1")),
                 // No extra synonyms.
-                E("t2"),
+                NCSemanticTestElement("t2"),
                 // Multiple words.
-                E("t3", synonyms = Set("t3 t3")),
+                NCSemanticTestElement("t3", synonyms = Set("t3 t3")),
                 // Value. No extra synonyms.
-                E("t4", values = Map("value4" -> Set.empty)),
+                NCSemanticTestElement("t4", values = Map("value4" -> Set.empty)),
                 // Value. Multiple words.
-                E("t5", values = Map("value5" -> Set("value 5"))),
+                NCSemanticTestElement("t5", values = Map("value5" -> Set("value 5"))),
                 // Elements data.
-                E("t6", props = Map("testKey" -> "testValue")),
+                NCSemanticTestElement("t6", props = Map("testKey" -> "testValue")),
                 // Regex.
-                E("t7", synonyms = Set("x //[a-d]+//")),
+                NCSemanticTestElement("t7", synonyms = Set("x //[a-d]+//")),
                 // Empty synonyms.
-                E("t8", synonyms = Set("{A|_} {B|_}"))
+                NCSemanticTestElement("t8", synonyms = Set("{A|_} {B|_}"))
             )
         )