You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by if...@apache.org on 2020/12/22 02:43:04 UTC

[incubator-nlpcraft] branch NLPCRAFT-91 updated (ccfaff1 -> 2f6e032)

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

ifropc pushed a change to branch NLPCRAFT-91
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git.


 discard ccfaff1  NLPCRAFT-91: Initial model for weather command
     new 2f6e032  NLPCRAFT-91: Initial model for weather command

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (ccfaff1)
            \
             N -- N -- N   refs/heads/NLPCRAFT-91 (2f6e032)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/kotlin/org/apache/nlpcraft/example/MinecraftModel.kt       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


[incubator-nlpcraft] 01/01: NLPCRAFT-91: Initial model for weather command

Posted by if...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ifropc pushed a commit to branch NLPCRAFT-91
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git

commit 2f6e03233391a31d0184868e422f377c02c5e457
Author: Ifropc <if...@apache.org>
AuthorDate: Sun Dec 20 23:25:17 2020 -0800

    NLPCRAFT-91: Initial model for weather command
---
 .../org/apache/nlpcraft/example/MinecraftModel.kt  | 19 ++----
 .../src/main/resources/minecraft.yaml              | 48 +++++++++----
 nlpcraft-examples/src/main/resources/nlpcraft.conf | 78 ++++++++++++++++++++++
 3 files changed, 121 insertions(+), 24 deletions(-)

diff --git a/nlpcraft-examples/src/main/kotlin/org/apache/nlpcraft/example/MinecraftModel.kt b/nlpcraft-examples/src/main/kotlin/org/apache/nlpcraft/example/MinecraftModel.kt
index 4f5593f..76cedd9 100644
--- a/nlpcraft-examples/src/main/kotlin/org/apache/nlpcraft/example/MinecraftModel.kt
+++ b/nlpcraft-examples/src/main/kotlin/org/apache/nlpcraft/example/MinecraftModel.kt
@@ -21,18 +21,13 @@ package org.apache.nlpcraft.example
 import org.apache.nlpcraft.model.*
 
 class MinecraftModel : NCModelFileAdapter("minecraft.yaml") {
+    @NCIntentRef("weatherIntent")
+    @Suppress("unused")
+    fun onMatch(ctx: NCIntentMatch, @NCIntentTerm("arg") tok: NCToken): NCResult {
+        if (ctx.isAmbiguous) {
+            throw NCRejection("Ambiguous request")
+        }
 
-    @NCIntentRef("intentId")
-    fun onMatch(ctx: NCIntentMatch, @NCIntentTerm("element") tok: NCToken): NCResult {
-        // TODO: add the actual intent logic here.
-
-        // As a placeholder - just return an echo string.
-        return NCResult.text(
-            String.format(
-                "Word `%s` found in text: `%s`",
-                tok.originalText,
-                ctx.context.request.normalizedText
-            )
-        )
+        return NCResult.text("weather ${tok.id}")
     }
 }
diff --git a/nlpcraft-examples/src/main/resources/minecraft.yaml b/nlpcraft-examples/src/main/resources/minecraft.yaml
index 0306294..872bf90 100644
--- a/nlpcraft-examples/src/main/resources/minecraft.yaml
+++ b/nlpcraft-examples/src/main/resources/minecraft.yaml
@@ -1,21 +1,45 @@
-# Mandatory model configuration.
-id: minecraft
+#
+# 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.
+#
+
+id: nlpcraft.minecraft.ex
 name: Minecraft Model
 version: '1.0'
 description: Minecraft Model.
 
-# List of macros, if any.
-macros:
-  - name: "<MY_MACRO>"
-    macro: "{word1|word2}"
-
-# List of model elements.
 elements:
-  - id: elementId
-    description: An element.
+  - id: rain
+    description: Set rain weather
+    groups:
+      - weather
+    synonyms:
+      - "{rain|rainy}"
+  - id: sun
+    description: Set sunny weather
+    groups:
+      - weather
+    synonyms:
+      - "{sun|sunny|clear sky}"
+  - id: storm
+    description: Set stormy weather
+    groups:
+      - weather
     synonyms:
-      - "{some|*} <MY_MACRO>"
+      - "{thunder|storm|stormy}"
 
 # List of model intents.
 intents:
-  - intent=intentId term(element)={id == 'elementId'}
+  - intent=weatherIntent term(arg)={groups @@ 'weather'}
diff --git a/nlpcraft-examples/src/main/resources/nlpcraft.conf b/nlpcraft-examples/src/main/resources/nlpcraft.conf
new file mode 100644
index 0000000..f9b4a44
--- /dev/null
+++ b/nlpcraft-examples/src/main/resources/nlpcraft.conf
@@ -0,0 +1,78 @@
+#
+# 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.
+#
+
+nlpcraft {
+    server {
+        lifecycle = ""
+        database {
+            jdbc {
+                url = "jdbc:ignite:thin://127.0.0.1/nlpcraft"
+                driver = org.apache.ignite.IgniteJdbcThinDriver
+            }
+            igniteDbInitialize = false
+            c3p0 {
+                maxStatements = 180
+                pool {
+                    initSize = 10
+                    minSize = 1
+                    maxSize = 50
+                    acquireIncrement = 2
+                }
+            }
+        }
+        rest {
+            host = "0.0.0.0"
+            port = 8081
+            apiImpl = "org.apache.nlpcraft.server.rest.NCBasicRestApi"
+        }
+        user {
+            pwdPoolBlowup = 3
+            timeoutScannerFreqMins = 1
+            accessTokenExpireTimeoutMins = 60
+        }
+        probe {
+            links {
+                upLink = "0.0.0.0:8201" # Server to probe data pipe.
+                downLink = "0.0.0.0:8202" # Probe to server data pipe.
+            }
+            pingTimeoutMs = 2000
+            soTimeoutMs = 5000
+            reconnectTimeoutMs = 5000
+        }
+        datesFormatStyle = MDY
+        tokenProviders = "nlpcraft"
+        ctxword.url="http://localhost:5000"
+    }
+
+    nlpEngine = "opennlp"
+
+    extConfig {
+        extUrl = "https://github.com/apache/incubator-nlpcraft/raw/master/external"
+        checkMd5 = true
+    }
+    probe {
+        id = "extended.examples"
+        token = "3141592653589793"
+        upLink = "0.0.0.0:8201"   # Server to probe data pipe.
+        downLink = "0.0.0.0:8202" # Probe to server data pipe.
+        jarsFolder = null
+        models =
+            """org.apache.nlpcraft.example.MinecraftModel"""
+        lifecycle = ""
+        resultMaxSizeBytes = 1048576
+    }
+}