This is an automated email from the ASF dual-hosted git repository.
sergeykamov 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 52d2077 WIP.
new f90c651 Merge remote-tracking branch 'origin/master'
52d2077 is described below
commit 52d2077a160d42b1fbeea69d2c16270d61f903e1
Author: Sergey Kamov <[email protected]>
AuthorDate: Tue Feb 22 00:48:10 2022 +0300
WIP.
---
nlpcraft-examples/echo/README.md | 50 ----------------
nlpcraft-examples/echo/pom.xml | 70 ----------------------
.../apache/nlpcraft/examples/echo/EchoModel.scala | 64 --------------------
.../examples/echo/NCModelValidationSpec.scala | 38 ------------
nlpcraft-examples/helloworld/README.md | 48 ---------------
nlpcraft-examples/helloworld/pom.xml | 70 ----------------------
.../examples/helloworld/HelloWorldModel.java | 52 ----------------
.../helloworld/NCModelValidationSpec.scala | 36 -----------
pom.xml | 2 -
9 files changed, 430 deletions(-)
diff --git a/nlpcraft-examples/echo/README.md b/nlpcraft-examples/echo/README.md
deleted file mode 100644
index 5be9ca2..0000000
--- a/nlpcraft-examples/echo/README.md
+++ /dev/null
@@ -1,50 +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.
--->
-
-<img src="https://nlpcraft.apache.org/images/nlpcraft_logo_black.gif"
height="80px">
-<br>
-
-[](https://raw.githubusercontent.com/apache/opennlp/master/LICENSE)
-[](https://github.com/apache/incubator-nlpcraft/actions)
-[](https://nlpcraft.apache.org/docs.html)
-[](https://gitter.im/apache-nlpcraft/community)
-
-### Echo Example
-For any user input this Scala-based example model returns JSON representation
of the query
-context corresponding to that input. This is a simple demonstration of the
-JSON output and of most of the NLPCraft-provided data that a user defined
model
-can operate on. This example can be useful during the development to see what
-object properties are available.
-
-### Documentation
-See [Getting Started](https://nlpcraft.apache.org/getting-started.html) guide
for more instructions on how to run these examples.
-
-For any questions, feedback or suggestions:
-
- * View & run other
[examples](https://github.com/apache/incubator-nlpcraft/tree/master/nlpcraft-examples)
- * Read [documentation](https://nlpcraft.apache.org/docs.html), latest
[Javadoc](https://nlpcraft.apache.org/apis/latest/index.html) and [REST
APIs](https://nlpcraft.apache.org/using-rest.html) * Download &
Maven/Grape/Gradle/SBT [instructions](https://nlpcraft.apache.org/download.html)
- * File a bug or improvement in
[JIRA](https://issues.apache.org/jira/projects/NLPCRAFT)
- * Post a question at [Stack
Overflow](https://stackoverflow.com/questions/ask) using <code>nlpcraft</code>
tag
- * Access [GitHub](https://github.com/apache/incubator-nlpcraft) mirror
repository.
- * Join project developers on
[[email protected]](mailto:[email protected])
-
-### Copyright
-Copyright (C) 2021 Apache Software Foundation
-
-<img src="https://www.apache.org/img/ASF20thAnniversary.jpg" height="64px"
alt="ASF Logo">
-
-
diff --git a/nlpcraft-examples/echo/pom.xml b/nlpcraft-examples/echo/pom.xml
deleted file mode 100644
index a37ed11..0000000
--- a/nlpcraft-examples/echo/pom.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?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:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
- 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 Example Echo</name>
- <artifactId>nlpcraft-example-echo</artifactId>
-
- <parent>
- <artifactId>nlpcraft-parent</artifactId>
- <groupId>org.apache.nlpcraft</groupId>
- <version>1.0.0</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>nlpcraft</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- Test dependencies. -->
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>nlpcraft</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>${maven.compiler.plugin.ver}</version>
- <configuration>
- <source>${java.ver}</source>
- <target>${java.ver}</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
diff --git
a/nlpcraft-examples/echo/src/main/java/org/apache/nlpcraft/examples/echo/EchoModel.scala
b/nlpcraft-examples/echo/src/main/java/org/apache/nlpcraft/examples/echo/EchoModel.scala
deleted file mode 100644
index b824cab..0000000
---
a/nlpcraft-examples/echo/src/main/java/org/apache/nlpcraft/examples/echo/EchoModel.scala
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.apache.nlpcraft.examples.echo
-
-/*
- * 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.
- */
-
-import com.google.gson.Gson
-import org.apache.nlpcraft.*
-import org.apache.nlpcraft.nlp.entity.parser.nlp.NCNLPEntityParser
-import org.apache.nlpcraft.nlp.token.parser.opennlp.NCOpenNLPTokenParser
-
-import java.util
-
-/**
- * Echo example data model.
- * <p>
- * For any user input this example returns JSON representation of the query
context
- * corresponding to that input. This is a simple demonstration of the JSON
output
- * and of most of the NLPCraft-provided data that a user defined model can
operate on.
- * <p>
- * This example doesn't define a model and simply implements `onContext(...)`
callback
- * method with a necessary logic.
- * <p>
- * See `README.md` file in the same folder for running instructions.
- */
-class EchoModel(tokMdlSrc: String, posMdlSrc: String, lemmaDicSrc: String)
extends NCModelAdapter(
- new NCModelConfig("nlpcraft.echo.ex", "Echo Example Model", "1.0"),
- new NCModelPipelineBuilder(
- new NCOpenNLPTokenParser(tokMdlSrc, posMdlSrc, lemmaDicSrc),
- new NCNLPEntityParser() // TODO: Required at least one parser.
- ).build()
-):
- override def onContext(ctx: NCContext): NCResult =
- val req = ctx.getRequest
-
- val sm = new util.HashMap[String, Any]()
- sm.put("normalizedText", req.getText)
- sm.put("srvReqId", req.getRequestId)
- sm.put("receiveTimestamp", req.getReceiveTimestamp)
- sm.put("isUserAdmin", req.getUserId)
- sm.put("variants", ctx.getVariants)
-
- val map = new util.HashMap[String, Any]()
- map.put("srvReqId", ctx.getRequest.getRequestId)
- map.put("sentence", sm)
-
- val res = new NCResult()
- res.setType(NCResultType.ASK_RESULT)
- res.setBody(new Gson().toJson(map))
-
- res
\ No newline at end of file
diff --git
a/nlpcraft-examples/echo/src/test/java/org/apache/nlpcraft/examples/echo/NCModelValidationSpec.scala
b/nlpcraft-examples/echo/src/test/java/org/apache/nlpcraft/examples/echo/NCModelValidationSpec.scala
deleted file mode 100644
index 704a3f3..0000000
---
a/nlpcraft-examples/echo/src/test/java/org/apache/nlpcraft/examples/echo/NCModelValidationSpec.scala
+++ /dev/null
@@ -1,38 +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.examples.echo
-
-import org.apache.nlpcraft.*
-import org.apache.nlpcraft.nlp.entity.parser.nlp.NCNLPEntityParser
-import org.apache.nlpcraft.nlp.token.parser.opennlp.NCOpenNLPTokenParser
-import org.junit.jupiter.api.*
-
-import scala.util.Using
-
-/**
- * JUnit model validation.
- */
-class NCModelValidationSpec:
- private val MDL = new EchoModel(
- "opennlp/en-token.bin",
- "opennlp/en-pos-maxent.bin",
- "opennlp/en-lemmatizer.dict"
- )
-
- @Test
- def test(): Unit = Using.resource(new NCModelClient(MDL)) { client =>
client.ask("It is example", null, "userId") }
diff --git a/nlpcraft-examples/helloworld/README.md
b/nlpcraft-examples/helloworld/README.md
deleted file mode 100644
index 8785c07..0000000
--- a/nlpcraft-examples/helloworld/README.md
+++ /dev/null
@@ -1,48 +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.
--->
-
-<img src="https://nlpcraft.apache.org/images/nlpcraft_logo_black.gif"
height="80px" alt="">
-<br>
-
-[](https://raw.githubusercontent.com/apache/opennlp/master/LICENSE)
-[](https://github.com/apache/incubator-nlpcraft/actions)
-[](https://nlpcraft.apache.org/docs.html)
-[](https://gitter.im/apache-nlpcraft/community)
-
-### HelloWorld Example
-This trivial example simply responds with 'Hello World!' on any user input.
-This is the simplest user model that can be defined.
-
-### Documentation
-See [Getting Started](https://nlpcraft.apache.org/getting-started.html) guide
for more instructions on how to run these examples.
-
-For any questions, feedback or suggestions:
-
- * View & run other
[examples](https://github.com/apache/incubator-nlpcraft/tree/master/nlpcraft-examples)
- * Read [documentation](https://nlpcraft.apache.org/docs.html), latest
[Javadoc](https://nlpcraft.apache.org/apis/latest/index.html) and [REST
APIs](https://nlpcraft.apache.org/using-rest.html)
- * Download & Maven/Grape/Gradle/SBT
[instructions](https://nlpcraft.apache.org/download.html)
- * File a bug or improvement in
[JIRA](https://issues.apache.org/jira/projects/NLPCRAFT)
- * Post a question at [Stack
Overflow](https://stackoverflow.com/questions/ask) using <code>nlpcraft</code>
tag
- * Access [GitHub](https://github.com/apache/incubator-nlpcraft) mirror
repository.
- * Join project developers on
[[email protected]](mailto:[email protected])
-
-### Copyright
-Copyright (C) 2021 Apache Software Foundation
-
-<img src="https://www.apache.org/img/ASF20thAnniversary.jpg" height="64px"
alt="ASF Logo">
-
-
diff --git a/nlpcraft-examples/helloworld/pom.xml
b/nlpcraft-examples/helloworld/pom.xml
deleted file mode 100644
index ec4e122..0000000
--- a/nlpcraft-examples/helloworld/pom.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?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:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
- 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 Example Hello World</name>
- <artifactId>nlpcraft-example-helloworld</artifactId>
-
- <parent>
- <artifactId>nlpcraft-parent</artifactId>
- <groupId>org.apache.nlpcraft</groupId>
- <version>1.0.0</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>nlpcraft</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- Test dependencies. -->
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>nlpcraft</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>${maven.compiler.plugin.ver}</version>
- <configuration>
- <source>${java.ver}</source>
- <target>${java.ver}</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
diff --git
a/nlpcraft-examples/helloworld/src/main/java/org/apache/nlpcraft/examples/helloworld/HelloWorldModel.java
b/nlpcraft-examples/helloworld/src/main/java/org/apache/nlpcraft/examples/helloworld/HelloWorldModel.java
deleted file mode 100644
index ff24105..0000000
---
a/nlpcraft-examples/helloworld/src/main/java/org/apache/nlpcraft/examples/helloworld/HelloWorldModel.java
+++ /dev/null
@@ -1,52 +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.examples.helloworld;
-
-import org.apache.nlpcraft.*;
-import org.apache.nlpcraft.nlp.entity.parser.nlp.NCNLPEntityParser;
-import org.apache.nlpcraft.nlp.token.parser.opennlp.NCOpenNLPTokenParser;
-
-/**
- * Hello World example data model.
- * <p>
- * This trivial example simply responds with 'Hello World!' on any user input.
- * This is the simplest user model that can be defined.
- * <p>
- * See 'README.md' file in the same folder for running and testing
instructions.
- */
-public class HelloWorldModel extends NCModelAdapter {
- public HelloWorldModel(String tokMdlSrc, String posMdlSrc, String
lemmaDicSrc) {
- super(
- new NCModelConfig("nlpcraft.helloworld.ex", "HelloWorld Example
Model", "1.0"),
- new NCModelPipelineBuilder(
- new NCOpenNLPTokenParser(tokMdlSrc, posMdlSrc, lemmaDicSrc),
- new NCNLPEntityParser() // TODO: Required at least one parser.
- ).build()
- );
- }
-
- @Override
- public NCResult onContext(NCContext ctx) {
- NCResult res = new NCResult();
-
- res.setType(NCResultType.ASK_RESULT);
- res.setBody("Hello World! This model returns the same result for any
input...");
-
- return res;
- }
-}
\ No newline at end of file
diff --git
a/nlpcraft-examples/helloworld/src/test/java/org/apache/nlpcraft/examples/helloworld/NCModelValidationSpec.scala
b/nlpcraft-examples/helloworld/src/test/java/org/apache/nlpcraft/examples/helloworld/NCModelValidationSpec.scala
deleted file mode 100644
index 573e8d2..0000000
---
a/nlpcraft-examples/helloworld/src/test/java/org/apache/nlpcraft/examples/helloworld/NCModelValidationSpec.scala
+++ /dev/null
@@ -1,36 +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.examples.helloworld
-
-import org.apache.nlpcraft.*
-import org.junit.jupiter.api.*
-
-import scala.util.Using
-
-/**
- * JUnit model validation.
- */
-class NCModelValidationSpec:
- private val MDL = new HelloWorldModel(
- "opennlp/en-token.bin",
- "opennlp/en-pos-maxent.bin",
- "opennlp/en-lemmatizer.dict"
- )
-
- @Test
- def test(): Unit = Using.resource(new NCModelClient(MDL)) { client =>
client.ask("It is example", null, "userId") }
diff --git a/pom.xml b/pom.xml
index ade79d9..a28c829 100644
--- a/pom.xml
+++ b/pom.xml
@@ -390,8 +390,6 @@
<id>examples</id>
<modules>
<module>nlpcraft-examples/utils</module>
- <module>nlpcraft-examples/echo</module>
- <module>nlpcraft-examples/helloworld</module>
<module>nlpcraft-examples/lightswitch</module>
<module>nlpcraft-examples/time</module>
<module>nlpcraft-examples/weather</module>