WIP.
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/alarm/intents.idl b/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/alarm/intents.idl
index f51d281..cb28dc4 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/alarm/intents.idl
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/alarm/intents.idl
@@ -19,9 +19,10 @@
fragment=buzz term~{id() == 'x:alarm'}
fragment=when
term(nums)~{
- id() == 'nlpcraft:num' &&
- meta_token('nlpcraft:num:unittype') == 'datetime' &&
- meta_token('nlpcraft:num:isequalcondition') == true
+ @type = meta_token('nlpcraft:num:unittype')
+ @iseq = meta_token('nlpcraft:num:isequalcondition')
+
+ id() == 'nlpcraft:num' && @type == 'datetime' && @iseq == true
}[0,7]
// Intents
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCIdlCompiler.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCIdlCompiler.scala
index 1dfc42b..c3613ee 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCIdlCompiler.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCIdlCompiler.scala
@@ -135,7 +135,8 @@
throw newSyntaxError(s"Unknown variable: @$varName")(ctx)
val instr: SI = (tok: NCToken, stack: S, idlCtx: NCIdlContext) ⇒
- stack.push(() ⇒ idlCtx.vars(varName)(tok, idlCtx))
+ stack.push(() ⇒
+ idlCtx.vars(varName)(tok, idlCtx))
expr += instr
}
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/solver/NCIntentSolverEngine.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/solver/NCIntentSolverEngine.scala
index e7ce6b3..b7675ca 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/solver/NCIntentSolverEngine.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/solver/NCIntentSolverEngine.scala
@@ -26,7 +26,7 @@
import org.apache.nlpcraft.model.{NCContext, NCDialogFlowItem, NCIntentMatch, NCResult, NCToken}
import org.apache.nlpcraft.probe.mgrs.dialogflow.NCDialogFlowManager
import org.apache.nlpcraft.model.impl.NCTokenPimp._
-import org.apache.nlpcraft.model.intent.{NCIdlContext, NCIdlIntent, NCIdlStackItem ⇒ Z, NCIdlTerm}
+import org.apache.nlpcraft.model.intent.{NCIdlContext, NCIdlFunction, NCIdlIntent, NCIdlTerm, NCIdlStackItem ⇒ Z}
import java.util.function.Function
import scala.collection.JavaConverters._
@@ -490,15 +490,16 @@
var lastTermMatch: TermMatch = null
val x = ctx.getConversation.getMetadata
-
- val termCtx = NCIdlContext(
- intentMeta = intent.meta,
- convMeta = if (x.isEmpty) Map.empty[String, Object] else x.asScala.toMap[String, Object],
- req = ctx.getRequest
- )
+ val convMeta = if (x.isEmpty) Map.empty[String, Object] else x.asScala.toMap[String, Object]
// Check terms.
for (term ← intent.terms if !abort) {
+ val termCtx = NCIdlContext(
+ intentMeta = intent.meta,
+ convMeta = convMeta,
+ req = ctx.getRequest
+ )
+
solveTerm(
term,
termCtx,