You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by ar...@apache.org on 2021/01/15 00:39:26 UTC

[incubator-nlpcraft-website] branch master updated: Update.

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-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 12950cf  Update.
12950cf is described below

commit 12950cf4c7745ff34ff538d409dee08db48fa38d
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Thu Jan 14 16:39:14 2021 -0800

    Update.
---
 cheat-sheet.html                  |   7 ++-
 download.html                     |   4 +-
 first-example.html                | 124 ++++++++++++++++++++++++++++++++++----
 installation.html                 |   2 +-
 intent-matching.html              |   2 +-
 relnotes/release-notes-0.7.0.html |   2 +-
 server-and-probe.html             |   4 +-
 7 files changed, 123 insertions(+), 22 deletions(-)

diff --git a/cheat-sheet.html b/cheat-sheet.html
index adcf039..ebd714f 100644
--- a/cheat-sheet.html
+++ b/cheat-sheet.html
@@ -236,11 +236,12 @@ id: cheat_sheet
         <div class="tab-content">
             <div class="tab-pane fade show active" id="nav-probe-script" role="tabpanel">
                 <pre class="brush: bash">
-                    $ bin/nlpcraft.sh start-probe # Start probe.
+                    $ bin/nlpcraft.sh start-probe # Start probe with default config.
+                    $ bin/nlpcraft.sh start-probe --cfg=~/myapp/nlpcraft.conf --mdls=my.package.Model --cp=~/myapp/target/classes --jmvOpts="-ea -Xms2048m" --timeoutMins=5
                 </pre>
                 <pre class="brush: bash">
-                    $ bin/nlpcraft.sh stop-probe # Start probe.
-                    $ bin/nlpcraft.sh stop # Start server and probe.
+                    $ bin/nlpcraft.sh stop-probe # Stop probe.
+                    $ bin/nlpcraft.sh stop # Stop server and probe.
                 </pre>
                 <p>
                     <b>NOTES:</b>
diff --git a/download.html b/download.html
index b6c50a1..d0c91ec 100644
--- a/download.html
+++ b/download.html
@@ -99,10 +99,10 @@ layout: interior
             </table>
             <div class="bq warn">
                 <p>
-                    <b>NLPCraft v0.7.0+ requires JDK 11 or newer</b>
+                    <b>NLPCraft v0.7.0+ requires JDK 11</b>
                 </p>
                 <p>
-                    Starting with version <b>0.7.0</b> NLPCraft requires JDK 11+ to compile and run. All development
+                    Starting with version <b>0.7.0</b> NLPCraft requires JDK 11 to compile and run. All development
                     and testing is done on JDK 11 and Scala 2.12. Prior versions only supported JDK 8.
                 </p>
             </div>
diff --git a/first-example.html b/first-example.html
index bc5c4af..b7eac9c 100644
--- a/first-example.html
+++ b/first-example.html
@@ -33,18 +33,15 @@ id: first_example
             or <code>"Could you please switch off all the lights?"</code>.
         </p>
         <p>
-            Let's setup a project for our first example with the following assumptions:
+            NOTE: for this example we'll use Scala and Linux, however, the example works exactly the same
+            way with any other JVM language or operating system.
         </p>
-        <ul>
-            <li>We'll use Mac OS/Linux environment.</li>
-            <li>We'll use Scala/Maven to implement our model - any JVM language works identically.</li>
-            <li>We'll use <a href="/tools/script.html"><code>nlpcraft.sh</code></a> to manage our project's runtime.</li>
-        </ul>
     </section>
     <section id="new_project">
         <h3 class="section-title">New Project</h3>
         <p>
-            Run <code>nlpcraft.sh</code> script from NLPCraft installation directory to create a new project stub (the script is located in <code>bin</code> sub-directory):
+            We'll use <a href="/tools/script.html">NLPCraft CLI</a> to perform all management operations.
+            Run <code>bin/nlpcraft.sh</code> script from NLPCraft installation directory to create a new project stub (the script is located in <code>bin</code> sub-directory):
         </p>
         <nav>
             <div class="nav nav-tabs" role="tablist">
@@ -154,17 +151,26 @@ id: first_example
             actions. We'll use these elements in our model's intent-based matching logic.
         </p>
         <p>
-            Next, let's go ahead and add model's logic which we'll write in Scala (note that this code can be converted to Java or Kotlin almost as is).
+            Next, let's go ahead and add model's logic which we'll write in Scala (with Java and Kotlin versions attached for reference).
             Open <code>src/main/scala/demo/<b>LightSwitch.scala</b></code> file and replace its content with the following
             code:
         </p>
+        <nav>
+            <div class="nav nav-tabs" role="tablist">
+                <a class="nav-item nav-link active" data-toggle="tab" href="#nav-scala" role="tab" aria-controls="nav-home" aria-selected="true">Scala <img src="/images/scala-logo.png" height="20px" alt=""></a>
+                <a class="nav-item nav-link" data-toggle="tab" href="#nav-java" role="tab" aria-controls="nav-home" aria-selected="true">Java <img src="/images/java2.png" height="20px" alt=""></a>
+                <a class="nav-item nav-link" data-toggle="tab" href="#nav-kotlin" role="tab" aria-controls="nav-home" aria-selected="true">Kotlin <img src="/images/kotlin.png" height="20px" alt=""></a>
+            </div>
+        </nav>
+        <div class="tab-content">
+            <div class="tab-pane fade show active" id="nav-scala" role="tabpanel">
         <pre class="brush: java, highlight: [5, 6, 7, 22, 23]">
 package demo
 
 import org.apache.nlpcraft.model.{NCIntentTerm, _}
 
 class LightSwitchModel extends NCModelFileAdapter("light_switch.yaml") {
-    @NCIntent("intent=ls term(act)={groups @@ 'act'} term(loc)={id == 'ls:loc'}*")
+    @NCIntentRef("ls")
     @NCIntentSample(Array(
         "Turn the lights off in the entire house.",
         "Switch on the illumination in the master bedroom closet.",
@@ -197,6 +203,100 @@ class LightSwitchModel extends NCModelFileAdapter("light_switch.yaml") {
     }
 }
         </pre>
+            </div>
+            <div class="tab-pane fade show" id="nav-java" role="tabpanel">
+        <pre class="brush: java">
+package demo;
+
+import org.apache.nlpcraft.model.*;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class LightSwitchJavaModel extends NCModelFileAdapter {
+    public LightSwitchJavaModel() {
+        // Loading the model from the file in the classpath.
+        super("lightswitch_model.yaml");
+    }
+
+    @NCIntentRef("ls")
+    @NCIntentSample({
+        "Turn the lights off in the entire house.",
+        "Switch on the illumination in the master bedroom closet.",
+        "Get the lights on.",
+        "Lights up in the kitchen.",
+        "Please, put the light out in the upstairs bedroom.",
+        "Set the lights on in the entire house.",
+        "Turn the lights off in the guest bedroom.",
+        "Could you please switch off all the lights?",
+        "Dial off illumination on the 2nd floor.",
+        "Please, no lights!",
+        "Kill off all the lights now!",
+        "No lights in the bedroom, please.",
+        "Light up the garage, please!",
+        "Kill the illumination now!"
+    })
+    NCResult onMatch(
+        @NCIntentTerm("act") NCToken actTok,
+        @NCIntentTerm("loc") List&lt;NCToken&gt; locToks) {
+        String status = actTok.getId().equals("ls:on") ? "on" : "off";
+        String locations = locToks.isEmpty() ?
+            "entire house" :
+            locToks.stream().map(t -> (String)t.meta("nlpcraft:nlp:origtext"))
+                .collect(Collectors.joining(", "));
+
+        // Add HomeKit, Arduino or other integration here.
+
+        // By default - just return a descriptive action string.
+        return NCResult.text("Lights are [" + status + "] in [" + locations.toLowerCase() + "].");
+    }
+}
+
+        </pre>
+            </div>
+            <div class="tab-pane fade show" id="nav-kotlin" role="tabpanel">
+        <pre class="brush: java">
+package demo
+
+import org.apache.nlpcraft.model.*
+import java.util.stream.Collectors
+
+class LightSwitchKotlinModel : NCModelFileAdapter("lightswitch_model.yaml") {
+    @NCIntentRef("ls")
+    @NCIntentSample(
+        "Turn the lights off in the entire house.",
+        "Switch on the illumination in the master bedroom closet.",
+        "Get the lights on.",
+        "Lights up in the kitchen.",
+        "Please, put the light out in the upstairs bedroom.",
+        "Set the lights on in the entire house.",
+        "Turn the lights off in the guest bedroom.",
+        "Could you please switch off all the lights?",
+        "Dial off illumination on the 2nd floor.",
+        "Please, no lights!",
+        "Kill off all the lights now!",
+        "No lights in the bedroom, please.",
+        "Light up the garage, please!",
+        "Kill the illumination now!"
+    )
+    fun onMatch(
+        @NCIntentTerm("act") actTok: NCToken,
+        @NCIntentTerm("loc") locToks: List&lt;NCToken&gt;
+    ): NCResult {
+        val status = if (actTok.id == "ls:on") "on" else "off"
+        val locations = if (locToks.isEmpty()) "entire house" else locToks.stream()
+            .map { t: NCToken -> t.meta("nlpcraft:nlp:origtext") as String }
+            .collect(Collectors.joining(", "))
+
+        // Add HomeKit, Arduino or other integration here.
+
+        // By default - just return a descriptive action string.
+        return NCResult.text("Lights are [" + status + "] in [" + locations.toLowerCase() + "].")
+    }
+}
+        </pre>
+            </div>
+        </div>
         <p>
             <b>NOTES:</b>
         </p>
@@ -210,9 +310,9 @@ class LightSwitchModel extends NCModelFileAdapter("light_switch.yaml") {
                 a template is matched against user input:
                 <ul>
                     <li>
-                        Line 6 uses <a target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCIntent.html">@NCIntent</a>
-                        annotation to define the intent (it can also be defined in the external model definition).
-                        The intent defined here matches
+                        Line 6 uses <a target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCIntentRef.html">@NCIntentRef</a>
+                        annotation to reference the intent defined in our model (it can also be defined in place).
+                        The intent matches
                         two parts: first should be any token belonging to <code>act</code> group (i.e. "on" or "off" action),
                         and the second should be a zero or more tokens with ID equal to <code>ls:loc</code> (i.e. optional list of locations).
                     </li>
diff --git a/installation.html b/installation.html
index 693a524..ed8117f 100644
--- a/installation.html
+++ b/installation.html
@@ -34,7 +34,7 @@ id: installation
         </ul>
         <div class="bq warn">
             <p>
-                <b>NLPCraft v0.7.0+ requires JDK 11 or newer</b>
+                <b>NLPCraft v0.7.0+ requires JDK 11</b>
             </p>
             <p>
                 Starting with version <b>0.7.0</b> NLPCraft requires JDK 11+ to compile and run. All development
diff --git a/intent-matching.html b/intent-matching.html
index 8706a49..aa5284f 100644
--- a/intent-matching.html
+++ b/intent-matching.html
@@ -25,7 +25,7 @@ id: intent_matching
     <section id="overview">
         <h2 class="section-title">Overview</h2>
         <p>
-            As we discussed in <a href="/data-model.html#logic">Data Model</a> section the processing logic of the data model is
+            <a href="/data-model.html#logic">Data Model</a> processing logic is
             encoded in intents and their callbacks. Sections below will explain how to declare an intent and how to develop
             a callback method when the intent is matched.
         </p>
diff --git a/relnotes/release-notes-0.7.0.html b/relnotes/release-notes-0.7.0.html
index aad4919..0cb1c33 100644
--- a/relnotes/release-notes-0.7.0.html
+++ b/relnotes/release-notes-0.7.0.html
@@ -27,7 +27,7 @@ layout: release-notes
     </p>
     <ul>
         <li>
-            The project has moved to JDK 11+ Java version and therefore is no longer compatible with previous
+            The project has moved to JDK 11 Java version and therefore is no longer compatible with previous
             versions or prior JDK version.
         </li>
         <li>
diff --git a/server-and-probe.html b/server-and-probe.html
index 1e61cc2..7895a08 100644
--- a/server-and-probe.html
+++ b/server-and-probe.html
@@ -186,11 +186,11 @@ id: server_and_probe
             The abnormally long GC pauses (over 5s) can be caused by the excessive memory swapping performed by OS due to
             insufficient JVM heap memory.
         </p>
-        <h3 class="section-sub-title">Apache Ignite 2.x and JDK 11+</h3>
+        <h3 class="section-sub-title">Apache Ignite 2.x and JDK 11</h3>
         <p>
             NLPCraft REST  server uses Apache Ignite 2.x as its distributed in-memory computing plane. Apache Ignite
             <a target=_new href="https://apacheignite.readme.io/docs/getting-started#running-ignite-with-java-11-and-later-versions">recommends</a>
-            the following additional JVM options to be used when running Apache Ignite 2.x on JDK 11+:
+            the following additional JVM options to be used when running Apache Ignite 2.x on JDK 11:
         </p>
         <pre class="brush: text">
 --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED