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/07/21 04:34:18 UTC
[incubator-nlpcraft] branch master updated: Improved documentation.
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 21d6245 Improved documentation.
21d6245 is described below
commit 21d62454e7e3c7c7a684785554b976731bdcf59d
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Tue Jul 20 21:34:05 2021 -0700
Improved documentation.
---
.../lightswitch/src/main/resources/lightswitch_model.yaml | 7 +++++++
.../minecraft/src/main/resources/minecraft.yaml | 4 ++++
nlpcraft-examples/sql/src/main/resources/sql_model.yaml | 5 +++++
.../main/scala/org/apache/nlpcraft/model/NCModelView.java | 13 ++++++++-----
4 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/nlpcraft-examples/lightswitch/src/main/resources/lightswitch_model.yaml b/nlpcraft-examples/lightswitch/src/main/resources/lightswitch_model.yaml
index 6ad9b7e..a912dca 100644
--- a/nlpcraft-examples/lightswitch/src/main/resources/lightswitch_model.yaml
+++ b/nlpcraft-examples/lightswitch/src/main/resources/lightswitch_model.yaml
@@ -33,8 +33,14 @@ macros:
- name: "<LIGHT>"
macro: "{all|_} {it|them|light|illumination|lamp|lamplight}"
enabledBuiltInTokens: [] # This example doesn't use any built-in tokens.
+
+#
+# Allows for multi-word synonyms in this entire model
+# to be sparse and permutate them for better detection.
+#
permutateSynonyms: true
sparse: true
+
elements:
- id: "ls:loc"
description: "Location of lights."
@@ -61,5 +67,6 @@ elements:
- "<KILL> <LIGHT>"
- "<LIGHT> <KILL>"
- "no <LIGHT>"
+
intents:
- "intent=ls term(act)={has(tok_groups(), 'act')} term(loc)={tok_id() == 'ls:loc'}*"
\ No newline at end of file
diff --git a/nlpcraft-examples/minecraft/src/main/resources/minecraft.yaml b/nlpcraft-examples/minecraft/src/main/resources/minecraft.yaml
index dfa7b50..6db4dc9 100644
--- a/nlpcraft-examples/minecraft/src/main/resources/minecraft.yaml
+++ b/nlpcraft-examples/minecraft/src/main/resources/minecraft.yaml
@@ -140,6 +140,10 @@ elements:
abstractTokens:
- mc:player
+#
+# Allows for multi-word synonyms in this entire model
+# to be sparse and permutate them for better detection.
+#
permutateSynonyms: true
sparse: true
diff --git a/nlpcraft-examples/sql/src/main/resources/sql_model.yaml b/nlpcraft-examples/sql/src/main/resources/sql_model.yaml
index 0df382a..73054b3 100644
--- a/nlpcraft-examples/sql/src/main/resources/sql_model.yaml
+++ b/nlpcraft-examples/sql/src/main/resources/sql_model.yaml
@@ -1513,5 +1513,10 @@ swearWordsAllowed: false
noNounsAllowed: true
noUserTokensAllowed: true
dupSynonymsAllowed: true
+
+#
+# Allows for multi-word synonyms in this entire model
+# to be sparse and permutate them for better detection.
+#
permutateSynonyms: true
sparse: true
\ No newline at end of file
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 c82ddd2..4a6e3a5 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelView.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCModelView.java
@@ -684,10 +684,9 @@ public interface NCModelView extends NCMetadata {
* Whether or not to permutate multi-word synonyms. Automatic multi-word synonyms permutations greatly
* increase the total number of synonyms in the system and allows for better multi-word synonym detection.
* 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.
+ * sequence of synonyms of "a b c", "b a c", "a c b". This property is closely related to {@link #isSparse()}
+ * which are typically changed together. Note that individual model elements can override this property using
+ * {@link NCElement#isPermutateSynonyms()} method.
* <p>
* <b>Default</b>
* <br>
@@ -704,6 +703,8 @@ public interface NCModelView extends NCMetadata {
*
* @return Whether or not to permutate multi-word synonyms.
* @see NCElement#isPermutateSynonyms()
+ * @see NCElement#isSparse()
+ * @see #isSparse()
*/
default boolean isPermutateSynonyms() {
return DFLT_IS_PERMUTATE_SYNONYMS;
@@ -786,7 +787,7 @@ public interface NCModelView extends NCMetadata {
/**
* Whether or not this model elements allows non-stop words gaps in their multi-word synonyms.
- * <p>
+ * This property is closely related to {@link #isPermutateSynonyms()} which are typically changed together.
* Note that individual model elements can override this property using {@link NCElement#isSparse()}
* method.
* <p>
@@ -805,6 +806,8 @@ public interface NCModelView extends NCMetadata {
*
* @return Optional multi-word synonym sparsity model property.
* @see NCElement#isSparse()
+ * @see NCElement#isPermutateSynonyms()
+ * @see #isPermutateSynonyms()
*/
default boolean isSparse() {
return DFLT_IS_SPARSE;