This is an automated email from the ASF dual-hosted git repository.

sergeykamov pushed a commit to branch NLPCRAFT-383
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git


The following commit(s) were added to refs/heads/NLPCRAFT-383 by this push:
     new b6996c8  WIP.
b6996c8 is described below

commit b6996c81d66868d431c0e46a7451d343b8849cf1
Author: Sergey Kamov <[email protected]>
AuthorDate: Fri Aug 6 19:39:32 2021 +0300

    WIP.
---
 .../solarsystem/loaders/SolarSystemDiscoversValueLoader.scala  | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/nlpcraft-examples/solarsystem/src/main/java/org/apache/nlpcraft/examples/solarsystem/loaders/SolarSystemDiscoversValueLoader.scala
 
b/nlpcraft-examples/solarsystem/src/main/java/org/apache/nlpcraft/examples/solarsystem/loaders/SolarSystemDiscoversValueLoader.scala
index 0a92d58..a7391a1 100644
--- 
a/nlpcraft-examples/solarsystem/src/main/java/org/apache/nlpcraft/examples/solarsystem/loaders/SolarSystemDiscoversValueLoader.scala
+++ 
b/nlpcraft-examples/solarsystem/src/main/java/org/apache/nlpcraft/examples/solarsystem/loaders/SolarSystemDiscoversValueLoader.scala
@@ -30,13 +30,15 @@ class SolarSystemDiscoversValueLoader extends NCValueLoader 
{
         val syns = ArrayBuffer.empty[String]
 
         for (d <- discInfo.split(",").map(_.trim).filter(_.nonEmpty)) {
-            syns += d.toLowerCase
+            val lc = d.toLowerCase
 
-            val arr = d.split(" ")
+            syns += lc
+
+            val lastNameIdx = lc.lastIndexOf(" ")
 
             // Tries to detect last name.
-            if (arr.length > 1)
-                syns += arr.last.strip.toLowerCase
+            if (lastNameIdx > 0)
+                syns += lc.substring(lastNameIdx + 1)
         }
 
         new NCValue {

Reply via email to