You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by ar...@apache.org on 2021/01/03 00:10:58 UTC
[incubator-nlpcraft-website] branch master updated: Update
intent-matching.html
This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft-website.git
The following commit(s) were added to refs/heads/master by this push:
new 9f18ee5 Update intent-matching.html
9f18ee5 is described below
commit 9f18ee5ac9567c026c23d4be1454f386e1c22b10
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Sat Jan 2 16:10:45 2021 -0800
Update intent-matching.html
---
intent-matching.html | 57 ++++++++++++++++++++++++++++++----------------------
1 file changed, 33 insertions(+), 24 deletions(-)
diff --git a/intent-matching.html b/intent-matching.html
index 4ea1ed3..b6b4a42 100644
--- a/intent-matching.html
+++ b/intent-matching.html
@@ -27,21 +27,23 @@ id: intent_matching
<p>
As we discussed in <a href="/data-model.html#logic">Data Model</a> section the processing logic of the data model is
encoded in intents and their callbacks. Sections below will explain how to declare an intent and how to develop
- a callback method when its intent is matched.
+ a callback method when the intent is matched.
</p>
</section>
<section id="matching">
<h2 class="section-title">Intent-Based Matching</h2>
<p>
The intent matching is based on an idea of defining one or more templates for user input and let the
- algorithm choose the best matching one given the user input. Such template is called an <em>intent</em>.
- Each intent defines a pattern of the user input and associated action to take when that pattern is detected
- and selected as a best match. While selecting the best matching intent NLPCraft uses sophisticated
- NLP algorithms. When more than one intent matches the user input - the system selects the
- most specific one as its best match.
+ algorithm choose the best matching intent given the user input. Such template is called an <em>intent</em>.
+ Each intent defines a pattern of the user input and associated action to take - <em>a callback method to call</em> - when that pattern is detected
+ and selected as a best match. While selecting the best matching intent NLPCraft uses a fully deterministic, traceable, algorithm.
+ When more than one intent matches the user input - the system automatically selects the <em>most specific one</em> as its best match.
</p>
<p>
- In NLPCraft intents are specified using the following Java annotations:
+ In NLPCraft intents are specified using the Java annotations that are attached to the callback methods. Note
+ that intents can either be defined in the annotation itself or in the external model YAML/JSON representation
+ and then referenced in annotation. Both methods are equally supported and their usage is the matter of
+ preference or convenience:
</p>
<table class="gradient-table">
<thead>
@@ -69,16 +71,18 @@ id: intent_matching
<tr>
<td><a target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCIntentTerm.html">@NCIntentTerm</a></td>
<td>
- This annotation annotation marks a formal callback method parameter to receive term's tokens.
+ This annotation marks a formal callback method parameter to receive term's tokens when the intent
+ to which this term belongs is selected as the best match.
</td>
</tr>
<tr>
<td><a target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCIntentSample.html">@NCIntentSample</a></td>
<td>
- Optional annotation that provides one or more sample of the input that associated intent should match on.
- Although this annotation is optional it's highly recommended to provide at least 5 samples per intent.
- These samples serve not only documentation purpose but also used in built-in model <a href="/tools/test_framework.html">auto-validation</a>
- and <a href="/tools/syn_tool.html">model inspector</a> tool.
+ Annotation that provides one or more sample of the input that associated intent should match on.
+ Although this annotation is optional it's <b>highly recommended</b> to provide at least several samples per intent. There's no upper
+ limit on how many examples can be provided and typically the more examples the better for the built-in tools.
+ These samples serve documentation purpose as well as used in built-in model <a href="/tools/test_framework.html">auto-validation</a>
+ and and <a href="/tools/syn_tool.html">synonym suggesting</a> tools.
</td>
</tr>
</tbody>
@@ -128,10 +132,13 @@ id: intent_matching
</li>
<li>
Terms is conversational if it uses <code>'~'</code> and non-conversational if it uses <code>'='</code>
- symbol in its definition.
+ symbol in its definition. If term is conversational, the matching algorithm will look into the conversation
+ context short-term-memory (STM) to seek the matching tokens for this term. Note that the terms that were fully or partially matched using tokens from
+ the conversation context will contribute a smaller weight to the overall intent matching weight since these terms are <em>less specific.</em>
+ Non-conversational terms will be matched using tokens found only in the current user input without looking at the conversation context.
</li>
<li>
- Method <code>onMatch(...)</code> will be called when this intent is selected as the best match.
+ Method <code>onMatch(...)</code> will be called if and when this intent is selected as the best match.
</li>
<li>
Note that terms have <code>min=1, max=1</code> quantifiers by default, i.e. one and only one.
@@ -210,7 +217,10 @@ id: intent_matching
</li>
<li>
Terms is conversational if it uses <code>'~'</code> and non-conversational if it uses <code>'='</code>
- symbol in its definition.
+ symbol in its definition. If term is conversational, the matching algorithm will look into the conversation
+ context short-term-memory (STM) to seek the matching tokens for this term. Note that the terms that were fully or partially matched using tokens from
+ the conversation context will contribute a smaller weight to the overall intent matching weight since these terms are <em>less specific.</em>
+ Non-conversational terms will be matched using tokens found only in the current user input without looking at the conversation context.
</li>
<li>
Method <code>onMatch(...)</code> will be called when this intent is the best match detected.
@@ -271,9 +281,8 @@ id: intent_matching
<a href="/data-model.html#builtin">built-in named entities</a>.
</p>
<p>
- The result of this step is a sequence of converted texts, where each element is in itself a sequence
- of tokens with each token representing a named entity. These sequences are send down to the data probe
- that has requested data model deployed.
+ The result of this step is a sequence of converted sentences, where each element is a sequence
+ of tokens. These sequences are send down to the data probe that has requested data model deployed.
</p>
</li>
<li>
@@ -288,9 +297,9 @@ id: intent_matching
<b>Step: 4</b><br>
<p>
This is an important step for understanding intent matching logic. At this step the data probe
- takes sequences of tokens generated at the last step and comes up with a definitive parsing
- variants. A parsing variant is a sequence of tokens that is free from overlapping and parsing
- ambiguity. Typically, a single sequence of tokens can produce one (always) or more parsing variants.
+ takes sequences of tokens generated at the last step and comes up with one or more parsing
+ variants. A parsing variant is a sequence of tokens that is free from token overlapping and other parsing
+ ambiguities. Typically, a single sequence of tokens can produce one (always) or more parsing variants.
</p>
<p>
Let's consider the input text <code>'A B C D'</code> and the following elements defined in our model:
@@ -321,9 +330,9 @@ id: intent_matching
</ol>
<p></p>
<p>
- Note that at this point the system cannot determine which of these variants is the best - there's simply not
- enough information at this stage. It can only be determined when matched against model's intents - which
- will happen in the next step.
+ Note that at this point the <em>system cannot determine which of these variants is the best one
+ for matching - there's simply not enough information at this stage</em>. It can only be determined
+ when each variant is matched against model's intents - which happens in the next step.
</p>
</li>
<li>