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
The following commit(s) were added to refs/heads/master by this push:
new 165a529 Update NCDeployManager.scala
165a529 is described below
commit 165a5291c239f2c1bf9474305a990c7147e8f384
Author: Aaron Radzinski <[email protected]>
AuthorDate: Fri Aug 6 21:09:41 2021 -0700
Update NCDeployManager.scala
---
.../probe/mgrs/deploy/NCDeployManager.scala | 37 +++++++++++-----------
1 file changed, 18 insertions(+), 19 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
index 028608a..d518e62 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
@@ -427,8 +427,7 @@ object NCDeployManager extends NCService {
.groupBy(_.origText)
.map(x => (x._1, x._2.map(_.alias).filter(_ != null)))
.values
- .toSeq
- .flatten
+ .flatMap(_.toSeq)
.toList
// Check for IDL alias uniqueness.
@@ -491,7 +490,7 @@ object NCDeployManager extends NCService {
case ids if ids.nonEmpty =>
throw new NCE(s"Duplicate intent IDs [" +
s"mdlId=$mdlId, " +
- s"mdlOrigin=${mdl.getOrigin}, " +
+ s"origin=${mdl.getOrigin}, " +
s"ids=${ids.mkString(",")}" +
s"]")
case _ => ()
@@ -1363,7 +1362,7 @@ object NCDeployManager extends NCService {
if (compType != CLS_TOKEN)
throw new NCE(s"Unexpected array element type for
@NCIntentTerm annotated argument [" +
s"mdlId=$mdlId, " +
- s"mdlOrigin=${mdl.getOrigin}, " +
+ s"origin=${mdl.getOrigin}, " +
s"type=${class2Str(compType)}, " +
s"arg=${mkArg()}" +
s"]")
@@ -1379,7 +1378,7 @@ object NCDeployManager extends NCService {
throw new NCE(
s"Unexpected generic types count for
@NCIntentTerm annotated argument [" +
s"mdlId=$mdlId, " +
- s"mdlOrigin=${mdl.getOrigin}, " +
+ s"origin=${mdl.getOrigin}, " +
s"count=${compTypes.length}, " +
s"arg=${mkArg()}" +
s"]")
@@ -1394,7 +1393,7 @@ object NCDeployManager extends NCService {
if (genClass != CLS_TOKEN)
throw new NCE(s"Unexpected generic type
for @NCIntentTerm annotated argument [" +
s"mdlId=$mdlId, " +
- s"mdlOrigin=${mdl.getOrigin}, " +
+ s"origin=${mdl.getOrigin}, " +
s"type=${class2Str(genClass)}, " +
s"arg=${mkArg()}" +
s"]")
@@ -1409,14 +1408,14 @@ object NCDeployManager extends NCService {
throw new NCE(
s"Unexpected Kotlin generic type for
@NCIntentTerm annotated argument [" +
s"mdlId=$mdlId, " +
- s"mdlOrigin=${mdl.getOrigin}, " +
+ s"origin=${mdl.getOrigin}, " +
s"type=${wc2Str(wildcardType)}, " +
s"arg=${mkArg()}" +
s"]")
case _ =>
throw new NCE(s"Unexpected generic type for
@NCIntentTerm annotated argument [" +
s"mdlId=$mdlId, " +
- s"mdlOrigin=${mdl.getOrigin}, " +
+ s"origin=${mdl.getOrigin}, " +
s"type=${compType.getTypeName}, " +
s"arg=${mkArg()}" +
s"]")
@@ -1424,7 +1423,7 @@ object NCDeployManager extends NCService {
case _ => throw new NCE(s"Unexpected parameter type for
@NCIntentTerm annotated argument [" +
s"mdlId=$mdlId, " +
- s"mdlOrigin=${mdl.getOrigin}, " +
+ s"origin=${mdl.getOrigin}, " +
s"type=${pGenType.getTypeName}, " +
s"arg=${mkArg()}" +
s"]")
@@ -1433,7 +1432,7 @@ object NCDeployManager extends NCService {
else
throw new NCE(s"Unexpected parameter type for @NCIntentTerm
annotated argument [" +
s"mdlId=$mdlId, " +
- s"mdlOrigin=${mdl.getOrigin}, " +
+ s"origin=${mdl.getOrigin}, " +
s"type=${class2Str(pClass)}, " +
s"arg=${mkArg()}" +
s"]")
@@ -1465,7 +1464,7 @@ object NCDeployManager extends NCService {
val p1 = "its @NCIntentTerm annotated argument"
val p2 = s"[" +
s"mdlId=$mdlId, " +
- s"mdlOrigin=${mdl.getOrigin}, " +
+ s"origin=${mdl.getOrigin}, " +
s"arg=${mkArg()}" +
s"]"
@@ -1528,7 +1527,7 @@ object NCDeployManager extends NCService {
if (intentDecls.exists(_.id == intent.id))
throw new NCE(s"Duplicate intent ID [" +
s"mdlId=$mdlId, " +
- s"mdlOrigin=${mdl.getOrigin}, " +
+ s"origin=${mdl.getOrigin}, " +
s"class=$mdlCls, " +
s"id=${intent.id}" +
s"]")
@@ -1548,7 +1547,7 @@ object NCDeployManager extends NCService {
if (intents.exists(i => i._1.id == intent.id && i._2._1 !=
cb._1))
throw new NCE(s"The intent cannot be bound to more than
one callback [" +
s"mdlId=$mdlId, " +
- s"mdlOrigin=${mdl.getOrigin}, " +
+ s"origin=${mdl.getOrigin}, " +
s"class=$mdlCls, " +
s"intentId=${intent.id}" +
s"]")
@@ -1563,7 +1562,7 @@ object NCDeployManager extends NCService {
if (intentDecls.exists(_.id == intent.id) ||
intents.exists(_._1.id == intent.id))
throw new NCE(s"Duplicate intent ID [" +
s"mdlId=$mdlId, " +
- s"mdlOrigin=${mdl.getOrigin}, " +
+ s"origin=${mdl.getOrigin}, " +
s"callback=$mtdStr, " +
s"id=${intent.id}" +
s"]")
@@ -1579,7 +1578,7 @@ object NCDeployManager extends NCService {
case None => throw new NCE(
s"""@NCIntentRef("$refId") references unknown intent
ID [""" +
s"mdlId=$mdlId, " +
- s"mdlOrigin=${mdl.getOrigin}, " +
+ s"origin=${mdl.getOrigin}, " +
s"refId=$refId, " +
s"callback=$mtdStr" +
s"]")
@@ -1590,9 +1589,9 @@ object NCDeployManager extends NCService {
val unusedIntents = intentDecls.filter(i => !intents.exists(_._1.id ==
i.id))
if (unusedIntents.nonEmpty)
- logger.warn(s"Declared but unused intents: [" +
+ logger.warn(s"Intents are unused (have no callback): [" +
s"mdlId=$mdlId, " +
- s"mdlOrigin=${mdl.getOrigin}, " +
+ s"origin=${mdl.getOrigin}, " +
s"intentIds=${unusedIntents.map(_.id).mkString("(", ", ",
")")}]"
)
@@ -1639,7 +1638,7 @@ object NCDeployManager extends NCService {
smpAnnsRef, "@NCIntentSampleRef", a =>
U.readAnySource(a.value())
)
- if (U.containsDups(seqSeq.flatten.toList))
+ if (U.containsDups(seqSeq.flatMap(_.toSeq).toList))
logger.warn(s"@NCIntentSample and @NCIntentSampleRef
annotations have duplicates (safely ignoring): $mtdStr")
val distinct = seqSeq.map(_.distinct).distinct
@@ -1672,7 +1671,7 @@ object NCDeployManager extends NCService {
val processed = mutable.HashSet.empty[Case]
samples.
- flatMap { case (_, smp) => smp.flatten.map(_.toLowerCase) }.
+ flatMap { case (_, smp) =>
smp.flatMap(_.toSeq).map(_.toLowerCase) }.
map(s => s -> SEPARATORS.foldLeft(s)((s, ch) =>
s.replaceAll(s"\\$ch", s" $ch "))).
foreach {
case (s, sNorm) =>