This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-91-MODULES
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-91-MODULES by this
push:
new a16ef8e WIP.
a16ef8e is described below
commit a16ef8e6a750f085301fa7a59061fe36c774dbc3
Author: Sergey Kamov <[email protected]>
AuthorDate: Thu Apr 22 22:53:56 2021 +0300
WIP.
---
.../{examples => utils}/alarm/AlarmModel.java | 2 +-
.../alarm/NCTestExampleModelsSpec.scala | 2 +-
.../{examples => utils}/echo/EchoModel.scala | 2 +-
.../echo/NCTestExampleModelsSpec.scala | 2 +-
.../helloworld/HelloWorldModel.java | 2 +-
.../helloworld/NCTestExampleModelsSpec.scala | 2 +-
.../lightswitch/LightSwitchGroovyModel.groovy | 2 +-
.../lightswitch/LightSwitchJavaModel.java | 2 +-
.../lightswitch/LightSwitchKotlinModel.kt | 2 +-
.../lightswitch/LightSwitchModel.scala | 2 +-
.../lightswitch/NCTestExampleModelsSpec.scala | 2 +-
.../{examples => utils}/phone/PhoneModel.java | 2 +-
.../{examples => utils}/sql/SqlModel.scala | 4 +-
.../{examples => utils}/sql/db/SqlAccess.scala | 2 +-
.../{examples => utils}/sql/db/SqlBeans.scala | 2 +-
.../{examples => utils}/sql/db/SqlBuilder.scala | 4 +-
.../{examples => utils}/sql/db/SqlServer.scala | 4 +-
.../sql/db/SqlValueLoader.scala | 2 +-
.../examples/sql/db => resources}/model.png | Bin
.../examples/sql/db => resources}/northwind.sql | 0
.../{examples => utils}/sql/NCSqlExampleSpec.scala | 4 +-
.../sql/NCSqlGeneratorSpec.scala | 4 +-
.../{examples => utils}/sql/NCSqlModelSpec.scala | 4 +-
.../sql/NCTestExampleModelsSpec.scala | 2 +-
.../{examples => utils}/time/TimeModel.java | 8 +-
.../{examples => utils}/time/TimeModelApp.java | 2 +-
.../time/NCTestExampleModelsSpec.scala | 4 +-
.../{examples => utils}/time/NCTimeModelSpec.scala | 2 +-
.../{examples => utils}/weather/WeatherModel.java | 26 +++-
.../utils/weather}/darksky/DarkSkyException.java | 2 +-
.../utils/weather}/darksky/DarkSkyService.java | 2 +-
.../weather/NCTestExampleModelsSpec.scala | 2 +-
nlpcraft/pom.xml | 2 +-
.../apache/nlpcraft/{examples => utils}/README.md | 2 +
.../geo => utils}/cities/CitiesDataProvider.java | 4 +-
.../{examples/misc/geo => utils}/cities/City.java | 2 +-
.../misc/geo => utils}/cities/CityData.java | 2 +-
.../misc/geo => utils}/cities/cities_timezones.txt | 0
.../misc/geo => utils}/keycdn/GeoManager.java | 6 +-
.../geo => utils}/keycdn/beans/GeoDataBean.java | 2 +-
.../geo => utils}/keycdn/beans/ResponseBean.java | 2 +-
.../keycdn/beans/ResponseDataBean.java | 2 +-
nlpcraft/src/test/resources/nlpcraft.conf | 151 +++++++++++++++++++++
.../apache/nlpcraft/NCTestExampleModelsSpec.scala | 46 -------
.../nlpcraft/server/rest/NCRestErrorsSpec.scala | 28 ++--
.../nlpcraft/server/rest/NCRestModelSpec.scala | 7 +-
.../nlpcraft/server/rest/RestTestModel.scala | 10 +-
47 files changed, 244 insertions(+), 126 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/utils/alarm/AlarmModel.java
similarity index 99%
rename from
nlpcraft-examples/alarm/src/main/java/org/apache/nlpcraft/examples/alarm/AlarmModel.java
rename to
nlpcraft-examples/alarm/src/main/java/org/apache/nlpcraft/utils/alarm/AlarmModel.java
index 8c26ae1..0129caf 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/utils/alarm/AlarmModel.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.alarm;
+package org.apache.nlpcraft.utils.alarm;
import org.apache.nlpcraft.model.*;
import java.time.*;
diff --git
a/nlpcraft-examples/alarm/src/test/java/org/apache/nlpcraft/examples/alarm/NCTestExampleModelsSpec.scala
b/nlpcraft-examples/alarm/src/test/java/org/apache/nlpcraft/utils/alarm/NCTestExampleModelsSpec.scala
similarity index 96%
rename from
nlpcraft-examples/alarm/src/test/java/org/apache/nlpcraft/examples/alarm/NCTestExampleModelsSpec.scala
rename to
nlpcraft-examples/alarm/src/test/java/org/apache/nlpcraft/utils/alarm/NCTestExampleModelsSpec.scala
index b942742..7483b43 100644
---
a/nlpcraft-examples/alarm/src/test/java/org/apache/nlpcraft/examples/alarm/NCTestExampleModelsSpec.scala
+++
b/nlpcraft-examples/alarm/src/test/java/org/apache/nlpcraft/utils/alarm/NCTestExampleModelsSpec.scala
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.alarm
+package org.apache.nlpcraft.utils.alarm
import org.apache.nlpcraft.model.tools.test.NCTestAutoModelValidator
import org.junit.jupiter.api.{Assertions, Test}
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/utils/echo/EchoModel.scala
similarity index 98%
rename from
nlpcraft-examples/echo/src/main/java/org/apache/nlpcraft/examples/echo/EchoModel.scala
rename to
nlpcraft-examples/echo/src/main/java/org/apache/nlpcraft/utils/echo/EchoModel.scala
index 15c509b..35f85e1 100644
---
a/nlpcraft-examples/echo/src/main/java/org/apache/nlpcraft/examples/echo/EchoModel.scala
+++
b/nlpcraft-examples/echo/src/main/java/org/apache/nlpcraft/utils/echo/EchoModel.scala
@@ -1,4 +1,4 @@
-package org.apache.nlpcraft.examples.echo
+package org.apache.nlpcraft.utils.echo
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
diff --git
a/nlpcraft-examples/echo/src/test/java/org/apache/nlpcraft/examples/echo/NCTestExampleModelsSpec.scala
b/nlpcraft-examples/echo/src/test/java/org/apache/nlpcraft/utils/echo/NCTestExampleModelsSpec.scala
similarity index 96%
rename from
nlpcraft-examples/echo/src/test/java/org/apache/nlpcraft/examples/echo/NCTestExampleModelsSpec.scala
rename to
nlpcraft-examples/echo/src/test/java/org/apache/nlpcraft/utils/echo/NCTestExampleModelsSpec.scala
index 7805be9..d3d800d 100644
---
a/nlpcraft-examples/echo/src/test/java/org/apache/nlpcraft/examples/echo/NCTestExampleModelsSpec.scala
+++
b/nlpcraft-examples/echo/src/test/java/org/apache/nlpcraft/utils/echo/NCTestExampleModelsSpec.scala
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.echo
+package org.apache.nlpcraft.utils.echo
import org.apache.nlpcraft.model.tools.test.NCTestAutoModelValidator
import org.junit.jupiter.api.{Assertions, Test}
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/utils/helloworld/HelloWorldModel.java
similarity index 97%
rename from
nlpcraft-examples/helloworld/src/main/java/org/apache/nlpcraft/examples/helloworld/HelloWorldModel.java
rename to
nlpcraft-examples/helloworld/src/main/java/org/apache/nlpcraft/utils/helloworld/HelloWorldModel.java
index 8d1580a..45ec5f6 100644
---
a/nlpcraft-examples/helloworld/src/main/java/org/apache/nlpcraft/examples/helloworld/HelloWorldModel.java
+++
b/nlpcraft-examples/helloworld/src/main/java/org/apache/nlpcraft/utils/helloworld/HelloWorldModel.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.helloworld;
+package org.apache.nlpcraft.utils.helloworld;
import org.apache.nlpcraft.common.NCException;
import org.apache.nlpcraft.model.NCContext;
diff --git
a/nlpcraft-examples/helloworld/src/test/java/org/apache/nlpcraft/examples/helloworld/NCTestExampleModelsSpec.scala
b/nlpcraft-examples/helloworld/src/test/java/org/apache/nlpcraft/utils/helloworld/NCTestExampleModelsSpec.scala
similarity index 96%
rename from
nlpcraft-examples/helloworld/src/test/java/org/apache/nlpcraft/examples/helloworld/NCTestExampleModelsSpec.scala
rename to
nlpcraft-examples/helloworld/src/test/java/org/apache/nlpcraft/utils/helloworld/NCTestExampleModelsSpec.scala
index e7c561f..aca3084 100644
---
a/nlpcraft-examples/helloworld/src/test/java/org/apache/nlpcraft/examples/helloworld/NCTestExampleModelsSpec.scala
+++
b/nlpcraft-examples/helloworld/src/test/java/org/apache/nlpcraft/utils/helloworld/NCTestExampleModelsSpec.scala
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.helloworld
+package org.apache.nlpcraft.utils.helloworld
import org.apache.nlpcraft.model.tools.test.NCTestAutoModelValidator
import org.junit.jupiter.api.{Assertions, Test}
diff --git
a/nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/examples/lightswitch/LightSwitchGroovyModel.groovy
b/nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/utils/lightswitch/LightSwitchGroovyModel.groovy
similarity index 98%
rename from
nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/examples/lightswitch/LightSwitchGroovyModel.groovy
rename to
nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/utils/lightswitch/LightSwitchGroovyModel.groovy
index b8f0cc6..9dac096 100644
---
a/nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/examples/lightswitch/LightSwitchGroovyModel.groovy
+++
b/nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/utils/lightswitch/LightSwitchGroovyModel.groovy
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.lightswitch
+package org.apache.nlpcraft.utils.lightswitch
import org.apache.nlpcraft.model.*
diff --git
a/nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/examples/lightswitch/LightSwitchJavaModel.java
b/nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/utils/lightswitch/LightSwitchJavaModel.java
similarity index 98%
rename from
nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/examples/lightswitch/LightSwitchJavaModel.java
rename to
nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/utils/lightswitch/LightSwitchJavaModel.java
index 9b81e82..2183284 100644
---
a/nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/examples/lightswitch/LightSwitchJavaModel.java
+++
b/nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/utils/lightswitch/LightSwitchJavaModel.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.lightswitch;
+package org.apache.nlpcraft.utils.lightswitch;
import org.apache.nlpcraft.model.*;
diff --git
a/nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/examples/lightswitch/LightSwitchKotlinModel.kt
b/nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/utils/lightswitch/LightSwitchKotlinModel.kt
similarity index 98%
rename from
nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/examples/lightswitch/LightSwitchKotlinModel.kt
rename to
nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/utils/lightswitch/LightSwitchKotlinModel.kt
index cc87371..1d3455e 100644
---
a/nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/examples/lightswitch/LightSwitchKotlinModel.kt
+++
b/nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/utils/lightswitch/LightSwitchKotlinModel.kt
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.lightswitch
+package org.apache.nlpcraft.utils.lightswitch
import org.apache.nlpcraft.model.*
import java.util.stream.Collectors
diff --git
a/nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/examples/lightswitch/LightSwitchModel.scala
b/nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/utils/lightswitch/LightSwitchModel.scala
similarity index 98%
rename from
nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/examples/lightswitch/LightSwitchModel.scala
rename to
nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/utils/lightswitch/LightSwitchModel.scala
index a8f65b1..0ac9db1 100644
---
a/nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/examples/lightswitch/LightSwitchModel.scala
+++
b/nlpcraft-examples/lightswitch/src/main/java/org/apache/nlpcraft/utils/lightswitch/LightSwitchModel.scala
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.lightswitch
+package org.apache.nlpcraft.utils.lightswitch
import org.apache.nlpcraft.model.{NCIntentTerm, _}
diff --git
a/nlpcraft-examples/lightswitch/src/test/java/org/apache/nlpcraft/examples/lightswitch/NCTestExampleModelsSpec.scala
b/nlpcraft-examples/lightswitch/src/test/java/org/apache/nlpcraft/utils/lightswitch/NCTestExampleModelsSpec.scala
similarity index 96%
rename from
nlpcraft-examples/lightswitch/src/test/java/org/apache/nlpcraft/examples/lightswitch/NCTestExampleModelsSpec.scala
rename to
nlpcraft-examples/lightswitch/src/test/java/org/apache/nlpcraft/utils/lightswitch/NCTestExampleModelsSpec.scala
index ada9677..dc28bdf 100644
---
a/nlpcraft-examples/lightswitch/src/test/java/org/apache/nlpcraft/examples/lightswitch/NCTestExampleModelsSpec.scala
+++
b/nlpcraft-examples/lightswitch/src/test/java/org/apache/nlpcraft/utils/lightswitch/NCTestExampleModelsSpec.scala
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.lightswitch
+package org.apache.nlpcraft.utils.lightswitch
import org.apache.nlpcraft.model.tools.test.NCTestAutoModelValidator
import org.junit.jupiter.api.{Assertions, Test}
diff --git
a/nlpcraft-examples/phone/src/main/java/org/apache/nlpcraft/examples/phone/PhoneModel.java
b/nlpcraft-examples/phone/src/main/java/org/apache/nlpcraft/utils/phone/PhoneModel.java
similarity index 98%
rename from
nlpcraft-examples/phone/src/main/java/org/apache/nlpcraft/examples/phone/PhoneModel.java
rename to
nlpcraft-examples/phone/src/main/java/org/apache/nlpcraft/utils/phone/PhoneModel.java
index fe19f09..2f6dd70 100644
---
a/nlpcraft-examples/phone/src/main/java/org/apache/nlpcraft/examples/phone/PhoneModel.java
+++
b/nlpcraft-examples/phone/src/main/java/org/apache/nlpcraft/utils/phone/PhoneModel.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.phone;
+package org.apache.nlpcraft.utils.phone;
import org.apache.nlpcraft.model.*;
import java.util.*;
diff --git
a/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/SqlModel.scala
b/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/utils/sql/SqlModel.scala
similarity index 99%
rename from
nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/SqlModel.scala
rename to
nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/utils/sql/SqlModel.scala
index c0a29f7..5aa4ff8 100644
---
a/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/SqlModel.scala
+++
b/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/utils/sql/SqlModel.scala
@@ -15,11 +15,11 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.sql
+package org.apache.nlpcraft.utils.sql
import com.google.gson.Gson
import com.typesafe.scalalogging.LazyLogging
-import org.apache.nlpcraft.examples.sql.db._
+import org.apache.nlpcraft.utils.sql.db._
import org.apache.nlpcraft.model._
import org.apache.nlpcraft.model.tools.sqlgen._
diff --git
a/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/db/SqlAccess.scala
b/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/utils/sql/db/SqlAccess.scala
similarity index 99%
rename from
nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/db/SqlAccess.scala
rename to
nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/utils/sql/db/SqlAccess.scala
index 8ee31d1..ddeedec 100644
---
a/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/db/SqlAccess.scala
+++
b/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/utils/sql/db/SqlAccess.scala
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.sql.db
+package org.apache.nlpcraft.utils.sql.db
import java.sql.{Connection, PreparedStatement, SQLException}
diff --git
a/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/db/SqlBeans.scala
b/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/utils/sql/db/SqlBeans.scala
similarity index 97%
rename from
nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/db/SqlBeans.scala
rename to
nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/utils/sql/db/SqlBeans.scala
index 07ca44e..710b876 100644
---
a/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/db/SqlBeans.scala
+++
b/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/utils/sql/db/SqlBeans.scala
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.sql.db
+package org.apache.nlpcraft.utils.sql.db
import org.apache.nlpcraft.model.tools.sqlgen.NCSqlColumn
diff --git
a/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/db/SqlBuilder.scala
b/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/utils/sql/db/SqlBuilder.scala
similarity index 99%
rename from
nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/db/SqlBuilder.scala
rename to
nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/utils/sql/db/SqlBuilder.scala
index 6e10899..8a5a7dc 100644
---
a/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/db/SqlBuilder.scala
+++
b/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/utils/sql/db/SqlBuilder.scala
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.sql.db
+package org.apache.nlpcraft.utils.sql.db
import java.sql.Types
@@ -384,7 +384,7 @@ case class SqlBuilder(schema: NCSqlSchema) extends
LazyLogging {
case Some(col) ⇒
val range = freeDateRangeOpt.getOrElse(throw new
AssertionError("Missed date range"))
- import
org.apache.nlpcraft.examples.sql.db.{SqlSimpleCondition ⇒ C}
+ import
org.apache.nlpcraft.utils.sql.db.{SqlSimpleCondition ⇒ C}
(Seq(C(col, ">=", range.getFrom), C(col, "<=",
range.getTo)), Seq(range.getFrom, range.getTo))
case None ⇒ (Seq.empty, Seq.empty)
diff --git
a/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/db/SqlServer.scala
b/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/utils/sql/db/SqlServer.scala
similarity index 96%
rename from
nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/db/SqlServer.scala
rename to
nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/utils/sql/db/SqlServer.scala
index 349d33d..3c734fa 100644
---
a/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/db/SqlServer.scala
+++
b/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/utils/sql/db/SqlServer.scala
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.sql.db
+package org.apache.nlpcraft.utils.sql.db
import java.io.File
import java.sql.SQLException
@@ -39,7 +39,7 @@ object SqlServer extends LazyLogging {
"-tcpAllowOthers"
)
- private final val INIT_FILE =
"classpath:org/apache/nlpcraft/examples/sql/db/northwind.sql"
+ private final val INIT_FILE = "classpath:northwind.sql"
final val H2_URL: String = s"jdbc:h2:tcp://localhost:$H2_PORT/nlp2sql"
diff --git
a/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/db/SqlValueLoader.scala
b/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/utils/sql/db/SqlValueLoader.scala
similarity index 97%
rename from
nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/db/SqlValueLoader.scala
rename to
nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/utils/sql/db/SqlValueLoader.scala
index 6c6b0a3..e79f49a 100644
---
a/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/db/SqlValueLoader.scala
+++
b/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/utils/sql/db/SqlValueLoader.scala
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.sql.db
+package org.apache.nlpcraft.utils.sql.db
import java.util
import java.util.Collections
diff --git
a/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/db/model.png
b/nlpcraft-examples/sql/src/main/resources/model.png
similarity index 100%
rename from
nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/db/model.png
rename to nlpcraft-examples/sql/src/main/resources/model.png
diff --git
a/nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/db/northwind.sql
b/nlpcraft-examples/sql/src/main/resources/northwind.sql
similarity index 100%
rename from
nlpcraft-examples/sql/src/main/java/org/apache/nlpcraft/examples/sql/db/northwind.sql
rename to nlpcraft-examples/sql/src/main/resources/northwind.sql
diff --git
a/nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/examples/sql/NCSqlExampleSpec.scala
b/nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/utils/sql/NCSqlExampleSpec.scala
similarity index 99%
rename from
nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/examples/sql/NCSqlExampleSpec.scala
rename to
nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/utils/sql/NCSqlExampleSpec.scala
index a2df2e8..953154a 100644
---
a/nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/examples/sql/NCSqlExampleSpec.scala
+++
b/nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/utils/sql/NCSqlExampleSpec.scala
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.sql
+package org.apache.nlpcraft.utils.sql
import com.github.difflib.text.DiffRowGenerator
import com.github.vertical_blank.sqlformatter.SqlFormatter
@@ -23,7 +23,7 @@ import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import org.apache.nlpcraft.{NCTestContext, NCTestEnvironment}
import org.apache.nlpcraft.common.ascii.NCAsciiTable
-import org.apache.nlpcraft.examples.sql.db.SqlServer
+import org.apache.nlpcraft.utils.sql.db.SqlServer
import org.junit.jupiter.api.Test
import java.util
diff --git
a/nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/examples/sql/NCSqlGeneratorSpec.scala
b/nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/utils/sql/NCSqlGeneratorSpec.scala
similarity index 95%
rename from
nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/examples/sql/NCSqlGeneratorSpec.scala
rename to
nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/utils/sql/NCSqlGeneratorSpec.scala
index 64087ed..f98fcd1 100644
---
a/nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/examples/sql/NCSqlGeneratorSpec.scala
+++
b/nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/utils/sql/NCSqlGeneratorSpec.scala
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.sql
+package org.apache.nlpcraft.utils.sql
-import org.apache.nlpcraft.examples.sql.db.SqlServer
+import org.apache.nlpcraft.utils.sql.db.SqlServer
import org.apache.nlpcraft.model.tools.sqlgen.impl.NCSqlModelGeneratorImpl
import org.junit.jupiter.api.{AfterEach, BeforeEach, Test}
diff --git
a/nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/examples/sql/NCSqlModelSpec.scala
b/nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/utils/sql/NCSqlModelSpec.scala
similarity index 98%
rename from
nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/examples/sql/NCSqlModelSpec.scala
rename to
nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/utils/sql/NCSqlModelSpec.scala
index d7e6852..e0a3472 100644
---
a/nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/examples/sql/NCSqlModelSpec.scala
+++
b/nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/utils/sql/NCSqlModelSpec.scala
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.sql
+package org.apache.nlpcraft.utils.sql
import org.apache.nlpcraft.NCTestEnvironment
-import org.apache.nlpcraft.examples.sql.db.SqlServer
+import org.apache.nlpcraft.utils.sql.db.SqlServer
import org.apache.nlpcraft.model.NCElement
import org.apache.nlpcraft.probe.mgrs.nlp.enrichers.NCTestSortTokenType._
import org.apache.nlpcraft.probe.mgrs.nlp.enrichers.{NCDefaultTestModel,
NCEnricherBaseSpec, NCTestDateToken => dte, NCTestLimitToken ⇒ lim,
NCTestNlpToken ⇒ nlp, NCTestSortToken ⇒ srt, NCTestUserToken ⇒ usr}
diff --git
a/nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/examples/sql/NCTestExampleModelsSpec.scala
b/nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/utils/sql/NCTestExampleModelsSpec.scala
similarity index 97%
rename from
nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/examples/sql/NCTestExampleModelsSpec.scala
rename to
nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/utils/sql/NCTestExampleModelsSpec.scala
index a43f754..81803a7 100644
---
a/nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/examples/sql/NCTestExampleModelsSpec.scala
+++
b/nlpcraft-examples/sql/src/test/java/org/apache/nlpcraft/utils/sql/NCTestExampleModelsSpec.scala
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.sql
+package org.apache.nlpcraft.utils.sql
import org.apache.nlpcraft.model.tools.test.NCTestAutoModelValidator
import org.junit.jupiter.api.{Assertions, Test}
diff --git
a/nlpcraft-examples/time/src/main/java/org/apache/nlpcraft/examples/time/TimeModel.java
b/nlpcraft-examples/time/src/main/java/org/apache/nlpcraft/utils/time/TimeModel.java
similarity index 96%
rename from
nlpcraft-examples/time/src/main/java/org/apache/nlpcraft/examples/time/TimeModel.java
rename to
nlpcraft-examples/time/src/main/java/org/apache/nlpcraft/utils/time/TimeModel.java
index 6a5ebf6..c03cdb1 100644
---
a/nlpcraft-examples/time/src/main/java/org/apache/nlpcraft/examples/time/TimeModel.java
+++
b/nlpcraft-examples/time/src/main/java/org/apache/nlpcraft/utils/time/TimeModel.java
@@ -15,16 +15,16 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.time;
+package org.apache.nlpcraft.utils.time;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.dataformat.yaml.*;
import org.apache.commons.text.*;
import org.apache.nlpcraft.common.*;
-import org.apache.nlpcraft.examples.misc.geo.cities.*;
-import org.apache.nlpcraft.examples.misc.geo.keycdn.*;
-import org.apache.nlpcraft.examples.misc.geo.keycdn.beans.*;
+import org.apache.nlpcraft.utils.cities.*;
+import org.apache.nlpcraft.utils.keycdn.*;
+import org.apache.nlpcraft.utils.keycdn.beans.*;
import org.apache.nlpcraft.model.*;
import java.time.*;
import java.time.format.*;
diff --git
a/nlpcraft-examples/time/src/main/java/org/apache/nlpcraft/examples/time/TimeModelApp.java
b/nlpcraft-examples/time/src/main/java/org/apache/nlpcraft/utils/time/TimeModelApp.java
similarity index 97%
rename from
nlpcraft-examples/time/src/main/java/org/apache/nlpcraft/examples/time/TimeModelApp.java
rename to
nlpcraft-examples/time/src/main/java/org/apache/nlpcraft/utils/time/TimeModelApp.java
index 8f52122..f9af63b 100644
---
a/nlpcraft-examples/time/src/main/java/org/apache/nlpcraft/examples/time/TimeModelApp.java
+++
b/nlpcraft-examples/time/src/main/java/org/apache/nlpcraft/utils/time/TimeModelApp.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.time;
+package org.apache.nlpcraft.utils.time;
import org.apache.nlpcraft.model.tools.embedded.NCEmbeddedProbe;
diff --git
a/nlpcraft-examples/time/src/test/java/org/apache/nlpcraft/examples/time/NCTestExampleModelsSpec.scala
b/nlpcraft-examples/time/src/test/java/org/apache/nlpcraft/utils/time/NCTestExampleModelsSpec.scala
similarity index 94%
rename from
nlpcraft-examples/time/src/test/java/org/apache/nlpcraft/examples/time/NCTestExampleModelsSpec.scala
rename to
nlpcraft-examples/time/src/test/java/org/apache/nlpcraft/utils/time/NCTestExampleModelsSpec.scala
index f49aa0b..b959b88 100644
---
a/nlpcraft-examples/time/src/test/java/org/apache/nlpcraft/examples/time/NCTestExampleModelsSpec.scala
+++
b/nlpcraft-examples/time/src/test/java/org/apache/nlpcraft/utils/time/NCTestExampleModelsSpec.scala
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.time
+package org.apache.nlpcraft.utils.time
import org.apache.nlpcraft.model.tools.test.NCTestAutoModelValidator
import org.junit.jupiter.api.{Assertions, Test}
@@ -27,7 +27,7 @@ class NCTestExampleModelsSpec {
@Test
def test(): Unit = {
// Instruct auto-validator what models to test.
- System.setProperty("NLPCRAFT_TEST_MODELS",
"org.apache.nlpcraft.examples.sql.SqlModel")
+ System.setProperty("NLPCRAFT_TEST_MODELS",
"org.apache.nlpcraft.examples.time.TimeModel")
// Start model auto-validator.
Assertions.assertTrue(NCTestAutoModelValidator.isValid(),"See error
logs above.")
diff --git
a/nlpcraft-examples/time/src/test/java/org/apache/nlpcraft/examples/time/NCTimeModelSpec.scala
b/nlpcraft-examples/time/src/test/java/org/apache/nlpcraft/utils/time/NCTimeModelSpec.scala
similarity index 97%
rename from
nlpcraft-examples/time/src/test/java/org/apache/nlpcraft/examples/time/NCTimeModelSpec.scala
rename to
nlpcraft-examples/time/src/test/java/org/apache/nlpcraft/utils/time/NCTimeModelSpec.scala
index ccc5e31..989b13b 100644
---
a/nlpcraft-examples/time/src/test/java/org/apache/nlpcraft/examples/time/NCTimeModelSpec.scala
+++
b/nlpcraft-examples/time/src/test/java/org/apache/nlpcraft/utils/time/NCTimeModelSpec.scala
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.time
+package org.apache.nlpcraft.utils.time
import org.apache.nlpcraft.{NCTestContext, NCTestEnvironment}
import org.apache.nlpcraft.common.NCException
diff --git
a/nlpcraft-examples/weather/src/main/java/org/apache/nlpcraft/examples/weather/WeatherModel.java
b/nlpcraft-examples/weather/src/main/java/org/apache/nlpcraft/utils/weather/WeatherModel.java
similarity index 91%
rename from
nlpcraft-examples/weather/src/main/java/org/apache/nlpcraft/examples/weather/WeatherModel.java
rename to
nlpcraft-examples/weather/src/main/java/org/apache/nlpcraft/utils/weather/WeatherModel.java
index 9d7de36..804432f 100644
---
a/nlpcraft-examples/weather/src/main/java/org/apache/nlpcraft/examples/weather/WeatherModel.java
+++
b/nlpcraft-examples/weather/src/main/java/org/apache/nlpcraft/utils/weather/WeatherModel.java
@@ -15,18 +15,30 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.weather;
+package org.apache.nlpcraft.utils.weather;
import com.google.gson.Gson;
import org.apache.commons.lang3.tuple.Pair;
-import org.apache.nlpcraft.examples.misc.darksky.DarkSkyException;
-import org.apache.nlpcraft.examples.misc.darksky.DarkSkyService;
-import org.apache.nlpcraft.examples.misc.geo.keycdn.GeoManager;
-import org.apache.nlpcraft.examples.misc.geo.keycdn.beans.GeoDataBean;
-import org.apache.nlpcraft.model.*;
+import org.apache.nlpcraft.utils.keycdn.GeoManager;
+import org.apache.nlpcraft.utils.keycdn.beans.GeoDataBean;
+import org.apache.nlpcraft.utils.weather.darksky.DarkSkyException;
+import org.apache.nlpcraft.utils.weather.darksky.DarkSkyService;
+import org.apache.nlpcraft.model.NCIntent;
+import org.apache.nlpcraft.model.NCIntentMatch;
+import org.apache.nlpcraft.model.NCIntentSample;
+import org.apache.nlpcraft.model.NCIntentTerm;
+import org.apache.nlpcraft.model.NCModelFileAdapter;
+import org.apache.nlpcraft.model.NCRejection;
+import org.apache.nlpcraft.model.NCResult;
+import org.apache.nlpcraft.model.NCToken;
import java.time.Instant;
-import java.util.*;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
import static java.time.temporal.ChronoUnit.DAYS;
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/darksky/DarkSkyException.java
b/nlpcraft-examples/weather/src/main/java/org/apache/nlpcraft/utils/weather/darksky/DarkSkyException.java
similarity index 96%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/darksky/DarkSkyException.java
rename to
nlpcraft-examples/weather/src/main/java/org/apache/nlpcraft/utils/weather/darksky/DarkSkyException.java
index 239bb1d..cd019ec 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/darksky/DarkSkyException.java
+++
b/nlpcraft-examples/weather/src/main/java/org/apache/nlpcraft/utils/weather/darksky/DarkSkyException.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.misc.darksky;
+package org.apache.nlpcraft.utils.weather.darksky;
/**
* DarkSkyException exception.
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/darksky/DarkSkyService.java
b/nlpcraft-examples/weather/src/main/java/org/apache/nlpcraft/utils/weather/darksky/DarkSkyService.java
similarity index 99%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/darksky/DarkSkyService.java
rename to
nlpcraft-examples/weather/src/main/java/org/apache/nlpcraft/utils/weather/darksky/DarkSkyService.java
index 9579692..a41bd72 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/darksky/DarkSkyService.java
+++
b/nlpcraft-examples/weather/src/main/java/org/apache/nlpcraft/utils/weather/darksky/DarkSkyService.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.misc.darksky;
+package org.apache.nlpcraft.utils.weather.darksky;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
diff --git
a/nlpcraft-examples/weather/src/test/java/org/apache/nlpcraft/examples/weather/NCTestExampleModelsSpec.scala
b/nlpcraft-examples/weather/src/test/java/org/apache/nlpcraft/utils/weather/NCTestExampleModelsSpec.scala
similarity index 97%
rename from
nlpcraft-examples/weather/src/test/java/org/apache/nlpcraft/examples/weather/NCTestExampleModelsSpec.scala
rename to
nlpcraft-examples/weather/src/test/java/org/apache/nlpcraft/utils/weather/NCTestExampleModelsSpec.scala
index 25f24e9..635e018 100644
---
a/nlpcraft-examples/weather/src/test/java/org/apache/nlpcraft/examples/weather/NCTestExampleModelsSpec.scala
+++
b/nlpcraft-examples/weather/src/test/java/org/apache/nlpcraft/utils/weather/NCTestExampleModelsSpec.scala
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.weather
+package org.apache.nlpcraft.utils.weather
import org.apache.nlpcraft.model.tools.test.NCTestAutoModelValidator
import org.junit.jupiter.api.{Assertions, Test}
diff --git a/nlpcraft/pom.xml b/nlpcraft/pom.xml
index c0c4dcd..d62429f 100644
--- a/nlpcraft/pom.xml
+++ b/nlpcraft/pom.xml
@@ -447,7 +447,7 @@
]]>
</top>
<excludePackageNames>
-
org.apache.nlpcraft.common.*:org.apache.nlpcraft.common:org.apache.nlpcraft.examples.*:org.apache.nlpcraft.examples:org.apache.nlpcraft.model.impl:org.apache.nlpcraft.model.impl.json:org.apache.nlpcraft.model.intent.impl.antlr4:org.apache.nlpcraft.model.intent.utils:org.apache.nlpcraft.probe.mgrs.model.antlr4:org.apache.nlpcraft.server.mdo.impl
+
org.apache.nlpcraft.common.*:org.apache.nlpcraft.common:org.apache.nlpcraft.utils.*:org.apache.nlpcraft.examples:org.apache.nlpcraft.model.impl:org.apache.nlpcraft.model.impl.json:org.apache.nlpcraft.model.intent.impl.antlr4:org.apache.nlpcraft.model.intent.utils:org.apache.nlpcraft.probe.mgrs.model.antlr4:org.apache.nlpcraft.server.mdo.impl
</excludePackageNames>
<groups>
<group>
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/README.md
b/nlpcraft/src/main/scala/org/apache/nlpcraft/utils/README.md
similarity index 97%
rename from nlpcraft/src/main/scala/org/apache/nlpcraft/examples/README.md
rename to nlpcraft/src/main/scala/org/apache/nlpcraft/utils/README.md
index 69334bf..36ad1e9 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/README.md
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/utils/README.md
@@ -15,6 +15,8 @@
limitations under the License.
-->
+TODO: add here that we need it for tests (examples).
+
<img src="https://nlpcraft.apache.org/images/nlpcraft_logo_black.gif"
height="80px">
<br>
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/cities/CitiesDataProvider.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/utils/cities/CitiesDataProvider.java
similarity index 96%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/cities/CitiesDataProvider.java
rename to
nlpcraft/src/main/scala/org/apache/nlpcraft/utils/cities/CitiesDataProvider.java
index a3a0f80..d4556e1 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/cities/CitiesDataProvider.java
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/utils/cities/CitiesDataProvider.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.misc.geo.cities;
+package org.apache.nlpcraft.utils.cities;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.nlpcraft.common.NCException;
@@ -44,7 +44,7 @@ public class CitiesDataProvider {
Objects.requireNonNull(
CitiesDataProvider.class.
getClassLoader().
-
getResourceAsStream("org/apache/nlpcraft/examples/misc/geo/cities/cities_timezones.txt"))
+
getResourceAsStream("org/apache/nlpcraft/utils/cities/cities_timezones.txt"))
))) {
String line = reader.readLine();
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/cities/City.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/utils/cities/City.java
similarity index 97%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/cities/City.java
rename to nlpcraft/src/main/scala/org/apache/nlpcraft/utils/cities/City.java
index 8f2ee0c..82a511b 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/cities/City.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/utils/cities/City.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.misc.geo.cities;
+package org.apache.nlpcraft.utils.cities;
import java.util.Objects;
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/cities/CityData.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/utils/cities/CityData.java
similarity index 97%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/cities/CityData.java
rename to nlpcraft/src/main/scala/org/apache/nlpcraft/utils/cities/CityData.java
index 0760c37..40d5bc7 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/cities/CityData.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/utils/cities/CityData.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.misc.geo.cities;
+package org.apache.nlpcraft.utils.cities;
/**
* City data holder.
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/cities/cities_timezones.txt
b/nlpcraft/src/main/scala/org/apache/nlpcraft/utils/cities/cities_timezones.txt
similarity index 100%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/cities/cities_timezones.txt
rename to
nlpcraft/src/main/scala/org/apache/nlpcraft/utils/cities/cities_timezones.txt
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/keycdn/GeoManager.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/utils/keycdn/GeoManager.java
similarity index 96%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/keycdn/GeoManager.java
rename to
nlpcraft/src/main/scala/org/apache/nlpcraft/utils/keycdn/GeoManager.java
index 7f0b7e9..db76f1c 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/keycdn/GeoManager.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/utils/keycdn/GeoManager.java
@@ -15,11 +15,11 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.misc.geo.keycdn;
+package org.apache.nlpcraft.utils.keycdn;
import com.google.gson.Gson;
-import org.apache.nlpcraft.examples.misc.geo.keycdn.beans.GeoDataBean;
-import org.apache.nlpcraft.examples.misc.geo.keycdn.beans.ResponseBean;
+import org.apache.nlpcraft.utils.keycdn.beans.GeoDataBean;
+import org.apache.nlpcraft.utils.keycdn.beans.ResponseBean;
import org.apache.nlpcraft.model.NCRequest;
import java.io.BufferedReader;
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/keycdn/beans/GeoDataBean.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/utils/keycdn/beans/GeoDataBean.java
similarity index 97%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/keycdn/beans/GeoDataBean.java
rename to
nlpcraft/src/main/scala/org/apache/nlpcraft/utils/keycdn/beans/GeoDataBean.java
index e6754fa..2558046 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/keycdn/beans/GeoDataBean.java
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/utils/keycdn/beans/GeoDataBean.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.misc.geo.keycdn.beans;
+package org.apache.nlpcraft.utils.keycdn.beans;
import com.google.gson.annotations.SerializedName;
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/keycdn/beans/ResponseBean.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/utils/keycdn/beans/ResponseBean.java
similarity index 97%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/keycdn/beans/ResponseBean.java
rename to
nlpcraft/src/main/scala/org/apache/nlpcraft/utils/keycdn/beans/ResponseBean.java
index 1f6dcbd..a79a77e 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/keycdn/beans/ResponseBean.java
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/utils/keycdn/beans/ResponseBean.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.misc.geo.keycdn.beans;
+package org.apache.nlpcraft.utils.keycdn.beans;
/**
* Service https://tools.keycdn.com/geo response part bean.
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/keycdn/beans/ResponseDataBean.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/utils/keycdn/beans/ResponseDataBean.java
similarity index 95%
rename from
nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/keycdn/beans/ResponseDataBean.java
rename to
nlpcraft/src/main/scala/org/apache/nlpcraft/utils/keycdn/beans/ResponseDataBean.java
index d86bb16..3329767 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/misc/geo/keycdn/beans/ResponseDataBean.java
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/utils/keycdn/beans/ResponseDataBean.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.examples.misc.geo.keycdn.beans;
+package org.apache.nlpcraft.utils.keycdn.beans;
/**
* Service https://tools.keycdn.com/geo response bean.
diff --git a/nlpcraft/src/test/resources/nlpcraft.conf
b/nlpcraft/src/test/resources/nlpcraft.conf
new file mode 100644
index 0000000..59eba4b
--- /dev/null
+++ b/nlpcraft/src/test/resources/nlpcraft.conf
@@ -0,0 +1,151 @@
+#
+# 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.
+#
+
+// TODO: why do we need it?
+
+# 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/tree/master/external
+ extConfig {
+ # Mandatory.
+ extUrl =
"https://github.com/apache/incubator-nlpcraft/raw/master/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.
+ // TODO:
+ id = "tests"
+
+ # 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 = ...
+
+ # 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/src/test/scala/org/apache/nlpcraft/NCTestExampleModelsSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/NCTestExampleModelsSpec.scala
deleted file mode 100644
index 713eae6..0000000
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/NCTestExampleModelsSpec.scala
+++ /dev/null
@@ -1,46 +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
-
-import org.apache.nlpcraft.model.tools.test.NCTestAutoModelValidator
-import org.junit.jupiter.api.{Assertions, Test}
-
-/**
- * JUnit example models validation.
- */
-class NCTestExampleModelsSpec {
- @Test
- def test(): Unit = {
- var models = "" +
- "org.apache.nlpcraft.examples.alarm.AlarmModel," +
- "org.apache.nlpcraft.examples.time.TimeModel," +
- "org.apache.nlpcraft.examples.lightswitch.LightSwitchModel," +
- "org.apache.nlpcraft.examples.echo.EchoModel"
-
- val maven = System.getProperty("NLPCRAFT_TEST_MAVEN_ENV")
-
- if (maven == null || maven.toLowerCase != "true")
- models =
s"$models,org.apache.nlpcraft.examples.weather.WeatherModel"
-
- // Instruct auto-validator what models to test.
- System.setProperty("NLPCRAFT_TEST_MODELS", models)
-
- // Start model auto-validator.
- Assertions.assertTrue(NCTestAutoModelValidator.isValid(),"See error
logs above.")
- }
-}
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/NCRestErrorsSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/NCRestErrorsSpec.scala
index c960909..e88adfd 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/NCRestErrorsSpec.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/NCRestErrorsSpec.scala
@@ -71,24 +71,24 @@ class NCRestErrorsSpec extends NCRestSpec {
401,
"NC_INVALID_ACCESS_TOKEN",
"acsTok" → "UNEXPECTED",
- "mdlId" → "nlpcraft.time.ex"
+ "mdlId" → "rest.test.model"
)
postError("clear/dialog",
401,
"NC_INVALID_ACCESS_TOKEN",
"acsTok" → "UNEXPECTED",
- "mdlId" → "nlpcraft.time.ex"
+ "mdlId" → "rest.test.model"
)
// Invalid values.
postError("clear/conversation",
- 400, "NC_INVALID_FIELD", "usrId" → -1, "mdlId" → "nlpcraft.time.ex"
+ 400, "NC_INVALID_FIELD", "usrId" → -1, "mdlId" → "rest.test.model"
)
postError(
"clear/dialog",
400, "NC_INVALID_FIELD",
"usrId" → -1,
- "mdlId" → "nlpcraft.time.ex"
+ "mdlId" → "rest.test.model"
)
postError("clear/conversation", 400, "NC_INVALID_FIELD", "mdlId" →
"UNEXPECTED")
@@ -290,14 +290,14 @@ class NCRestErrorsSpec extends NCRestSpec {
"NC_INVALID_ACCESS_TOKEN",
"acsTok" → "UNEXPECTED",
"txt" → "What's the local time?",
- "mdlId" → "nlpcraft.time.ex"
+ "mdlId" → "rest.test.model"
)
postError("ask/sync",
401,
"NC_INVALID_ACCESS_TOKEN",
"acsTok" → "UNEXPECTED",
"txt" → "What's the local time?",
- "mdlId" → "nlpcraft.time.ex"
+ "mdlId" → "rest.test.model"
)
// Invalid values.
@@ -305,27 +305,27 @@ class NCRestErrorsSpec extends NCRestSpec {
400,
"NC_INVALID_FIELD",
"txt" → "What's the local time?",
- "mdlId" → "nlpcraft.time.ex",
+ "mdlId" → "rest.test.model",
"usrId" → -1
)
postError("ask/sync",
400,
"NC_INVALID_FIELD",
"txt" → "What's the local time?",
- "mdlId" → "nlpcraft.time.ex",
+ "mdlId" → "rest.test.model",
"usrId" → -1
)
postError("ask",
400,
"NC_INVALID_FIELD",
"txt" → mkString(1025),
- "mdlId" → "nlpcraft.time.ex"
+ "mdlId" → "rest.test.model"
)
postError("ask/sync",
400,
"NC_INVALID_FIELD",
"txt" → mkString(1025),
- "mdlId" → "nlpcraft.time.ex"
+ "mdlId" → "rest.test.model"
)
postError("ask",
400,
@@ -344,12 +344,12 @@ class NCRestErrorsSpec extends NCRestSpec {
postError("ask",
400,
"NC_ERROR",
- "mdlId" → "nlpcraft.time.ex"
+ "mdlId" → "rest.test.model"
)
postError("ask/sync",
400,
"NC_ERROR",
- "mdlId" → "nlpcraft.time.ex"
+ "mdlId" → "rest.test.model"
)
}
@@ -360,7 +360,7 @@ class NCRestErrorsSpec extends NCRestSpec {
401,
"NC_INVALID_ACCESS_TOKEN",
"acsTok" → "UNEXPECTED",
- "mdlId" → "nlpcraft.time.ex"
+ "mdlId" → "rest.test.model"
)
// Invalid values.
@@ -372,7 +372,7 @@ class NCRestErrorsSpec extends NCRestSpec {
postError("model/sugsyn",
400,
"NC_INVALID_FIELD",
- "mdlId" → "nlpcraft.time.ex",
+ "mdlId" → "rest.test.model",
"minScore" → 1000
)
}
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/NCRestModelSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/NCRestModelSpec.scala
index 7ec4888..1686581 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/NCRestModelSpec.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/NCRestModelSpec.scala
@@ -29,15 +29,14 @@ import scala.collection.JavaConverters._
@NCTestEnvironment(model = classOf[RestTestModel], startClient = false)
class NCRestModelSpec extends NCRestSpec {
@Test
- // TODO:!
def test(): Unit = {
def extract(data: java.util.List[java.util.Map[String, Object]]):
Seq[Double] =
data.asScala.map(_.get("score").asInstanceOf[Number].doubleValue())
- // Note that checked values are valid for current configuration of
`nlpcraft.alarm.ex` model.
+ // Note that checked values are valid for current configuration of
`RestTestModel` model.
post("model/sugsyn", "mdlId" → "rest.test.model")(
("$.status", (status: String) ⇒ assertEquals("API_OK", status)),
- ("$.result.suggestions[:1].x:alarm.*", (data:
java.util.List[java.util.Map[String, Object]]) ⇒ {
+ ("$.result.suggestions[:1].a.*", (data:
java.util.List[java.util.Map[String, Object]]) ⇒ {
val scores = extract(data)
assertTrue(scores.nonEmpty)
@@ -48,7 +47,7 @@ class NCRestModelSpec extends NCRestSpec {
)
post("model/sugsyn", "mdlId" → "rest.test.model", "minScore" → 0.5)(
("$.status", (status: String) ⇒ assertEquals("API_OK", status)),
- ("$.result.suggestions[:1].x:alarm.*", (data:
java.util.List[java.util.Map[String, Object]]) ⇒ {
+ ("$.result.suggestions[:1].a.*", (data:
java.util.List[java.util.Map[String, Object]]) ⇒ {
val scores = extract(data)
assertTrue(scores.nonEmpty)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/RestTestModel.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/RestTestModel.scala
index 16b25b7..115caa5 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/RestTestModel.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/RestTestModel.scala
@@ -18,7 +18,7 @@
package org.apache.nlpcraft.server.rest
import org.apache.nlpcraft.NCTestElement
-import org.apache.nlpcraft.model.{NCElement, NCIntent, NCIntentMatch,
NCModelAdapter, NCResult}
+import org.apache.nlpcraft.model.{NCElement, NCIntent, NCIntentMatch,
NCIntentRef, NCIntentSample, NCModelAdapter, NCResult}
import java.util
@@ -29,15 +29,15 @@ class RestTestModel extends
NCModelAdapter("rest.test.model", "REST test model",
override def getElements: util.Set[NCElement] =
Set(
NCTestElement("a"),
- NCTestElement("b")
+ NCTestElement("b"),
+ NCTestElement("x", "cat")
)
@NCIntent("intent=onA term(t)={tok_id() == 'a'}")
+ @NCIntentSample(Array("My A"))
private def a(ctx: NCIntentMatch): NCResult = NCResult.text("OK")
@NCIntent("intent=onB term(t)={tok_id() == 'b'}")
+ @NCIntentSample(Array("My B"))
private def b(ctx: NCIntentMatch): NCResult = NCResult.text("OK")
-
- @NCIntent("intent=onB term(t)={tok_id() == 'a' && tok_id() == 'b'}")
- private def ab(ctx: NCIntentMatch): NCResult = NCResult.text("OK")
}