This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-474
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-474 by this push:
new 9cbb148 WIP
9cbb148 is described below
commit 9cbb14886b4a56d0b9fb1928da20a9ee5a4a81fb
Author: Aaron Radzinski <[email protected]>
AuthorDate: Wed Jan 26 15:48:36 2022 -0800
WIP
---
.../internal/intent/compiler/NCIDLCodeGenerator.scala | 16 ++++++++--------
.../intent/compiler/functions/NCIDLFunctions.scala | 2 +-
.../intent/compiler/functions/NCIDLFunctionsEntity.scala | 2 +-
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/compiler/NCIDLCodeGenerator.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/compiler/NCIDLCodeGenerator.scala
index 3343866..bb8e222 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/compiler/NCIDLCodeGenerator.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/compiler/NCIDLCodeGenerator.scala
@@ -925,17 +925,17 @@ trait NCIDLCodeGenerator:
case "ent_count" => checkAvail(); z0(() =>
Z(idlCtx.entities.size, 0))
case "ent_groups" => arg1Tok() match { case x => stack.push(()
=> Z(toEntity(x().value).getImpl.getGroups, 1)) }
case "ent_all" => checkAvail(); z0(() =>
Z(idlCtx.entities.asJava, 0))
- case "ent_all_for_id" => checkAvail(); doForAll((ent, id) =>
ent.getImpl.getId == id)
- case "ent_all_for_group" => checkAvail(); doForAll((ent, grp)
=> ent.getImpl.getGroups.contains(grp))
+ case "ent_all_for_id" => checkAvail(); doForAll((e, id) =>
e.getImpl.getId == id)
+ case "ent_all_for_group" => checkAvail(); doForAll((e, grp) =>
e.getImpl.getGroups.contains(grp))
case "ent_this" => z0(() => Z(ent, 1))
case "ent_is_last" => checkAvail(); arg1Tok() match { case x
=> stack.push(() => { Z(toEntity(x().value).getIndex == idlCtx.entities.size -
1, 1) }) }
case "ent_is_first" => checkAvail(); arg1Tok() match { case x
=> stack.push(() => { Z(toEntity(x().value).getIndex == 0, 1) }) }
- case "ent_is_before_id" => checkAvail(); doIsBefore((tok, id)
=> ent.getImpl.getId == id)
- case "ent_is_before_group" => checkAvail(); doIsBefore((tok,
grpId) => ent.getImpl.getGroups.contains(grpId))
- case "ent_is_after_id" => checkAvail(); doIsAfter((tok, id) =>
ent.getImpl.getId == id)
- case "ent_is_after_group" => checkAvail(); doIsAfter((tok,
grpId) => ent.getImpl.getGroups.contains(grpId))
- case "ent_is_between_ids" => checkAvail(); doIsBetween((tok,
id) => ent.getImpl.getId == id)
- case "ent_is_between_groups" => checkAvail();
doIsBetween((tok, grpId) => ent.getImpl.getGroups.contains(grpId))
+ case "ent_is_before_id" => checkAvail(); doIsBefore((e, id) =>
e.getImpl.getId == id)
+ case "ent_is_before_group" => checkAvail(); doIsBefore((e,
grpId) => e.getImpl.getGroups.contains(grpId))
+ case "ent_is_after_id" => checkAvail(); doIsAfter((e, id) =>
e.getImpl.getId == id)
+ case "ent_is_after_group" => checkAvail(); doIsAfter((e,
grpId) => e.getImpl.getGroups.contains(grpId))
+ case "ent_is_between_ids" => checkAvail(); doIsBetween((e, id)
=> e.getImpl.getId == id)
+ case "ent_is_between_groups" => checkAvail(); doIsBetween((e,
grpId) => e.getImpl.getGroups.contains(grpId))
// Request data.
case "req_id" => z0(() => Z(idlCtx.req.getRequestId, 0))
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/intent/compiler/functions/NCIDLFunctions.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/intent/compiler/functions/NCIDLFunctions.scala
index a493d50..a1c1045 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/intent/compiler/functions/NCIDLFunctions.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/intent/compiler/functions/NCIDLFunctions.scala
@@ -162,7 +162,7 @@ private[functions] object NCIDLFunctions:
override def getTokens: java.util.List[NCToken] = tokens.asJava
override def getRequestId: String = srvReqId
- override def getGroups: util.Set[String] = if groups != null then
groups.asJava else super.getGroups
+ override def getGroups: util.Set[String] = if groups != null then
groups.asJava else util.Collections.singleton(id)
override def getId: String = id
import org.apache.nlpcraft.internal.intent.compiler.functions.NCIDLFunctions.*
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/intent/compiler/functions/NCIDLFunctionsEntity.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/intent/compiler/functions/NCIDLFunctionsEntity.scala
index ecf1eed..0c91a5e 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/intent/compiler/functions/NCIDLFunctionsEntity.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/intent/compiler/functions/NCIDLFunctionsEntity.scala
@@ -67,7 +67,7 @@ class NCIDLFunctionsEntity extends NCIDLFunctions:
),
TestDesc(
truth = "ent_groups() == list('a')",
- entity = mkEntity(id = "a", tokens = t1, t2, groups = Set("a"))
+ entity = mkEntity(id = "a", tokens = t1, t2)
)
)