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 c4f786d  WIP.
c4f786d is described below

commit c4f786d7b4765beebc7dba968272bd4e60c42ca6
Author: Sergey Kamov <[email protected]>
AuthorDate: Tue Oct 12 23:01:33 2021 +0300

    WIP.
---
 .../org/apache/nlpcraft/spring/NlpCraftConfig.java | 21 ++++++++++++++++--
 .../apache/nlpcraft/spring/NlpCraftIntents.java    | 25 +++++++++++-----------
 .../nlpcraft/model/builders/NCModelBuilder.java    | 10 ++++-----
 .../model/builders/NCModelConfigBuilder.java       | 16 +++++++-------
 .../components/tokenizer/NCOpenNlpTokenizer.java   |  1 +
 5 files changed, 45 insertions(+), 28 deletions(-)

diff --git 
a/nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/NlpCraftConfig.java 
b/nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/NlpCraftConfig.java
index 08b2c8a..3097b3e 100644
--- 
a/nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/NlpCraftConfig.java
+++ 
b/nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/NlpCraftConfig.java
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.nlpcraft.spring;
 
 import org.apache.nlpcraft.NCNlpcraft;
@@ -46,8 +63,8 @@ public class NlpCraftConfig {
         return
             new NCModelBuilder().
                 withConfig(cfg).
-                withIntents(Arrays.asList(intent1, intent2)).
-                withIntentsClasses(Arrays.asList(NlpCraftConfig.class)).
+                withIntentsDefinitions(Arrays.asList(intent1, intent2)).
+                withIntentsClasses(Arrays.asList(NlpCraftIntents.class)).
                 getModel();
     }
 
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/components/tokenizer/NCOpenNlpTokenizer.java
 b/nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/NlpCraftIntents.java
similarity index 60%
copy from 
nlpcraft/src/main/scala/org/apache/nlpcraft/model/components/tokenizer/NCOpenNlpTokenizer.java
copy to 
nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/NlpCraftIntents.java
index 1d48141..4fe0d6f 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/components/tokenizer/NCOpenNlpTokenizer.java
+++ 
b/nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/NlpCraftIntents.java
@@ -15,20 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.nlpcraft.model.components.tokenizer;
+package org.apache.nlpcraft.spring;
 
-import org.apache.nlpcraft.model.NCRequest;
-import org.apache.nlpcraft.model.nlp.NCNlpTokenizer;
-import org.apache.nlpcraft.model.nlp.NCNlpWord;
+import org.apache.nlpcraft.NCNlpcraft;
+import org.apache.nlpcraft.NCNlpcraftBuilder;
+import org.apache.nlpcraft.model.NCModel;
+import org.apache.nlpcraft.model.NCModelConfig;
+import org.apache.nlpcraft.model.builders.NCModelBuilder;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
 
-import java.util.List;
+import java.util.Arrays;
 
-/**
- * Default tokenizer based on OpenNlp.
- */
-public class NCOpenNlpTokenizer implements NCNlpTokenizer {
-    @Override
-    public List<NCNlpWord> tokenize(NCRequest req) {
-        return null;
-    }
+public class NlpCraftIntents {
+    // TODO: add intents callback here.
 }
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 8865ddd..98a1d1d 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
@@ -40,7 +40,7 @@ public class NCModelBuilder {
     }
 
     // 3. Intents related methods:
-    
+
     // Static methods of given classes.
     // Scanned for NCIntent, NCIntentRef, NCIntentSample, NCIntentSampleRef
     public NCModelBuilder withIntentsClasses(List<Class<?>> classes) {
@@ -55,18 +55,18 @@ public class NCModelBuilder {
 
     // Manually defined intents.
     // Code in classes and objects can have references on defined below 
intents and samples and via NCIntentRef and NCIntentSampleRef.
-    public NCModelBuilder withIntents(List<String> objs) {
+    public NCModelBuilder withIntentsDefinitions(List<String> intents) {
         return this;
     }
-    public NCModelBuilder withIntentsSamples(Map<String, List<List<String>>> 
map) {
+    public NCModelBuilder withIntentsSamples(Map<String, List<List<String>>> 
samplesByIntentIв) {
         return this;
     }
 
     // Files only for intents, not for samples ?
-    public NCModelBuilder withIntentsFromFiles(List<File> objs) {
+    public NCModelBuilder withIntentsFromFiles(List<File> files) {
         return this;
     }
-    public NCModelBuilder withIntentsFromUrls(List<URL> objs) {
+    public NCModelBuilder withIntentsFromUrls(List<URL> urls) {
         return this;
     }
 
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 b622753..6d083a4 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
@@ -78,29 +78,29 @@ public class NCModelConfigBuilder {
     }
 
     // 2. Specail words detectors. Free implementation supported.
-    // Has default.
-    public NCModelConfigBuilder withStopWordsDetector(NCNlpWordsDetector 
detector) {
+    // Default used - 
org.apache.nlpcraft.model.components.detectors.NCDefaultStopWordsDetector.
+    public NCModelConfigBuilder withStopWordsDetector(NCNlpWordsDetector 
stopWordsDetector) {
         return this;
     }
 
-    // Has default.
-    public NCModelConfigBuilder withSwearWordsDetector(NCNlpWordsDetector 
detector) {
+    // Default used - 
org.apache.nlpcraft.model.components.detectors.NCDefaultSwearWordsDetector.
+    public NCModelConfigBuilder withSwearWordsDetector(NCNlpWordsDetector 
swearWordsDetector) {
         return this;
     }
 
-    // Empty by default.
-    public NCModelConfigBuilder withSuspiciousWordsDetector(NCNlpWordsDetector 
detector) {
+    // Not used by default.
+    public NCModelConfigBuilder withSuspiciousWordsDetector(NCNlpWordsDetector 
suspWordsDetector) {
         return this;
     }
 
     // 3. Base Nlp parser (open nlp - default, stanford)
-    // Has default.
+    // Default used - 
org.apache.nlpcraft.model.components.tokenizer.NCOpenNlpTokenizer
     public NCModelConfigBuilder withTokenizer(NCNlpTokenizer parser) {
         return this;
     }
 
     // 4. NER parsers (open nlp, stanford, our one built parser 
NCDefaultNerParser + any custom)
-    // Has default - list with one element. open nlp
+    // Default single elemeent list used { 
org.apache.nlpcraft.model.components.ner.opennlp.NCOpenNlpNerParser }
     public NCModelConfigBuilder withNerParsers(List<NCNlpNerParser> parsers) {
         return this;
     }
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/components/tokenizer/NCOpenNlpTokenizer.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/components/tokenizer/NCOpenNlpTokenizer.java
index 1d48141..22902ba 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/components/tokenizer/NCOpenNlpTokenizer.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/components/tokenizer/NCOpenNlpTokenizer.java
@@ -25,6 +25,7 @@ import java.util.List;
 
 /**
  * Default tokenizer based on OpenNlp.
+ * Can be renamed to DefaultTokenizer.
  */
 public class NCOpenNlpTokenizer implements NCNlpTokenizer {
     @Override

Reply via email to