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 2020/12/31 08:37:03 UTC
[incubator-nlpcraft] 02/02: Update NCIntentSolverEngine.scala
This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
commit 5014de51441994d751120b412cb92ef16ee77770
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Thu Dec 31 00:36:45 2020 -0800
Update NCIntentSolverEngine.scala
---
.../model/intent/impl/NCIntentSolverEngine.scala | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/NCIntentSolverEngine.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/NCIntentSolverEngine.scala
index c18d284..5058302 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/NCIntentSolverEngine.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/NCIntentSolverEngine.scala
@@ -374,6 +374,7 @@ object NCIntentSolverEngine extends LazyLogging with NCOpenCensusTrace {
* @param convToks
* @return
*/
+ //noinspection DuplicatedCode
private def solveIntent(
ctx: NCContext,
intent: NCDslIntent,
@@ -386,24 +387,21 @@ object NCIntentSolverEngine extends LazyLogging with NCOpenCensusTrace {
val varStr = s"(variant #${varIdx + 1})"
val flowRegex = intent.flowRegex
- val histS = s" |-- ${c("History:")} ${hist.mkString(" ")}"
+ def logFlowMatch(s: String) = {
+ logger.info(s)
+ logger.info(s" |-- ${c("Dialog flow:")} ${hist.mkString(" ")}")
+ logger.info(s" +-- ${c("Match regex:")} ${flowRegex.get.toString}")
+ }
// Check dialog flow first.
if (intent.flowRegex.isDefined && !flowRegex.get.matcher(hist.mkString(" ")).find(0)) {
- logger.info(s"Intent '$intentId' ${r("did not")} match because of dialog flow $varStr:")
- logger.info(histS)
- logger.info(s" +-- ${c("Regex:")} ${flowRegex.get.toString}")
+ logFlowMatch(s"Intent '$intentId' ${r("did not")} match because of dialog flow $varStr:")
None
}
else {
- logger.whenDebugEnabled {
- if (intent.flowRegex.isDefined) {
- logger.debug(s"Intent '$intentId' ${g("matched")} dialog flow $varStr:")
- logger.debug(histS)
- logger.debug(s" +-- ${c("Regex:")} ${flowRegex.get.toString}")
- }
- }
+ if (intent.flowRegex.isDefined)
+ logFlowMatch(s"Intent '$intentId' ${g("matched")} dialog flow $varStr:")
val intentW = new Weight()
val intentGrps = mutable.ListBuffer.empty[TermTokensGroup]