This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-206
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-206 by this push:
new 1a8bc56 WIP.
1a8bc56 is described below
commit 1a8bc56bcc660a00ad8be58960a6ca0e77a00429
Author: Aaron Radzinski <[email protected]>
AuthorDate: Fri Mar 12 21:12:04 2021 -0800
WIP.
---
.../scala/org/apache/nlpcraft/common/util/NCUtils.scala | 5 +++--
.../main/scala/org/apache/nlpcraft/server/NCServer.scala | 16 ++++++++--------
.../org/apache/nlpcraft/model/NCIntentDslSpec.scala | 10 +++++++---
3 files changed, 18 insertions(+), 13 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala
index 1e73bd2..56a2f3f 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala
@@ -1217,9 +1217,10 @@ object NCUtils extends LazyLogging {
def neon(s: String): Boolean = s != null && s.nonEmpty
/**
- * Generates (relatively) unique ID good for a short-term usage.
+ * Generates (a relatively) globally unique ID good for a short-term
usage.
*/
- def genGuid(): String = idGen.encrypt(System.currentTimeMillis(),
System.nanoTime())
+ def genGuid(): String = idGen.encrypt(System.currentTimeMillis(),
System.nanoTime()).
+ toUpperCase.grouped(4).filter(_.length() == 4).mkString("-")
/**
* Converts non-empty sequence of '\n' and '\s' into one ' '.
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/NCServer.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/NCServer.scala
index abfc142..5270eec 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/NCServer.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/NCServer.scala
@@ -297,8 +297,8 @@ object NCServer extends App with NCIgniteInstance with
LazyLogging with NCOpenCe
val tbl = NCAsciiTable()
- tbl += (s"${b("PID")}", Config.pid)
- tbl += (s"${b("Database:")}", "")
+ tbl += (s"${bo(b("PID"))}", Config.pid)
+ tbl += (s"${bo(b("Database:"))}", "")
tbl += (s"${b(" JDBC URL")}", Config.dbUrl)
tbl += (s"${b(" JDBC Driver")}", Config.dbDriver)
tbl += (s"${b(" Pool min")}", Config.dbPoolMin)
@@ -306,18 +306,18 @@ object NCServer extends App with NCIgniteInstance with
LazyLogging with NCOpenCe
tbl += (s"${b(" Pool max")}", Config.dbPoolMax)
tbl += (s"${b(" Pool increment")}", Config.dbPoolInc)
tbl += (s"${b(" Reset on start")}", Config.dbInit)
- tbl += (s"${b("REST:")}", "")
+ tbl += (s"${bo(b("REST:"))}", "")
tbl += (s"${b(" Endpoint")}", Config.restEndpoint)
tbl += (s"${b(" API provider")}", Config.restApi)
- tbl += (s"${b("Probe:")}", "")
+ tbl += (s"${bo(b("Probe:"))}", "")
tbl += (s"${b(" Uplink")}", Config.upLink)
tbl += (s"${b(" Downlink")}", Config.downLink)
- tbl += (s"${b("Token providers")}", Config.tokProviders)
- tbl += (s"${b("NLP engine")}", Config.nlpEngine)
- tbl += (s"${b("Access tokens:")}", "")
+ tbl += (s"${bo(b("Token providers"))}", Config.tokProviders)
+ tbl += (s"${bo(b("NLP engine"))}", Config.nlpEngine)
+ tbl += (s"${bo(b("Access tokens:"))}", "")
tbl += (s"${b(" Scan frequency")}",
s"${Config.acsToksScanMins} mins")
tbl += (s"${b(" Expiration timeout")}",
s"${Config.acsToksExpireMins} mins")
- tbl += (s"${b("External config:")}", "")
+ tbl += (s"${bo(b("External config:"))}", "")
tbl += (s"${b(" URL")}", Config.extCfgUrl)
tbl += (s"${b(" Check MD5")}", Config.extCfgCheckMd5)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/NCIntentDslSpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/NCIntentDslSpec.scala
index def742c..bb80ac2 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/NCIntentDslSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/NCIntentDslSpec.scala
@@ -36,13 +36,17 @@ class NCIntentDslSpecModel extends NCModelAdapter(
override def getElements: util.Set[NCElement] = Set(NCTestElement("paris"))
// Moscow population filter.
- @NCIntent("intent=bigCity term(city)={id() == 'nlpcraft:city' &&
get(meta_token('nlpcraft:city:citymeta'), 'population') >= 10381222}")
+ @NCIntent("intent=bigCity " +
+ "term(city)={" +
+ "id() == 'nlpcraft:city' && " +
+ "get(meta_token('nlpcraft:city:citymeta'), 'population') >=
10381222" +
+ "}")
private def onBigCity(ctx: NCIntentMatch): NCResult = "OK"
- @NCIntent("intent=otherCity term(city)={id() == 'nlpcraft:city' }")
+ @NCIntent("intent=otherCity term(city)={id() == 'nlpcraft:city'}")
private def onOtherCity(ctx: NCIntentMatch): NCResult = "OK"
- @NCIntent("intent=userElement term(x)={id() == 'paris' }")
+ @NCIntent("intent=userElement term(x)={id() == 'paris'}")
private def onUserElement(ctx: NCIntentMatch): NCResult = "OK"
}