This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-387
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-387 by this push:
new 87aa056 WIP on NLPCRAFT-387.
87aa056 is described below
commit 87aa05675a22b03d89fedc430e6d221021947c85
Author: Aaron Radzinzski <[email protected]>
AuthorDate: Mon Aug 2 19:39:17 2021 -0700
WIP on NLPCRAFT-387.
---
.../alarm/src/main/resources/alarm_model.json | 2 +-
.../alarm/src/main/resources/alarm_samples.txt | 5 +++--
.../nlpcraft/examples/alarm/NCAlarmModelSpec.scala | 11 ++++++++++-
.../nlpcraft/common/nlp/numeric/NCNumericFuzzy.scala | 18 +++++++++---------
4 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/nlpcraft-examples/alarm/src/main/resources/alarm_model.json
b/nlpcraft-examples/alarm/src/main/resources/alarm_model.json
index 3d79875..9060fde 100644
--- a/nlpcraft-examples/alarm/src/main/resources/alarm_model.json
+++ b/nlpcraft-examples/alarm/src/main/resources/alarm_model.json
@@ -29,7 +29,7 @@
"description": "Alarm token indicator.",
"synonyms": [
"{ping|buzz|wake|call|hit} {me|up|me up|_}",
- "{set|_} {my|_} {wake|wake up|_}
{alarm|timer|clock|buzzer|call} {up|_}"
+ "{set|_} {my|_} {wake|wake up|_}
{alarm|timer|clock|buzzer|call} {clock|_} {up|_}"
]
}
],
diff --git a/nlpcraft-examples/alarm/src/main/resources/alarm_samples.txt
b/nlpcraft-examples/alarm/src/main/resources/alarm_samples.txt
index d0f84a8..07ce622 100644
--- a/nlpcraft-examples/alarm/src/main/resources/alarm_samples.txt
+++ b/nlpcraft-examples/alarm/src/main/resources/alarm_samples.txt
@@ -25,9 +25,10 @@ Set my alarm for 30s
Please, wake me up in twenty-five minutes!
Buzz me in few minutes
Buzz me in a couple of minutes
-Buzz me in an hour
+Wake me up in an hour
Buzz me in a couple of hours
-Buzz me in an hour and 15mins
+Wake me up in a bit
+Set my alarm clock for an hour and 15mins
Buzz me in one hour and 15mins
Buzz me in 1 hour and 15mins
Buzz me in 1h and 15mins
diff --git
a/nlpcraft-examples/alarm/src/test/java/org/apache/nlpcraft/examples/alarm/NCAlarmModelSpec.scala
b/nlpcraft-examples/alarm/src/test/java/org/apache/nlpcraft/examples/alarm/NCAlarmModelSpec.scala
index 4782757..0cb90ad 100644
---
a/nlpcraft-examples/alarm/src/test/java/org/apache/nlpcraft/examples/alarm/NCAlarmModelSpec.scala
+++
b/nlpcraft-examples/alarm/src/test/java/org/apache/nlpcraft/examples/alarm/NCAlarmModelSpec.scala
@@ -48,7 +48,15 @@ class NCAlarmModelSpec extends NCTestContext {
def test(): Unit = {
val now = LocalDateTime.now
- def mkPeriod(hours: Int, mins: Int): Long =
now.until(now.plusHours(hours).plusMinutes(mins), MILLIS)
+ /**
+ *
+ * @param hours
+ * @param mins
+ * @param secs
+ * @return
+ */
+ def mkPeriod(hours: Int, mins: Int, secs: Int = 0): Long =
+
now.until(now.plusHours(hours).plusMinutes(mins).plusSeconds(secs), MILLIS)
// Fuzzy.
check("Buzz me in few minutes.", mkPeriod(0, 2))
@@ -56,6 +64,7 @@ class NCAlarmModelSpec extends NCTestContext {
check("Buzz me in one or two minutes.", mkPeriod(0, 2))
check("Buzz me in a couple of minutes.", mkPeriod(0, 2))
check("Buzz me in an hour.", mkPeriod(1, 0))
+ check("Buzz me in a bit.", mkPeriod(0, 2))
// Complex periods.
check("Buzz me in an hour and 15mins", mkPeriod(1, 15))
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/numeric/NCNumericFuzzy.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/numeric/NCNumericFuzzy.scala
index eb15a0d..4222667 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/numeric/NCNumericFuzzy.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/numeric/NCNumericFuzzy.scala
@@ -35,19 +35,19 @@ object NCNumericFuzzy {
val singleDt =
Map(
- "in {a|an} second {or two|_}" -> U("second", "datetime"),
- "in {a|an} hour {or two|_}" -> U("hour", "datetime"),
- "in {a|an} minute {or two|_}" -> U("minute", "datetime"),
- "in {a|an} day {or two|_}" -> U("day", "datetime"),
- "in {a|an} week {or two|_}" -> U("week", "datetime"),
- "in {a|an} month {or two|_}" -> U("month", "datetime"),
- "in {a|an} year {or two|_}" -> U("year", "datetime")
+ "in second {or two|_}" -> U("second", "datetime"),
+ "in hour {or two|_}" -> U("hour", "datetime"),
+ "in minute {or two|_}" -> U("minute", "datetime"),
+ "in day {or two|_}" -> U("day", "datetime"),
+ "in week {or two|_}" -> U("week", "datetime"),
+ "in month {or two|_}" -> U("month", "datetime"),
+ "in year {or two|_}" -> U("year", "datetime")
).flatMap { case (txt, u) => make(txt, u, 1) }
val bitDt =
Map(
- "in {a|an} bit" -> U("second", "datetime")
- ).flatMap { case (txt, u) => make(txt, u, 60) }
+ "in {a|an} bit" -> U("minute", "datetime")
+ ).flatMap { case (txt, u) => make(txt, u, 2) }
val fewDt =
Map(