You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by ar...@apache.org on 2022/10/17 20:18:52 UTC
[incubator-nlpcraft] 02/02: Update CalculatorModel.scala
This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-518
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
commit 6fd7e8f3fcb70c2e9bc269b1d1c95e43fdc27d34
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Mon Oct 17 13:18:44 2022 -0700
Update CalculatorModel.scala
---
.../org/apache/nlpcraft/examples/time/CalculatorModel.scala | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/nlpcraft-examples/calculator/src/main/scala/org/apache/nlpcraft/examples/time/CalculatorModel.scala b/nlpcraft-examples/calculator/src/main/scala/org/apache/nlpcraft/examples/time/CalculatorModel.scala
index 49268abf..2d95c360 100644
--- a/nlpcraft-examples/calculator/src/main/scala/org/apache/nlpcraft/examples/time/CalculatorModel.scala
+++ b/nlpcraft-examples/calculator/src/main/scala/org/apache/nlpcraft/examples/time/CalculatorModel.scala
@@ -29,7 +29,6 @@ import java.util.Properties
*/
object CalculatorModel:
private val OPS: Map[String, (Int, Int) => Int] = Map("+" -> (_ + _), "-" -> (_ - _), "*" -> (_ * _), "/" -> (_ / _))
-
private val PIPELINE: NCPipeline =
val props = new Properties()
props.setProperty("annotators", "tokenize, ssplit, pos, lemma, ner")
@@ -58,9 +57,9 @@ class CalculatorModel extends NCModelAdapter(NCModelConfig("nlpcraft.calculator.
@NCIntent(
"intent=calc options={ 'ordered': true }" +
- " term(x)={# == 'stanford:number'} " +
- " term(op)={# == 'nlp:token' && has(list('+', '-', '*', '/'), meta_ent('nlp:token:text')) == true} " +
- " term(y)={# == 'stanford:number'}"
+ " term(x)={# == 'stanford:number'}" +
+ " term(op)={has(list('+', '-', '*', '/'), meta_ent('nlp:token:text')) == true}" +
+ " term(y)={# == 'stanford:number'}"
)
def onMatch(
ctx: NCContext,
@@ -72,8 +71,8 @@ class CalculatorModel extends NCModelAdapter(NCModelConfig("nlpcraft.calculator.
@NCIntent(
"intent=calcMem options={ 'ordered': true }" +
- " term(op)={# == 'nlp:token' && has(list('+', '-', '*', '/'), meta_ent('nlp:token:text')) == true} " +
- " term(y)={# == 'stanford:number'}"
+ " term(op)={has(list('+', '-', '*', '/'), meta_ent('nlp:token:text')) == true}" +
+ " term(y)={# == 'stanford:number'}"
)
def onMatchMem(
ctx: NCContext,