This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-206
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-206 by this push:
new 5efd5b8 Update NCIdlCompilerBase.scala
5efd5b8 is described below
commit 5efd5b81c28fe630eb34ee53f6aa4f3207e51123
Author: Aaron Radzinski <[email protected]>
AuthorDate: Fri Mar 19 17:56:52 2021 -0700
Update NCIdlCompilerBase.scala
---
.../nlpcraft/model/intent/compiler/NCIdlCompilerBase.scala | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCIdlCompilerBase.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCIdlCompilerBase.scala
index c860319..952501c 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCIdlCompilerBase.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCIdlCompilerBase.scala
@@ -118,6 +118,13 @@ trait NCIdlCompilerBase {
case _ ⇒ throw new AssertionError(s"Unexpected real value: $v")
}
+ def box(v: Object): Object =
+ if (isInt(v))
+ asInt(v)
+ else if (isReal(v))
+ asReal(v)
+ else
+ v
//noinspection ComparingUnrelatedTypes
def isBool(v: Object): Boolean = v.isInstanceOf[Boolean]
@@ -668,7 +675,7 @@ trait NCIdlCompilerBase {
val NCIdlStackItem(v1, n1) = x1()
val NCIdlStackItem(v2, n2) = x2()
- Z(toJList(v1).contains(v2), n1 + n2)
+ Z(toJList(v1).contains(box(v2)), n1 + n2)
})
}
@@ -687,7 +694,7 @@ trait NCIdlCompilerBase {
throw rtParamTypeError(fun, key, "numeric")
}
else if (isJMap(col))
- Z(asJMap(col).get(key).asInstanceOf[Object], n)
+ Z(asJMap(col).get(box(key)).asInstanceOf[Object], n)
else
throw rtParamTypeError(fun, col, "list or map")
})