This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-384
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-384 by this push:
new a8226c9 WIP on NLPCRAFT-384
a8226c9 is described below
commit a8226c9e1732fd2159521470face95d68f3964d5
Author: Aaron Radzinski <[email protected]>
AuthorDate: Sun Aug 15 22:03:35 2021 -0700
WIP on NLPCRAFT-384
---
.../apache/nlpcraft/examples/alarm/AlarmModel.java | 2 +-
.../resources/{intents.idl => alarm_intents.idl} | 4 +-
.../alarm/src/main/resources/alarm_model.json | 2 +-
nlpcraft-examples/cargps/README.md | 45 ++++++
nlpcraft-examples/cargps/pom.xml | 151 +++++++++++++++++++++
.../nlpcraft/examples/alarm/CarGpsModel.scala} | 23 ++--
.../src/main/resources/cargps_intents.idl} | 16 ---
.../src/main/resources/cargps_model.json} | 22 +--
.../cargps/src/main/resources/cargps_samples.txt | 22 +++
.../cargps/src/main/resources/probe.conf | 148 ++++++++++++++++++++
.../examples/alarm/NCModelValidationSpec.scala} | 29 ++--
pom.xml | 1 +
12 files changed, 403 insertions(+), 62 deletions(-)
diff --git
a/nlpcraft-examples/alarm/src/main/java/org/apache/nlpcraft/examples/alarm/AlarmModel.java
b/nlpcraft-examples/alarm/src/main/java/org/apache/nlpcraft/examples/alarm/AlarmModel.java
index 0e15a02..a6034a7 100644
---
a/nlpcraft-examples/alarm/src/main/java/org/apache/nlpcraft/examples/alarm/AlarmModel.java
+++
b/nlpcraft-examples/alarm/src/main/java/org/apache/nlpcraft/examples/alarm/AlarmModel.java
@@ -62,7 +62,7 @@ public class AlarmModel extends NCModelFileAdapter {
* @param ctx Intent solver context.
* @return Query result.
*/
- @NCIntentRef("alarm") // Intent is defined in JSON model file
(alarm_model.json and intents.idl).
+ @NCIntentRef("alarm") // Intent is defined in JSON model file
(alarm_model.json and alarm_intents.idl).
@NCIntentSampleRef("alarm_samples.txt") // Samples supplied in an external
file.
NCResult onMatch(
NCIntentMatch ctx,
diff --git a/nlpcraft-examples/alarm/src/main/resources/intents.idl
b/nlpcraft-examples/alarm/src/main/resources/alarm_intents.idl
similarity index 92%
copy from nlpcraft-examples/alarm/src/main/resources/intents.idl
copy to nlpcraft-examples/alarm/src/main/resources/alarm_intents.idl
index 3c1810b..da7a066 100644
--- a/nlpcraft-examples/alarm/src/main/resources/intents.idl
+++ b/nlpcraft-examples/alarm/src/main/resources/alarm_intents.idl
@@ -21,9 +21,9 @@ fragment=when
term(nums)~{
// Demonstrating term variables.
@type = meta_tok('nlpcraft:num:unittype')
- @iseq = meta_tok('nlpcraft:num:isequalcondition') // Excludes
conditional statements.
+ @isEq = meta_tok('nlpcraft:num:isequalcondition') // Excludes
conditional statements.
- tok_id() == 'nlpcraft:num' && @type == 'datetime' && @iseq == true
+ tok_id() == 'nlpcraft:num' && @type == 'datetime' && @isEq == true
}[1,7]
// Intents (using fragments).
diff --git a/nlpcraft-examples/alarm/src/main/resources/alarm_model.json
b/nlpcraft-examples/alarm/src/main/resources/alarm_model.json
index 9060fde..e55fd15 100644
--- a/nlpcraft-examples/alarm/src/main/resources/alarm_model.json
+++ b/nlpcraft-examples/alarm/src/main/resources/alarm_model.json
@@ -34,6 +34,6 @@
}
],
"intents": [
- "import('intents.idl')" // Import intents from external file.
+ "import('alarm_intents.idl')" // Import intents from external file.
]
}
\ No newline at end of file
diff --git a/nlpcraft-examples/cargps/README.md
b/nlpcraft-examples/cargps/README.md
new file mode 100644
index 0000000..ce7a565
--- /dev/null
+++ b/nlpcraft-examples/cargps/README.md
@@ -0,0 +1,45 @@
+<!--
+ 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)
+
+### Car GPS Example
+This example provides a simulation of the in-car GPS-based navigation system
with the natural
+language interface.
+
+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/cargps/pom.xml b/nlpcraft-examples/cargps/pom.xml
new file mode 100644
index 0000000..bbc0bf2
--- /dev/null
+++ b/nlpcraft-examples/cargps/pom.xml
@@ -0,0 +1,151 @@
+<?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 Car GPS</name>
+ <artifactId>nlpcraft-example-cargps</artifactId>
+
+ <parent>
+ <artifactId>nlpcraft-parent</artifactId>
+ <groupId>org.apache.nlpcraft</groupId>
+ <version>0.9.0</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <properties>
+ <nlpcraft.server.module>nlpcraft</nlpcraft.server.module>
+
<nlpcraft.all.deps.jar>apache-${nlpcraft.server.module}-incubating-${project.version}-all-deps.jar</nlpcraft.all.deps.jar>
+ </properties>
+
+ <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>
+ <plugin>
+ <groupId>com.bazaarvoice.maven.plugins</groupId>
+ <artifactId>process-exec-maven-plugin</artifactId>
+ <version>${maven.bazaarvoice.plugin.ver}</version>
+ <executions>
+ <execution>
+ <id>pre-integration-test</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ <configuration>
+ <!--
+ Depending on the console config and how maven
is run this will produce the output with ANSI colors.
+ To strip out ANSI escape sequences from the
log file, see the following:
+
https://stackoverflow.com/questions/17998978/removing-colors-from-output
+ -->
+ <name>server</name>
+
<healthcheckUrl>http://localhost:8081/api/v1/health</healthcheckUrl>
+ <waitAfterLaunch>600</waitAfterLaunch>
+
<processLogFile>${project.build.directory}/server-${timestamp}.log</processLogFile>
+ <arguments>
+ <argument>${java.home}/bin/java</argument>
+ <argument>-Xmx4G</argument>
+ <argument>-Xms4G</argument>
+
<argument>--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED</argument>
+
<argument>--add-exports=java.base/sun.nio.ch=ALL-UNNAMED</argument>
+
<argument>--add-exports=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED</argument>
+
<argument>--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED</argument>
+
<argument>--add-exports=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED</argument>
+
<argument>--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED</argument>
+ <argument>--illegal-access=permit</argument>
+
<argument>-DNLPCRAFT_ANSI_COLOR_DISABLED=true</argument> <!-- Remove ANSI at
least from NLPCraft output. -->
+
<argument>-Djdk.tls.client.protocols=TLSv1.2</argument>
+ <argument>-jar</argument>
+
<argument>${project.basedir}/../../${nlpcraft.server.module}/target/${nlpcraft.all.deps.jar}</argument>
+ <argument>-server</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop-all</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop-all</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${maven.surefire.plugin.ver}</version>
+ <configuration>
+ <!-- Skips all tests on phase `test`. -->
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <!-- All tests are defined as integration. -->
+ <execution>
+ <id>integration-tests</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <!-- Mandatory part. -->
+ <includes>
+ <include>**/*.*</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/nlpcraft-examples/alarm/src/main/resources/intents.idl
b/nlpcraft-examples/cargps/src/main/java/org/apache/nlpcraft/examples/alarm/CarGpsModel.scala
similarity index 59%
copy from nlpcraft-examples/alarm/src/main/resources/intents.idl
copy to
nlpcraft-examples/cargps/src/main/java/org/apache/nlpcraft/examples/alarm/CarGpsModel.scala
index 3c1810b..e72058d 100644
--- a/nlpcraft-examples/alarm/src/main/resources/intents.idl
+++
b/nlpcraft-examples/cargps/src/main/java/org/apache/nlpcraft/examples/alarm/CarGpsModel.scala
@@ -6,7 +6,7 @@
* (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
+ * https://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,
@@ -15,18 +15,13 @@
* limitations under the License.
*/
-// Fragments (mostly for demo purposes here).
-fragment=buzz term~{tok_id() == 'x:alarm'}
-fragment=when
- term(nums)~{
- // Demonstrating term variables.
- @type = meta_tok('nlpcraft:num:unittype')
- @iseq = meta_tok('nlpcraft:num:isequalcondition') // Excludes
conditional statements.
+package org.apache.nlpcraft.examples.alarm
- tok_id() == 'nlpcraft:num' && @type == 'datetime' && @iseq == true
- }[1,7]
+import org.apache.nlpcraft.model.NCModelFileAdapter
-// Intents (using fragments).
-intent=alarm
- fragment(buzz)
- fragment(when)
\ No newline at end of file
+/**
+ * See 'README.md' file in the same folder for running and testing
instructions.
+ */
+class CarGpsModel extends NCModelFileAdapter("cargps_model.yaml") {
+
+}
diff --git a/nlpcraft-examples/alarm/src/main/resources/intents.idl
b/nlpcraft-examples/cargps/src/main/resources/cargps_intents.idl
similarity index 62%
copy from nlpcraft-examples/alarm/src/main/resources/intents.idl
copy to nlpcraft-examples/cargps/src/main/resources/cargps_intents.idl
index 3c1810b..ae6f28c 100644
--- a/nlpcraft-examples/alarm/src/main/resources/intents.idl
+++ b/nlpcraft-examples/cargps/src/main/resources/cargps_intents.idl
@@ -14,19 +14,3 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-// Fragments (mostly for demo purposes here).
-fragment=buzz term~{tok_id() == 'x:alarm'}
-fragment=when
- term(nums)~{
- // Demonstrating term variables.
- @type = meta_tok('nlpcraft:num:unittype')
- @iseq = meta_tok('nlpcraft:num:isequalcondition') // Excludes
conditional statements.
-
- tok_id() == 'nlpcraft:num' && @type == 'datetime' && @iseq == true
- }[1,7]
-
-// Intents (using fragments).
-intent=alarm
- fragment(buzz)
- fragment(when)
\ No newline at end of file
diff --git a/nlpcraft-examples/alarm/src/main/resources/intents.idl
b/nlpcraft-examples/cargps/src/main/resources/cargps_model.json
similarity index 62%
copy from nlpcraft-examples/alarm/src/main/resources/intents.idl
copy to nlpcraft-examples/cargps/src/main/resources/cargps_model.json
index 3c1810b..c5fec53 100644
--- a/nlpcraft-examples/alarm/src/main/resources/intents.idl
+++ b/nlpcraft-examples/cargps/src/main/resources/cargps_model.json
@@ -15,18 +15,10 @@
* limitations under the License.
*/
-// Fragments (mostly for demo purposes here).
-fragment=buzz term~{tok_id() == 'x:alarm'}
-fragment=when
- term(nums)~{
- // Demonstrating term variables.
- @type = meta_tok('nlpcraft:num:unittype')
- @iseq = meta_tok('nlpcraft:num:isequalcondition') // Excludes
conditional statements.
-
- tok_id() == 'nlpcraft:num' && @type == 'datetime' && @iseq == true
- }[1,7]
-
-// Intents (using fragments).
-intent=alarm
- fragment(buzz)
- fragment(when)
\ No newline at end of file
+{
+ "id": "nlpcraft.cargps.ex",
+ "name": "Car GPS Example Model",
+ "version": "1.0",
+ "description": "Car GPS example model.",
+ "elements": []
+}
\ No newline at end of file
diff --git a/nlpcraft-examples/cargps/src/main/resources/cargps_samples.txt
b/nlpcraft-examples/cargps/src/main/resources/cargps_samples.txt
new file mode 100644
index 0000000..564f630
--- /dev/null
+++ b/nlpcraft-examples/cargps/src/main/resources/cargps_samples.txt
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+
+#
+# Set of samples (corpus) for automatic unit and regression testing.
+#
+
+
diff --git a/nlpcraft-examples/cargps/src/main/resources/probe.conf
b/nlpcraft-examples/cargps/src/main/resources/probe.conf
new file mode 100644
index 0000000..e15ac80
--- /dev/null
+++ b/nlpcraft-examples/cargps/src/main/resources/probe.conf
@@ -0,0 +1,148 @@
+#
+# 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.
+#
+
+#
+# This is joint configuration file for both the server and the data probes.
Note that
+# server and probe configuration can be placed into separate files - each file
containing only
+# 'nlpcraft.server' or 'nlpcraft.probe' sub-sections.
+#
+# You can also provide configuration properties or override the default ones
via environment variables.
+# To use environment variables override:
+# 1. Set probe or server JVM system property
-Dconfig.override_with_env_vars=true
+# 2. For each configuration 'x.y.z' set the environment variable
CONFIG_FORCE_x_y_z=some_value
+#
+# Examples of environment variables:
+# -- Overrides 'nlpcraft.sever.host' configuration property.
+# CONFIG_FORCE_nlpcraft_server_rest_host="localhost"
+#
+# -- Overrides 'nlpcraft.sever.models' configuration property.
+# CONFIG_FORCE_nlpcraft_server_models="com.models.MyModel"
+#
+# See https://nlpcraft.apache.org/server-and-probe.html for more details.
+#
+
+# Common server/probe configuration root.
+nlpcraft {
+ # Basic NLP toolkit to use on both server and probes. Possible values:
+ # - 'opennlp'
+ # - 'stanford'
+ #
+ # NOTE: Stanford CoreNLP requires special installation due to its
licensing.
+ # See https://nlpcraft.apache.org/integrations.html#stanford for more
details.
+ nlpEngine = "opennlp"
+
+ # External configuration resources.
+ #
+ # NOTE:
+ # ----
+ # Due to licensing restrictions of the official ASF release policy some of
the
+ # configuration for NLPCraft cannot be shipped with the official Apache
release.
+ # Instead, NLPCraft will attempt to download these configuration files
from the
+ # external URL upon the first start.
+ #
+ # NLPCraft will attempt to download the missing configuration files from
URL defined
+ # in 'nlpcraft.extConfig.extUrl' property and place them into
'nlpcraft.extConfig.locDir'
+ # folder on the local file system. On subsequent starts, NLPCraft will
check if the required
+ # file is already present locally and skip the download in such case. If
'nlpcraft.extConfig.checkMd5'
+ # property is set to 'true' then on each start NLPCraft will check the
checksum of each file
+ # locally and remote and will re-download such file if the MD5 checksums
don't match.
+ #
+ # By default, the external configuration is stored in the main Git
repository for NLPCraft
+ # project from where it will be downloaded ('/external' folder). See this
folder in the Git
+ # repository for more information:
https://github.com/apache/incubator-nlpcraft/raw/external_config/external
+ extConfig {
+ # Mandatory.
+ extUrl =
"https://github.com/apache/incubator-nlpcraft/raw/external_config/external"
+
+ # Optional.
+ # Default value is $USER_HOME/.nlpcraft/extcfg
+ # locDir = ...
+
+ # If 'true', on each start NLPCraft will check the MD5 checksum of the
each local and remote
+ # external configuration file and will re-download such file if the
checksum doesn't match.
+ # Set it to 'false' to speed up the bootstrap of the NLPCraft server
and the data probe if you
+ # are certain that all external configuration files are properly
downloaded and available
+ # in 'nlpcraft.extConfig.locDir' local folder.
+ checkMd5 = true
+ }
+
+ # +---------------------+
+ # | Probe configuration. |
+ # +---------------------+
+ probe {
+ # Any arbitrary descriptive name.
+ id = "cargps"
+
+ # This is the default token (as in default company).
+ # Note that this token must match the probe token for the company this
probe
+ # associated with. If changed from default, this token must be kept
secure.
+ token = "3141592653589793"
+
+ # These are default up-link and down-link endpoints that the probe
will connect to.
+ # If changed - they need to be changed on both server and probe.
+ upLink = "0.0.0.0:8201" # Server to probe data pipe.
+ downLink = "0.0.0.0:8202" # Probe to server data pipe.
+
+ # All JARs in this folder will be scanned for models.
+ # Safely ignored if 'null' - but then 'models' should have at least
one element.
+ jarsFolder = null
+
+ # Specifies fully qualifies model class names for the probe to start
with.
+ #
+ # Note that following models require 'google' on the server side.
+ # See https://nlpcraft.apache.org/integrations.html#nlp for more
details
+ # on how to configure 3rd party token providers:
+ models = org.apache.nlpcraft.examples.cargps.CarGpsModel
+
+ # Specify class names for probe life cycle components.
+ # Each class should extend 'NCProbeLifecycle' interface and provide a
no-arg constructor.
+ #
+ # The following built-in OpenCensus exporters are supported as
lifecycle components:
+ # - org.apache.nlpcraft.model.opencensus.NCJaegerExporter (traces)
+ # - org.apache.nlpcraft.model.opencensus.NCZipkinExporter (traces)
+ # - org.apache.nlpcraft.model.opencensus.NCPrometheusExporter (stats)
+ # - org.apache.nlpcraft.model.opencensus.NCStackdriverTraceExporter
(traces)
+ # - org.apache.nlpcraft.model.opencensus.NCStackdriverStatsExporter
(stats)
+ lifecycle = ""
+
+ # Properties for built-in OpenCensus exporters.
+ # All configuration properties are optional unless otherwise specified.
+ # opencensus {
+ # jaeger {
+ # thriftUrl = "http://127.0.0.1:14268/api/traces"
+ # serviceName = "nlpcraft-probe"
+ # }
+ # prometheus {
+ # hostPort = "localhost:8889"
+ # namespace = "nlpcraft-probe"
+ # }
+ # stackdriver {
+ # # Mandatory Google project ID.
+ # googleProjectId = "your_google_project_id"
+ # metricsPrefix = "custom.googleapis.com/nlpcraft/probe"
+ # }
+ # zipkin {
+ # v2Url = "http://127.0.0.1:9411/api/v2/spans"
+ # serviceName = "nlpcraft-probe"
+ # }
+ # }
+
+ # Maximum execution result size in bytes. Default value is 1M.
+ # When exceeded the request will be automatically rejected.
+ resultMaxSizeBytes = 1048576
+ }
+}
diff --git a/nlpcraft-examples/alarm/src/main/resources/intents.idl
b/nlpcraft-examples/cargps/src/test/java/org/apache/nlpcraft/examples/alarm/NCModelValidationSpec.scala
similarity index 59%
rename from nlpcraft-examples/alarm/src/main/resources/intents.idl
rename to
nlpcraft-examples/cargps/src/test/java/org/apache/nlpcraft/examples/alarm/NCModelValidationSpec.scala
index 3c1810b..c08b430 100644
--- a/nlpcraft-examples/alarm/src/main/resources/intents.idl
+++
b/nlpcraft-examples/cargps/src/test/java/org/apache/nlpcraft/examples/alarm/NCModelValidationSpec.scala
@@ -15,18 +15,21 @@
* limitations under the License.
*/
-// Fragments (mostly for demo purposes here).
-fragment=buzz term~{tok_id() == 'x:alarm'}
-fragment=when
- term(nums)~{
- // Demonstrating term variables.
- @type = meta_tok('nlpcraft:num:unittype')
- @iseq = meta_tok('nlpcraft:num:isequalcondition') // Excludes
conditional statements.
+package org.apache.nlpcraft.examples.alarm
- tok_id() == 'nlpcraft:num' && @type == 'datetime' && @iseq == true
- }[1,7]
+import org.apache.nlpcraft.model.tools.test.NCTestAutoModelValidator
+import org.junit.jupiter.api.{Assertions, Test}
-// Intents (using fragments).
-intent=alarm
- fragment(buzz)
- fragment(when)
\ No newline at end of file
+/**
+ * JUnit model validation.
+ */
+class NCModelValidationSpec {
+ @Test
+ def test(): Unit = {
+ // Instruct auto-validator what models to test.
+ System.setProperty("NLPCRAFT_TEST_MODELS",
"org.apache.nlpcraft.examples.cargps.CarGpsModel")
+
+ // Start model auto-validator.
+ Assertions.assertTrue(NCTestAutoModelValidator.isValid(),"See error
logs above.")
+ }
+}
diff --git a/pom.xml b/pom.xml
index 4a6649e..dff899f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -635,6 +635,7 @@
<profile>
<id>examples</id>
<modules>
+ <module>nlpcraft-examples/cargps</module>
<module>nlpcraft-examples/alarm</module>
<module>nlpcraft-examples/echo</module>
<module>nlpcraft-examples/helloworld</module>