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 939ba87 WIP.
939ba87 is described below
commit 939ba875705f1f0be228c40002e9fa1274391152
Author: Sergey Kamov <[email protected]>
AuthorDate: Tue Oct 12 16:23:05 2021 +0300
WIP.
---
.../org/apache/nlpcraft/spring/Application.java | 90 ----------------------
.../nlpcraft/spring/NlpCraftApplication.java | 36 +++++++++
.../org/apache/nlpcraft/spring/NlpCraftConfig.java | 57 ++++++++++++++
3 files changed, 93 insertions(+), 90 deletions(-)
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
deleted file mode 100644
index b6d011e..0000000
--- a/nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/Application.java
+++ /dev/null
@@ -1,90 +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.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.beans.factory.annotation.Value;
-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.Arrays;
-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);
- }
-
- @Bean
- public NCModelConfig getModelConfig(
- @Value("${model.id}") String mdlId,
- @Value("${model.name}") String mdlName,
- @Value("${model.version}") String mdlVersion
- ) {
- return new NCModelConfig() {
- @Override
- public String getId() {
- return mdlId;
- }
-
- @Override
- public String getName() {
- return mdlName;
- }
-
- @Override
- public String getVersion() {
- return mdlVersion;
- }
- };
- }
-
- @Bean
- public NCNlpcraft getNlpCraft(
- NCModelConfig cfg,
- @Value("${intent.1}") String intent1,
- @Value("${intent.2}") String intent2
- ) {
- return new NCNlpcraftBuilder().
- withModel(
- new NCModelBuilder().
- withConfig(cfg).
- withIntents(Arrays.asList(intent1, intent2)).
- getModel()
- ).
- getNlpcraft();
- }
-}
diff --git
a/nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/NlpCraftApplication.java
b/nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/NlpCraftApplication.java
new file mode 100644
index 0000000..4dbb635
--- /dev/null
+++
b/nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/NlpCraftApplication.java
@@ -0,0 +1,36 @@
+/*
+ * 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.NCNlpcraft;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@SpringBootApplication
+public class NlpCraftApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(NlpCraftApplication.class, args);
+ }
+
+ @Bean
+ public NCNlpcraftController getNCNlpcraftController(NCNlpcraft nlp) {
+ return new NCNlpcraftController(nlp);
+ }
+}
diff --git
a/nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/NlpCraftConfig.java
b/nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/NlpCraftConfig.java
new file mode 100644
index 0000000..935f21e
--- /dev/null
+++
b/nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/NlpCraftConfig.java
@@ -0,0 +1,57 @@
+package org.apache.nlpcraft.spring;
+
+import org.apache.nlpcraft.NCNlpcraft;
+import org.apache.nlpcraft.NCNlpcraftBuilder;
+import org.apache.nlpcraft.model.NCModel;
+import org.apache.nlpcraft.model.NCModelConfig;
+import org.apache.nlpcraft.model.builders.NCModelBuilder;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.Arrays;
+
+@Configuration
+public class NlpCraftConfig {
+ @Bean
+ public NCModelConfig getModelConfig(
+ @Value("${model.id}") String mdlId,
+ @Value("${model.name}") String mdlName,
+ @Value("${model.version}") String mdlVersion
+ ) {
+ return new NCModelConfig() {
+ @Override
+ public String getId() {
+ return mdlId;
+ }
+
+ @Override
+ public String getName() {
+ return mdlName;
+ }
+
+ @Override
+ public String getVersion() {
+ return mdlVersion;
+ }
+ };
+ }
+
+ @Bean
+ public NCModel getModel(
+ NCModelConfig cfg,
+ @Value("${intent.1}") String intent1,
+ @Value("${intent.2}") String intent2
+ ) {
+ return
+ new NCModelBuilder().
+ withConfig(cfg).
+ withIntents(Arrays.asList(intent1, intent2)).
+ getModel();
+ }
+
+ @Bean
+ public NCNlpcraft getNlpCraft(NCModel mdl) {
+ return new NCNlpcraftBuilder().withModel(mdl).getNlpcraft();
+ }
+}