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 2021/04/15 23:57:29 UTC
[incubator-nlpcraft] branch NLPCRAFT-287 updated: Code review &
javadoc fixes.
This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-287
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-287 by this push:
new 3fdfc12 Code review & javadoc fixes.
3fdfc12 is described below
commit 3fdfc12bf140ab08b9944707fd56fe8c5394f7eb
Author: Aaron Radzinzski <ar...@datalingvo.com>
AuthorDate: Fri Apr 16 02:57:12 2021 +0300
Code review & javadoc fixes.
---
.../nlpcraft/common/pool/NCThreadPoolManager.scala | 2 +-
.../scala/org/apache/nlpcraft/model/NCElement.java | 23 ++++++++++++++++-
.../org/apache/nlpcraft/model/NCModelView.java | 29 +++++++++++++++++++---
.../model/tools/cmdline/NCCliRestSpec.scala | 2 +-
.../mgrs/nlp/enrichers/model/NCModelEnricher.scala | 2 +-
5 files changed, 51 insertions(+), 7 deletions(-)
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/pool/NCThreadPoolManager.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/pool/NCThreadPoolManager.scala
index 58f419d..f53e201 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/pool/NCThreadPoolManager.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/pool/NCThreadPoolManager.scala
@@ -28,9 +28,9 @@ import scala.concurrent.ExecutionContext
* Common thread pool manager.
*/
object NCThreadPoolManager extends NCService {
+ // TODO: in the future - we may need to open this to user configuration.
/**
* Pools that should NOT default to a system context.
- * TODO: in the future - we may need to open this to user configuration.
*/
private final val NON_SYS_POOLS = Seq(
"probes.communication",
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCElement.java b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCElement.java
index 7c88864..c0d9ec6 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCElement.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCElement.java
@@ -357,7 +357,28 @@ public interface NCElement extends NCMetadata, Serializable {
return Optional.empty();
}
- // TODO:
+ /**
+ * Whether or not this element allows non-stopword words, the gaps, in its multi-word synonyms.
+ * <p>
+ * This property overrides the value from {@link NCModelView#isSparse()}.
+ * One should use this property if model's value isn't applicable to this element.
+ * <p>
+ * <b>JSON</b>
+ * <br>
+ * If using JSON/YAML model presentation this is set by <code>sparse</code>:
+ * <pre class="brush: js, highlight: [4]">
+ * "elements": [
+ * {
+ * "id": "elem",
+ * "sparse": true,
+ * ...
+ * }
+ * ]
+ * </pre>
+ *
+ * @return Optional multi-word synonym sparsity property overriding model's one.
+ * @see NCModelView#isSparse()
+ */
default Optional<Boolean> isSparse() {
return Optional.empty();
}
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelView.java b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelView.java
index 1a9b533..c4c7b64 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelView.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelView.java
@@ -189,7 +189,7 @@ public interface NCModelView extends NCMetadata {
int DFLT_CONV_DEPTH = 3;
/**
- * TODO:
+ * Default value fof {@link #getMetadata()} method.
*/
Map<String, Object> DFLT_METADATA = new HashMap<>();
@@ -686,6 +686,9 @@ public interface NCModelView extends NCMetadata {
* For example, if permutation is allowed the synonym "a b c" will be automatically converted into a
* sequence of synonyms of "a b c", "b a c", "a c b".
* <p>
+ * Note that individual model elements can override this property using {@link NCElement#isPermutateSynonyms()}
+ * method.
+ * <p>
* <b>Default</b>
* <br>
* If not provided by the model the default value {@link #DFLT_IS_PERMUTATE_SYNONYMS} will be used.
@@ -700,6 +703,7 @@ public interface NCModelView extends NCMetadata {
* </pre>
*
* @return Whether or not to permutate multi-word synonyms.
+ * @see NCElement#isPermutateSynonyms()
*/
default boolean isPermutateSynonyms() {
return DFLT_IS_PERMUTATE_SYNONYMS;
@@ -781,8 +785,27 @@ public interface NCModelView extends NCMetadata {
}
/**
- * TODO:
- * @return TODO:
+ * Whether or not this model elements allows non-stopword words, the gaps, in their multi-word synonyms.
+ * <p>
+ * Note that individual model elements can override this property using {@link NCElement#isSparse()}
+ * method.
+ * <p>
+ * <b>Default</b>
+ * <br>
+ * If not provided by the model the default value {@link #DFLT_IS_SPARSE} will be used.
+ * <p>
+ * <p>
+ * <b>JSON</b>
+ * <br>
+ * If using JSON/YAML model presentation this is set by <code>sparse</code>:
+ * <pre class="brush: js, highlight: [2]">
+ * {
+ * "sparse": true
+ * }
+ * </pre>
+ *
+ * @return Optional multi-word synonym sparsity model property.
+ * @see NCElement#isSparse()
*/
default boolean isSparse() {
return DFLT_IS_SPARSE;
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliRestSpec.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliRestSpec.scala
index 47dfca1..7a420bc 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliRestSpec.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliRestSpec.scala
@@ -38,9 +38,9 @@ private [cmdline] case class RestSpecParameter(
optional: Boolean = false // Mandatory by default.
)
+// TODO: this needs to be loaded dynamically from OpenAPI spec.
/**
* NLPCraft REST specification.
- * TODO: this needs to be loaded dynamically from OpenAPI spec.
*/
private [cmdline] object NCCliRestSpec {
//noinspection DuplicatedCode
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCModelEnricher.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCModelEnricher.scala
index 1bea582..1e1b441 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCModelEnricher.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCModelEnricher.scala
@@ -581,8 +581,8 @@ object NCModelEnricher extends NCProbeEnricher with DecorateAsScala {
}
}
+ // TODO: simplify, add tests, check model properties (sparse etc) for optimization.
/**
- * TODO: simplify, add tests, check model properties (sparse etc) for optimization.
*
* @param elemId
* @param toks