You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by se...@apache.org on 2020/12/21 13:40:47 UTC

[incubator-nlpcraft] branch NLPCRAFT-202 created (now 6911f9d)

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

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


      at 6911f9d  Synonyms usages fixed. Existing test improvemented.

This branch includes the following new commits:

     new 6911f9d  Synonyms usages fixed. Existing test improvemented.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-nlpcraft] 01/01: Synonyms usages fixed. Existing test improvemented.

Posted by se...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 6911f9da1600ac8265d6a53b2243154cfeec9351
Author: Sergey Kamov <se...@apache.org>
AuthorDate: Mon Dec 21 16:40:39 2020 +0300

    Synonyms usages fixed. Existing test improvemented.
---
 .../org/apache/nlpcraft/examples/weather/WeatherModel.java     |  2 +-
 .../scala/org/apache/nlpcraft/server/geo/NCGeoManager.scala    | 10 ++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/weather/WeatherModel.java b/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/weather/WeatherModel.java
index 46dcfad..44ab50a 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/weather/WeatherModel.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/weather/WeatherModel.java
@@ -143,7 +143,7 @@ public class WeatherModel extends NCModelFileAdapter {
     @NCIntentSample({
         "What's the local weather forecast?",
         "What's the weather in Moscow?",
-        "What's the current forecast for Chicago?",
+        "What's the current forecast for LA?",
         "What is the weather like outside?",
         "How's the weather?",
         "What's the weather forecast for the rest of the week?",
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/NCGeoManager.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/NCGeoManager.scala
index 4328a37..d26b23c 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/NCGeoManager.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/NCGeoManager.scala
@@ -356,10 +356,12 @@ object NCGeoManager extends NCService {
                             // NCGeoSynonym shouldn't be matched with common dictionary word.
                             // Exception - manually defined synonyms.
                             syns.filter(s ⇒
-                                SYNONYMS_MANUAL_FILES.exists(p ⇒ res.fileName.endsWith(s"/$p")) ||
-                                    (!dicts.contains(s) &&
-                                        !dicts.contains(s.replaceAll("the ", "")) &&
-                                        !dicts.contains(s.replaceAll("the-", "")))
+                                SYNONYMS_MANUAL_FILES.exists(p ⇒ res.fileName.endsWith(p)) ||
+                                (
+                                    !dicts.contains(s) &&
+                                    !dicts.contains(s.replaceAll("the ", "")) &&
+                                    !dicts.contains(s.replaceAll("the-", ""))
+                                )
                             ).foreach(addEntry(_, geoEntry, lowerCase = true))
                         case _ ⇒ throw new NCE(s"Unknown synonym or its sub-component: $geoEntry")
                     }