This is an automated email from the ASF dual-hosted git repository.

sergeykamov 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 e8b3e08  JMH based performance tests improved.
e8b3e08 is described below

commit e8b3e087c4eac97eba9dbac95324b171909aca8b
Author: Sergey Kamov <[email protected]>
AuthorDate: Thu Mar 24 12:07:25 2022 +0300

    JMH based performance tests improved.
---
 .../apache/nlpcraft/NCModelPipelineBuilder.java    |  1 -
 .../nlpcraft/nlp/benchmark/client/2022-03-24.json  | 38 +++++++++++-----------
 .../nlp/benchmark/client/NCClientBenchmark.java    | 26 ++++++++++-----
 3 files changed, 37 insertions(+), 28 deletions(-)

diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModelPipelineBuilder.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModelPipelineBuilder.java
index e1f11b0..7c5c0a4 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModelPipelineBuilder.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModelPipelineBuilder.java
@@ -232,7 +232,6 @@ public class NCModelPipelineBuilder {
         ));
         tokEnrichers.add(new NCEnStopWordsTokenEnricher());
 
-        // TODO: Do we need the following components here?
         tokEnrichers.add(new 
NCEnSwearWordsTokenEnricher(NCResourceReader.getPath("badfilter/swear_words.txt")));
         tokEnrichers.add(new NCEnQuotesTokenEnricher());
         tokEnrichers.add(new NCEnDictionaryTokenEnricher());
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/benchmark/client/2022-03-24.json
 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/benchmark/client/2022-03-24.json
index 104e8f8..d32d76a 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/benchmark/client/2022-03-24.json
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/benchmark/client/2022-03-24.json
@@ -20,32 +20,32 @@
         "measurementTime" : "5 s",
         "measurementBatchSize" : 1,
         "primaryMetric" : {
-            "score" : 25.068108681069525,
-            "scoreError" : 6.605110263308195,
+            "score" : 33.79294654474718,
+            "scoreError" : 2.6623621700704545,
             "scoreConfidence" : [
-                18.46299841776133,
-                31.67321894437772
+                31.130584374676726,
+                36.45530871481763
             ],
             "scorePercentiles" : {
-                "0.0" : 22.4460412735426,
-                "50.0" : 25.551017474489797,
-                "90.0" : 27.0597884,
-                "95.0" : 27.0597884,
-                "99.0" : 27.0597884,
-                "99.9" : 27.0597884,
-                "99.99" : 27.0597884,
-                "99.999" : 27.0597884,
-                "99.9999" : 27.0597884,
-                "100.0" : 27.0597884
+                "0.0" : 32.856635424836604,
+                "50.0" : 33.618395845637586,
+                "90.0" : 34.6278818137931,
+                "95.0" : 34.6278818137931,
+                "99.0" : 34.6278818137931,
+                "99.9" : 34.6278818137931,
+                "99.99" : 34.6278818137931,
+                "99.999" : 34.6278818137931,
+                "99.9999" : 34.6278818137931,
+                "100.0" : 34.6278818137931
             },
             "scoreUnit" : "ms/op",
             "rawData" : [
                 [
-                    22.4460412735426,
-                    24.557350980392158,
-                    25.551017474489797,
-                    25.726345276923077,
-                    27.0597884
+                    32.856635424836604,
+                    34.6278818137931,
+                    33.618395845637586,
+                    33.56359287919463,
+                    34.29822676027397
                 ]
             ]
         },
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/benchmark/client/NCClientBenchmark.java
 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/benchmark/client/NCClientBenchmark.java
index 79f4efe..dc4c6b8 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/benchmark/client/NCClientBenchmark.java
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/benchmark/client/NCClientBenchmark.java
@@ -20,7 +20,12 @@ package org.apache.nlpcraft.nlp.benchmark.client;
 import org.apache.nlpcraft.NCEntity;
 import org.apache.nlpcraft.NCIntent;
 import org.apache.nlpcraft.NCIntentTerm;
+import org.apache.nlpcraft.NCModel;
+import org.apache.nlpcraft.NCModelAdapter;
 import org.apache.nlpcraft.NCModelClient;
+import org.apache.nlpcraft.NCModelConfig;
+import org.apache.nlpcraft.NCModelPipeline;
+import org.apache.nlpcraft.NCModelPipelineBuilder;
 import org.apache.nlpcraft.NCRequest;
 import org.apache.nlpcraft.NCResult;
 import org.apache.nlpcraft.NCResultType;
@@ -77,20 +82,25 @@ public class NCClientBenchmark {
 
     @Setup
     public void setUp() {
-        client = new NCModelClient(
-            new NCTestModelAdapter() {
+        // Models contains all EN components, including
+        //  - openNLP based tokens parser,
+        //  - stopword and lemma tokens enrichers,
+        //  - set of unused here tokens enrichers (they just added by default 
in 'en' builder profile) and
+        //  - one semantic entities parser.
+        NCModel mdl =
+            new NCModelAdapter(
+                new NCModelConfig("testId", "test", "1.0", "Test description", 
"Test origin"),
+                new NCModelPipelineBuilder().withSemantic("en", 
"models/lightswitch_model.yaml").build()
+            ) {
                 private final NCResult res = new NCResult("OK", 
NCResultType.ASK_RESULT);
 
-                {
-                    
getPipeline().getEntityParsers().add(NCTestUtils.mkENSemanticParser("models/lightswitch_model.yaml"));
-                }
-
                 @NCIntent("intent=ls term(act)={# == 'ls:on'} term(loc)={# == 
'ls:loc'}*")
                 public NCResult onMatch(@NCIntentTerm("act") NCEntity act, 
@NCIntentTerm("loc")List<NCEntity> locs) {
                     return res;
                 }
-            }
-        );
+            };
+
+        client = new NCModelClient(mdl);
     }
 
     @TearDown

Reply via email to