This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-468
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-468 by this push:
new 7f2f720 WIP.
7f2f720 is described below
commit 7f2f720541abef533915d4db03dc14322f6c7ce2
Author: Sergey Kamov <[email protected]>
AuthorDate: Tue Oct 12 21:31:30 2021 +0300
WIP.
---
.../org/apache/nlpcraft/model/builders/NCModelBuilder.java | 7 ++++---
.../nlpcraft/model/builders/NCModelConfigBuilder.java | 13 ++++++++++---
.../scala/org/apache/nlpcraft/model/nlp/NCNlpDetector.java | 12 ++++++++++++
.../scala/org/apache/nlpcraft/model/nlp/NCNlpTokenizer.java | 6 +++++-
.../main/scala/org/apache/nlpcraft/model/nlp/NCNlpWord.java | 1 -
5 files changed, 31 insertions(+), 8 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelBuilder.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelBuilder.java
index 2910274..8865ddd 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelBuilder.java
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelBuilder.java
@@ -29,17 +29,18 @@ import java.util.Map;
public class NCModelBuilder {
// Intents or Behaviour - mandatory.
- // Config.
+ // 1. Config.
public NCModelBuilder withConfig(NCModelConfig cfg) {
return this;
}
- // Behaviour.
+ // 2. Behaviour.
public NCModelBuilder withBehaviour(NCModelBehaviour behaviour) {
return this;
}
- // Intents related methods:
+ // 3. Intents related methods:
+
// Static methods of given classes.
// Scanned for NCIntent, NCIntentRef, NCIntentSample, NCIntentSampleRef
public NCModelBuilder withIntentsClasses(List<Class<?>> classes) {
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelConfigBuilder.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelConfigBuilder.java
index e31ea51..ecb6a06 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelConfigBuilder.java
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/builders/NCModelConfigBuilder.java
@@ -77,23 +77,30 @@ public class NCModelConfigBuilder {
return this;
}
- // 2. 3 custom words detector. Free implementation supported.
+ // 2. Specail words detectors. Free implementation supported.
+ // Has default.
public NCModelConfigBuilder withStopWordsDetector(NCNlpDetector detector) {
return this;
}
- public NCModelConfigBuilder withSwearWordsDetector(NCNlpDetector
detectorr) {
+
+ // Has default.
+ public NCModelConfigBuilder withSwearWordsDetector(NCNlpDetector detector)
{
return this;
}
+
+ // Empty by default.
public NCModelConfigBuilder withSuspiciousWordsDetector(NCNlpDetector
detector) {
return this;
}
// 3. Base Nlp parser (open nlp - default, stanford)
+ // Has default.
public NCModelConfigBuilder withTokenizer(NCNlpTokenizer parser) {
return this;
}
- // 4. NER parsers (open nlp - default, stanford, our one built parser
NCDefaultNerParser + any custom)
+ // 4. NER parsers (open nlp, stanford, our one built parser
NCDefaultNerParser + any custom)
+ // Has default - list with one element. open nlp
public NCModelConfigBuilder withNerParsers(List<NCNlpNerParser> parsers) {
return this;
}
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpDetector.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpDetector.java
index 0e2fa27..04c82ab 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpDetector.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpDetector.java
@@ -21,6 +21,18 @@ import org.apache.nlpcraft.model.nlp.NCNlpWord;
import java.util.List;
+/**
+ * For detection stop, swear and suspicios words in sentence.
+ *
+ * Provided default implementation for stop and swear USA words.
+ * -
org.apache.nlpcraft.model.components.detectors.NCDefaultStopWordsDetector,
+ * -
org.apache.nlpcraft.model.components.detectors.NCDefaultSwearWordsDetector
+ *
+ * Additionally and excluded stop words can be impemented by overriding
default solution.
+ *
+ * Custom and language related solutions should be implemented and defined in
model configuration.
+ *
+ */
public interface NCNlpDetector {
/**
* Finds words by some criteria in given words list.
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpTokenizer.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpTokenizer.java
index 079a464..d8b033b 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpTokenizer.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpTokenizer.java
@@ -22,7 +22,11 @@ import org.apache.nlpcraft.model.NCRequest;
import java.util.List;
/**
- * Initial request text parser.
+ * Test tokenizer.
+ * Default implementation provided and based on OpenNlp solution.
+ * org.apache.nlpcraft.model.components.tokenizer.NCOpenNlpTokenizer
+ *
+ * User can provide any custom implementation.
*/
public interface NCNlpTokenizer {
/**
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpWord.java
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpWord.java
index 982c23c..4c2d0ff 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpWord.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/nlp/NCNlpWord.java
@@ -17,7 +17,6 @@
package org.apache.nlpcraft.model.nlp;
-// Initial parsing result, look at NCNlpWordsParser.
public interface NCNlpWord {
String getWord();
String getNormalWord();