Client version updated for nlpcraft 0.7.2.
diff --git a/KEYS b/KEYS
deleted file mode 100644
index 4b3afaf..0000000
--- a/KEYS
+++ /dev/null
@@ -1,116 +0,0 @@
-pub rsa4096 2020-04-11 [SC]
- 4793 17FA 7AFD 44AC A4CC 0778 C7C4 3555 607F E2EF
-uid [ultimate] Nikita Ivanov <nivanov30@gmail.com>
-sub rsa4096 2020-04-11 [E]
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-
-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
-=5XS0
------END PGP PUBLIC KEY BLOCK-----
-
-pub rsa4096 2020-03-31 [SC] [expires: 2024-03-31]
- 223A2AADD175994F4450467491D161EDD8405C82
-uid [ultimate] Aaron Radzinski <aradzinski@datalingvo.com>
-sig 3 91D161EDD8405C82 2020-03-31 Aaron Radzinski <aradzinski@datalingvo.com>
-sub rsa4096 2020-03-31 [E] [expires: 2024-03-31]
-sig 91D161EDD8405C82 2020-03-31 Aaron Radzinski <aradzinski@datalingvo.com>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-
-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
-U1vaIvVhIXD6xZ6ug/RDsFUJSQ==
-=O7in
------END PGP PUBLIC KEY BLOCK-----
\ No newline at end of file
diff --git a/README.md b/README.md
index f897e57..9a0fe81 100644
--- a/README.md
+++ b/README.md
@@ -25,8 +25,7 @@
## What is Apache NLPCraft?
[Apache NLPCraft](https://nlpcraft.apache.org/) is an open source library for adding a natural language interface to any applications.
-NLPCraft is free and developer friendly, it securely works with any private data source, and has no hardware or software
-lock-in.
+Based on semantic modelling it allows rapid implementation and requires no model training or pre-existing text corpora.
## Java Client
Native Java client provide easy-to-use Java-based API that wraps standard NLPCraft [REST APIs](https://nlpcraft.apache.org/using-rest.html).
@@ -42,7 +41,6 @@
## Other Projects
- [Apache NLPCraft](https://github.com/apache/incubator-nlpcraft) - Main NLPCraft project.
-- [Apache NLPCraft UI](https://github.com/apache/incubator-nlpcraft-ui) - Web UI for testing and debugging.
## Usage
From any JVM-based application code:
diff --git a/javadoc/stylesheet.css b/javadoc/stylesheet.css
index 30779e5..5d48c84 100644
--- a/javadoc/stylesheet.css
+++ b/javadoc/stylesheet.css
@@ -15,36 +15,52 @@
* limitations under the License.
*/
+/*
+ * Styles for individual HTML elements.
+ *
+ * These are styles that are specific to individual HTML elements. Changing them affects the style of a particular
+ * HTML element throughout the page.
+ */
+
body {
background-color:#ffffff;
color:#353833;
- font-family:Helvetica, sans-serif;
- font-size:15px;
+ font-family: Verdana, Helvetica, Arial, sans-serif;
+ font-size:14px;
margin:0;
+ padding:0;
+ height:100%;
+ width:100%;
+}
+iframe {
+ margin:0;
+ padding:0;
+ height:100%;
+ width:100%;
+ overflow-y:scroll;
+ border:none;
}
a:link, a:visited {
+ text-decoration: none;
color:#4A6782;
- text-decoration:none;
}
-a:hover, a:focus {
+a[href]:hover, a[href]:focus {
+ text-decoration:none;
color:#bb7a2a;
- text-decoration:none;
-}
-a:active {
- color:#4A6782;
- text-decoration:none;
}
a[name] {
color:#353833;
- text-decoration:none;
}
-a[name]:hover {
- color:#353833;
- text-decoration:none;
+a[name]:before, a[name]:target, a[id]:before, a[id]:target {
+ content:"";
+ display:inline-block;
+ position:relative;
+ padding-top:129px;
+ margin-top:-129px;
}
pre {
- font-family: monospace;
- font-size: 90%;
+ font-family:"Roboto Mono", monospace;
+ font-size:14px;
}
h1 {
font-size:20px;
@@ -57,7 +73,7 @@
font-style:italic;
}
h4 {
- font-size:14px;
+ font-size:13px;
}
h5 {
font-size:12px;
@@ -69,33 +85,36 @@
list-style-type:disc;
}
code, tt {
- font-family: monospace;
+ font-family:"Roboto Mono", monospace;
+ font-size:14px;
padding-top:4px;
margin-top:8px;
line-height:1.4em;
- color: #4A6782;
}
dt code {
- font-family: monospace;
+ font-family:"Roboto Mono", monospace;
+ font-size:14px;
padding-top:4px;
- color: #4A6782;
}
table tr td dt code {
- font-family: monospace;
+ font-family:"Roboto Mono", monospace;
+ font-size:14px;
vertical-align:top;
padding-top:4px;
- color: #4A6782;
-}
-a code {
- color: inherit !important;
- text-decoration: underline;
}
sup {
font-size:8px;
}
+
/*
-Document title and Copyright styles
-*/
+ * Styles for HTML generated by javadoc.
+ *
+ * These are style classes that are used by the standard doclet to generate HTML documentation.
+ */
+
+/*
+ * Styles for document title and copyright.
+ */
.clear {
clear:both;
height:0;
@@ -126,25 +145,33 @@
font-weight:bold;
}
/*
-Navigation bar styles
-*/
+ * Styles for navigation bar.
+ */
.bar {
background-color:#4D7A97;
color:#FFFFFF;
- padding: .6em .5em .6em .8em;
+ padding:.8em .5em .4em .8em;
height:auto;/*height:1.8em;*/
font-size:11px;
margin:0;
}
+.navPadding {
+ padding-top: 107px;
+}
+.fixedNav {
+ position:fixed;
+ width:100%;
+ z-index:999;
+ background-color:#ffffff;
+}
.topNav {
background-color:#4D7A97;
color:#FFFFFF;
float:left;
- padding:0;
width:100%;
clear:right;
height:2.8em;
- padding-top:10px;
+ padding: 10px 0 0;
overflow:hidden;
font-size:12px;
}
@@ -153,11 +180,10 @@
background-color:#4D7A97;
color:#FFFFFF;
float:left;
- padding:0;
width:100%;
clear:right;
height:2.8em;
- padding-top:10px;
+ padding: 10px 0 0;
overflow:hidden;
font-size:12px;
}
@@ -185,7 +211,22 @@
padding: 5px 6px;
text-transform:uppercase;
}
-ul.subNavList li{
+ul.navListSearch {
+ float:right;
+ margin:0 0 0 0;
+ padding:0;
+}
+ul.navListSearch li {
+ list-style:none;
+ float:right;
+ padding: 5px 6px;
+ text-transform:uppercase;
+}
+ul.navListSearch li label {
+ position:relative;
+ right:-16px;
+}
+ul.subNavList li {
list-style:none;
float:left;
}
@@ -211,22 +252,30 @@
overflow:hidden;
}
/*
-Page header and footer styles
-*/
+ * Styles for page header and footer.
+ */
.header, .footer {
clear:both;
margin:0 20px;
padding:5px 0 0 0;
}
-.indexHeader {
- margin:10px;
+.indexNav {
position:relative;
+ font-size:12px;
+ background-color:#dee3e9;
}
-.indexHeader span{
- margin-right:15px;
+.indexNav ul {
+ margin-top:0;
+ padding:5px;
}
-.indexHeader h1 {
- font-size:14px;
+.indexNav ul li {
+ display:inline;
+ list-style-type:none;
+ padding-right:10px;
+ text-transform:uppercase;
+}
+.indexNav h1 {
+ font-size:13px;
}
.title {
color:#2c4557;
@@ -244,11 +293,11 @@
}
.header ul li, .footer ul li {
list-style:none;
- font-size:14px;
+ font-size:13px;
}
/*
-Heading styles
-*/
+ * Styles for headings.
+ */
div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 {
background-color:#dee3e9;
border:1px solid #d0d9e0;
@@ -269,9 +318,10 @@
padding:0 0 20px 0;
}
/*
-Page layout container styles
-*/
-.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer {
+ * Styles for page layout containers.
+ */
+.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer,
+.allClassesContainer, .allPackagesContainer {
clear:both;
padding:10px 20px;
position:relative;
@@ -279,10 +329,10 @@
.indexContainer {
margin:10px;
position:relative;
- font-size:14px;
+ font-size:12px;
}
.indexContainer h2 {
- font-size:14px;
+ font-size:13px;
padding:0 0 3px 0;
}
.indexContainer ul {
@@ -301,7 +351,8 @@
}
.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd {
margin:5px 0 10px 0;
- font-size:15px;
+ font-size:14px;
+ font-family: Verdana, Georgia, "Times New Roman", Times, serif;
}
.serializedFormContainer dl.nameValue dt {
margin-left:1px;
@@ -315,8 +366,11 @@
display:inline;
}
/*
-List styles
-*/
+ * Styles for lists.
+ */
+li.circle {
+ list-style:circle;
+}
ul.horizontal li {
display:inline;
font-size:0.9em;
@@ -369,19 +423,22 @@
margin-bottom:1px;
}
/*
-Table styles
-*/
-.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary {
+ * Styles for tables.
+ */
+.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary,
+.requiresSummary, .packagesSummary, .providesSummary, .usesSummary {
width:100%;
+ border-spacing:0;
border-left:1px solid #EEE;
border-right:1px solid #EEE;
border-bottom:1px solid #EEE;
}
-.overviewSummary, .memberSummary {
+.overviewSummary, .memberSummary, .requiresSummary, .packagesSummary, .providesSummary, .usesSummary {
padding:0;
}
.overviewSummary caption, .memberSummary caption, .typeSummary caption,
-.useSummary caption, .constantsSummary caption, .deprecatedSummary caption {
+.useSummary caption, .constantsSummary caption, .deprecatedSummary caption,
+.requiresSummary caption, .packagesSummary caption, .providesSummary caption, .usesSummary caption {
position:relative;
text-align:left;
background-repeat:no-repeat;
@@ -389,36 +446,46 @@
font-weight:bold;
clear:none;
overflow:hidden;
- padding:0;
- padding-top:10px;
- padding-left:1px;
+ padding: 10px 0 0 1px;
margin:0;
white-space:pre;
}
.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link,
-.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link,
+.constantsSummary caption a:link, .deprecatedSummary caption a:link,
+.requiresSummary caption a:link, .packagesSummary caption a:link, .providesSummary caption a:link,
+.usesSummary caption a:link,
.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover,
-.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover,
+.constantsSummary caption a:hover, .deprecatedSummary caption a:hover,
+.requiresSummary caption a:hover, .packagesSummary caption a:hover, .providesSummary caption a:hover,
+.usesSummary caption a:hover,
.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active,
-.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active,
+.constantsSummary caption a:active, .deprecatedSummary caption a:active,
+.requiresSummary caption a:active, .packagesSummary caption a:active, .providesSummary caption a:active,
+.usesSummary caption a:active,
.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited,
-.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited {
+.constantsSummary caption a:visited, .deprecatedSummary caption a:visited,
+.requiresSummary caption a:visited, .packagesSummary caption a:visited, .providesSummary caption a:visited,
+.usesSummary caption a:visited {
color:#FFFFFF;
}
+.useSummary caption a:link, .useSummary caption a:hover, .useSummary caption a:active,
+.useSummary caption a:visited {
+ color:#1f389c;
+}
.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span,
-.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span {
+.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span,
+.requiresSummary caption span, .packagesSummary caption span, .providesSummary caption span,
+.usesSummary caption span {
white-space:nowrap;
- padding-top:5px;
- padding-left:12px;
- padding-right:12px;
- padding-bottom:7px;
+ padding: 5px 12px 7px;
display:inline-block;
float:left;
background-color:#F8981D;
border: none;
height:16px;
}
-.memberSummary caption span.activeTableTab span {
+.memberSummary caption span.activeTableTab span, .packagesSummary caption span.activeTableTab span,
+.overviewSummary caption span.activeTableTab span, .typeSummary caption span.activeTableTab span {
white-space:nowrap;
padding-top:5px;
padding-left:12px;
@@ -429,7 +496,8 @@
background-color:#F8981D;
height:16px;
}
-.memberSummary caption span.tableTab span {
+.memberSummary caption span.tableTab span, .packagesSummary caption span.tableTab span,
+.overviewSummary caption span.tableTab span, .typeSummary caption span.tableTab span {
white-space:nowrap;
padding-top:5px;
padding-left:12px;
@@ -440,7 +508,10 @@
background-color:#4D7A97;
height:16px;
}
-.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab {
+.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab,
+.packagesSummary caption span.tableTab, .packagesSummary caption span.activeTableTab,
+.overviewSummary caption span.tableTab, .overviewSummary caption span.activeTableTab,
+.typeSummary caption span.tableTab, .typeSummary caption span.activeTableTab {
padding-top:0;
padding-left:0;
padding-right:0;
@@ -449,14 +520,16 @@
display:inline;
}
.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd,
-.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd {
+.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd,
+.requiresSummary .tabEnd, .packagesSummary .tabEnd, .providesSummary .tabEnd, .usesSummary .tabEnd {
display:none;
width:5px;
position:relative;
float:left;
background-color:#F8981D;
}
-.memberSummary .activeTableTab .tabEnd {
+.memberSummary .activeTableTab .tabEnd, .packagesSummary .activeTableTab .tabEnd,
+.overviewSummary .activeTableTab .tabEnd, .typeSummary .activeTableTab .tabEnd {
display:none;
width:5px;
margin-right:3px;
@@ -464,66 +537,88 @@
float:left;
background-color:#F8981D;
}
-.memberSummary .tableTab .tabEnd {
+.memberSummary .tableTab .tabEnd, .packagesSummary .tableTab .tabEnd,
+.overviewSummary .tableTab .tabEnd, .typeSummary .tableTab .tabEnd {
display:none;
width:5px;
margin-right:3px;
position:relative;
background-color:#4D7A97;
float:left;
-
+}
+.rowColor th, .altColor th {
+ font-weight:normal;
}
.overviewSummary td, .memberSummary td, .typeSummary td,
-.useSummary td, .constantsSummary td, .deprecatedSummary td {
+.useSummary td, .constantsSummary td, .deprecatedSummary td,
+.requiresSummary td, .packagesSummary td, .providesSummary td, .usesSummary td {
text-align:left;
padding:0 0 12px 10px;
}
-th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th,
-td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{
+th.colFirst, th.colSecond, th.colLast, th.colConstructorName, th.colDeprecatedItemName, .useSummary th,
+.constantsSummary th, .packagesSummary th, td.colFirst, td.colSecond, td.colLast, .useSummary td,
+.constantsSummary td {
vertical-align:top;
padding-right:0;
padding-top:8px;
padding-bottom:3px;
}
-th.colFirst, th.colLast, th.colOne, .constantsSummary th {
+th.colFirst, th.colSecond, th.colLast, th.colConstructorName, th.colDeprecatedItemName, .constantsSummary th,
+.packagesSummary th {
background:#dee3e9;
text-align:left;
padding:8px 3px 3px 7px;
}
td.colFirst, th.colFirst {
- white-space:nowrap;
- font-size:14px;
+ font-size:13px;
}
-td.colLast, th.colLast {
- font-size:14px;
+td.colSecond, th.colSecond, td.colLast, th.colConstructorName, th.colDeprecatedItemName, th.colLast {
+ font-size:13px;
}
-td.colOne, th.colOne {
- font-size:14px;
+.constantsSummary th, .packagesSummary th {
+ font-size:13px;
+}
+.providesSummary th.colFirst, .providesSummary th.colLast, .providesSummary td.colFirst,
+.providesSummary td.colLast {
+ white-space:normal;
+ font-size:13px;
}
.overviewSummary td.colFirst, .overviewSummary th.colFirst,
-.useSummary td.colFirst, .useSummary th.colFirst,
-.overviewSummary td.colOne, .overviewSummary th.colOne,
+.requiresSummary td.colFirst, .requiresSummary th.colFirst,
+.packagesSummary td.colFirst, .packagesSummary td.colSecond, .packagesSummary th.colFirst, .packagesSummary th,
+.usesSummary td.colFirst, .usesSummary th.colFirst,
+.providesSummary td.colFirst, .providesSummary th.colFirst,
.memberSummary td.colFirst, .memberSummary th.colFirst,
-.memberSummary td.colOne, .memberSummary th.colOne,
-.typeSummary td.colFirst{
- width:25%;
+.memberSummary td.colSecond, .memberSummary th.colSecond, .memberSummary th.colConstructorName,
+.typeSummary td.colFirst, .typeSummary th.colFirst {
vertical-align:top;
}
-td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover {
+.packagesSummary th.colLast, .packagesSummary td.colLast {
+ white-space:normal;
+}
+td.colFirst a:link, td.colFirst a:visited,
+td.colSecond a:link, td.colSecond a:visited,
+th.colFirst a:link, th.colFirst a:visited,
+th.colSecond a:link, th.colSecond a:visited,
+th.colConstructorName a:link, th.colConstructorName a:visited,
+th.colDeprecatedItemName a:link, th.colDeprecatedItemName a:visited,
+.constantValuesContainer td a:link, .constantValuesContainer td a:visited,
+.allClassesContainer td a:link, .allClassesContainer td a:visited,
+.allPackagesContainer td a:link, .allPackagesContainer td a:visited {
font-weight:bold;
}
.tableSubHeadingColor {
background-color:#EEEEFF;
}
-.altColor {
+.altColor, .altColor th {
background-color:#FFFFFF;
}
-.rowColor {
+.rowColor, .rowColor th {
background-color:#EEEEEF;
}
/*
-Content styles
-*/
+ * Styles for contents.
+ */
.description pre {
margin-top:0;
}
@@ -534,27 +629,22 @@
.docSummary {
padding:0;
}
-
ul.blockList ul.blockList ul.blockList li.blockList h3 {
font-style:normal;
}
-
div.block {
- font-size:15px;
- font-family: Helvetica, "Times New Roman", Times, serif;
+ font-size:14px;
+ font-family: Verdana, Georgia, "Times New Roman", Times, serif;
}
-
td.colLast div {
padding-top:0;
}
-
-
td.colLast a {
padding-bottom:3px;
}
/*
-Formatting effect styles
-*/
+ * Styles for formatting effect.
+ */
.sourceLineNo {
color:green;
padding:0 30px 0 0;
@@ -569,23 +659,257 @@
margin:3px 10px 2px 0;
color:#474747;
}
-.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink,
-.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel,
-.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink {
+.deprecatedLabel, .descfrmTypeLabel, .implementationLabel, .memberNameLabel, .memberNameLink,
+.moduleLabelInPackage, .moduleLabelInType, .overrideSpecifyLabel, .packageLabelInType,
+.packageHierarchyLabel, .paramLabel, .returnLabel, .seeLabel, .simpleTagLabel,
+.throwsLabel, .typeNameLabel, .typeNameLink, .searchTagLink {
font-weight:bold;
}
.deprecationComment, .emphasizedPhrase, .interfaceName {
font-style:italic;
}
-
-div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase,
+.deprecationBlock {
+ font-size:14px;
+ font-family: Verdana, Georgia, "Times New Roman", Times, serif;
+ border-style:solid;
+ border-width:thin;
+ border-radius:10px;
+ padding:10px;
+ margin-bottom:10px;
+ margin-right:10px;
+ display:inline-block;
+}
+div.block div.deprecationComment, div.block div.block span.emphasizedPhrase,
div.block div.block span.interfaceName {
font-style:normal;
}
-
-div.contentContainer ul.blockList li.blockList h2{
+div.contentContainer ul.blockList li.blockList h2 {
padding-bottom:0;
}
+/*
+ * Styles for IFRAME.
+ */
+.mainContainer {
+ margin:0 auto;
+ padding:0;
+ height:100%;
+ width:100%;
+ position:fixed;
+ top:0;
+ left:0;
+}
+.leftContainer {
+ height:100%;
+ position:fixed;
+ width:320px;
+}
+.leftTop {
+ position:relative;
+ float:left;
+ width:315px;
+ top:0;
+ left:0;
+ height:30%;
+ border-right:6px solid #ccc;
+ border-bottom:6px solid #ccc;
+}
+.leftBottom {
+ position:relative;
+ float:left;
+ width:315px;
+ bottom:0;
+ left:0;
+ height:70%;
+ border-right:6px solid #ccc;
+ border-top:1px solid #000;
+}
+.rightContainer {
+ position:absolute;
+ left:320px;
+ top:0;
+ bottom:0;
+ height:100%;
+ right:0;
+ border-left:1px solid #000;
+}
+.rightIframe {
+ padding:0;
+ height:100%;
+ right:30px;
+ width:100%;
+ overflow:visible;
+ margin: 0 0 30px;
+}
+/*
+ * Styles specific to HTML5 elements.
+ */
+main, nav, header, footer, section {
+ display:block;
+}
+/*
+ * Styles for javadoc search.
+ */
+.ui-autocomplete-category {
+ font-weight:bold;
+ font-size:15px;
+ padding:7px 0 7px 3px;
+ background-color:#4D7A97;
+ color:#FFFFFF;
+}
+.resultItem {
+ font-size:13px;
+}
+.ui-autocomplete {
+ max-height:85%;
+ max-width:65%;
+ overflow-y:scroll;
+ overflow-x:scroll;
+ white-space:nowrap;
+ box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
+}
+ul.ui-autocomplete {
+ position:fixed;
+ z-index:999999;
+}
+ul.ui-autocomplete li {
+ float:left;
+ clear:both;
+ width:100%;
+}
+.resultHighlight {
+ font-weight:bold;
+}
+#search {
+ background-image:url('resources/glass.png');
+ background-size:13px;
+ background-repeat:no-repeat;
+ background-position:2px 3px;
+ padding-left:20px;
+ position:relative;
+ right:-18px;
+}
+#reset {
+ background-color: rgb(255,255,255);
+ background-image:url('resources/x.png');
+ background-position:center;
+ background-repeat:no-repeat;
+ background-size:12px;
+ border:0 none;
+ width:16px;
+ height:17px;
+ position:relative;
+ left:-4px;
+ top:-4px;
+ font-size:0;
+}
+.watermark {
+ color:#545454;
+}
+.searchTagDescResult {
+ font-style:italic;
+ font-size:11px;
+}
+.searchTagHolderResult {
+ font-style:italic;
+ font-size:12px;
+}
+.searchTagResult:before, .searchTagResult:target {
+ color:red;
+}
+.moduleGraph span {
+ display:none;
+ position:absolute;
+}
+.moduleGraph:hover span {
+ display:block;
+ margin: -100px 0 0 100px;
+ z-index: 1;
+}
+.methodSignature {
+ white-space:normal;
+ color: #4d7a97;
+ font-weight: 700;
+}
+
+/*
+ * Styles for user-provided tables.
+ *
+ * borderless:
+ * No borders, vertical margins, styled caption.
+ * This style is provided for use with existing doc comments.
+ * In general, borderless tables should not be used for layout purposes.
+ *
+ * plain:
+ * Plain borders around table and cells, vertical margins, styled caption.
+ * Best for small tables or for complex tables for tables with cells that span
+ * rows and columns, when the "striped" style does not work well.
+ *
+ * striped:
+ * Borders around the table and vertical borders between cells, striped rows,
+ * vertical margins, styled caption.
+ * Best for tables that have a header row, and a body containing a series of simple rows.
+ */
+
+table.borderless,
+table.plain,
+table.striped {
+ margin-top: 10px;
+ margin-bottom: 10px;
+}
+table.borderless > caption,
+table.plain > caption,
+table.striped > caption {
+ font-weight: bold;
+ font-size: smaller;
+}
+table.borderless th, table.borderless td,
+table.plain th, table.plain td,
+table.striped th, table.striped td {
+ padding: 2px 5px;
+}
+table.borderless,
+table.borderless > thead > tr > th, table.borderless > tbody > tr > th, table.borderless > tr > th,
+table.borderless > thead > tr > td, table.borderless > tbody > tr > td, table.borderless > tr > td {
+ border: none;
+}
+table.borderless > thead > tr, table.borderless > tbody > tr, table.borderless > tr {
+ background-color: transparent;
+}
+table.plain {
+ border-collapse: collapse;
+ border: 1px solid black;
+}
+table.plain > thead > tr, table.plain > tbody tr, table.plain > tr {
+ background-color: transparent;
+}
+table.plain > thead > tr > th, table.plain > tbody > tr > th, table.plain > tr > th,
+table.plain > thead > tr > td, table.plain > tbody > tr > td, table.plain > tr > td {
+ border: 1px solid black;
+}
+table.striped {
+ border-collapse: collapse;
+ border: 1px solid black;
+}
+table.striped > thead {
+ background-color: #E3E3E3;
+}
+table.striped > thead > tr > th, table.striped > thead > tr > td {
+ border: 1px solid black;
+}
+table.striped > tbody > tr:nth-child(even) {
+ background-color: #EEE
+}
+table.striped > tbody > tr:nth-child(odd) {
+ background-color: #FFF
+}
+table.striped > tbody > tr > th, table.striped > tbody > tr > td {
+ border-left: 1px solid black;
+ border-right: 1px solid black;
+}
+table.striped > tbody > tr > th {
+ font-weight: normal;
+}
+
/* ================================================================= */
diff --git a/pom.xml b/pom.xml
index 9336402..8aa3f44 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,30 +24,30 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <apache.httpcomponents.ver>4.5.7</apache.httpcomponents.ver>
- <apache.common.lang.ver>3.8.1</apache.common.lang.ver>
- <commons.validator.ver>1.6</commons.validator.ver>
- <gson.ver>2.8.5</gson.ver>
- <log4j.ver>2.11.2</log4j.ver>
- <nlpcraft.ver>0.5.0</nlpcraft.ver>
- <junit.ver>5.4.0</junit.ver>
- <maven.compiler.version>3.7.0</maven.compiler.version>
- <maven.exec.version>1.6.0</maven.exec.version>
- <maven.shade.plugin.ver>3.1.0</maven.shade.plugin.ver>
+ <apache.httpcomponents.ver>4.5.13</apache.httpcomponents.ver>
+ <apache.common.lang.ver>3.11</apache.common.lang.ver>
+ <commons.validator.ver>1.7</commons.validator.ver>
+ <gson.ver>2.8.6</gson.ver>
+ <log4j.ver>2.14.0</log4j.ver>
+ <nlpcraft.ver>0.7.2</nlpcraft.ver>
+ <junit.ver>5.7.0</junit.ver>
+ <maven.compiler.version>3.8.0</maven.compiler.version>
+ <maven.shade.plugin.ver>3.2.4</maven.shade.plugin.ver>
<maven.source.plugin.ver>3.0.1</maven.source.plugin.ver>
<maven.gpg.plugin.ver>1.6</maven.gpg.plugin.ver>
<maven.enforcer.plugin.ver>1.4.1</maven.enforcer.plugin.ver>
- <maven.surefire.plugin.ver>2.22.1</maven.surefire.plugin.ver>
+ <maven.surefire.plugin.ver>2.22.2</maven.surefire.plugin.ver>
<maven.javadoc.plugin.ver>3.2.0</maven.javadoc.plugin.ver>
- <maven.jar.plugin.ver>3.1.1</maven.jar.plugin.ver>
+ <maven.jar.plugin.ver>3.2.0</maven.jar.plugin.ver>
<apache.rat.plugin.ver>0.13</apache.rat.plugin.ver>
<maven.bazaarvoice.plugin.ver>0.9</maven.bazaarvoice.plugin.ver>
+ <maven.clean.plugin.ver>3.1.0</maven.clean.plugin.ver>
</properties>
<name>NLPCraft - Java Client</name>
<groupId>org.apache.nlpcraft</groupId>
<artifactId>java-client</artifactId>
- <version>0.5.0</version>
+ <version>0.7.2</version>
<url>https://nlpcraft.apache.org</url>
<description>An open source API to convert natural language into actions.</description>
@@ -84,7 +84,7 @@
<connection>scm:git:ssh://git@github.com/apache/incubator-nlpcraft.git</connection>
<developerConnection>scm:git:ssh://git@github.com/apache/incubator-nlpcraft.git</developerConnection>
<!-- Set actual tag name here -->
- <tag>v0.5.0</tag>
+ <tag>v0.7.2</tag>
</scm>
<dependencies>
@@ -135,12 +135,28 @@
<build>
<plugins>
<plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>${maven.clean.plugin.ver}</version>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>${user.home}/.nlpcraft</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <followSymlinks>false</followSymlinks>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
- <source>1.8</source>
- <target>1.8</target>
+ <source>11</source>
+ <target>11</target>
</configuration>
</plugin>
<plugin>
@@ -151,12 +167,15 @@
<rules>
<requireJavaVersion>
<message>
- [INFO] ------------------------------------------------------------------------
- [ERROR] You are trying to compile NLPCraft with inappropriate JDK version!
- [ERROR] Detected JDK Version: ${java.runtime.version}
- [ERROR] JDK version should be >= 1.8.0_1.
+
+ ------------------------------------------------------------------------
+ You are trying to compile NLPCraft with inappropriate JDK version!
+ Detected JDK Version: ${java.runtime.version}
+ JDK version should be 11 or later
+ ------------------------------------------------------------------------
+
</message>
- <version>1.8,11</version>
+ <version>11</version>
</requireJavaVersion>
</rules>
</configuration>
@@ -173,8 +192,6 @@
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven.javadoc.plugin.ver}</version>
<configuration>
- <source>1.8</source>
- <!-- Required as of JDK 8u121 -->
<additionalOptions>--allow-script-in-comments, -Xdoclint:none</additionalOptions>
<javadocDirectory>${project.basedir}/javadoc</javadocDirectory>
<docfilessubdirs>true</docfilessubdirs>
@@ -202,13 +219,14 @@
<link href="{@docRoot}/resources/sh/styles/shCoreNlpCraft.css" rel="stylesheet" type="text/css" title="Style">
<link href="{@docRoot}/resources/sh/styles/shThemeNlpCraft.css" rel="stylesheet" type="text/css" title="Style">
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
+ <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<script async defer src="https://buttons.github.io/buttons.js"></script>
]]>
</top>
<!-- Disabled because of https://bugs.openjdk.java.net/browse/JDK-8193030 -->
<!-- <subpackages>org.apache.nlpcraft.client</subpackages> -->
<excludePackageNames>
- org.apache.nlpcraft.client.impl
+ org.apache.nlpcraft.client.impl:org.apache.nlpcraft.client.impl.beans
</excludePackageNames>
<groups>
<group>
@@ -250,7 +268,7 @@
</footer>
<doctitle>
<![CDATA[
- Apache NLPCraft - Java Client API <span style="font-size: 80%">${project.version}</span>
+ <img style="margin-top: 15px" src="https://nlpcraft.apache.org/images/nlpcraft_logo_darkblue.png" height="54px">
]]>
</doctitle>
<windowtitle>Apache NLPCraft - Java Client ${project.version}</windowtitle>
@@ -324,13 +342,27 @@
<goal>start</goal>
</goals>
<configuration>
+ <!--
+ Depending on the console config and how maven is run this will produce the output with ANSI colors.
+ To strip out ANSI escape sequences from the log file, see the following:
+ https://stackoverflow.com/questions/17998978/removing-colors-from-output
+ -->
<name>server</name>
<healthcheckUrl>http://localhost:8081/api/v1/health</healthcheckUrl>
- <waitAfterLaunch>180</waitAfterLaunch>
+ <waitAfterLaunch>600</waitAfterLaunch>
<arguments>
<argument>java</argument>
<argument>-Xmx4G</argument>
<argument>-Xms4G</argument>
+ <argument>--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED</argument>
+ <argument>--add-exports=java.base/sun.nio.ch=ALL-UNNAMED</argument>
+ <argument>--add-exports=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED</argument>
+ <argument>--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED</argument>
+ <argument>--add-exports=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED</argument>
+ <argument>--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED</argument>
+ <argument>--illegal-access=permit</argument>
+ <argument>-DNLPCRAFT_ANSI_COLOR_DISABLED=true</argument> <!-- Remove ANSI at least from NLPCraft output. -->
+ <argument>-Djdk.tls.client.protocols=TLSv1.2</argument>
<argument>-cp</argument>
<argument>${project.build.directory}/server-lib/*</argument>
<argument>org.apache.nlpcraft.server.NCServer</argument>
@@ -371,6 +403,15 @@
<includes>
<include>**/*.*</include>
</includes>
+ <excludes>
+ <!--
+ Some tests skipped on maven `verify` phase.
+ ===========================================
+ -->
+ <!-- Reason: 'contextWordServer' should be started. -->
+ <exclude>**/NCModelTest.*</exclude>
+ </excludes>
+
</configuration>
</execution>
</executions>
diff --git a/src/main/java/org/apache/nlpcraft/client/NCClient.java b/src/main/java/org/apache/nlpcraft/client/NCClient.java
index 79c7432..283d913 100644
--- a/src/main/java/org/apache/nlpcraft/client/NCClient.java
+++ b/src/main/java/org/apache/nlpcraft/client/NCClient.java
@@ -21,9 +21,9 @@
import java.util.*;
/**
- * Java client API. Java REST client provides native and easy-to-use wrapper for NLPCraft
- * <a target=_ href="https://nlpcraft.apache.org/using-rest.html">REST APIs</a> for any JVM-based languages
- * like Java, Scala, Kotlin or Groovy. Note that NLPCraft REST APIs allow to submit the request to existing
+ * <b>Java client API</b> provides native JVM wrapper for NLPCraft
+ * <a target=_ href="https://nlpcraft.apache.org/using-rest.html">REST APIs</a>. Note that NLPCraft REST APIs allow to
+ * submit the request to existing
* deployed data model and perform other related, auxiliary operations. To create data models you need to
* use main <a target=_ href="https://nlpcraft.apache.org/apis/latest/index.html">NLPCraft APIs</a>.
* <p>
@@ -49,7 +49,7 @@
* // Perform any necessary calls...
* NCResult res = cli.askSync("my.model.id", txt);
*
- * // Close client & sign out at the end.
+ * // Close client & sign out at the end.
* cli.close();
* </pre>
*
@@ -542,6 +542,21 @@
* @throws IOException Thrown in case of generic I/O errors.
*/
void deleteCompany() throws NCClientException, IOException;
+
+ /**
+ * Runs <a href="https://nlpcraft.apache.org/tools/syn_tool.html">synonym suggestion tool</a> for given model
+ * ID and minimal score.
+ *
+ * @param mdlId ID Of the model to run the tool for.
+ * @param minScore Minimum score to include into the result, ranging from 0 to 1, default is 0.
+ * Score of 0 will include all results, and score of 1 will include only results with the absolutely highest
+ * confidence score. Values between 0.5 and 0.7 is generally suggested.
+ * @return Suggestion data container.
+ * @throws NCClientException Thrown in case of client-specific errors.
+ * @throws IOException Thrown in case of generic I/O errors.
+ * @see <a href="https://nlpcraft.apache.org/tools/syn_tool.html">Synonym suggestion tool</a>.
+ */
+ NCSuggestionData suggestSynonyms(String mdlId, Double minScore) throws NCClientException, IOException;
/**
* Closes the client and signs out from the REST server. Any further calls to this client will result in
diff --git a/src/main/java/org/apache/nlpcraft/client/NCClientBuilder.java b/src/main/java/org/apache/nlpcraft/client/NCClientBuilder.java
index b004425..c0a238b 100644
--- a/src/main/java/org/apache/nlpcraft/client/NCClientBuilder.java
+++ b/src/main/java/org/apache/nlpcraft/client/NCClientBuilder.java
@@ -40,7 +40,7 @@
* // Perform any necessary calls...
* NCResult res = cli.askSync("my.model.id", txt);
*
- * // Close client & sign out at the end.
+ * // Close client & sign out at the end.
* cli.close();
* </pre>
*/
diff --git a/src/main/java/org/apache/nlpcraft/client/NCSuggestion.java b/src/main/java/org/apache/nlpcraft/client/NCSuggestion.java
new file mode 100644
index 0000000..cb90f1c
--- /dev/null
+++ b/src/main/java/org/apache/nlpcraft/client/NCSuggestion.java
@@ -0,0 +1,39 @@
+/*
+ * 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.client;
+
+/**
+ * Individual synonym suggestion returned from {@link NCSuggestionData#getSynonyms()} method.
+ *
+ * @see <a href="https://nlpcraft.apache.org/tools/syn_tool.html">Synonym suggestion tool</a>.
+ */
+public interface NCSuggestion {
+ /**
+ * Gets score of the suggested synonym.
+ *
+ * @return Score of the suggested synonym.
+ */
+ double getScore();
+
+ /**
+ * Gets synonym.
+ *
+ * @return A synonym.
+ */
+ String getSynonym();
+}
diff --git a/src/main/java/org/apache/nlpcraft/client/NCSuggestionData.java b/src/main/java/org/apache/nlpcraft/client/NCSuggestionData.java
new file mode 100644
index 0000000..967b7f0
--- /dev/null
+++ b/src/main/java/org/apache/nlpcraft/client/NCSuggestionData.java
@@ -0,0 +1,77 @@
+/*
+ * 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.client;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Result container returned by {@link NCClient#suggestSynonyms(String, Double)} method.
+ *
+ * @see <a href="https://nlpcraft.apache.org/tools/syn_tool.html">Synonym suggestion tool</a>.
+ */
+public interface NCSuggestionData {
+ /**
+ * Gets model ID.
+ *
+ * @return model ID.
+ */
+ String getModelId();
+
+ /**
+ * Gets minimal score used.
+ *
+ * @return Minimal score used.
+ */
+ double getMinScore();
+
+ /**
+ * Gets duration of the operation in milliseconds.
+ *
+ * @return Duration of the operation in milliseconds.
+ */
+ long getDurationMs();
+
+ /**
+ * Gets timestamp of the operation.
+ *
+ * @return Timestamp of the operation.
+ */
+ long getTimestamp();
+
+ /**
+ * Gets optional error message.
+ *
+ * @return Error message or {@code null} if there was no error.
+ */
+ String getError();
+
+ /**
+ * Gets list of synonym suggestions for each model element ID.
+ *
+ * @return List of synonym suggestions for each model element ID.
+ */
+ List<Map<String, List<NCSuggestion>>> getSynonyms();
+
+ /**
+ * Optional list of warnings.
+ *
+ * @return List of warnings or {@code null} if there's no warnings.
+ */
+ List<String> getWarnings();
+}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/NCClientImpl.java b/src/main/java/org/apache/nlpcraft/client/impl/NCClientImpl.java
index 6a5c55b..e2957c9 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/NCClientImpl.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/NCClientImpl.java
@@ -39,6 +39,7 @@
import org.apache.nlpcraft.client.NCNewCompany;
import org.apache.nlpcraft.client.NCProbe;
import org.apache.nlpcraft.client.NCResult;
+import org.apache.nlpcraft.client.NCSuggestionData;
import org.apache.nlpcraft.client.NCUser;
import org.apache.nlpcraft.client.impl.beans.NCAskBean;
import org.apache.nlpcraft.client.impl.beans.NCAskSyncBean;
@@ -52,12 +53,13 @@
import org.apache.nlpcraft.client.impl.beans.NCRequestStateBean;
import org.apache.nlpcraft.client.impl.beans.NCSigninBean;
import org.apache.nlpcraft.client.impl.beans.NCStatusResponseBean;
+import org.apache.nlpcraft.client.impl.beans.NCSuggestionResultBean;
import org.apache.nlpcraft.client.impl.beans.NCTokenCreationBean;
import org.apache.nlpcraft.client.impl.beans.NCUserAddBean;
import org.apache.nlpcraft.client.impl.beans.NCUserBean;
import org.apache.nlpcraft.client.impl.beans.NCUsersAllBean;
-import org.apache.nlpcraft.probe.embedded.NCEmbeddedProbe;
-import org.apache.nlpcraft.probe.embedded.NCEmbeddedResult;
+import org.apache.nlpcraft.model.tools.embedded.NCEmbeddedProbe;
+import org.apache.nlpcraft.model.tools.embedded.NCEmbeddedResult;
import java.io.IOException;
import java.lang.reflect.Type;
@@ -324,7 +326,7 @@
*/
private <T extends NCStatusResponseBean> T checkAndExtract(String js, Type type) throws NCClientException {
T t = gson.fromJson(js, type);
-
+
checkStatus(t.getStatus());
return t;
@@ -340,7 +342,7 @@
* @throws IllegalStateException
*/
@SafeVarargs
- private final String post(String url, Pair<String, Object>... ps) throws NCClientException, IOException {
+ private String post(String url, Pair<String, Object>... ps) throws NCClientException, IOException {
if (!started)
throw new IllegalStateException("Client is not initialized.");
@@ -403,7 +405,7 @@
if (js == null)
throw new NCClientException(String.format("Unexpected empty response [code=%d]", code));
-
+
if (code == 200)
return js;
@@ -437,16 +439,6 @@
}
/**
- * @param v
- * @param name
- * @throws IllegalArgumentException
- */
- private void notNull(Object v, String name) throws IllegalArgumentException {
- if (v == null)
- throw new IllegalArgumentException(String.format("Parameter cannot be null: '%s'", name));
- }
-
- /**
*
* @return
* @throws IOException
@@ -566,7 +558,7 @@
"user/get",
Pair.of("acsTok", acsTok),
Pair.of("id", id),
- Pair.of("extId", extId)
+ Pair.of("usrExtId", extId)
),
NCUserBean.class
);
@@ -990,4 +982,19 @@
)
);
}
+
+ @Override
+ public NCSuggestionData suggestSynonyms(String mdlId, Double minScore) throws NCClientException, IOException {
+ NCSuggestionResultBean res = checkAndExtract(
+ post(
+ "model/sugsyn",
+ Pair.of("acsTok", acsTok),
+ Pair.of("mdlId", mdlId),
+ Pair.of("minScore", minScore)
+ ),
+ NCSuggestionResultBean.class
+ );
+
+ return res.getResult();
+ }
}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCAskBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCAskBean.java
index 774a781..4423647 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCAskBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCAskBean.java
@@ -25,9 +25,6 @@
public class NCAskBean extends NCStatusResponseBean {
@SerializedName("srvReqId") private String srvReqId;
- /**
- * Gets server request ID.
- */
public String getServerRequestId() {
return srvReqId;
}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCAskSyncBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCAskSyncBean.java
index 53c436b..aac9c33 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCAskSyncBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCAskSyncBean.java
@@ -25,9 +25,6 @@
public class NCAskSyncBean extends NCStatusResponseBean {
@SerializedName("state") private NCRequestStateBean state;
- /**
- * Gets request state.
- */
public NCRequestStateBean getState() {
return state;
}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCCheckBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCCheckBean.java
index 40828d5..93a3a99 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCCheckBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCCheckBean.java
@@ -27,9 +27,6 @@
public class NCCheckBean extends NCStatusResponseBean {
@SerializedName("states") private List<NCRequestStateBean> states;
- /**
- * Gets the list of request states.
- */
public List<NCRequestStateBean> getStates() {
return states;
}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCCompanyBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCCompanyBean.java
index 287428b..5b522f8 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCCompanyBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCCompanyBean.java
@@ -33,43 +33,28 @@
@SerializedName("address") private String address;
@SerializedName("postalCode") private String postalCode;
- @Override
- public long getId() {
+ @Override public long getId() {
return id;
}
-
- @Override
- public String getName() {
+ @Override public String getName() {
return name;
}
-
- @Override
- public String getWebsite() {
+ @Override public String getWebsite() {
return website;
}
-
- @Override
- public String getCountry() {
+ @Override public String getCountry() {
return country;
}
-
- @Override
- public String getRegion() {
+ @Override public String getRegion() {
return region;
}
-
- @Override
- public String getCity() {
+ @Override public String getCity() {
return city;
}
-
- @Override
- public String getAddress() {
+ @Override public String getAddress() {
return address;
}
-
- @Override
- public String getPostalCode() {
+ @Override public String getPostalCode() {
return postalCode;
}
}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCCompanyTokenResetBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCCompanyTokenResetBean.java
index db419f7..5fed10d 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCCompanyTokenResetBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCCompanyTokenResetBean.java
@@ -25,9 +25,6 @@
public class NCCompanyTokenResetBean extends NCStatusResponseBean {
@SerializedName("token") private String token;
- /**
- * Gets new company token.
- */
public String getToken() {
return token;
}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCErrorMessageBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCErrorMessageBean.java
index 05cc30d..73c0d79 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCErrorMessageBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCErrorMessageBean.java
@@ -26,16 +26,9 @@
@SerializedName("code") private String code;
@SerializedName("msg") private String msg;
- /**
- * Gets error code.
- */
public String getCode() {
return code;
}
-
- /**
- * Gets error message.
- */
public String getMessage() {
return msg;
}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCFeedbackAddBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCFeedbackAddBean.java
index b55f0d6..d94d03b 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCFeedbackAddBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCFeedbackAddBean.java
@@ -25,9 +25,6 @@
public class NCFeedbackAddBean extends NCStatusResponseBean {
@SerializedName("id") private Long id;
- /**
- * ID of the newly added feedback record.
- */
public Long getId() {
return id;
}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCFeedbackAllBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCFeedbackAllBean.java
index 8464432..91f753a 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCFeedbackAllBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCFeedbackAllBean.java
@@ -27,9 +27,6 @@
public class NCFeedbackAllBean extends NCStatusResponseBean {
@SerializedName("feedback") private List<NCFeedbackBean> feedback;
- /**
- * Gets the list of all feedback records.
- */
public List<NCFeedbackBean> getFeedback() {
return feedback;
}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCFeedbackBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCFeedbackBean.java
index c40b2a4..119ab65 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCFeedbackBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCFeedbackBean.java
@@ -29,75 +29,41 @@
private double score;
private String comment;
private long createTstamp;
-
- @Override
- public long getId() {
+
+ @Override public String getServerRequestId() {
+ return srvReqId;
+ }
+ @Override public long getCreateTimestamp() {
+ return createTstamp;
+ }
+ @Override public long getUserId() {
+ return usrId;
+ }
+ @Override public double getScore() {
+ return score;
+ }
+ @Override public String getComment() {
+ return comment;
+ }
+ @Override public long getId() {
return id;
}
- /**
- * Sets feedback record ID.
- */
public void setId(long id) {
this.id = id;
}
-
- @Override
- public String getServerRequestId() {
- return srvReqId;
- }
-
- /**
- * Sets server request ID.
- */
public void setServerRequestId(String srvReqId) {
this.srvReqId = srvReqId;
}
-
- @Override
- public long getUserId() {
- return usrId;
- }
-
- /**
- * Sets user ID.
- */
public void setUsrId(long usrId) {
this.usrId = usrId;
}
-
- @Override
- public double getScore() {
- return score;
- }
-
- /**
- * Sets feedback score.
- */
public void setScore(double score) {
this.score = score;
}
-
- @Override
- public String getComment() {
- return comment;
- }
-
- /**
- * Sets feedback comment.
- */
public void setComment(String comment) {
this.comment = comment;
}
-
- @Override
- public long getCreateTimestamp() {
- return createTstamp;
- }
-
- /**
- * Sets create timestamp.
- */
public void setCreateTstamp(long createTstamp) {
this.createTstamp = createTstamp;
}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCModelBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCModelBean.java
index fa6a293..1fcf975 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCModelBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCModelBean.java
@@ -28,18 +28,13 @@
@SerializedName("name") private String name;
@SerializedName("version") private String version;
- @Override
- public String getId() {
+ @Override public String getId() {
return id;
}
-
- @Override
- public String getName() {
+ @Override public String getName() {
return name;
}
-
- @Override
- public String getVersion() {
+ @Override public String getVersion() {
return version;
}
}
\ No newline at end of file
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCProbeBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCProbeBean.java
index 635a03c..86f9dda 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCProbeBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCProbeBean.java
@@ -21,6 +21,7 @@
import org.apache.nlpcraft.client.NCModel;
import org.apache.nlpcraft.client.NCProbe;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@@ -48,98 +49,23 @@
@SerializedName("macAddr") private String macAddr;
@SerializedName("models") private Set<NCModelBean> models;
- @Override
- public String getProbeToken() {
- return probeToken;
- }
-
- @Override
- public String getId() {
- return id;
- }
-
- @Override
- public String getProbeGuid() {
- return probeGuid;
- }
-
- @Override
- public String getProbeApiVersion() {
- return probeApiVersion;
- }
-
- @Override
- public String getProbeApiDate() {
- return probeApiDate;
- }
-
- @Override
- public String getOsVersion() {
- return osVersion;
- }
-
- @Override
- public String getOsName() {
- return osName;
- }
-
- @Override
- public String getOsArchitecture() {
- return osArch;
- }
-
- @Override
- public long getStartTimestamp() {
- return startTstamp;
- }
-
- @Override
- public String getTimezoneId() {
- return tmzId;
- }
-
- @Override
- public String getTimezoneAbbreviation() {
- return tmzAbbr;
- }
-
- @Override
- public String getTimezoneName() {
- return tmzName;
- }
-
- @Override
- public String getUserName() {
- return userName;
- }
-
- @Override
- public String getJavaVersion() {
- return javaVersion;
- }
-
- @Override
- public String getJavaVendor() {
- return javaVendor;
- }
-
- @Override
- public String getHostName() {
- return hostName;
- }
-
- @Override
- public String getHostAddress() {
- return hostAddr;
- }
-
- @Override
- public String getMacAddress() {
- return macAddr;
- }
-
- @Override
- public Set<NCModel> getModels() {
- return new HashSet<>(models);
- }
+ @Override public String getProbeToken() { return probeToken; }
+ @Override public String getId() { return id; }
+ @Override public String getProbeGuid() { return probeGuid; }
+ @Override public String getProbeApiVersion() { return probeApiVersion; }
+ @Override public String getProbeApiDate() { return probeApiDate; }
+ @Override public String getOsVersion() { return osVersion; }
+ @Override public String getOsName() { return osName; }
+ @Override public String getOsArchitecture() { return osArch; }
+ @Override public long getStartTimestamp() { return startTstamp; }
+ @Override public String getTimezoneId() { return tmzId; }
+ @Override public String getTimezoneAbbreviation() { return tmzAbbr; }
+ @Override public String getTimezoneName() { return tmzName; }
+ @Override public String getUserName() { return userName; }
+ @Override public String getJavaVersion() { return javaVersion; }
+ @Override public String getJavaVendor() { return javaVendor; }
+ @Override public String getHostName() { return hostName; }
+ @Override public String getHostAddress() { return hostAddr; }
+ @Override public String getMacAddress() { return macAddr; }
+ @Override public Set<NCModel> getModels() { return models != null ? new HashSet<>(models) : Collections.emptySet(); }
}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCProbesAllBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCProbesAllBean.java
index 9434003..e9a9f64 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCProbesAllBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCProbesAllBean.java
@@ -27,9 +27,6 @@
public class NCProbesAllBean extends NCStatusResponseBean {
@SerializedName("probes") private List<NCProbeBean> probes;
- /**
- * Gets all probes.
- */
public List<NCProbeBean> getProbes() {
return probes;
}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCRequestStateBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCRequestStateBean.java
index 544e390..f50f9cf 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCRequestStateBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCRequestStateBean.java
@@ -21,7 +21,6 @@
/**
* REST bean.
- * TODO: doc
*/
public class NCRequestStateBean implements NCResult {
private String srvReqId;
@@ -36,101 +35,70 @@
private String error;
private String logHolder;
- @Override
- public String getServerRequestId() {
+ @Override public String getServerRequestId() {
return srvReqId;
}
-
- @Override
- public String getText() {
- return txt;
- }
-
- @Override
- public long getUserId() {
- return usrId;
- }
-
- @Override
- public String getModelId() {
- return mdlId;
- }
-
- @Override
- public String getProbeId() {
- return probeId;
- }
-
- @Override
- public String getResultType() {
- return resType;
- }
-
- @Override
- public String getResultBody() {
- return resBody;
- }
-
- @Override
- public boolean isReady() {
- return "QRY_READY".equals(status);
- }
-
- @Override
- public Integer getErrorCode() {
- return errorCode;
- }
-
- @Override
- public String getErrorMessage() {
- return error;
- }
-
- @Override
- public String getLogHolder() {
+ @Override public String getText() {
+ return txt;
+}
+ @Override public long getUserId() {
+ return usrId;
+}
+ @Override public String getModelId() {
+ return mdlId;
+}
+ @Override public String getProbeId() {
+ return probeId;
+}
+ @Override public String getResultType() {
+ return resType;
+}
+ @Override public String getResultBody() {
+ return resBody;
+}
+ @Override public boolean isReady() {
+ return "QRY_READY".equals(status);
+}
+ @Override public Integer getErrorCode() {
+ return errorCode;
+}
+ @Override public String getErrorMessage() {
+ return error;
+}
+ @Override public String getLogHolder() {
return logHolder;
}
public void setSrvReqId(String srvReqId) {
this.srvReqId = srvReqId;
}
-
public void setTxt(String txt) {
this.txt = txt;
}
-
public void setUsrId(long usrId) {
this.usrId = usrId;
}
-
public void setMdlId(String mdlId) {
this.mdlId = mdlId;
}
-
public void setProbeId(String probeId) {
this.probeId = probeId;
}
-
public void setResType(String resType) {
this.resType = resType;
}
-
public void setResBody(String resBody) {
this.resBody = resBody;
}
-
public void setStatus(String status) {
this.status = status;
}
-
public void setErrorCode(Integer errorCode) {
this.errorCode = errorCode;
}
-
public void setError(String error) {
this.error = error;
}
-
public void setLogHolder(String logHolder) {
this.logHolder = logHolder;
}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCSigninBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCSigninBean.java
index 1e69237..1051b85 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCSigninBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCSigninBean.java
@@ -25,9 +25,6 @@
public class NCSigninBean extends NCStatusResponseBean {
@SerializedName("acsTok") private String acsTok;
- /**
- * Gets newly acquired access token.
- */
public String getAccessToken() {
return acsTok;
}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCStatusResponseBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCStatusResponseBean.java
index 4a101e9..c3ac263 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCStatusResponseBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCStatusResponseBean.java
@@ -25,9 +25,6 @@
public class NCStatusResponseBean {
@SerializedName("status") private String status;
- /**
- * Gets response status.
- */
public String getStatus() {
return status;
}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCSuggestionBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCSuggestionBean.java
new file mode 100644
index 0000000..943bfde
--- /dev/null
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCSuggestionBean.java
@@ -0,0 +1,36 @@
+/*
+ * 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.client.impl.beans;
+
+import com.google.gson.annotations.SerializedName;
+import org.apache.nlpcraft.client.NCSuggestion;
+
+/**
+ * REST bean.
+ */
+public class NCSuggestionBean implements NCSuggestion {
+ @SerializedName("score") private double score;
+ @SerializedName("synonym") private String synonym;
+
+ @Override public double getScore() {
+ return score;
+ }
+ @Override public String getSynonym() {
+ return synonym;
+ }
+}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCSuggestionDataBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCSuggestionDataBean.java
new file mode 100644
index 0000000..d1e7d75
--- /dev/null
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCSuggestionDataBean.java
@@ -0,0 +1,67 @@
+/*
+ * 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.client.impl.beans;
+
+import com.google.gson.annotations.SerializedName;
+import org.apache.nlpcraft.client.NCSuggestionData;
+import org.apache.nlpcraft.client.NCSuggestion;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * REST bean.
+ */
+public class NCSuggestionDataBean implements NCSuggestionData {
+ @SerializedName("modelId") private String modelId;
+ @SerializedName("minScore") private double minScore;
+ @SerializedName("durationMs") private long durationMs;
+ @SerializedName("timestamp") private long timestamp;
+ @SerializedName("error") private String error;
+ @SerializedName("suggestions") private List<Map<String, List<NCSuggestionBean>>> suggestions;
+ @SerializedName("warnings") private java.util.List<String> warnings;
+
+ @Override public List<String> getWarnings() { return warnings; }
+ @Override public String getModelId() {
+ return modelId;
+ }
+ @Override public double getMinScore() {
+ return minScore;
+ }
+ @Override public long getDurationMs() {
+ return durationMs;
+ }
+ @Override public long getTimestamp() { return timestamp; }
+ @Override public String getError() { return error; }
+
+ @Override
+ public List<Map<String, List<NCSuggestion>>> getSynonyms() {
+ return suggestions == null ?
+ null :
+ suggestions.stream().map(
+ p -> p.entrySet().stream().collect(
+ Collectors.toMap(
+ Map.Entry::getKey,
+ x -> (List<NCSuggestion>) new ArrayList<NCSuggestion>(x.getValue())
+ )
+ )
+ ).collect(Collectors.toList());
+ }
+}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCSuggestionResultBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCSuggestionResultBean.java
new file mode 100644
index 0000000..304bb39
--- /dev/null
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCSuggestionResultBean.java
@@ -0,0 +1,31 @@
+/*
+ * 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.client.impl.beans;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * REST bean.
+ */
+public class NCSuggestionResultBean extends NCStatusResponseBean {
+ @SerializedName("result") private NCSuggestionDataBean result;
+
+ public NCSuggestionDataBean getResult() {
+ return result;
+ }
+}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCTokenCreationBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCTokenCreationBean.java
index 65aa440..fb1dc78 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCTokenCreationBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCTokenCreationBean.java
@@ -27,13 +27,10 @@
@SerializedName("token") private String token;
@SerializedName("adminId") private long adminId;
- @Override
- public String getToken() {
+ @Override public String getToken() {
return token;
}
-
- @Override
- public long getAdminUserId() {
+ @Override public long getAdminUserId() {
return adminId;
}
}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCUserAddBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCUserAddBean.java
index 0077791..e6086e3 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCUserAddBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCUserAddBean.java
@@ -25,9 +25,6 @@
public class NCUserAddBean extends NCStatusResponseBean {
@SerializedName("id") private long id;
- /**
- * Gets ID of the newly created user.
- */
public long getId() {
return id;
}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCUserBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCUserBean.java
index 84cad39..4f9b5df 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCUserBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCUserBean.java
@@ -27,7 +27,7 @@
*/
public class NCUserBean extends NCStatusResponseBean implements NCUser {
@SerializedName("id") private long id;
- @SerializedName("extId") private String extId;
+ @SerializedName("usrExtId") private String usrExtId;
@SerializedName("email") private String email;
@SerializedName("firstName") private String firstName;
@SerializedName("lastName") private String lastName;
@@ -35,43 +35,28 @@
@SerializedName("isAdmin") private boolean isAdmin;
@SerializedName("properties") private Map<String, String> properties;
- @Override
- public long getId() {
+ @Override public long getId() {
return id;
}
-
- @Override
- public String getEmail() {
+ @Override public String getEmail() {
return email;
}
-
- @Override
- public String getFirstName() {
- return firstName;
- }
-
- @Override
- public String getLastName() {
- return lastName;
- }
-
- @Override
- public String getAvatarUrl() {
- return avatarUrl;
- }
-
- @Override
- public boolean isAdmin() {
- return isAdmin;
- }
-
- @Override
- public String getExternalId() {
- return extId;
- }
-
- @Override
- public Map<String, String> getProperties() {
+ @Override public String getFirstName() {
+ return firstName;
+}
+ @Override public String getLastName() {
+ return lastName;
+}
+ @Override public String getAvatarUrl() {
+ return avatarUrl;
+}
+ @Override public boolean isAdmin() {
+ return isAdmin;
+}
+ @Override public String getExternalId() {
+ return usrExtId;
+}
+ @Override public Map<String, String> getProperties() {
return properties;
}
}
diff --git a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCUsersAllBean.java b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCUsersAllBean.java
index c35bac1..3808dd3 100644
--- a/src/main/java/org/apache/nlpcraft/client/impl/beans/NCUsersAllBean.java
+++ b/src/main/java/org/apache/nlpcraft/client/impl/beans/NCUsersAllBean.java
@@ -27,9 +27,6 @@
public class NCUsersAllBean extends NCStatusResponseBean {
@SerializedName("users") private List<NCUserBean> users;
- /**
- * Gets the list of users.
- */
public List<NCUserBean> getUsers() {
return users;
}
diff --git a/src/main/java/org/apache/nlpcraft/client/package-info.java b/src/main/java/org/apache/nlpcraft/client/package-info.java
index 08c01cc..84eb8d9 100644
--- a/src/main/java/org/apache/nlpcraft/client/package-info.java
+++ b/src/main/java/org/apache/nlpcraft/client/package-info.java
@@ -19,5 +19,19 @@
* NLPCraft Java Client API - provides native wrapper for
* <a target=_ href="https://nlpcraft.apache.org/using-rest.html">REST APIs</a> for any JVM-based languages
* like Java, Scala, Kotlin or Groovy.
+ * <p>
+ * <b>Usage</b><br>
+ * Java client usage is straightforward - create client instance using {@link org.apache.nlpcraft.client.NCClientBuilder} and use the
+ * client instance for all API calls:
+ * <pre class="brush: java">
+ * // Get client instance with all defaults.
+ * NCClient cli = new NCClientBuilder().build();
+ *
+ * // Perform any necessary calls...
+ * NCResult res = cli.askSync("my.model.id", txt);
+ *
+ * // Close client & sign out at the end.
+ * cli.close();
+ * </pre>
*/
package org.apache.nlpcraft.client;
\ No newline at end of file
diff --git a/src/test/java/org/apache/nlpcraft/client/NCAskSyncTest.java b/src/test/java/org/apache/nlpcraft/client/NCAskSyncTest.java
index 102deb7..4a0c80a 100644
--- a/src/test/java/org/apache/nlpcraft/client/NCAskSyncTest.java
+++ b/src/test/java/org/apache/nlpcraft/client/NCAskSyncTest.java
@@ -17,23 +17,22 @@
package org.apache.nlpcraft.client;
-import org.apache.nlpcraft.examples.alarm.AlarmModel;
+import org.apache.nlpcraft.client.models.NCCommonSpecModel;
import org.apache.nlpcraft.model.NCModel;
import org.junit.jupiter.api.Test;
import java.util.Optional;
import java.util.function.Consumer;
+import static org.apache.nlpcraft.client.models.NCCommonSpecModel.MDL_ID;
+
/**
* REST client test. Method `ask/sync`.
*/
class NCAskSyncTest extends NCTestAdapter {
- //
- private static final String MDL_ID = "nlpcraft.alarm.ex";
-
@Override
Optional<Class<? extends NCModel>> getModelClass() {
- return Optional.of(AlarmModel.class);
+ return Optional.of(NCCommonSpecModel.class);
}
/**
@@ -66,8 +65,6 @@
// Only latin charset is supported.
check("El tiempo en España", this::checkError);
- check("Ping me in 3 minutes", this::checkOk);
- check("Buzz me in an hour and 15mins", this::checkOk);
- check("Set my alarm for 30s", this::checkOk);
+ check("test", this::checkOk);
}
}
diff --git a/src/test/java/org/apache/nlpcraft/client/NCAskTest.java b/src/test/java/org/apache/nlpcraft/client/NCAskTest.java
index dcefb9c..78e0d1a 100644
--- a/src/test/java/org/apache/nlpcraft/client/NCAskTest.java
+++ b/src/test/java/org/apache/nlpcraft/client/NCAskTest.java
@@ -17,7 +17,7 @@
package org.apache.nlpcraft.client;
-import org.apache.nlpcraft.examples.alarm.AlarmModel;
+import org.apache.nlpcraft.client.models.NCCommonSpecModel;
import org.apache.nlpcraft.model.NCModel;
import org.junit.jupiter.api.Test;
@@ -25,6 +25,7 @@
import java.util.Optional;
import java.util.function.Consumer;
+import static org.apache.nlpcraft.client.models.NCCommonSpecModel.MDL_ID;
import static org.junit.jupiter.api.Assertions.fail;
/**
@@ -32,14 +33,11 @@
*/
class NCAskTest extends NCTestAdapter {
/** */
- private static final String MDL_ID = "nlpcraft.alarm.ex";
-
- /** */
private static final int MAX_TEST_TIME = 20000;
@Override
Optional<Class<? extends NCModel>> getModelClass() {
- return Optional.of(AlarmModel.class);
+ return Optional.of(NCCommonSpecModel.class);
}
/**
@@ -85,7 +83,7 @@
*/
@Test
void test() throws Exception {
- test0("Ping me in 3 minutes", this::checkOk);
+ test0("test", this::checkOk);
test0("El tiempo en España", this::checkError);
}
}
diff --git a/src/test/java/org/apache/nlpcraft/client/NCClearConversationTest.java b/src/test/java/org/apache/nlpcraft/client/NCClearConversationTest.java
new file mode 100644
index 0000000..7dc0e49
--- /dev/null
+++ b/src/test/java/org/apache/nlpcraft/client/NCClearConversationTest.java
@@ -0,0 +1,75 @@
+/*
+ * 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.client;
+
+import org.apache.nlpcraft.client.models.NCConversationSpecModel;
+import org.apache.nlpcraft.model.NCModel;
+import org.junit.jupiter.api.Test;
+
+import java.util.Optional;
+import java.util.function.Consumer;
+
+/**
+ * REST client test. Methods `clear/conversation`.
+ */
+class NCClearConversationTest extends NCTestAdapter {
+ @Override
+ Optional<Class<? extends NCModel>> getModelClass() {
+ return Optional.of(NCConversationSpecModel.class);
+ }
+
+ /**
+ * @param txt
+ * @param resConsumer
+ * @throws Exception
+ */
+ private void check(String txt, Consumer<NCResult> resConsumer) throws Exception {
+ resConsumer.accept(admCli.askSync(NCConversationSpecModel.MDL_ID, txt, null, true, null, null));
+ }
+
+ private void flow() throws Exception {
+ // missed 'test1'
+ check("test2", this::checkError);
+
+ check("test1 test2", this::checkOk);
+
+ // 'test1' received from conversation.
+ check("test2", this::checkOk);
+ }
+
+ /**
+ * @throws Exception
+ */
+ @Test
+ void test() throws Exception {
+ flow();
+
+ admCli.clearConversation(
+ NCConversationSpecModel.MDL_ID,
+ // Finds its own ID.
+ get(admCli.getAllUsers(), (u) -> NCClientBuilder.DFLT_EMAIL.equals(u.getEmail())).getId(),
+ null
+ );
+
+ flow();
+
+ admCli.clearConversation(NCConversationSpecModel.MDL_ID, null, null);
+
+ flow();
+ }
+}
diff --git a/src/test/java/org/apache/nlpcraft/client/NCClearDialogTest.java b/src/test/java/org/apache/nlpcraft/client/NCClearDialogTest.java
new file mode 100644
index 0000000..92a871d
--- /dev/null
+++ b/src/test/java/org/apache/nlpcraft/client/NCClearDialogTest.java
@@ -0,0 +1,81 @@
+/*
+ * 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.client;
+
+import org.apache.nlpcraft.client.models.NCDialogSpecModel;
+import org.apache.nlpcraft.model.NCModel;
+import org.junit.jupiter.api.Test;
+
+import java.util.Optional;
+import java.util.function.Consumer;
+
+/**
+ * REST client test. Methods `clear/dialog`.
+ */
+class NCClearDialogTest extends NCTestAdapter {
+ @Override
+ Optional<Class<? extends NCModel>> getModelClass() {
+ return Optional.of(NCDialogSpecModel.class);
+ }
+
+ /**
+ * @param txt
+ * @param resConsumer
+ * @throws Exception
+ */
+ private void check(String txt, Consumer<NCResult> resConsumer) throws Exception {
+ resConsumer.accept(admCli.askSync(NCDialogSpecModel.MDL_ID, txt, null, true, null, null));
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ private void flow() throws Exception {
+ // There isn't `test1` before.
+ check("test2", this::checkError);
+
+ // `test1` is always ok.
+ check("test1", this::checkOk);
+
+ // There is one `test1` before.
+ check("test2", this::checkOk);
+
+ // `test1` is always ok.
+ check("test1", this::checkOk);
+ check("test1", this::checkOk);
+
+ // There are too much `test1` before.
+ // TODO:
+ //check("test2", this::checkError);
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ @Test
+ void test() throws Exception {
+ flow();
+
+ admCli.clearDialog(NCDialogSpecModel.MDL_ID, null, null);
+ admCli.clearConversation(NCDialogSpecModel.MDL_ID, null, null);
+
+ flow();
+ }
+}
diff --git a/src/test/java/org/apache/nlpcraft/client/NCConversationTest.java b/src/test/java/org/apache/nlpcraft/client/NCConversationTest.java
deleted file mode 100644
index 7dcc5d0..0000000
--- a/src/test/java/org/apache/nlpcraft/client/NCConversationTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.client;
-
-import org.apache.nlpcraft.examples.weather.WeatherModel;
-import org.apache.nlpcraft.model.NCModel;
-import org.junit.jupiter.api.Test;
-
-import java.util.Optional;
-import java.util.function.Consumer;
-
-/**
- * REST client test. Methods `clear/conversation`.
- */
-class NCConversationTest extends NCTestAdapter {
- /**
- *
- */
- private static final String MDL_ID = "nlpcraft.weather.ex";
-
- @Override
- Optional<Class<? extends NCModel>> getModelClass() {
- return Optional.of(WeatherModel.class);
- }
-
- /**
- * @param txt
- * @param resConsumer
- * @throws Exception
- */
- private void check(String txt, Consumer<NCResult> resConsumer) throws Exception {
- resConsumer.accept(admCli.askSync(MDL_ID, txt, null, true, null, null));
- }
-
- /**
- * @throws Exception
- */
- @Test
- void test1() throws Exception {
- check("What's the weather in Moscow?", this::checkOk);
-
- // Should be answered with conversation.
- check("Moscow", this::checkOk);
-
- admCli.clearConversation(MDL_ID, null, null);
-
- // Cannot be answered without conversation.
- check("Moscow", this::checkError);
- }
-
- /**
- * @throws Exception
- */
- @Test
- void test2() throws Exception {
- check("What's the weather in Moscow?", this::checkOk);
-
- // Should be answered with conversation.
- check("Moscow", this::checkOk);
-
- admCli.clearConversation(MDL_ID,
- // Finds its own ID.
- get(admCli.getAllUsers(), (u) -> NCClientBuilder.DFLT_EMAIL.equals(u.getEmail())).getId(), null);
-
- // Cannot be answered without conversation.
- check("Moscow", this::checkError);
- }
-}
diff --git a/src/test/java/org/apache/nlpcraft/client/NCFeedbackTest.java b/src/test/java/org/apache/nlpcraft/client/NCFeedbackTest.java
index 572afe7..7d2fb71 100644
--- a/src/test/java/org/apache/nlpcraft/client/NCFeedbackTest.java
+++ b/src/test/java/org/apache/nlpcraft/client/NCFeedbackTest.java
@@ -17,24 +17,22 @@
package org.apache.nlpcraft.client;
-import org.apache.nlpcraft.examples.alarm.AlarmModel;
+import org.apache.nlpcraft.client.models.NCCommonSpecModel;
import org.apache.nlpcraft.model.NCModel;
import org.junit.jupiter.api.Test;
import java.util.Optional;
+import static org.apache.nlpcraft.client.models.NCCommonSpecModel.MDL_ID;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* REST client test. Methods `ask`.
*/
class NCFeedbackTest extends NCTestAdapter {
- /** */
- private static final String MDL_ID = "nlpcraft.alarm.ex";
-
@Override
Optional<Class<? extends NCModel>> getModelClass() {
- return Optional.of(AlarmModel.class);
+ return Optional.of(NCCommonSpecModel.class);
}
/**
@@ -45,7 +43,7 @@
*/
private void test0(Long usrId, String usrExtId) throws Exception {
// Adds request.
- String srvReqId = admCli.ask(MDL_ID, "Ping me in 3 minutes", null, false, usrId, usrExtId);
+ String srvReqId = admCli.ask(MDL_ID, "test", null, false, usrId, usrExtId);
// Creates 2 feedback.
long fId1 = admCli.addFeedback(srvReqId, 0.5, null, usrId, usrExtId);
@@ -64,7 +62,7 @@
// Creates 2 feedback.
admCli.addFeedback(srvReqId, 0.5, null, usrId, usrExtId);
- admCli.addFeedback(srvReqId, 0.1, "Somme comment", usrId, usrExtId);
+ admCli.addFeedback(srvReqId, 0.1, "Some comment", usrId, usrExtId);
// Checks their existing.
assertEquals(2, admCli.getAllFeedback(null, usrId, usrExtId).size());
diff --git a/src/test/java/org/apache/nlpcraft/client/NCModelTest.java b/src/test/java/org/apache/nlpcraft/client/NCModelTest.java
new file mode 100644
index 0000000..de94337
--- /dev/null
+++ b/src/test/java/org/apache/nlpcraft/client/NCModelTest.java
@@ -0,0 +1,83 @@
+/*
+ * 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.client;
+
+import org.apache.nlpcraft.client.models.NCSuggestionSpecModel;
+import org.apache.nlpcraft.model.NCModel;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import static org.apache.nlpcraft.client.models.NCSuggestionSpecModel.MDL_ID;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * REST client test. Methods `model/sugsyn`.
+ */
+class NCModelTest extends NCTestAdapter {
+ @Override
+ Optional<Class<? extends NCModel>> getModelClass() {
+ return Optional.of(NCSuggestionSpecModel.class);
+ }
+
+ /**
+ *
+ * @param s
+ * @param minScore
+ * @throws Exception
+ */
+ private static void check(NCSuggestionData s, double minScore) {
+ assertNotNull(s);
+
+ assertNull(s.getError());
+ assertNotNull(s.getModelId());
+ assertNotNull(s.getSynonyms());
+ assertFalse(s.getSynonyms().isEmpty());
+ assertFalse(s.getSynonyms().isEmpty());
+ assertEquals(minScore, s.getMinScore());
+
+ List<NCSuggestion> allSugs =
+ s.getSynonyms().
+ stream().
+ flatMap(p -> p.values().stream().flatMap(Collection::stream)).
+ collect(Collectors.toList());
+
+ assertFalse(allSugs.isEmpty());
+
+ allSugs.forEach(sugg -> {
+ assertNotNull(sugg.getSynonym());
+ assertTrue(sugg.getScore() >= minScore);
+ });
+ }
+
+ /**
+ * @throws Exception
+ */
+ @Test
+ void testSuggestionSynonym() throws Exception {
+ check(admCli.suggestSynonyms(MDL_ID, null), 0);
+ check(admCli.suggestSynonyms(MDL_ID, 0.5), 0.5);
+ }
+}
diff --git a/src/test/java/org/apache/nlpcraft/client/NCMultiClientsTest.java b/src/test/java/org/apache/nlpcraft/client/NCMultiClientsTest.java
index 099e182..6dbd361 100644
--- a/src/test/java/org/apache/nlpcraft/client/NCMultiClientsTest.java
+++ b/src/test/java/org/apache/nlpcraft/client/NCMultiClientsTest.java
@@ -18,8 +18,9 @@
package org.apache.nlpcraft.client;
import org.apache.http.client.config.RequestConfig;
-import org.apache.nlpcraft.examples.alarm.AlarmModel;
+import org.apache.nlpcraft.client.models.NCCommonSpecModel;
import org.apache.nlpcraft.model.NCModel;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.util.Optional;
@@ -31,17 +32,15 @@
import java.util.concurrent.atomic.AtomicReference;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static org.apache.nlpcraft.client.models.NCCommonSpecModel.MDL_ID;
/**
* REST client test. Methods `ask`.
*/
class NCMultiClientsTest extends NCTestAdapter {
- /** */
- private static final String MDL_ID = "nlpcraft.alarm.ex";
-
@Override
Optional<Class<? extends NCModel>> getModelClass() {
- return Optional.of(AlarmModel.class);
+ return Optional.of(NCCommonSpecModel.class);
}
/**
@@ -63,7 +62,7 @@
long maxTime = System.currentTimeMillis() + testTimeMs;
CountDownLatch cdl = new CountDownLatch(clientsCnt);
-
+
for (int i = 0; i < clientsCnt; i++) {
int fi = i;
@@ -84,7 +83,7 @@
while (System.currentTimeMillis() < maxTime && err.get() == null) {
client.ask(
MDL_ID,
- "Ping me in 3 minutes",
+ "test",
null,
false,
null,
@@ -93,7 +92,7 @@
System.out.println("Request sent [reqNum=" + cnt.incrementAndGet() + ", clientNum=" + fi + ']');
- Thread.sleep(rnd.nextInt(500) + 1);
+ Thread.sleep(rnd.nextInt(400) + 100);
}
}
finally {
@@ -113,10 +112,15 @@
}
cdl.await(timeoutMs * 2, MILLISECONDS);
-
- if (err.get() != null)
- throw err.get();
-
+
+ Throwable t = err.get();
+
+ if (t != null) {
+ t.printStackTrace();
+
+ Assertions.fail(t.getMessage());
+ }
+
System.out.println("Clients count: " + clientsCnt);
System.out.println("Processed requests: " + cnt.get());
}
diff --git a/src/test/java/org/apache/nlpcraft/client/NCPermissionsTest.java b/src/test/java/org/apache/nlpcraft/client/NCPermissionsTest.java
index 9e9cad5..1242f77 100644
--- a/src/test/java/org/apache/nlpcraft/client/NCPermissionsTest.java
+++ b/src/test/java/org/apache/nlpcraft/client/NCPermissionsTest.java
@@ -17,7 +17,7 @@
package org.apache.nlpcraft.client;
-import org.apache.nlpcraft.examples.alarm.AlarmModel;
+import org.apache.nlpcraft.client.models.NCCommonSpecModel;
import org.apache.nlpcraft.model.NCModel;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
@@ -25,19 +25,18 @@
import java.util.Optional;
+import static org.apache.nlpcraft.client.models.NCCommonSpecModel.MDL_ID;
+
/**
* REST client test. Checks user permissions.
*/
class NCPermissionsTest extends NCTestAdapter {
/** */
- private static final String MDL_ID = "nlpcraft.alarm.ex";
-
- /** */
private NCClient client;
@Override
Optional<Class<? extends NCModel>> getModelClass() {
- return Optional.of(AlarmModel.class);
+ return Optional.of(NCCommonSpecModel.class);
}
/**
diff --git a/src/test/java/org/apache/nlpcraft/client/NCProbesTest.java b/src/test/java/org/apache/nlpcraft/client/NCProbesTest.java
index 0285558..5d6fb80 100644
--- a/src/test/java/org/apache/nlpcraft/client/NCProbesTest.java
+++ b/src/test/java/org/apache/nlpcraft/client/NCProbesTest.java
@@ -17,7 +17,7 @@
package org.apache.nlpcraft.client;
-import org.apache.nlpcraft.examples.alarm.AlarmModel;
+import org.apache.nlpcraft.client.models.NCCommonSpecModel;
import org.apache.nlpcraft.model.NCModel;
import org.junit.jupiter.api.Test;
@@ -31,7 +31,7 @@
class NCProbesTest extends NCTestAdapter {
@Override
Optional<Class<? extends NCModel>> getModelClass() {
- return Optional.of(AlarmModel.class);
+ return Optional.of(NCCommonSpecModel.class);
}
/**
diff --git a/src/test/java/org/apache/nlpcraft/client/NCTestAdapter.java b/src/test/java/org/apache/nlpcraft/client/NCTestAdapter.java
index d8a329d..bdd7a9c 100644
--- a/src/test/java/org/apache/nlpcraft/client/NCTestAdapter.java
+++ b/src/test/java/org/apache/nlpcraft/client/NCTestAdapter.java
@@ -18,7 +18,7 @@
package org.apache.nlpcraft.client;
import org.apache.nlpcraft.model.NCModel;
-import org.apache.nlpcraft.probe.embedded.NCEmbeddedProbe;
+import org.apache.nlpcraft.model.tools.embedded.NCEmbeddedProbe;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
@@ -54,7 +54,7 @@
protected long admUsrId;
/** */
- private final Optional<Class<? extends NCModel>> mdlOpt = getModelClass();
+ private Class<? extends NCModel> mdlClass;
/**
*
@@ -70,7 +70,10 @@
*/
@BeforeEach
void setUp() throws Exception {
- mdlOpt.ifPresent(NCEmbeddedProbe::start);
+ mdlClass = getModelClass().orElse(null);
+
+ if (mdlClass != null)
+ NCEmbeddedProbe.start(mdlClass);
admCli = new NCClientBuilder().build();
@@ -92,7 +95,7 @@
admCli.close();
}
- if (mdlOpt.isPresent())
+ if (mdlClass != null)
NCEmbeddedProbe.stop();
}
@@ -163,8 +166,8 @@
protected<T> T get(List<T> list, Predicate<T> p) {
Optional<T> opt = getOpt(list, p);
- if (!opt.isPresent())
- fail("Object not found");
+ if (opt.isEmpty())
+ fail("Object not found in list: " + list);
return opt.get();
}
@@ -174,13 +177,11 @@
* @param state
*/
protected void checkOk(NCResult state) {
- System.out.println(
- String.format(
- "Text: %s \ntype: %s\nresult: %s",
- state.getText(),
- state.getResultType(),
- state.getResultBody()
- )
+ System.out.printf(
+ "Text: %s \ntype: %s\nresult: %s%n",
+ state.getText(),
+ state.getResultType(),
+ state.getResultBody()
);
if (state.getLogHolder() != null)
@@ -199,13 +200,11 @@
protected void checkError(NCResult state) {
assert state != null;
- System.out.println(
- String.format(
- "Text: %s \nerror: %s\ncode: %d",
- state.getText(),
- state.getErrorMessage(),
- state.getErrorCode()
- )
+ System.out.printf(
+ "Text: %s \nerror: %s\ncode: %d%n",
+ state.getText(),
+ state.getErrorMessage(),
+ state.getErrorCode()
);
if (state.getLogHolder() != null)
diff --git a/src/test/java/org/apache/nlpcraft/client/NCUserTest.java b/src/test/java/org/apache/nlpcraft/client/NCUserTest.java
index ff0fa15..61151de 100644
--- a/src/test/java/org/apache/nlpcraft/client/NCUserTest.java
+++ b/src/test/java/org/apache/nlpcraft/client/NCUserTest.java
@@ -17,13 +17,14 @@
package org.apache.nlpcraft.client;
-import org.apache.nlpcraft.examples.alarm.AlarmModel;
+import org.apache.nlpcraft.client.models.NCCommonSpecModel;
import org.apache.nlpcraft.model.NCModel;
import org.junit.jupiter.api.Test;
import java.util.List;
import java.util.Optional;
+import static org.apache.nlpcraft.client.models.NCCommonSpecModel.MDL_ID;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -31,12 +32,9 @@
* REST client test. Methods `user/*`.
*/
class NCUserTest extends NCTestAdapter {
- /** */
- private static final String MDL_ID = "nlpcraft.alarm.ex";
-
@Override
Optional<Class<? extends NCModel>> getModelClass() {
- return Optional.of(AlarmModel.class);
+ return Optional.of(NCCommonSpecModel.class);
}
/**
@@ -172,7 +170,7 @@
String extId = "extId";
// Implicitly creates user with external ID.
- admCli.askSync(MDL_ID, "Ping me in 3 minutes", null, false, null, extId);
+ admCli.askSync(MDL_ID, "test", null, false, null, extId);
NCUser newUser = get(admCli.getAllUsers(), (u) -> extId.equals(u.getExternalId()));
@@ -195,7 +193,7 @@
String extId = "extId";
// Implicitly creates user with external ID.
- admCli.askSync(MDL_ID, "Ping me in 3 minutes", null, false, null, extId);
+ admCli.askSync(MDL_ID, "test", null, false, null, extId);
// Updates existing user with given external ID.
admCli.addUser(
diff --git a/src/test/java/org/apache/nlpcraft/client/models/NCCommonSpecModel.java b/src/test/java/org/apache/nlpcraft/client/models/NCCommonSpecModel.java
new file mode 100644
index 0000000..03b20af
--- /dev/null
+++ b/src/test/java/org/apache/nlpcraft/client/models/NCCommonSpecModel.java
@@ -0,0 +1,46 @@
+/*
+ * 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.client.models;
+
+import org.apache.nlpcraft.model.NCElement;
+import org.apache.nlpcraft.model.NCIntent;
+
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * Test model.
+ */
+public class NCCommonSpecModel extends NCSpecModelAdapter {
+ public static final String MDL_ID = NCCommonSpecModel.class.getSimpleName();
+
+ @Override
+ public String getId() {
+ return MDL_ID;
+ }
+
+ @Override
+ public Set<NCElement> getElements() {
+ return Collections.singleton(mkElement("test"));
+ }
+
+ @NCIntent("intent=intentId term~{id == 'test'}")
+ public org.apache.nlpcraft.model.NCResult onTest() {
+ return org.apache.nlpcraft.model.NCResult.text("OK");
+ }
+}
diff --git a/src/test/java/org/apache/nlpcraft/client/models/NCConversationSpecModel.java b/src/test/java/org/apache/nlpcraft/client/models/NCConversationSpecModel.java
new file mode 100644
index 0000000..2050631
--- /dev/null
+++ b/src/test/java/org/apache/nlpcraft/client/models/NCConversationSpecModel.java
@@ -0,0 +1,48 @@
+/*
+ * 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.client.models;
+
+import org.apache.nlpcraft.model.NCElement;
+import org.apache.nlpcraft.model.NCIntent;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * Test model.
+ */
+public class NCConversationSpecModel extends NCSpecModelAdapter {
+ public static final String MDL_ID = NCConversationSpecModel.class.getSimpleName();
+
+ @Override
+ public String getId() {
+ return MDL_ID;
+ }
+ @Override
+ public Set<NCElement> getElements() {
+ return Stream.of(mkElement("test1"), mkElement("test2")).collect(Collectors.toCollection(HashSet::new));
+ }
+
+ // 'test1' is mandatory, 'test2' is optional.
+ @NCIntent("intent=intentId term~{id == 'test1'} term~{id == 'test2'}?")
+ public org.apache.nlpcraft.model.NCResult onTest() {
+ return org.apache.nlpcraft.model.NCResult.text("OK");
+ }
+}
diff --git a/src/test/java/org/apache/nlpcraft/client/models/NCDialogSpecModel.java b/src/test/java/org/apache/nlpcraft/client/models/NCDialogSpecModel.java
new file mode 100644
index 0000000..1176259
--- /dev/null
+++ b/src/test/java/org/apache/nlpcraft/client/models/NCDialogSpecModel.java
@@ -0,0 +1,53 @@
+/*
+ * 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.client.models;
+
+import org.apache.nlpcraft.model.NCElement;
+import org.apache.nlpcraft.model.NCIntent;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * Test model.
+ */
+public class NCDialogSpecModel extends NCSpecModelAdapter {
+ public static final String MDL_ID = NCDialogSpecModel.class.getSimpleName();
+
+ @Override
+ public String getId() {
+ return MDL_ID;
+ }
+
+ @Override
+ public Set<NCElement> getElements() {
+ return Stream.of(mkElement("test1"), mkElement("test2")).collect(Collectors.toCollection(HashSet::new));
+ }
+
+ @NCIntent("intent=intentId1 term~{id == 'test1'}")
+ public org.apache.nlpcraft.model.NCResult onTest1() {
+ return org.apache.nlpcraft.model.NCResult.text("OK");
+ }
+
+ @NCIntent("intent=intentId2 flow='intentId1[1,1]' term~{id == 'test2'}")
+ public org.apache.nlpcraft.model.NCResult onTest2() {
+ return org.apache.nlpcraft.model.NCResult.text("OK");
+ }
+}
diff --git a/src/test/java/org/apache/nlpcraft/client/models/NCSpecModelAdapter.java b/src/test/java/org/apache/nlpcraft/client/models/NCSpecModelAdapter.java
new file mode 100644
index 0000000..8816a9b
--- /dev/null
+++ b/src/test/java/org/apache/nlpcraft/client/models/NCSpecModelAdapter.java
@@ -0,0 +1,59 @@
+/*
+ * 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.client.models;
+
+import org.apache.nlpcraft.model.NCElement;
+import org.apache.nlpcraft.model.NCModel;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Test model adapter.
+ */
+abstract class NCSpecModelAdapter implements NCModel {
+ @Override
+ public String getName() {
+ return getId();
+ }
+
+ @Override
+ public String getVersion() {
+ return "1.0.0";
+ }
+
+ protected NCElement mkElement(String id, String... syns) {
+ return new NCElement() {
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public List<String> getSynonyms() {
+ List<String> l = new ArrayList<>();
+
+ l.add(id);
+ l.addAll(Arrays.asList(syns));
+
+ return l;
+ }
+ };
+ }
+}
diff --git a/src/test/java/org/apache/nlpcraft/client/models/NCSuggestionSpecModel.java b/src/test/java/org/apache/nlpcraft/client/models/NCSuggestionSpecModel.java
new file mode 100644
index 0000000..c4875f9
--- /dev/null
+++ b/src/test/java/org/apache/nlpcraft/client/models/NCSuggestionSpecModel.java
@@ -0,0 +1,48 @@
+/*
+ * 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.client.models;
+
+import org.apache.nlpcraft.model.NCElement;
+import org.apache.nlpcraft.model.NCIntent;
+import org.apache.nlpcraft.model.NCIntentSample;
+
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * Test model.
+ */
+public class NCSuggestionSpecModel extends NCSpecModelAdapter {
+ public static final String MDL_ID = NCSuggestionSpecModel.class.getSimpleName();
+
+ @Override
+ public String getId() {
+ return MDL_ID;
+ }
+
+ @Override
+ public Set<NCElement> getElements() {
+ return Collections.singleton(mkElement( "test"));
+ }
+
+ @NCIntentSample({"Tests passed well"})
+ @NCIntent("intent=intentId term~{id == 'test'}")
+ public org.apache.nlpcraft.model.NCResult onTest() {
+ return org.apache.nlpcraft.model.NCResult.text("OK");
+ }
+}