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

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


The following commit(s) were added to refs/heads/master-model by this push:
     new 654a38f  WIP.
654a38f is described below

commit 654a38f45b2b44faa765ca181ab1d31d46054501
Author: Sergey Kamov <[email protected]>
AuthorDate: Thu Oct 7 21:25:05 2021 +0300

    WIP.
---
 .../scala/org/apache/nlpcraft/model/NCModel.java   | 20 +++++--
 .../org/apache/nlpcraft/model/NCModelAction.java   | 59 --------------------
 .../org/apache/nlpcraft/model/NCModelConfig.java   | 10 ++--
 .../nlpcraft/model/annotations/NCIntent.java       | 13 +++--
 .../nlpcraft/model/annotations/NCIntentRef.java    |  8 +--
 .../nlpcraft/model/annotations/NCIntentSample.java |  9 ++--
 .../model/annotations/NCIntentSampleRef.java       |  2 -
 .../nlpcraft/model/annotations/NCIntentTerm.java   | 10 ++--
 .../annotations/delete/NCAddElementClass.java      | 51 ------------------
 .../annotations/delete/NCModelAddClasses.java      | 63 ----------------------
 .../annotations/delete/NCModelAddPackage.java      | 63 ----------------------
 .../model/builders/NCModelActionBuilder.java       | 53 ------------------
 .../nlpcraft/model/builders/NCModelBuilder.java    |  4 --
 .../model/builders/NCModelConfigBuilder.java       | 44 +++++++++++++++
 .../java/org/apache/nlpcraft/model/NCSpec.java     | 41 +++++++-------
 15 files changed, 112 insertions(+), 338 deletions(-)

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 25dc95b..370eb98 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModel.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModel.java
@@ -22,22 +22,32 @@ import java.util.Map;
 import java.util.List;
 
 public interface NCModel {
-    // 2 different configs.
     NCModelConfig getModelConfig();
-    NCModelAction getModelAction();
 
     // Lifecycle. TODO: I am not sure that we need them. Look at it after 
Server API development.
     void start();
     void stop();
 
-    // All these methods can be repeated with samoe parameters by defaylt.
     String ask(String txt, Map<String, Object> data, boolean enableLog, String 
userId);
+    String ask(String txt, String userId);
+    String ask(String txt);
+
     NCResult askSync(String txt, Map<String, Object> data, boolean enableLog, 
String userId);
+    NCResult askSync(String txt, String userId);
+    NCResult askSync(String txt);
 
-    List<NCResult> check(Set<String> srvReqIds, Integer maxRows, String 
userId);
+    List<NCResult> check(Set<String> srvReqIds, int maxRows);
+    List<NCResult> check(String userId, int maxRows);
+    NCResult check(String srvReqId);
 
-    void cancel(Set<String> srvReqIds, String userId);
+    void cancel(Set<String> srvReqIds);
+    void cancel(String srvReqId);
+    void cancelAll(String userId);
+    void cancelAll();
 
     void clearConversation(String userId);
+    void clearConversation();
+
     void clearDialog(String userId);
+    void clearDialog();
 }
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelAction.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelAction.java
deleted file mode 100644
index ac589b5..0000000
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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;
-
-import java.time.Duration;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-public interface NCModelAction {
-    default List<String> getIntentsDsl() {
-        return null;
-    }
-
-    default Map<String, List<List<String>>> getIntentsDslSamples() {
-        return null;
-    }
-
-    default boolean onParsedVariant(NCVariant var) {
-        return true;
-    }
-
-    default NCResult onContext(NCContext ctx) throws NCRejection {
-        return null;
-    }
-
-    default boolean onMatchedIntent(NCIntentMatch ctx) throws NCRejection {
-        return true;
-    }
-
-    default NCResult onResult(NCIntentMatch ctx, NCResult res) {
-        return null;
-    }
-
-    default NCResult onRejection(NCIntentMatch ctx, NCRejection e) {
-        return null;
-    }
-
-    default NCResult onError(NCContext ctx, Throwable e) {
-        return null;
-    }
-}
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelConfig.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelConfig.java
index 4e8efa1..2a3f064 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelConfig.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelConfig.java
@@ -221,9 +221,14 @@ public interface NCModelConfig extends NCMetadata {
     }
 
     List<NCElement> getElements();
-    List<String> getIntentsDsl();
 
-///
+    default List<String> getIntentsDsl() {
+        return null;
+    }
+
+    default Map<String, List<List<String>>> getIntentsDslSamples() {
+        return null;
+    }
 
     default boolean onParsedVariant(NCVariant var) {
         return true;
@@ -248,5 +253,4 @@ public interface NCModelConfig extends NCMetadata {
     default NCResult onError(NCContext ctx, Throwable e) {
         return null;
     }
-
 }
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/NCIntent.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/NCIntent.java
index bad4828..0c19130 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/NCIntent.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/NCIntent.java
@@ -20,13 +20,16 @@ package org.apache.nlpcraft.model.annotations;
 import org.apache.nlpcraft.model.NCIntentMatch;
 import org.apache.nlpcraft.model.NCIntentSkip;
 import org.apache.nlpcraft.model.NCModel;
-import org.apache.nlpcraft.model.annotations.delete.NCModelAddClasses;
-import org.apache.nlpcraft.model.annotations.delete.NCModelAddPackage;
 
-import java.lang.annotation.*;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Repeatable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 
-import static java.lang.annotation.ElementType.*;
-import static java.lang.annotation.RetentionPolicy.*;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
 
 /**
  * Annotation to bind an intent with the method serving as its callback. This 
annotation takes a string value
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/NCIntentRef.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/NCIntentRef.java
index 5bf7d64..54355d0 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/NCIntentRef.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/NCIntentRef.java
@@ -20,10 +20,12 @@ package org.apache.nlpcraft.model.annotations;
 import org.apache.nlpcraft.model.NCIntentMatch;
 import org.apache.nlpcraft.model.NCIntentSkip;
 import org.apache.nlpcraft.model.NCModel;
-import org.apache.nlpcraft.model.annotations.delete.NCModelAddClasses;
-import org.apache.nlpcraft.model.annotations.delete.NCModelAddPackage;
 
-import java.lang.annotation.*;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Repeatable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 
 import static java.lang.annotation.ElementType.METHOD;
 import static java.lang.annotation.RetentionPolicy.RUNTIME;
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/NCIntentSample.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/NCIntentSample.java
index 413a0a0..3a092cc 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/NCIntentSample.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/NCIntentSample.java
@@ -20,10 +20,13 @@ package org.apache.nlpcraft.model.annotations;
 import org.apache.nlpcraft.model.NCIntentMatch;
 import org.apache.nlpcraft.model.NCIntentSkip;
 import org.apache.nlpcraft.model.NCModel;
-import org.apache.nlpcraft.model.annotations.delete.NCModelAddClasses;
-import org.apache.nlpcraft.model.annotations.delete.NCModelAddPackage;
 
-import java.lang.annotation.*;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Repeatable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
 import static java.lang.annotation.ElementType.METHOD;
 import static java.lang.annotation.RetentionPolicy.RUNTIME;
 
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/NCIntentSampleRef.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/NCIntentSampleRef.java
index bfa8068..15fea2d 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/NCIntentSampleRef.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/NCIntentSampleRef.java
@@ -20,8 +20,6 @@ package org.apache.nlpcraft.model.annotations;
 import org.apache.nlpcraft.model.NCIntentMatch;
 import org.apache.nlpcraft.model.NCIntentSkip;
 import org.apache.nlpcraft.model.NCModel;
-import org.apache.nlpcraft.model.annotations.delete.NCModelAddClasses;
-import org.apache.nlpcraft.model.annotations.delete.NCModelAddPackage;
 
 import java.lang.annotation.Documented;
 import java.lang.annotation.Repeatable;
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/NCIntentTerm.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/NCIntentTerm.java
index c2c457f..7beb5bc 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/NCIntentTerm.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/NCIntentTerm.java
@@ -20,13 +20,13 @@ package org.apache.nlpcraft.model.annotations;
 import org.apache.nlpcraft.model.NCIntentMatch;
 import org.apache.nlpcraft.model.NCIntentSkip;
 import org.apache.nlpcraft.model.NCModel;
-import org.apache.nlpcraft.model.annotations.delete.NCModelAddClasses;
-import org.apache.nlpcraft.model.annotations.delete.NCModelAddPackage;
 
-import java.lang.annotation.*;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
 
-import static java.lang.annotation.ElementType.*;
-import static java.lang.annotation.RetentionPolicy.*;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
 
 /**
  * Annotation to mark callback parameter to receive intent term's tokens. This 
is a companion annotation
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/delete/NCAddElementClass.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/delete/NCAddElementClass.java
deleted file mode 100644
index 1daf4cd..0000000
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/delete/NCAddElementClass.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.annotations.delete;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Repeatable;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-// TODO: drop it,
-@Documented
-@Retention(value=RUNTIME)
-@Target(value=METHOD)
-@Repeatable(NCAddElementClass.NCAddElementClassList.class)
-public @interface NCAddElementClass {
-    /**
-     * ID of the intent term.
-     *
-     * @return ID of the intent term.
-     */
-    Class<?> value();
-
-    /**
-     * 
-     */
-    @Retention(RetentionPolicy.RUNTIME)
-    @Target(value=METHOD)
-    @Documented
-    @interface NCAddElementClassList {
-        NCAddElementClass[] value();
-    }
-}
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/delete/NCModelAddClasses.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/delete/NCModelAddClasses.java
deleted file mode 100644
index 6abfc7d..0000000
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/delete/NCModelAddClasses.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.annotations.delete;
-
-import org.apache.nlpcraft.model.NCIntentMatch;
-import org.apache.nlpcraft.model.NCIntentSkip;
-import org.apache.nlpcraft.model.annotations.NCIntentRef;
-import org.apache.nlpcraft.model.annotations.NCIntentSampleRef;
-import org.apache.nlpcraft.model.annotations.NCIntentTerm;
-import org.apache.nlpcraft.model.annotations.NCIntentSample;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-/**
- * Annotation to add one or more classes that contain intent callbacks. This 
annotation should be applied to the main
- * model class. When found the internal intent detection algorithm will scan 
these additional classes searching
- * for intent callbacks.
- * <p>
- * Additionally with {@link NCModelAddPackage} annotation, these two 
annotations allowing to have model implementation,
- * i.e. intent callbacks, in external classes not linked through sub-type 
relationship to the main model class. This
- * approach provides greater modularity, isolated testability and overall 
coding efficiencies for the larger models
- * <p>
- * Read full documentation in <a target=_ 
href="https://nlpcraft.apache.org/intent-matching.html#binding";>Intent 
Matching</a> section and review
- * <a target=_ 
href="https://github.com/apache/incubator-nlpcraft/tree/master/nlpcraft-examples";>examples</a>.
- *
- * @see NCModelAddPackage
- * @see NCIntentRef
- * @see NCIntentTerm
- * @see NCIntentSample
- * @see NCIntentSampleRef
- * @see NCIntentSkip
- * @see NCIntentMatch
- */
-@Retention(value=RUNTIME)
-@Target(value=TYPE)
-public @interface NCModelAddClasses {
-    // TODO: drop it,
-    /**
-     * Array of class instances to additionally scan for intent callbacks.
-     *
-     * @return Array of class instances to additionally scan for intent 
callbacks.
-     */
-    Class<?>[] value();
-}
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/delete/NCModelAddPackage.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/delete/NCModelAddPackage.java
deleted file mode 100644
index c9a6c24..0000000
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/annotations/delete/NCModelAddPackage.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.annotations.delete;
-
-import org.apache.nlpcraft.model.NCIntentMatch;
-import org.apache.nlpcraft.model.NCIntentSkip;
-import org.apache.nlpcraft.model.annotations.NCIntentRef;
-import org.apache.nlpcraft.model.annotations.NCIntentSampleRef;
-import org.apache.nlpcraft.model.annotations.NCIntentTerm;
-import org.apache.nlpcraft.model.annotations.NCIntentSample;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-/**
- * Annotation to add one or more JVM packages that contain classes with intent 
callbacks. This annotation should be
- * applied to the main model class. When found the internal intent detection 
algorithm will recursively scan these
- * additional packages and their classes searching for intent callbacks.
- * <p>
- * Additionally with {@link NCModelAddClasses} annotation, these two 
annotations allowing to have model implementation,
- * i.e. intent callbacks, in external classes not linked through sub-type 
relationship to the main model class. This
- * approach provides greater modularity, isolated testability and overall 
coding efficiencies for the larger models
- * <p>
- * Read full documentation in <a target=_ 
href="https://nlpcraft.apache.org/intent-matching.html#binding";>Intent 
Matching</a> section and review
- * <a target=_ 
href="https://github.com/apache/incubator-nlpcraft/tree/master/nlpcraft-examples";>examples</a>.
- *
- * @see NCModelAddClasses
- * @see NCIntentRef
- * @see NCIntentTerm
- * @see NCIntentSample
- * @see NCIntentSampleRef
- * @see NCIntentSkip
- * @see NCIntentMatch
- */
-@Retention(value=RUNTIME)
-@Target(value=TYPE)
-public @interface NCModelAddPackage {
-    // TODO: drop it,
-    /**
-     * Array of JVM package names to recursively scan for intent callbacks.
-     *
-     * @return Array of JVM package names to recursively scan for intent 
callbacks.
-     */
-    String[] value();
-}
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelActionBuilder.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelActionBuilder.java
deleted file mode 100644
index c57506a..0000000
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelActionBuilder.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.apache.nlpcraft.model.builders;
-
-import org.apache.nlpcraft.model.NCContext;
-import org.apache.nlpcraft.model.NCIntentMatch;
-import org.apache.nlpcraft.model.NCRejection;
-import org.apache.nlpcraft.model.NCResult;
-import org.apache.nlpcraft.model.NCVariant;
-import org.apache.nlpcraft.model.NCModelAction;
-
-import java.util.List;
-import java.util.Map;
-import java.util.function.BiFunction;
-import java.util.function.Function;
-import java.util.function.Predicate;
-
-public class NCModelActionBuilder {
-    public NCModelActionBuilder withIntentsDsl(List<String> intentsDsl) {
-        return null;
-    }
-
-    // IntentID - sample.
-    public NCModelActionBuilder withIntentsDslSamples(Map<String, 
List<List<String>>> samples) {
-        return null;
-    }
-
-    public NCModelActionBuilder withOnParsedVariant(Predicate<NCVariant> 
predicate) {
-        return null;
-    }
-
-    public NCModelActionBuilder withOnMatchedIntent(Predicate<NCIntentMatch> 
predicate) throws NCRejection {
-        return null;
-    }
-
-    public NCModelActionBuilder withOnContext(Function<NCContext, NCResult> 
resultMaker) throws NCRejection {
-        return null;
-    }
-    
-    public NCModelActionBuilder withOnResult(BiFunction<NCIntentMatch, 
NCResult, NCResult> resultMaker) {
-        return null;
-    }
-
-    public NCModelActionBuilder withOnRejection(BiFunction<NCIntentMatch, 
NCRejection, NCResult> resultMaker) {
-        return null;
-    }
-
-    public NCModelActionBuilder withOnError(BiFunction<NCContext, Throwable, 
NCResult> resultMaker) {
-        return null;
-    }
-
-    public NCModelAction make() {
-        return null;
-    }
-}
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 2d7b08e..00b77d4 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
@@ -1,16 +1,12 @@
 package org.apache.nlpcraft.model.builders;
 
 import org.apache.nlpcraft.model.NCModel;
-import org.apache.nlpcraft.model.NCModelAction;
 import org.apache.nlpcraft.model.NCModelConfig;
 
 public class NCModelBuilder {
     public NCModelBuilder withConfig(NCModelConfig cfg) {
         return null;
     }
-    public NCModelBuilder withModelAction(NCModelAction a) {
-        return null;
-    }
 
     public NCModel make() {
         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
index 28b016e..f4196d8 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelConfigBuilder.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelConfigBuilder.java
@@ -1,15 +1,23 @@
 package org.apache.nlpcraft.model.builders;
 
+import org.apache.nlpcraft.model.NCContext;
 import org.apache.nlpcraft.model.NCCustomParser;
 import org.apache.nlpcraft.model.NCElement;
+import org.apache.nlpcraft.model.NCIntentMatch;
+import org.apache.nlpcraft.model.NCRejection;
+import org.apache.nlpcraft.model.NCResult;
 import org.apache.nlpcraft.model.NCValue;
 import org.apache.nlpcraft.model.NCValueLoader;
 import org.apache.nlpcraft.model.NCModelConfig;
+import org.apache.nlpcraft.model.NCVariant;
 
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+import java.util.function.Predicate;
 
 public class NCModelConfigBuilder {
     public NCModelConfigBuilder withDescription(String description) {
@@ -117,6 +125,42 @@ public class NCModelConfigBuilder {
         return null;
     }
 
+    //
+    public NCModelConfigBuilder withIntentsDsl(List<String> intentsDsl) {
+        return null;
+    }
+
+    // IntentID - sample.
+    public NCModelConfigBuilder withIntentsDslSamples(Map<String, 
List<List<String>>> samples) {
+        return null;
+    }
+
+    public NCModelConfigBuilder withOnParsedVariant(Predicate<NCVariant> 
predicate) {
+        return null;
+    }
+
+    public NCModelConfigBuilder withOnMatchedIntent(Predicate<NCIntentMatch> 
predicate) throws NCRejection {
+        return null;
+    }
+
+    public NCModelConfigBuilder withOnContext(Function<NCContext, NCResult> 
resultMaker) throws NCRejection {
+        return null;
+    }
+
+    public NCModelConfigBuilder withOnResult(BiFunction<NCIntentMatch, 
NCResult, NCResult> resultMaker) {
+        return null;
+    }
+
+    public NCModelConfigBuilder withOnRejection(BiFunction<NCIntentMatch, 
NCRejection, NCResult> resultMaker) {
+        return null;
+    }
+
+    public NCModelConfigBuilder withOnError(BiFunction<NCContext, Throwable, 
NCResult> resultMaker) {
+        return null;
+    }
+
+
+
     public NCModelConfig make() {
         return null;
     }
diff --git a/nlpcraft/src/test/java/org/apache/nlpcraft/model/NCSpec.java 
b/nlpcraft/src/test/java/org/apache/nlpcraft/model/NCSpec.java
index a1409e0..8bcb82a 100644
--- a/nlpcraft/src/test/java/org/apache/nlpcraft/model/NCSpec.java
+++ b/nlpcraft/src/test/java/org/apache/nlpcraft/model/NCSpec.java
@@ -2,7 +2,6 @@ package org.apache.nlpcraft.model;
 
 import org.apache.nlpcraft.model.annotations.NCIntentRef;
 import org.apache.nlpcraft.model.builders.NCElementBuilder;
-import org.apache.nlpcraft.model.builders.NCModelActionBuilder;
 import org.apache.nlpcraft.model.builders.NCModelConfigBuilder;
 import org.apache.nlpcraft.model.builders.NCModelBuilder;
 import org.apache.nlpcraft.model.providers.NCElementsProvider;
@@ -17,11 +16,11 @@ import java.util.Set;
 import java.util.function.BiFunction;
 
 public class NCSpec {
-    private static<T> Set<T> asSet(T s) {
+    private static <T> Set<T> asSet(T s) {
         return Collections.singleton(s);
     }
 
-    private static<T> List<T> asList(T s) {
+    private static <T> List<T> asList(T s) {
         return Collections.singletonList(s);
     }
 
@@ -46,14 +45,6 @@ public class NCSpec {
 
         elements.add(new 
NCElementBuilder().withId("additionalElementId").make());
 
-        return
-            new NCModelConfigBuilder().
-                withDescription("test model").
-                withElements(elements).
-                make();
-    }
-
-    private NCModelAction getModelAction() {
         NCIntentsProvider intentsProvider = new NCIntentsProvider();
 
         class SomeClassWithIntents {
@@ -67,8 +58,11 @@ public class NCSpec {
 
         List<String> intents = intentsProvider.getProviderIntentsDls();
 
+
         return
-            new NCModelActionBuilder().
+            new NCModelConfigBuilder().
+                withDescription("test model").
+                withElements(elements).
                 withIntentsDsl(intentsProvider.getProviderIntentsDls()).
                 
withIntentsDslSamples(intentsProvider.getProviderIntentsSamples()).
                 withOnRejection(new BiFunction<NCIntentMatch, NCRejection, 
NCResult>() {
@@ -84,7 +78,6 @@ public class NCSpec {
         return
             new NCModelBuilder().
                 withConfig(getModelConfig()).
-                withModelAction(getModelAction()).
                 make();
     }
 
@@ -94,9 +87,9 @@ public class NCSpec {
 
         mdl.start();
 
-        String reqId = mdl.ask("weather today", null, true, null);
+        String reqId = mdl.ask("weather today");
 
-        mdl.cancel(asSet(reqId), null);
+        mdl.cancel(reqId);
 
         mdl.stop();
     }
@@ -105,13 +98,23 @@ public class NCSpec {
     public void test2() {
         NCModel mdl =
             new NCModelBuilder().
-            withConfig(new NCModelConfigBuilder().withElements(asList(new 
NCElementBuilder().withId("elemeId").withSynonyms(asList("element")).make())).make()).
-                withModelAction(new 
NCModelActionBuilder().withIntentsDsl(asList("intent=req term(date)~{# == 
'opennlp:date'}?")).make()).
-            make();
+                withConfig(
+                    new NCModelConfigBuilder().
+                        withElements(
+                            asList(
+                                new NCElementBuilder().
+                                    withId("elemeId").
+                                    withSynonyms(asList("element")).
+                                    make()
+                            )
+                        ).
+                        withIntentsDsl(asList("intent=req term(date)~{# == 
'opennlp:date'}?")).
+                        make()
+                ).make();
 
         mdl.start();
 
-        NCResult res = mdl.askSync("weather today", null, true, null);
+        NCResult res = mdl.askSync("weather today", "some user id");
 
         mdl.stop();
     }

Reply via email to