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
The following commit(s) were added to refs/heads/master by this push:
new 67a5fc3 WIP
67a5fc3 is described below
commit 67a5fc3249171167f39e6103125ef4d55ce1ffba
Author: Nikita Ivanov <>
AuthorDate: Sun Dec 5 11:30:14 2021 -0800
WIP
---
.../main/scala/org/apache/nlpcraft/NCModel.java | 61 ++++++++++++++++++++++
.../nlpcraft/{NCModel.java => NCModelClient.java} | 49 ++++++++++++++++-
2 files changed, 108 insertions(+), 2 deletions(-)
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModel.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModel.java
index 80643d0..3c4e656 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModel.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModel.java
@@ -17,6 +17,8 @@
package org.apache.nlpcraft;
+import java.util.List;
+
/**
*
*/
@@ -26,4 +28,63 @@ public interface NCModel {
* @return
*/
NCModelConfig getConfig();
+
+ /**
+ *
+ * @param var
+ * @return
+ */
+ default boolean onVariant(List<NCToken> var) {
+ return true;
+ }
+
+ /**
+ *
+ * @param ctx
+ * @return
+ * @throws NCRejection
+ */
+ default NCResult onContext(NCContext ctx) throws NCRejection {
+ return null;
+ }
+
+ /**
+ *
+ * @param ctx
+ * @return
+ * @throws NCRejection
+ */
+ default boolean onMatchedIntent(NCIntentMatch ctx) throws NCRejection {
+ return true;
+ }
+
+ /**
+ *
+ * @param ctx
+ * @param res
+ * @return
+ */
+ default NCResult onResult(NCIntentMatch ctx, NCResult res) {
+ return null;
+ }
+
+ /**
+ *
+ * @param ctx
+ * @param e
+ * @return
+ */
+ default NCResult onRejection(NCIntentMatch ctx, NCRejection e) {
+ return null;
+ }
+
+ /**
+ *
+ * @param ctx
+ * @param e
+ * @return
+ */
+ default NCResult onError(NCContext ctx, Throwable e) {
+ return null;
+ }
}
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModel.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModelClient.java
similarity index 52%
copy from nlpcraft/src/main/scala/org/apache/nlpcraft/NCModel.java
copy to nlpcraft/src/main/scala/org/apache/nlpcraft/NCModelClient.java
index 80643d0..94c3484 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModel.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModelClient.java
@@ -17,13 +17,58 @@
package org.apache.nlpcraft;
+import java.util.Map;
+import java.util.concurrent.*;
+
/**
*
*/
-public interface NCModel {
+public class NCModelClient {
+ private NCModel mdl;
+
+ /**
+ *
+ * @param mdl
+ */
+ public NCModelClient(NCModel mdl) {
+ this.mdl = mdl;
+ }
+
/**
*
+ * @param txt
+ * @param data
+ * @param usrId
* @return
*/
- NCModelConfig getConfig();
+ Future<NCResult> ask(String txt, Map<String, Object> data, String usrId) {
+ return null; // TODO
+ }
+
+ /**
+ *
+ * @param txt
+ * @param data
+ * @param usrId
+ * @return
+ */
+ NCResult askSync(String txt, Map<String, Object> data, String usrId) {
+ return null; // TODO
+ }
+
+ /**
+ *
+ * @param usrId
+ */
+ void clearConversation(String usrId) {
+ // TODO
+ }
+
+ /**
+ *
+ * @param usrId
+ */
+ void clearDialog(String usrId) {
+ // TODO
+ }
}