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

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


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

commit 281581e89af11c21ce645bd4c71f64ebe0f6ef96
Author: Sergey Kamov <[email protected]>
AuthorDate: Mon Oct 11 22:58:11 2021 +0300

    WIP.
---
 .../scala/org/apache/nlpcraft/model/NCContext.java |   2 +-
 .../org/apache/nlpcraft/model/NCConversation.java  |   4 +-
 .../scala/org/apache/nlpcraft/model/NCModel.java   |   3 +-
 .../apache/nlpcraft/model/NCModelBehaviour.java    |   1 -
 .../model/{NCModelView.java => NCModelConfig.java} |   9 +-
 .../nlpcraft/model/builders/NCModelBuilder.java    | 101 +----------------
 .../model/builders/NCModelConfigBuilder.java       | 126 +++++++++++++++++++++
 .../model/impl/opennlp/NCOpenNlpNerParser.java     |   4 +-
 ...NlpWordsParser.java => NCOpenNlpTokenizer.java} |   6 +-
 .../apache/nlpcraft/model/nlp/NCNlpNerParser.java  |   4 +-
 .../apache/nlpcraft/model/nlp/NCNlpNerToken.java   |   4 +-
 .../{NCNlpTextParser.java => NCNlpTokenizer.java}  |   4 +-
 .../src/test/java/org/apache/nlpcraft/NCSpec.java  |  21 ++--
 13 files changed, 168 insertions(+), 121 deletions(-)

diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCContext.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCContext.java
index f4acced..3b5ae62 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCContext.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCContext.java
@@ -48,7 +48,7 @@ public interface NCContext extends NCMetadata, Serializable {
      *
      * @return Model.
      */
-    NCModelView getModel();
+    NCModelConfig getModel();
 
     /**
      * Gets supplemental information about user request.
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCConversation.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCConversation.java
index 465150c..5bf63de 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCConversation.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCConversation.java
@@ -40,8 +40,8 @@ import java.util.function.Predicate;
  * from oldest to newest for the current user and data model.
  *
  * @see NCContext#getConversation()
- * @see NCModelView#getConversationDepth()
- * @see NCModelView#getConversationTimeout()
+ * @see NCModelConfig#getConversationDepth()
+ * @see NCModelConfig#getConversationTimeout()
  */
 public interface NCConversation extends NCMetadata {
     /**
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModel.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModel.java
index 6caa66a..91389cc 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModel.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModel.java
@@ -20,8 +20,9 @@ package org.apache.nlpcraft.model;
 /**
  *
  */
-public interface NCModel extends NCModelView {
+public interface NCModel {
     NCModelBehaviour getModelBehaviour();
+    NCModelConfig getConfig();
 
     // TDOO: do we need these methods?
     // Maybe model should be already prepared (`start` omitted) + autoclosable 
?
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelBehaviour.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelBehaviour.java
index 11f931b..5a65448 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelBehaviour.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelBehaviour.java
@@ -16,7 +16,6 @@
  */
 
 package org.apache.nlpcraft.model;
-
 /**
  *
  */
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelView.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelConfig.java
similarity index 98%
rename from nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelView.java
rename to nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelConfig.java
index 910d2b6..ac32ac7 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelView.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelConfig.java
@@ -18,7 +18,9 @@
 package org.apache.nlpcraft.model;
 
 import org.apache.nlpcraft.model.impl.ner.NCSynonymsNerElement;
+import org.apache.nlpcraft.model.impl.opennlp.NCOpenNlpTokenizer;
 import org.apache.nlpcraft.model.nlp.NCNlpNerParser;
+import org.apache.nlpcraft.model.nlp.NCNlpTokenizer;
 
 import java.time.Duration;
 import java.util.Collections;
@@ -39,7 +41,7 @@ import java.util.Set;
  * @see NCModelAdapter
  * @see NCModelFileAdapter
  */
-public interface NCModelView extends NCMetadata {
+public interface NCModelConfig extends NCMetadata {
     /**
      * Minimum value for {@link #getConversationTimeout()} method.
      */
@@ -726,6 +728,11 @@ public interface NCModelView extends NCMetadata {
         return Collections.emptyList();
     }
 
+    // TODO:
+    default NCNlpTokenizer getTokenizer() {
+        return new NCOpenNlpTokenizer();
+    }
+
     /**
      * Gets timeout in ms after which the unused conversation element is 
automatically "forgotten".
      * <p>
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelBuilder.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelBuilder.java
index 6549e51..d905deb 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelBuilder.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelBuilder.java
@@ -19,108 +19,22 @@ package org.apache.nlpcraft.model.builders;
 
 import org.apache.nlpcraft.model.NCModel;
 import org.apache.nlpcraft.model.NCModelBehaviour;
-import org.apache.nlpcraft.model.nlp.NCNlpNerParser;
-import org.apache.nlpcraft.model.nlp.NCNlpTextParser;
-import org.apache.nlpcraft.model.nlp.NCNlpWord;
+import org.apache.nlpcraft.model.NCModelConfig;
 
 import java.io.File;
 import java.net.URL;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
-import java.util.function.Function;
 
-// Mandatory withOnContext or any of withIntentsXXX methods.
-// All other - optional.
 public class NCModelBuilder {
-    // 1. Common  properties.
-    // Mandatory.
-    public NCModelBuilder withId(String description) {
+    public NCModelBuilder withConfig(NCModelConfig cfg) {
         return null;
     }
-    public NCModelBuilder withName(String description) {
-        return null;
-    }
-    public NCModelBuilder withDescription(String description) {
-        return null;
-    }
-    public NCModelBuilder withOrigin(String origin) {
-        return null;
-    }
-    public NCModelBuilder withMaxUnknownWords(int maxUnknownWords) {
-        return null;
-    }
-    public NCModelBuilder withMaxFreeWords(int maxFreeWords) {
-        return null;
-    }
-    public NCModelBuilder withMaxSuspiciousWords(int maxSuspiciousWords) {
-        return null;
-    }
-    public NCModelBuilder withMinWords(int minWords) {
-        return null;
-    }
-    public NCModelBuilder withMaxWords(int maxWords) {
-        return null;
-    }
-    public NCModelBuilder withMinTokens(int minTokens) {
-        return null;
-    }
-    public NCModelBuilder withMaxTokens(int maxTokens) {
-        return null;
-    }
-    public NCModelBuilder withMinNonStopwords(int minNonStopwords) {
-        return null;
-    }
-    public NCModelBuilder withSwearWordsAllowed(boolean swearWordsAllowed) {
-        return null;
-    }
-    public NCModelBuilder withNoNounsAllowed(boolean noNounsAllowed) {
-        return null;
-    }
-    // TODO? do we need it?
-    public NCModelBuilder withNoUserTokensAllowed(boolean noUserTokensAllowed) 
{
-        return null;
-    }
-    public NCModelBuilder withConversationTimeout(long conversationTimeout) { 
return null; }
-    public NCModelBuilder withConversationDepth(int conversationDepth) { 
return null; }
-    public NCModelBuilder withMetadata(Map<String, Object> meta) {
-        return null;
-    }
-
-    // 2. Words - for built stop/swear EN detection. (Suspicious vai 
dictioanry)
-    public NCModelBuilder withAdditionalStopWords(Set<String> 
additionalStopWords) {
-        return null;
-    }
-    public NCModelBuilder withExcludedStopWords(Set<String> excludedStopWords) 
{
-        return null;
-    }
-    public NCModelBuilder withSuspiciousWords(Set<String> suspiciousWords) {
-        return null;
-    }
-
-    // TODO: Alternative - 3 custom words free implementation support - 
discuss it.
-    // We can provie all logic via these components for DE etc.
-    // Function<List<NCNlpWord>, List<NCNlpWord>> filter
-    // input - all sentence's words, output - detected stop/swear words. Empty 
result - not found.
-    public NCModelBuilder withStopWordsFilter(Function<List<NCNlpWord>, 
List<NCNlpWord>> finder) {
-        return null;
-    }
-    public NCModelBuilder withSwearWordsFilter(Function<List<NCNlpWord>, 
List<NCNlpWord>> finder) {
-        return null;
-    }
-    public NCModelBuilder withSuspiciousWordsFilter(Function<List<NCNlpWord>, 
List<NCNlpWord>> finder) {
+    public NCModelBuilder withBehaviour(NCModelBehaviour behaviour) {
         return null;
     }
 
-    // 3. Base Nlp parser (open nlp - default, stanford)
-    public NCModelBuilder withNlpWordsParser(NCNlpTextParser parser) {
-        return null;
-    }
-
-    // 4. NER parsers (open nlp - default, stanford, our one built parser 
NCDefaultNerParser + any custom)
-    public NCModelBuilder withNlpNerParsers(List<NCNlpNerParser> parsers) {
-        return null;
-    }
+    // Intents or Behaviour - mandatory.
 
     // 5. Intents related methods:
     // model class by default + for static methods of given classes.
@@ -149,13 +63,6 @@ public class NCModelBuilder {
         return null;
     }
 
-    // 6. Behaviour.
-    public NCModelBuilder withModelBehaviour(NCModelBehaviour behaviour) {
-        return null;
-    }
-
-    // Intents or Behaviour - mandatory.
-
     public NCModel getModel() {
         return null;
     }
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelConfigBuilder.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelConfigBuilder.java
new file mode 100644
index 0000000..a77cd81
--- /dev/null
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelConfigBuilder.java
@@ -0,0 +1,126 @@
+/*
+ * 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
+ *
+ *      http://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.model.builders;
+
+import org.apache.nlpcraft.model.NCModelConfig;
+import org.apache.nlpcraft.model.nlp.NCNlpNerParser;
+import org.apache.nlpcraft.model.nlp.NCNlpTokenizer;
+import org.apache.nlpcraft.model.nlp.NCNlpWord;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Function;
+
+// Mandatory withOnContext or any of withIntentsXXX methods.
+// All other - optional.
+public class NCModelConfigBuilder {
+    // 1. Common  properties.
+    // Mandatory.
+    public NCModelConfigBuilder withId(String description) {
+        return null;
+    }
+    public NCModelConfigBuilder withName(String description) {
+        return null;
+    }
+    public NCModelConfigBuilder withDescription(String description) {
+        return null;
+    }
+    public NCModelConfigBuilder withOrigin(String origin) {
+        return null;
+    }
+    public NCModelConfigBuilder withMaxUnknownWords(int maxUnknownWords) {
+        return null;
+    }
+    public NCModelConfigBuilder withMaxFreeWords(int maxFreeWords) {
+        return null;
+    }
+    public NCModelConfigBuilder withMaxSuspiciousWords(int maxSuspiciousWords) 
{
+        return null;
+    }
+    public NCModelConfigBuilder withMinWords(int minWords) {
+        return null;
+    }
+    public NCModelConfigBuilder withMaxWords(int maxWords) {
+        return null;
+    }
+    public NCModelConfigBuilder withMinTokens(int minTokens) {
+        return null;
+    }
+    public NCModelConfigBuilder withMaxTokens(int maxTokens) {
+        return null;
+    }
+    public NCModelConfigBuilder withMinNonStopwords(int minNonStopwords) {
+        return null;
+    }
+    public NCModelConfigBuilder withSwearWordsAllowed(boolean 
swearWordsAllowed) {
+        return null;
+    }
+    public NCModelConfigBuilder withNoNounsAllowed(boolean noNounsAllowed) {
+        return null;
+    }
+    // TODO? do we need it?
+    public NCModelConfigBuilder withNoUserTokensAllowed(boolean 
noUserTokensAllowed) {
+        return null;
+    }
+    public NCModelConfigBuilder withConversationTimeout(long 
conversationTimeout) { return null; }
+    public NCModelConfigBuilder withConversationDepth(int conversationDepth) { 
return null; }
+    public NCModelConfigBuilder withMetadata(Map<String, Object> meta) {
+        return null;
+    }
+
+    // 2. Words - for built stop/swear EN detection. (Suspicious vai 
dictioanry)
+    public NCModelConfigBuilder withAdditionalStopWords(Set<String> 
additionalStopWords) {
+        return null;
+    }
+    public NCModelConfigBuilder withExcludedStopWords(Set<String> 
excludedStopWords) {
+        return null;
+    }
+    public NCModelConfigBuilder withSuspiciousWords(Set<String> 
suspiciousWords) {
+        return null;
+    }
+
+    // TODO: Alternative - 3 custom words free implementation support - 
discuss it.
+    // We can provie all logic via these components for DE etc.
+    // Function<List<NCNlpWord>, List<NCNlpWord>> filter
+    // input - all sentence's words, output - detected stop/swear words. Empty 
result - not found.
+    public NCModelConfigBuilder withStopWordsFilter(Function<List<NCNlpWord>, 
List<NCNlpWord>> finder) {
+        return null;
+    }
+    public NCModelConfigBuilder withSwearWordsFilter(Function<List<NCNlpWord>, 
List<NCNlpWord>> finder) {
+        return null;
+    }
+    public NCModelConfigBuilder 
withSuspiciousWordsFilter(Function<List<NCNlpWord>, List<NCNlpWord>> finder) {
+        return null;
+    }
+
+    // 3. Base Nlp parser (open nlp - default, stanford)
+    public NCModelConfigBuilder withTokenizer(NCNlpTokenizer parser) {
+        return null;
+    }
+
+    // 4. NER parsers (open nlp - default, stanford, our one built parser 
NCDefaultNerParser + any custom)
+    public NCModelConfigBuilder withNerParsers(List<NCNlpNerParser> parsers) {
+        return null;
+    }
+    // Intents or Behaviour - mandatory.
+
+    public NCModelConfig getConfig() {
+        return null;
+    }
+}
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/opennlp/NCOpenNlpNerParser.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/opennlp/NCOpenNlpNerParser.java
index 591558e..1f0447e 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/opennlp/NCOpenNlpNerParser.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/opennlp/NCOpenNlpNerParser.java
@@ -17,7 +17,7 @@
 
 package org.apache.nlpcraft.model.impl.opennlp;
 
-import org.apache.nlpcraft.model.NCModelView;
+import org.apache.nlpcraft.model.NCModelConfig;
 import org.apache.nlpcraft.model.NCRequest;
 import org.apache.nlpcraft.model.nlp.NCNlpNerParser;
 import org.apache.nlpcraft.model.nlp.NCNlpNerToken;
@@ -28,7 +28,7 @@ import java.util.List;
 // Implementation by default for opennlp NERs. Stanford in another module.
 public class NCOpenNlpNerParser implements NCNlpNerParser {
     @Override
-    public List<NCNlpNerToken> parse(NCRequest req, NCModelView mdl, 
List<NCNlpRichWord> words, List<NCNlpNerToken> elements) {
+    public List<NCNlpNerToken> parse(NCRequest req, NCModelConfig mdl, 
List<NCNlpRichWord> words, List<NCNlpNerToken> elements) {
         return null;
     }
 }
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/opennlp/NCOpenNlpWordsParser.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/opennlp/NCOpenNlpTokenizer.java
similarity index 86%
rename from 
nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/opennlp/NCOpenNlpWordsParser.java
rename to 
nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/opennlp/NCOpenNlpTokenizer.java
index 6c193a1..72ed9cd 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/opennlp/NCOpenNlpWordsParser.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/opennlp/NCOpenNlpTokenizer.java
@@ -18,15 +18,15 @@
 package org.apache.nlpcraft.model.impl.opennlp;
 
 import org.apache.nlpcraft.model.NCRequest;
-import org.apache.nlpcraft.model.nlp.NCNlpTextParser;
+import org.apache.nlpcraft.model.nlp.NCNlpTokenizer;
 import org.apache.nlpcraft.model.nlp.NCNlpWord;
 
 import java.util.List;
 
 // Implementation by default. Stanford in another module. Can  be provided by 
user.
-public class NCOpenNlpWordsParser implements NCNlpTextParser {
+public class NCOpenNlpTokenizer implements NCNlpTokenizer {
     @Override
-    public List<NCNlpWord> parse(NCRequest req) {
+    public List<NCNlpWord> tokenize(NCRequest req) {
         return null;
     }
 }
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpNerParser.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpNerParser.java
index c8c0e1b..eb5dc2a 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpNerParser.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpNerParser.java
@@ -18,7 +18,7 @@
 package org.apache.nlpcraft.model.nlp;
 
 import org.apache.nlpcraft.model.NCModel;
-import org.apache.nlpcraft.model.NCModelView;
+import org.apache.nlpcraft.model.NCModelConfig;
 import org.apache.nlpcraft.model.NCRequest;
 
 import java.util.List;
@@ -61,5 +61,5 @@ public interface NCNlpNerParser {
      * @return List of custom elements. List can be empty or {@code null} if 
no model elements detected.
      * @see NCModel#getParsers()
      */
-    List<NCNlpNerToken> parse(NCRequest req, NCModelView mdl, 
List<NCNlpRichWord> words, List<NCNlpNerToken> toks);
+    List<NCNlpNerToken> parse(NCRequest req, NCModelConfig mdl, 
List<NCNlpRichWord> words, List<NCNlpNerToken> toks);
 }
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpNerToken.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpNerToken.java
index d14ba36..894c4b8 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpNerToken.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpNerToken.java
@@ -19,7 +19,7 @@ package org.apache.nlpcraft.model.nlp;
 
 import org.apache.nlpcraft.model.NCMetadata;
 import org.apache.nlpcraft.model.NCModel;
-import org.apache.nlpcraft.model.NCModelView;
+import org.apache.nlpcraft.model.NCModelConfig;
 import org.apache.nlpcraft.model.NCRequest;
 import org.apache.nlpcraft.model.impl.ner.NCSynonymsNerElement;
 
@@ -41,7 +41,7 @@ public interface NCNlpNerToken extends NCMetadata {
 
     /**
      * Gets a list of NLP custom words that matched detected model element. 
These must be the same custom words
-     * that were originally passed to {@link NCCustomParser#parse(NCRequest, 
NCModelView, List, List)} method.
+     * that were originally passed to {@link NCCustomParser#parse(NCRequest, 
NCModelConfig, List, List)} method.
      *
      * @return List of NLP custom words that comprise detected custom model 
element.
      */
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpTextParser.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpTokenizer.java
similarity index 93%
rename from 
nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpTextParser.java
rename to 
nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpTokenizer.java
index 6bf941f..079a464 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpTextParser.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpTokenizer.java
@@ -24,11 +24,11 @@ import java.util.List;
 /**
  * Initial request text parser.
  */
-public interface NCNlpTextParser {
+public interface NCNlpTokenizer {
     /**
      *
      * @param req Main parameter is request text, but also request can contain 
some hints in its request data.
      * @return
      */
-    List<NCNlpWord> parse(NCRequest req);
+    List<NCNlpWord> tokenize(NCRequest req);
 }
diff --git a/nlpcraft/src/test/java/org/apache/nlpcraft/NCSpec.java 
b/nlpcraft/src/test/java/org/apache/nlpcraft/NCSpec.java
index 36b1be8..b01ca24 100644
--- a/nlpcraft/src/test/java/org/apache/nlpcraft/NCSpec.java
+++ b/nlpcraft/src/test/java/org/apache/nlpcraft/NCSpec.java
@@ -21,7 +21,9 @@ import org.apache.nlpcraft.model.NCIntentMatch;
 import org.apache.nlpcraft.model.NCModel;
 import org.apache.nlpcraft.model.NCModelBehaviour;
 import org.apache.nlpcraft.model.NCRejection;
+import org.apache.nlpcraft.model.NCModelConfig;
 import org.apache.nlpcraft.model.NCResult;
+import org.apache.nlpcraft.model.builders.NCModelConfigBuilder;
 import org.apache.nlpcraft.model.impl.ner.NCSynonymsNerValue;
 import org.apache.nlpcraft.model.builders.NCModelBuilder;
 import org.apache.nlpcraft.model.impl.ner.NCSynonymsNerElement;
@@ -30,7 +32,7 @@ import 
org.apache.nlpcraft.model.impl.ner.NCSynonymsNerValueLoader;
 import org.apache.nlpcraft.model.impl.ner.builders.NCSynonymsNerElementBuilder;
 import org.apache.nlpcraft.model.impl.ner.builders.NCSynonymsNerParserBuilder;
 import org.apache.nlpcraft.model.impl.opennlp.NCOpenNlpNerParser;
-import org.apache.nlpcraft.model.impl.opennlp.NCOpenNlpWordsParser;
+import org.apache.nlpcraft.model.impl.opennlp.NCOpenNlpTokenizer;
 import org.junit.jupiter.api.Test;
 
 import java.io.File;
@@ -80,18 +82,23 @@ public class NCSpec {
                 ).
                 getNlpcraftNerParser();
 
-        NCModel mdl =
-            new NCModelBuilder().
+        NCModelConfig cfg =
+            new NCModelConfigBuilder().
                 // Common.
                 withId("modleId").
                 withName("name").
                 withSwearWordsAllowed(true).
                 // Stopwords etc.
                 withAdditionalStopWords(new HashSet<>(Arrays.asList("x1", 
"x2"))).
-                // Nlp parser.
-                withNlpWordsParser(new NCOpenNlpWordsParser()).
+                // Nlp tokenizer.
+                withTokenizer(new NCOpenNlpTokenizer()).
                 // NERs.
-                withNlpNerParsers(Arrays.asList(new NCOpenNlpNerParser(), 
ner1, ner2)).
+                withNerParsers(Arrays.asList(new NCOpenNlpNerParser(), ner1, 
ner2)).
+                getConfig();
+
+        NCModel mdl =
+            new NCModelBuilder().
+                withConfig(cfg).
                 // Intents.
                 withIntentsFromUrls(Collections.singletonList(new 
URL("http://urls.com";))).
                 
withIntentsClasses(Collections.singletonList(SomeClassWithIntents.class)).
@@ -101,7 +108,7 @@ public class NCSpec {
                     new HashMap<>() { { put("intent1", 
Arrays.asList(Arrays.asList("sample1", "sample2"))); } }
                 ).
                 // Model behaviour.
-                withModelBehaviour(
+                withBehaviour(
                     new NCModelBehaviour() {
                         @Override
                         public NCResult onRejection(NCIntentMatch ctx, 
NCRejection e) {

Reply via email to