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/19 14:49:51 UTC

[incubator-nlpcraft] branch master updated: Test fix.

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

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


The following commit(s) were added to refs/heads/master by this push:
     new c1f0c01  Test fix.
c1f0c01 is described below

commit c1f0c012b385fd83502168f038267ffe87b18c45
Author: Sergey Kamov <se...@apache.org>
AuthorDate: Sat Dec 19 17:49:44 2020 +0300

    Test fix.
---
 .../apache/nlpcraft/server/nlp/enrichers/date/NCDateParser.scala  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/date/NCDateParser.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/date/NCDateParser.scala
index bb5daea..3614509 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/date/NCDateParser.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/date/NCDateParser.scala
@@ -446,8 +446,8 @@ object NCDateParser {
             def lde(): PartResult = ldYears(10)
             def ldc(): PartResult = ldYears(100)
 
-            def ld3M(map3m: Map[Int, Int]): PartResult = lastDay((c: C) ⇒ {
-                val n = map3m(MONTH_NUM_MAP(c.get(C.MONTH)))
+            def ld3M(map3m: Map[Int, Int], getIndex: Int ⇒ Int): PartResult = lastDay((c: C) ⇒ {
+                val n = map3m(getIndex(c.get(C.MONTH)))
 
                 // Should not be in one function call (last day is relative).
                 // Note that keys in `map3m` sorted.
@@ -455,8 +455,8 @@ object NCDateParser {
                 set(c, C.DAY_OF_MONTH → c.getActualMaximum(C.DAY_OF_MONTH))
             })
 
-            def ldq(): PartResult = ld3M(QUARTERS)
-            def lds(): PartResult = ld3M(SEASONS)
+            def ldq(): PartResult = ld3M(QUARTERS, i ⇒ MONTH_NUM_MAP(i))
+            def lds(): PartResult = ld3M(SEASONS, i ⇒ i)
 
             res = fn match {
                 case "now" ⇒ now()