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 6976928 WIP.
6976928 is described below
commit 6976928486a65a7b1b7469233855d574f1d11357
Author: Sergey Kamov <[email protected]>
AuthorDate: Tue Oct 12 15:42:45 2021 +0300
WIP.
---
nlpcraft-akka/pom.xml | 16 ++++
nlpcraft-spring/pom.xml | 69 ++++++++++++++++
.../nlpcraft/spring/NCNlpcraftController.java | 73 +++++++++++++++++
.../org/apache/nlpcraft/spring/Application.java | 77 ++++++++++++++++++
.../src/test/resources/application.properties | 21 +++++
.../org/apache/nlpcraft/NCNlpcraftBuilder.java | 94 +++++++++++++++++++++-
.../nlpcraft/model/builders/NCModelBuilder.java | 39 ++++++---
.../model/builders/NCModelConfigBuilder.java | 52 ++++++------
.../org/apache/nlpcraft/rest/NCAskRequest.java | 53 ++++++++++++
.../org/apache/nlpcraft/rest/NCAskResponse.java | 20 +++++
.../org/apache/nlpcraft/rest/NCAskSyncRequest.java | 52 ++++++++++++
.../apache/nlpcraft/rest/NCAskSyncResponse.java | 22 +++++
.../org/apache/nlpcraft/rest/NCCancelRequest.java | 32 ++++++++
.../org/apache/nlpcraft/rest/NCCancelResponse.java | 32 ++++++++
pom.xml | 2 +
15 files changed, 616 insertions(+), 38 deletions(-)
diff --git a/nlpcraft-akka/pom.xml b/nlpcraft-akka/pom.xml
new file mode 100644
index 0000000..e20144f
--- /dev/null
+++ b/nlpcraft-akka/pom.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>nlpcraft-parent</artifactId>
+ <groupId>org.apache.nlpcraft</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>nlpcraft-akka</artifactId>
+ <properties>
+ <maven.compiler.source>11</maven.compiler.source>
+ <maven.compiler.target>11</maven.compiler.target>
+ </properties>
+</project>
\ No newline at end of file
diff --git a/nlpcraft-spring/pom.xml b/nlpcraft-spring/pom.xml
new file mode 100644
index 0000000..c314e54
--- /dev/null
+++ b/nlpcraft-spring/pom.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <name>NLPCraft Spring</name>
+ <artifactId>nlpcraft-spring</artifactId>
+ <parent>
+ <groupId>org.apache.nlpcraft</groupId>
+ <artifactId>nlpcraft-parent</artifactId>
+ <version>1.0.0</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <!-- Import dependency management from Spring Boot -->
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>2.5.5</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>nlpcraft</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ <version>2.5.5</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git
a/nlpcraft-spring/src/main/java/org/apache/nlpcraft/spring/NCNlpcraftController.java
b/nlpcraft-spring/src/main/java/org/apache/nlpcraft/spring/NCNlpcraftController.java
new file mode 100644
index 0000000..80790c4
--- /dev/null
+++
b/nlpcraft-spring/src/main/java/org/apache/nlpcraft/spring/NCNlpcraftController.java
@@ -0,0 +1,73 @@
+/*
+ * 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.spring;
+
+import org.apache.nlpcraft.rest.NCAskRequest;
+import org.apache.nlpcraft.rest.NCAskResponse;
+import org.apache.nlpcraft.rest.NCCancelResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.apache.nlpcraft.NCNlpcraft;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+@RequestMapping("/nlpcraft")
+public class NCNlpcraftController {
+ // TODO: + all validations for all requests.
+ private NCNlpcraft nlp;
+
+ public NCNlpcraftController(NCNlpcraft nlp) {
+ this.nlp = nlp;
+ }
+
+ @RequestMapping(path = "ask", method = RequestMethod.POST)
+ @ResponseBody
+ public NCAskResponse ask(@RequestBody NCAskRequest req) {
+ NCAskResponse resp = new NCAskResponse();
+
+ resp.setRequestId(nlp.ask(req.getTxt(), req.getData(),
req.isEnableLog(), req.getUserId()));
+
+ return resp;
+ }
+
+ @RequestMapping(path = "cancel", method = RequestMethod.POST)
+ @ResponseBody
+ public NCCancelResponse cancel(@RequestBody String reqId) {
+ nlp.cancelAll();
+
+ return new NCCancelResponse();
+ }
+
+ @PostConstruct
+ public void start() {
+ // TODO: add starts if necessary.
+ System.out.println("Controller started");
+ }
+
+ @PreDestroy
+ public void stop() {
+ // TODO: add stops if necessary.
+ }
+}
diff --git
a/nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/Application.java
b/nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/Application.java
new file mode 100644
index 0000000..0122930
--- /dev/null
+++ b/nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/Application.java
@@ -0,0 +1,77 @@
+/*
+ * 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.spring;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import org.apache.nlpcraft.NCNlpcraft;
+import org.apache.nlpcraft.NCNlpcraftBuilder;
+import org.apache.nlpcraft.model.NCModelConfig;
+import org.apache.nlpcraft.model.NCResult;
+import org.apache.nlpcraft.model.builders.NCModelBuilder;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import
org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+
+@SpringBootApplication
+public class Application {
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+ @Bean
+ public NCNlpcraftController getNCNlpcraftController(NCNlpcraft nlp) {
+ return new NCNlpcraftController(nlp);
+ }
+ // Read it from own configs.
+
+
+ @Bean
+ public NCModelConfig getModelConfig() {
+ return new NCModelConfig() {
+ @Override
+ public String getId() {
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ return null;
+ }
+
+ @Override
+ public String getVersion() {
+ return null;
+ }
+ };
+ }
+
+ @Bean
+ public NCNlpcraft getNlpCraft(NCModelConfig cfg) {
+ return new NCNlpcraftBuilder().
+ withModel(new NCModelBuilder().withConfig(cfg).getModel()).
+ getNlpcraft();
+ }
+}
diff --git a/nlpcraft-spring/src/test/resources/application.properties
b/nlpcraft-spring/src/test/resources/application.properties
new file mode 100644
index 0000000..395606e
--- /dev/null
+++ b/nlpcraft-spring/src/test/resources/application.properties
@@ -0,0 +1,21 @@
+#
+# 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.
+#
+
+server.port=8080
+logging.level.root=INFO
+
+# Add model configuration properties here.
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCNlpcraftBuilder.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCNlpcraftBuilder.java
index de3fa03..e38eb64 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCNlpcraftBuilder.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCNlpcraftBuilder.java
@@ -18,11 +18,16 @@
package org.apache.nlpcraft;
import org.apache.nlpcraft.model.NCModel;
+import org.apache.nlpcraft.model.NCResult;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
public class NCNlpcraftBuilder {
// There we can validate user prepared model.
public NCNlpcraftBuilder withModel(NCModel mdl) {
- return null;
+ return this;
}
// TODO: add deserialization component.
@@ -31,6 +36,91 @@ public class NCNlpcraftBuilder {
//}
public NCNlpcraft getNlpcraft() {
- return null;
+ return new NCNlpcraft() {
+ @Override
+ public String ask(String txt, Map<String, Object> data, boolean
enableLog, String userId) {
+ return "ask";
+ }
+
+ @Override
+ public String ask(String txt, String userId) {
+ return null;
+ }
+
+ @Override
+ public String ask(String txt) {
+ return null;
+ }
+
+ @Override
+ public NCResult askSync(String txt, Map<String, Object> data,
boolean enableLog, String userId) {
+ return null;
+ }
+
+ @Override
+ public NCResult askSync(String txt, String userId) {
+ return null;
+ }
+
+ @Override
+ public NCResult askSync(String txt) {
+ return null;
+ }
+
+ @Override
+ public List<NCResult> check(Collection<String> reqIds, int
maxRows) {
+ return null;
+ }
+
+ @Override
+ public List<NCResult> check(String userId, int maxRows) {
+ return null;
+ }
+
+ @Override
+ public NCResult check(String reqId) {
+ return null;
+ }
+
+ @Override
+ public void cancel(Collection<String> reqIds) {
+
+ }
+
+ @Override
+ public void cancel(String reqId) {
+
+ }
+
+ @Override
+ public void cancelAll(String userId) {
+
+ }
+
+ @Override
+ public void cancelAll() {
+
+ }
+
+ @Override
+ public void clearConversation(String userId) {
+
+ }
+
+ @Override
+ public void clearConversation() {
+
+ }
+
+ @Override
+ public void clearDialog(String userId) {
+
+ }
+
+ @Override
+ public void clearDialog() {
+
+ }
+ };
}
}
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 7f72fba..2910274 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
@@ -31,46 +31,65 @@ public class NCModelBuilder {
// Config.
public NCModelBuilder withConfig(NCModelConfig cfg) {
- return null;
+ return this;
}
// Behaviour.
public NCModelBuilder withBehaviour(NCModelBehaviour behaviour) {
- return null;
+ return this;
}
// Intents related methods:
// Static methods of given classes.
// Scanned for NCIntent, NCIntentRef, NCIntentSample, NCIntentSampleRef
public NCModelBuilder withIntentsClasses(List<Class<?>> classes) {
- return null;
+ return this;
}
// Methods of given instances.
// Scanned for NCIntent, NCIntentRef, NCIntentSample, NCIntentSampleRef
public NCModelBuilder withIntentsObjects(List<Object> objs) {
- return null;
+ return this;
}
// Manually defined intents.
// Code in classes and objects can have references on defined below
intents and samples and via NCIntentRef and NCIntentSampleRef.
public NCModelBuilder withIntents(List<String> objs) {
- return null;
+ return this;
}
public NCModelBuilder withIntentsSamples(Map<String, List<List<String>>>
map) {
- return null;
+ return this;
}
// Files only for intents, not for samples ?
public NCModelBuilder withIntentsFromFiles(List<File> objs) {
- return null;
+ return this;
}
public NCModelBuilder withIntentsFromUrls(List<URL> objs) {
- return null;
+ return this;
}
-
public NCModel getModel() {
- return null;
+ return new NCModel() {
+ @Override
+ public NCModelBehaviour getModelBehaviour() {
+ return null;
+ }
+
+ @Override
+ public NCModelConfig getConfig() {
+ return null;
+ }
+
+ @Override
+ public void start() {
+
+ }
+
+ @Override
+ public void stop() {
+
+ }
+ };
}
}
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 d20dabe..d7e5e41 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
@@ -32,66 +32,66 @@ import java.util.function.Function;
public class NCModelConfigBuilder {
// 1. Common properties.
public NCModelConfigBuilder withId(String description) {
- return null;
+ return this;
} // Mandatory.
public NCModelConfigBuilder withName(String description) {
- return null;
+ return this;
}
public NCModelConfigBuilder withDescription(String description) {
- return null;
+ return this;
}
public NCModelConfigBuilder withOrigin(String origin) {
- return null;
+ return this;
}
public NCModelConfigBuilder withMaxUnknownWords(int maxUnknownWords) {
- return null;
+ return this;
}
public NCModelConfigBuilder withMaxFreeWords(int maxFreeWords) {
- return null;
+ return this;
}
public NCModelConfigBuilder withMaxSuspiciousWords(int maxSuspiciousWords)
{
- return null;
+ return this;
}
public NCModelConfigBuilder withMinWords(int minWords) {
- return null;
+ return this;
}
public NCModelConfigBuilder withMaxWords(int maxWords) {
- return null;
+ return this;
}
public NCModelConfigBuilder withMinTokens(int minTokens) {
- return null;
+ return this;
}
public NCModelConfigBuilder withMaxTokens(int maxTokens) {
- return null;
+ return this;
}
public NCModelConfigBuilder withMinNonStopwords(int minNonStopwords) {
- return null;
+ return this;
}
public NCModelConfigBuilder withSwearWordsAllowed(boolean
swearWordsAllowed) {
- return null;
+ return this;
}
public NCModelConfigBuilder withNoNounsAllowed(boolean noNounsAllowed) {
- return null;
+ return this;
}
// TODO? do we need it?
public NCModelConfigBuilder withNoUserTokensAllowed(boolean
noUserTokensAllowed) {
- return null;
+ return this;
}
- public NCModelConfigBuilder withConversationTimeout(long
conversationTimeout) { return null; }
- public NCModelConfigBuilder withConversationDepth(int conversationDepth) {
return null; }
+ public NCModelConfigBuilder withConversationTimeout(long
conversationTimeout) { return this; }
+ public NCModelConfigBuilder withConversationDepth(int conversationDepth) {
return this; }
public NCModelConfigBuilder withMetadata(Map<String, Object> meta) {
- return null;
+ return this;
}
// 2. Words - for built stop/swear EN detection. (Suspicious via
dictionary)
public NCModelConfigBuilder withAdditionalStopWords(Set<String>
additionalStopWords) {
- return null;
+ return this;
}
public NCModelConfigBuilder withExcludedStopWords(Set<String>
excludedStopWords) {
- return null;
+ return this;
}
public NCModelConfigBuilder withSuspiciousWords(Set<String>
suspiciousWords) {
- return null;
+ return this;
}
// TODO: discucc - Alternative - 3 custom words free implementation
support - discuss it.
@@ -99,23 +99,23 @@ public class NCModelConfigBuilder {
// 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;
+ return this;
}
public NCModelConfigBuilder withSwearWordsFilter(Function<List<NCNlpWord>,
List<NCNlpWord>> finder) {
- return null;
+ return this;
}
public NCModelConfigBuilder
withSuspiciousWordsFilter(Function<List<NCNlpWord>, List<NCNlpWord>> finder) {
- return null;
+ return this;
}
// 3. Base Nlp parser (open nlp - default, stanford)
public NCModelConfigBuilder withTokenizer(NCNlpTokenizer parser) {
- return null;
+ return this;
}
// 4. NER parsers (open nlp - default, stanford, our one built parser
NCDefaultNerParser + any custom)
public NCModelConfigBuilder withNerParsers(List<NCNlpNerParser> parsers) {
- return null;
+ return this;
}
public NCModelConfig getConfig() {
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/rest/NCAskRequest.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/rest/NCAskRequest.java
new file mode 100644
index 0000000..120c11d
--- /dev/null
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/rest/NCAskRequest.java
@@ -0,0 +1,53 @@
+package org.apache.nlpcraft.rest;
+
+import java.util.Map;
+
+public class NCAskRequest {
+ // TODO: add all validations.
+ public String txt;
+ public Map<String, Object> data;
+ public boolean enableLog;
+ public String userId;
+
+ public String getTxt() {
+ return txt;
+ }
+
+ public void setTxt(String txt) {
+ this.txt = txt;
+ }
+
+ public Map<String, Object> getData() {
+ return data;
+ }
+
+ public void setData(Map<String, Object> data) {
+ this.data = data;
+ }
+
+ public boolean isEnableLog() {
+ return enableLog;
+ }
+
+ public void setEnableLog(boolean enableLog) {
+ this.enableLog = enableLog;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ @Override
+ public String toString() {
+ return "NCAskRequest{" +
+ "txt='" + txt + '\'' +
+ ", data=" + data +
+ ", enableLog=" + enableLog +
+ ", userId='" + userId + '\'' +
+ '}';
+ }
+}
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/rest/NCAskResponse.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/rest/NCAskResponse.java
new file mode 100644
index 0000000..29538d6
--- /dev/null
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/rest/NCAskResponse.java
@@ -0,0 +1,20 @@
+package org.apache.nlpcraft.rest;
+
+public class NCAskResponse {
+ private String requestId;
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ @Override
+ public String toString() {
+ return "NCAskResponse{" +
+ "requestId='" + requestId + '\'' +
+ '}';
+ }
+}
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/rest/NCAskSyncRequest.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/rest/NCAskSyncRequest.java
new file mode 100644
index 0000000..4a1917a
--- /dev/null
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/rest/NCAskSyncRequest.java
@@ -0,0 +1,52 @@
+package org.apache.nlpcraft.rest;
+
+import java.util.Map;
+
+public class NCAskSyncRequest {
+ private String txt;
+ private Map<String, Object> data;
+ private boolean enableLog;
+ private String userId;
+
+ public String getTxt() {
+ return txt;
+ }
+
+ public void setTxt(String txt) {
+ this.txt = txt;
+ }
+
+ public Map<String, Object> getData() {
+ return data;
+ }
+
+ public void setData(Map<String, Object> data) {
+ this.data = data;
+ }
+
+ public boolean isEnableLog() {
+ return enableLog;
+ }
+
+ public void setEnableLog(boolean enableLog) {
+ this.enableLog = enableLog;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ @Override
+ public String toString() {
+ return "NCAskSyncRequest{" +
+ "txt='" + txt + '\'' +
+ ", data=" + data +
+ ", enableLog=" + enableLog +
+ ", userId='" + userId + '\'' +
+ '}';
+ }
+}
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/rest/NCAskSyncResponse.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/rest/NCAskSyncResponse.java
new file mode 100644
index 0000000..c13109c
--- /dev/null
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/rest/NCAskSyncResponse.java
@@ -0,0 +1,22 @@
+package org.apache.nlpcraft.rest;
+
+import org.apache.nlpcraft.model.NCResult;
+
+public class NCAskSyncResponse {
+ private NCResult result;
+
+ public NCResult getResult() {
+ return result;
+ }
+
+ public void setResult(NCResult result) {
+ this.result = result;
+ }
+
+ @Override
+ public String toString() {
+ return "NCAskSyncResponse{" +
+ "result=" + result +
+ '}';
+ }
+}
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/rest/NCCancelRequest.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/rest/NCCancelRequest.java
new file mode 100644
index 0000000..f50249a
--- /dev/null
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/rest/NCCancelRequest.java
@@ -0,0 +1,32 @@
+package org.apache.nlpcraft.rest;
+
+import java.util.Collection;
+
+public class NCCancelRequest {
+ private Collection<String> reqIds;
+ private String userId;
+
+ public Collection<String> getReqIds() {
+ return reqIds;
+ }
+
+ public void setReqIds(Collection<String> reqIds) {
+ this.reqIds = reqIds;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ @Override
+ public String toString() {
+ return "NCCancelRequest{" +
+ "reqIds=" + reqIds +
+ ", userId='" + userId + '\'' +
+ '}';
+ }
+}
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/rest/NCCancelResponse.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/rest/NCCancelResponse.java
new file mode 100644
index 0000000..c175d3c
--- /dev/null
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/rest/NCCancelResponse.java
@@ -0,0 +1,32 @@
+package org.apache.nlpcraft.rest;
+
+import java.util.Collection;
+
+public class NCCancelResponse {
+ private Collection<String> reqIds;
+ private String userId;
+
+ public Collection<String> getReqIds() {
+ return reqIds;
+ }
+
+ public void setReqIds(Collection<String> reqIds) {
+ this.reqIds = reqIds;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ @Override
+ public String toString() {
+ return "NCCancelResponse{" +
+ "reqIds=" + reqIds +
+ ", userId='" + userId + '\'' +
+ '}';
+ }
+}
diff --git a/pom.xml b/pom.xml
index 6210045..d1662dc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,6 +40,8 @@
<modules>
<module>nlpcraft</module>
+ <module>nlpcraft-spring</module>
+ <module>nlpcraft-akka</module>
</modules>
<developers>