This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-41-1
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-41-1 by this push:
new c3ad67d WIP.
c3ad67d is described below
commit c3ad67d0e523441959c4711c3a7ae2341035eee8
Author: Sergey Kamov <[email protected]>
AuthorDate: Thu Sep 10 13:20:30 2020 +0300
WIP.
---
.../org/apache/nlpcraft/model/NCModelFileAdapter.java | 18 +++++++++++-------
.../nlpcraft/probe/mgrs/deploy/NCDeployManager.scala | 4 +---
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelFileAdapter.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelFileAdapter.java
index 05b43a5..aa25fe1 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelFileAdapter.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelFileAdapter.java
@@ -103,14 +103,14 @@ abstract public class NCModelFileAdapter extends
NCModelAdapter {
super(proxy.getId(), proxy.getName(), proxy.getDescription());
this.proxy = proxy;
- this.suspWords = convert(proxy.getSuspiciousWords());
- this.enabledToks = convert(proxy.getEnabledBuiltInTokens());
- this.addStopwords = convert(proxy.getAdditionalStopwords());
- this.exclStopwords = convert(proxy.getExcludedStopwords());
+ this.suspWords = convert(proxy.getSuspiciousWords(), null);
+ this.enabledToks = convert(proxy.getEnabledBuiltInTokens(),
NCModelView.DFLT_ENABLED_BUILTIN_TOKENS);
+ this.addStopwords = convert(proxy.getAdditionalStopwords(), null);
+ this.exclStopwords = convert(proxy.getExcludedStopwords(), null);
this.elems = convertElements(proxy.getElements());
this.macros = convertMacros(proxy.getMacros());
this.metadata = convertMeta(proxy.getMetadata());
- this.intents = convert(proxy.getIntents());
+ this.intents = convert(proxy.getIntents(), null);
this.parsers = convertParsers(proxy.getParsers());
// NOTE: we can only test/check this at this point. Downstream - this
information is lost.
@@ -208,8 +208,12 @@ abstract public class NCModelFileAdapter extends
NCModelAdapter {
* @param arr
* @return
*/
- private static Set<String> convert(String[] arr) {
- return arr == null ? new
HashSet<>(NCModelView.DFLT_ENABLED_BUILTIN_TOKENS) : new
HashSet<>(Arrays.asList(arr));
+ private static Set<String> convert(String[] arr, Set<String> dflt) {
+ return arr != null ?
+ new HashSet<>(Arrays.asList(arr)) :
+ dflt != null ?
+ new HashSet<>(dflt) :
+ new HashSet<>();
}
/**
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 7671661..f9f78cd 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
@@ -941,13 +941,11 @@ object NCDeployManager extends NCService with
DecorateAsScala {
case (_, othSyns) ⇒ othSyns.intersect(syns).nonEmpty
}.toMap.keys.mkString(",")
-
if (cross.nonEmpty)
- throw new NCE(s"Element has duplicate synonyms with elements
'$cross' [modelId=$mdlId, elementId=$elemId]")
+ throw new NCE(s"Element has duplicate synonyms with element
[modelId=$mdlId, elementId=$elemId, cross=$cross]")
}
}
-
/**
*
* @param cls