This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-296
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-296 by this push:
new 7ea76a4 WIP.
7ea76a4 is described below
commit 7ea76a4733e67f6f225e1afdf458abaa6497d7f9
Author: Aaron Radzinzski <[email protected]>
AuthorDate: Sun Jun 6 14:12:14 2021 -0700
WIP.
---
.../src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala | 8 ++++++++
.../scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala | 6 +++---
.../nlpcraft/server/geo/tools/NCGeoSyntheticNamesGenerator.scala | 4 +++-
.../src/main/scala/org/apache/nlpcraft/server/json/NCJson.scala | 7 ++++++-
4 files changed, 20 insertions(+), 5 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 b7e910f..dcf9feb 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
@@ -587,6 +587,14 @@ object NCUtils extends LazyLogging {
s"${s.head.toLower}${s.tail}"
/**
+ *
+ * @param s
+ * @return
+ */
+ def capitalize(s: String): String =
+ s"${s.head.toUpper}${s.tail}"
+
+ /**
* Converts given name into properly capitalized first and last name.
*
* @param name Full name.
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
index 0fb2556..662377f 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
@@ -2586,7 +2586,7 @@ object NCCli extends NCCliBase {
exitStatus = 1
if (msg != null && msg.nonEmpty)
- logln(s"${r("X")} ${if (msg.head.isLower) msg.head.toUpper +
msg.tail else msg}")
+ logln(s"${r("X")} ${U.capitalize(msg)}")
}
/**
@@ -2595,7 +2595,7 @@ object NCCli extends NCCliBase {
*/
private def warn(msg: String = ""): Unit =
if (msg != null && msg.nonEmpty)
- logln(s"${y("!")} ${if (msg.head.isLower) msg.head.toUpper +
msg.tail else msg}")
+ logln(s"${y("!")} ${U.capitalize(msg)}")
/**
*
@@ -2932,7 +2932,7 @@ object NCCli extends NCCliBase {
.build()
// Process 'no-ansi' and 'ansi' commands first (before ASCII title is
shown).
- processAnsi(args, repl = false)
+ processAnsi(args.toSeq, repl = false)
if (!args.contains(NO_LOGO_CMD.name))
title() // Show logo unless we have 'no-logo' command.
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/NCGeoSyntheticNamesGenerator.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/NCGeoSyntheticNamesGenerator.scala
index e7cd5f5..a5833b1 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/NCGeoSyntheticNamesGenerator.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/NCGeoSyntheticNamesGenerator.scala
@@ -48,7 +48,9 @@ object NCGeoSyntheticNamesGenerator extends App {
println(s"Synonyms count: ${NCGeoManager.getModel.synonyms.size}")
for ((synonym, entries) <- NCGeoManager.getModel.synonyms) {
- val strs2Process = mutable.Set.empty[String] + synonym
+ val strs2Process = mutable.Set.empty[String]
+
+ strs2Process.add(synonym)
def add(s: String, base: String) =
if (!NCGeoManager.getModel.synonyms.contains(s) &&
!hs.contains(s)) {
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/json/NCJson.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/json/NCJson.scala
index 918ceee..f3890fd 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/json/NCJson.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/json/NCJson.scala
@@ -279,7 +279,12 @@ object NCJson {
@tailrec
def processExpNumbers(s: String): String =
EXP_REGEX.findFirstMatchIn(s) match {
- case Some(m) => processExpNumbers(m.before +
m.group(0).replaceAll("\\+", "") + m.after)
+ case Some(m) => processExpNumbers(
+ m.before.toString +
+ m.group(0).replaceAll("\\+", "") +
+ m.after.toString
+ )
+
case None => s
}