| <html><head><meta charset="utf-8"></meta><meta name="viewport" content="width=device-width, initial-scale=1"></meta><title>org.apache.nlpcraft.nlp.parsers</title><link rel="shortcut icon" type="image/x-icon" href="../../../../favicon.ico"></link><script type="text/javascript" src="../../../../scripts/theme.js"></script><script type="text/javascript" src="../../../../scripts/searchData.js" defer="true"></script><script type="text/javascript" src="../../../../scripts/scastieConfiguration.js" defer="true"></script><link rel="stylesheet" href="../../../../styles/nord-light.css"></link><link rel="stylesheet" href="../../../../styles/scalastyle.css"></link><link rel="stylesheet" href="../../../../styles/colors.css"></link><link rel="stylesheet" href="../../../../styles/dotty-icons.css"></link><link rel="stylesheet" href="../../../../styles/diagram.css"></link><link rel="stylesheet" href="../../../../styles/filter-bar.css"></link><link rel="stylesheet" href="../../../../styles/code-snippets.css"></link><link rel="stylesheet" href="../../../../styles/searchbar.css"></link><link rel="stylesheet" href="../../../../styles/social-links.css"></link><link rel="stylesheet" href="../../../../styles/ux.css"></link><link rel="stylesheet" href="../../../../styles/versions-dropdown.css"></link><link rel="stylesheet" href="../../../../styles/fontawesome.css"></link><script type="text/javascript" src="../../../../hljs/highlight.min.js" defer="true"></script><script type="text/javascript" src="../../../../scripts/hljs-scala3.js" defer="true"></script><script type="text/javascript" src="../../../../scripts/ux.js" defer="true"></script><script type="text/javascript" src="../../../../scripts/common/component.js" defer="true"></script><script type="text/javascript" src="../../../../scripts/common/utils.js" defer="true"></script><script type="text/javascript" src="../../../../scripts/components/FilterBar.js" defer="true"></script><script type="text/javascript" src="../../../../scripts/components/DocumentableList.js" defer="true"></script><script type="text/javascript" src="../../../../scripts/components/Input.js" defer="true"></script><script type="text/javascript" src="../../../../scripts/components/FilterGroup.js" defer="true"></script><script type="text/javascript" src="../../../../scripts/components/Filter.js" defer="true"></script><script type="text/javascript" src="../../../../scripts/scaladoc-scalajs.js" defer="true"></script><script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js" defer="true"></script><script type="text/javascript" src="https://d3js.org/d3.v6.min.js" defer="true"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/graphlib-dot@0.6.2/dist/graphlib-dot.min.js" defer="true"></script><script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/dagre-d3/0.6.1/dagre-d3.min.js" defer="true"></script><script type="text/javascript" src="https://scastie.scala-lang.org/embedded.js" defer="true"></script><script type="text/javascript" src="../../../../scripts/data.js" defer="true"></script><script>var pathToRoot = "../../../../";</script></head><body><div id="container"><div id="leftColumn"><div id="logo"><span><div class="projectName">NLPCraft</div></span><div id="version"><div class="versions-dropdown"><div onclick="dropdownHandler()" id="dropdown-button" class="dropdownbtn dropdownbtnactive"><div class="projectVersion">1.0.0</div><div id="dropdown-content" class="dropdown-content"><input type="text" placeholder="Search..." id="dropdown-input" onkeyup="filterFunction()"></input></div></div></div></div><div class="socials"><a href="https://github.com/apache/incubator-nlpcraft"><span class="social-icon" data-icon-path="github-icon-white.png"></span></a></div></div><div id="paneSearch"></div><nav id="sideMenu2"><div class="ni expanded"><span class="nh expanded"><span class="ar"></span><a href="../../../../index.html"><span>NLPCraft</span></a></span><div class="ni"><span class="nh "><span class="ar"></span><a href="../../nlpcraft.html"><span class="micon pa"></span><span>org.apache.nlpcraft</span></a></span><div class="ni "><span class="nh "><a href="../NCContext.html"><span class="micon tr"></span><span>NCContext</span></a></span></div><div class="ni "><span class="nh "><a href="../NCConversation.html"><span class="micon tr"></span><span>NCConversation</span></a></span></div><div class="ni "><span class="nh "><a href="../NCCuration.html"><span class="micon cl"></span><span>NCCuration</span></a></span></div><div class="ni "><span class="nh "><a href="../NCDialogFlowItem.html"><span class="micon tr"></span><span>NCDialogFlowItem</span></a></span></div><div class="ni "><span class="nh "><a href="../NCEntity.html"><span class="micon tr"></span><span>NCEntity</span></a></span></div><div class="ni "><span class="nh "><a href="../NCEntityEnricher.html"><span class="micon tr"></span><span>NCEntityEnricher</span></a></span></div><div class="ni "><span class="nh "><a href="../NCEntityMapper.html"><span class="micon tr"></span><span>NCEntityMapper</span></a></span></div><div class="ni "><span class="nh "><a href="../NCEntityParser.html"><span class="micon tr"></span><span>NCEntityParser</span></a></span></div><div class="ni "><span class="nh "><a href="../NCEntityValidator.html"><span class="micon tr"></span><span>NCEntityValidator</span></a></span></div><div class="ni "><span class="nh "><a href="../NCException.html"><span class="micon cl"></span><span>NCException</span></a></span></div><div class="ni "><span class="nh "><a href="../NCIntentMatch.html"><span class="micon tr"></span><span>NCIntentMatch</span></a></span></div><div class="ni "><span class="nh "><a href="../NCIntentSkip.html"><span class="micon cl"></span><span>NCIntentSkip</span></a></span></div><div class="ni "><span class="nh "><a href="../NCLifecycle.html"><span class="micon tr"></span><span>NCLifecycle</span></a></span></div><div class="ni "><span class="nh "><a href="../NCMatchedCallback.html"><span class="micon tr"></span><span>NCMatchedCallback</span></a></span></div><div class="ni "><span class="nh "><a href="../NCModel.html"><span class="micon tr"></span><span>NCModel</span></a></span></div><div class="ni "><span class="nh "><a href="../NCModelClient.html"><span class="micon cl"></span><span>NCModelClient</span></a></span></div><div class="ni "><span class="nh "><a href="../NCModelConfig$.html"><span class="micon ob"></span><span>NCModelConfig</span></a></span></div><div class="ni "><span class="nh "><a href="../NCModelConfig.html"><span class="micon tr"></span><span>NCModelConfig</span></a></span></div><div class="ni "><span class="nh "><a href="../NCPipeline.html"><span class="micon tr"></span><span>NCPipeline</span></a></span></div><div class="ni "><span class="nh "><a href="../NCPipelineBuilder.html"><span class="micon cl"></span><span>NCPipelineBuilder</span></a></span></div><div class="ni "><span class="nh "><a href="../NCPropertyMap.html"><span class="micon tr"></span><span>NCPropertyMap</span></a></span></div><div class="ni "><span class="nh "><a href="../NCPropertyMapAdapter.html"><span class="micon cl"></span><span>NCPropertyMapAdapter</span></a></span></div><div class="ni "><span class="nh "><a href="../NCRejection.html"><span class="micon cl"></span><span>NCRejection</span></a></span></div><div class="ni "><span class="nh "><a href="../NCRequest.html"><span class="micon tr"></span><span>NCRequest</span></a></span></div><div class="ni "><span class="nh "><a href="../NCResult$.html"><span class="micon ob"></span><span>NCResult</span></a></span></div><div class="ni "><span class="nh "><a href="../NCResult.html"><span class="micon tr"></span><span>NCResult</span></a></span></div><div class="ni "><span class="nh "><a href="../NCResultType.html"><span class="micon en"></span><span>NCResultType</span></a></span></div><div class="ni "><span class="nh "><a href="../NCToken.html"><span class="micon tr"></span><span>NCToken</span></a></span></div><div class="ni "><span class="nh "><a href="../NCTokenEnricher.html"><span class="micon tr"></span><span>NCTokenEnricher</span></a></span></div><div class="ni "><span class="nh "><a href="../NCTokenParser.html"><span class="micon tr"></span><span>NCTokenParser</span></a></span></div><div class="ni "><span class="nh "><a href="../NCTokenValidator.html"><span class="micon tr"></span><span>NCTokenValidator</span></a></span></div><div class="ni "><span class="nh "><a href="../NCVariant.html"><span class="micon tr"></span><span>NCVariant</span></a></span></div><div class="ni "><span class="nh "><a href="../NCVariantFilter.html"><span class="micon tr"></span><span>NCVariantFilter</span></a></span></div></div><div class="ni"><span class="nh "><span class="ar"></span><a href="enrichers.html"><span class="micon pa"></span><span>org.apache.nlpcraft.nlp.enrichers</span></a></span><div class="ni "><span class="nh "><a href="enrichers/NCBracketsTokenEnricher.html"><span class="micon cl"></span><span>NCBracketsTokenEnricher</span></a></span></div><div class="ni "><span class="nh "><a href="enrichers/NCDictionaryTokenEnricher.html"><span class="micon cl"></span><span>NCDictionaryTokenEnricher</span></a></span></div><div class="ni "><span class="nh "><a href="enrichers/NCEnStopWordsTokenEnricher.html"><span class="micon cl"></span><span>NCEnStopWordsTokenEnricher</span></a></span></div><div class="ni "><span class="nh "><a href="enrichers/NCOpenNLPTokenEnricher.html"><span class="micon cl"></span><span>NCOpenNLPTokenEnricher</span></a></span></div><div class="ni "><span class="nh "><a href="enrichers/NCQuotesTokenEnricher.html"><span class="micon cl"></span><span>NCQuotesTokenEnricher</span></a></span></div><div class="ni "><span class="nh "><a href="enrichers/NCSwearWordsTokenEnricher.html"><span class="micon cl"></span><span>NCSwearWordsTokenEnricher</span></a></span></div></div><div class="ni expanded"><span class="nh selected expanded"><span class="ar"></span><a href="parsers.html"><span class="micon pa"></span><span>org.apache.nlpcraft.nlp.parsers</span></a></span><div class="ni "><span class="nh "><a href="parsers/NCNLPEntityParser.html"><span class="micon cl"></span><span>NCNLPEntityParser</span></a></span></div><div class="ni "><span class="nh "><a href="parsers/NCOpenNLPEntityParser.html"><span class="micon cl"></span><span>NCOpenNLPEntityParser</span></a></span></div><div class="ni "><span class="nh "><a href="parsers/NCOpenNLPTokenParser.html"><span class="micon cl"></span><span>NCOpenNLPTokenParser</span></a></span></div><div class="ni "><span class="nh "><a href="parsers/NCSemanticElement.html"><span class="micon tr"></span><span>NCSemanticElement</span></a></span></div><div class="ni "><span class="nh "><a href="parsers/NCSemanticEntityParser.html"><span class="micon cl"></span><span>NCSemanticEntityParser</span></a></span></div></div><div class="ni"><span class="nh "><span class="ar"></span><a href="stemmer.html"><span class="micon pa"></span><span>org.apache.nlpcraft.nlp.stemmer</span></a></span><div class="ni "><span class="nh "><a href="stemmer/NCEnStemmer.html"><span class="micon cl"></span><span>NCEnStemmer</span></a></span></div><div class="ni "><span class="nh "><a href="stemmer/NCStemmer.html"><span class="micon tr"></span><span>NCStemmer</span></a></span></div></div></div></nav></div><div id="main"><div id="leftToggler"><span class="icon-toggler"></span></div><div id="scaladoc-searchBar"></div><main id="main-content"><div class="breadcrumbs container"><a href="../../../../index.html">NLPCraft</a>/<a href="parsers.html">org.apache.nlpcraft.nlp.parsers</a></div><div id="content"><div><div class="cover-header"><span class="micon pa"></span><h1>org.apache.nlpcraft.nlp.parsers</h1></div><div class="signature monospace"><span class="annotations monospace"></span><div class="signature"><span class="modifiers"></span><span class="kind"><span t="k">package </span></span><a href="parsers.html" class="documentableName ">org.apache.nlpcraft.nlp.parsers</a><span></span></div></div><div class="cover"><div class="doc"></div><dl class="attributes"></dl></div><div class="documentableFilter"><div class="filterUpperContainer"><button class="filterToggleButton" data-test-id="filterToggleButton"> |
| <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"> |
| <path d="M0 0h24v24H0z" fill="none"/> |
| <path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/> |
| </svg> |
| </button><input class="filterableInput" placeholder="Filter all members" data-test-id="filterBarInput"></input></div><div class="filterLowerContainer"></div></div><div class="membersList"><div class="tabs"><div class="names"><button data-togglable="Type members" class="tab selected">Type members</button></div><div class="contents"><div data-togglable="Type members" class="tab selected"><h2 data-togglable="Type members">Type members</h2><div class="documentableList"><h3 class="groupHeader">Classlikes</h3><div class="documentableElement"><div><span class="annotations monospace"></span></div><div class="header monospace"><div class="signature"><span class="modifiers"></span><span class="kind"><span t="k">class </span></span><a href="parsers/NCNLPEntityParser.html" class="documentableName ">NCNLPEntityParser</a><span>(<span t="k"></span><span t="k"></span>predicate: <a href="../NCToken.html" t="t">NCToken</a><span t="k"> => </span><a href="https://www.scala-lang.org/api/2.13.8/scala/Boolean.html" t="t">Boolean</a>)<span t="k"> extends </span><a href="../NCEntityParser.html" t="t">NCEntityParser</a></span></div></div><div class="docs"><span class="modifiers"></span><div><div class="originInfo"></div><div class="memberDocumentation"><div class="documentableBrief doc"><p>Common NLP data <a href="../NCEntityParser.html">entity parser</a>.</p> |
| </div><div class="cover"><div class="doc"><p>Common NLP data <a href="../NCEntityParser.html">entity parser</a>.</p> |
| <p>This parser converts list of input <a href="../NCToken.html">NCToken</a> instances <strong>one-to-one</strong> to the list of <a href="../NCEntity.html">NCEntity</a> instances with |
| type <strong>nlp:entity</strong>. All <a href="../NCEntity.html">NCEntity</a> instances in the result list will contain the following |
| <a href="../NCPropertyMap.html">metadata</a> properties:</p> |
| <ul> |
| <li><code>nlp:entity:text</code> - token's text.</li> |
| <li><code>nlp:entity:index</code> - token's index in the input sentence.</li> |
| <li><code>nlp:entity:startCharIndex</code> - token text's first character index in the input sentence.</li> |
| <li><code>nlp:entity:endCharIndex</code> - token text 's last character index in the input sentence.</li> |
| </ul> |
| <p>Note that <a href="../NCEntity.html">NCEntity</a> instances inherit all <a href="../NCToken.html">NCToken</a> <a href="../NCPropertyMap.html">metadata</a> properties from its |
| corresponding token with new name that is prefixed with <strong>'nlp:entity:'</strong>. For example, for token property <strong>prop</strong> |
| the corresponding inherited entity property name will be <strong>nlp:entity:prop</strong>.</p> |
| </div><dl class="attributes"><dt>Value parameters:</dt><dd><dl class="attributes"><dt>predicate</dt><dd><p>Predicate which allows to filter list of converted <a href="../NCToken.html">NCToken</a> instances. Only tokens that |
| satisfy given predicate will convert to entity by this parser. By default all <a href="../NCToken.html">NCToken</a> instances are |
| converted.</p> |
| </dd></dl></dd><dt>Source:</dt><dd><a href="https://github.com/apache/incubator-nlpcraft/blob/master/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCNLPEntityParser.scala#L52">NCNLPEntityParser.scala</a></dd></dl></div></div></div></div></div><div class="documentableElement"><div><span class="annotations monospace"></span></div><div class="header monospace"><div class="signature"><span class="modifiers"></span><span class="kind"><span t="k">class </span></span><a href="parsers/NCOpenNLPEntityParser.html" class="documentableName ">NCOpenNLPEntityParser</a><span>(<span t="k"></span><span t="k"></span>findersMdlsRes: <a href="https://www.scala-lang.org/api/2.13.8/scala/collection/immutable/List.html" t="t">List</a>[<a href="https://www.scala-lang.org/api/2.13.8/scala/Predef$.html#String" t="t">String</a>])<span t="k"> extends </span><a href="../NCEntityParser.html" t="t">NCEntityParser</a><span t="k"> with </span><span data-unresolved-link="" t="t">LazyLogging</span></span></div></div><div class="docs"><span class="modifiers"></span><div><div class="originInfo"></div><div class="memberDocumentation"><div class="documentableBrief doc"><p><a href="https://opennlp.apache.org/">OpenNLP</a> based language independent <a href="../NCEntityParser.html">entity parser</a> configured using |
| <a href="https://opennlp.apache.org/">OpenNLP</a> <strong>name finders</strong> models.</p> |
| </div><div class="cover"><div class="doc"><p><a href="https://opennlp.apache.org/">OpenNLP</a> based language independent <a href="../NCEntityParser.html">entity parser</a> configured using |
| <a href="https://opennlp.apache.org/">OpenNLP</a> <strong>name finders</strong> models.</p> |
| <p>This parser prepares <a href="../NCEntity.html">NCEntity</a> instances which are detected by the provided models. |
| These entities are created with type <code>opennlp:modelName</code>, where <code>modelName</code> is the model name. |
| This parser also adds <code>opennlp:modelName:probability</code> double <a href="../NCPropertyMap.html">metadata</a> property to the |
| entities extracted from the corresponding model.</p> |
| <p>Some of free OpenNLP community-maintained models can be found <a href="https://opennlp.sourceforge.net/models-1.5/">here</a>.</p> |
| <p><strong>NOTE:</strong> that parser can be configured with multiple models and therefore may produce different types of |
| <a href="../NCEntity.html">NCEntity</a> instances with each input <a href="../NCToken.html">NCToken</a> being "mapped" into zero, one or more different entities. |
| As a result, each input token may be included into more than one output <a href="../NCEntity.html">NCEntity</a> instances (or none at all).</p> |
| </div><dl class="attributes"><dt>Value parameters:</dt><dd><dl class="attributes"><dt>findersMdlsRes</dt><dd><p>Relative paths, absolute paths, resources or URLs to OpenNLP name finders |
| <a href="https://opennlp.apache.org/docs/2.0.0/apidocs/opennlp-tools/opennlp/tools/namefind/TokenNameFinderModel.html">models</a>.</p> |
| </dd></dl></dd><dt>Source:</dt><dd><a href="https://github.com/apache/incubator-nlpcraft/blob/master/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCOpenNLPEntityParser.scala#L53">NCOpenNLPEntityParser.scala</a></dd></dl></div></div></div></div></div><div class="documentableElement"><div><span class="annotations monospace"></span></div><div class="header monospace"><div class="signature"><span class="modifiers"></span><span class="kind"><span t="k">class </span></span><a href="parsers/NCOpenNLPTokenParser.html" class="documentableName ">NCOpenNLPTokenParser</a><span>(<span t="k"></span><span t="k"></span>tokMdlRes: <a href="https://www.scala-lang.org/api/2.13.8/scala/Predef$.html#String" t="t">String</a>)<span t="k"> extends </span><a href="../NCTokenParser.html" t="t">NCTokenParser</a><span t="k"> with </span><span data-unresolved-link="" t="t">LazyLogging</span></span></div></div><div class="docs"><span class="modifiers"></span><div><div class="originInfo"></div><div class="memberDocumentation"><div class="documentableBrief doc"><p><a href="https://opennlp.apache.org/">OpenNLP</a> based language independent <a href="../NCTokenParser.html">entity parser</a> configured |
| using path to <a href="https://opennlp.apache.org/">OpenNLP</a> <strong>tokenizer</strong> model.</p> |
| </div><div class="cover"><div class="doc"><p><a href="https://opennlp.apache.org/">OpenNLP</a> based language independent <a href="../NCTokenParser.html">entity parser</a> configured |
| using path to <a href="https://opennlp.apache.org/">OpenNLP</a> <strong>tokenizer</strong> model.</p> |
| <p>Some of free OpenNLP community-maintained models can be found <a href="https://opennlp.sourceforge.net/models-1.5/">here</a>.</p> |
| </div><dl class="attributes"><dt>Value parameters:</dt><dd><dl class="attributes"><dt>tokMdlRes</dt><dd><p>Relative path, absolute path, classpath resource or URL to the tokenizer |
| <a href="https://opennlp.apache.org/docs/2.0.0/apidocs/opennlp-tools/opennlp/tools/tokenize/TokenizerModel.html">model</a>.</p> |
| </dd></dl></dd><dt>Source:</dt><dd><a href="https://github.com/apache/incubator-nlpcraft/blob/master/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCOpenNLPTokenParser.scala#L38">NCOpenNLPTokenParser.scala</a></dd></dl></div></div></div></div></div><div class="documentableElement"><div><span class="annotations monospace"></span></div><div class="header monospace"><div class="signature"><span class="modifiers"></span><span class="kind"><span t="k">trait </span></span><a href="parsers/NCSemanticElement.html" class="documentableName ">NCSemanticElement</a><span></span></div></div><div class="docs"><span class="modifiers"></span><div><div class="originInfo"></div><div class="memberDocumentation"><div class="documentableBrief doc"><p>This trait defines a named <a href="../NCEntity.html">entity</a> that is used by <a href="parsers/NCSemanticEntityParser.html">NCSemanticEntityParser</a>.</p> |
| </div><div class="cover"><div class="doc"><p>This trait defines a named <a href="../NCEntity.html">entity</a> that is used by <a href="parsers/NCSemanticEntityParser.html">NCSemanticEntityParser</a>.</p> |
| <p>THe main purpose of this trait is to provide a set of synonyms by which this named entity can be matched |
| in the input text. Each synonym consists of one or more individual words. Synonym matching is performed on the |
| normalized and stemmatized forms of both a synonym and a user input on first phase and if the first attempt was not |
| successful, it tries to match stemmatized forms of synonyms with lemmatized and the stemmatized forms of user input. |
| This approach provides more accurate matching and doesn't force users to provide synonyms in their initial words form.</p> |
| <p>Note that element's type is its implicit synonym so that even if no additional synonyms are defined at least one synonym |
| always exists.</p> |
| <p><strong>1st Phase</strong>: on the 1st phase <a href="parsers/NCSemanticEntityParser.html">NCSemanticEntityParser</a> will use stemmatized forms of both the synonym and the user input. |
| For example, aa single synonyms <strong>argue</strong> will match all following words <strong>argued</strong>, <strong>argues</strong> and <strong>arguing</strong> by utilizing |
| the same stem <strong>argu</strong>.* Note that you can control stemmatization level by choosing preferable algorithm, |
| look at the following article <a href="https://www.baeldung.com/cs/porter-vs-lancaster-stemming-algorithms">Differences Between Porter and Lancaster Stemming Algorithms</a>. |
| Also note that stemmatization approach effectiveness varies depending on the chosen languages.</p> |
| <p><strong>2ng Phase</strong>: at the second phase, if the 1st phase didn't produce a match, <a href="parsers/NCSemanticEntityParser.html">NCSemanticEntityParser</a> will try to use lemmatized and |
| then stemmatized version of the user input against stemmatized form of the synonym. For example, if an element is defined via |
| synonym <strong>go</strong>, all following user input texts will be matched: <strong>go</strong>, <strong>gone</strong>, <strong>goes</strong>, <strong>went</strong>. Note that it is enough to |
| define just initial word's form for the synonym.</p> |
| <p>Beside described above synonyms, semantic element can also have an optional set of special synonyms called values or |
| "proper nouns" for this element. Unlike basic synonyms, each value is a pair of a name and a set of standard synonyms |
| by which that value, and ultimately its element, can be recognized in the user input. Note that the value name itself |
| acts as an implicit synonym even when no additional synonyms added for that value.</p> |
| <p>Example 1.</p> |
| <pre> |
| - id: "ord:menu" |
| description: "Order menu." |
| synonyms: |
| - "{menu|carte|card}" |
| - "{products|goods|food|item|_} list" |
| </pre> |
| <p>This YAML representation describes semantic entity <strong>ord:menu</strong> that can be detected via synonyms: <em>menu</em>, <em>products</em>, <em>products list</em> etc.</p> |
| <p>Example 2.</p> |
| <pre> |
| - id: "ord:pizza:size" |
| description: "Size of pizza." |
| values: |
| "small": [ "{small|smallest|min|minimal|tiny} {size|piece|_}" ] |
| "medium": [ "{medium|intermediate|normal|regular} {size|piece|_}" ] |
| "large": [ "{big|biggest|large|max|maximum|huge|enormous} {size|piece|_}" ] |
| </pre> |
| <p>This YAML definition describes semantic entity <strong>ord:pizza:size</strong> that can be detected via values synonyms: <em>small</em>, <em>medium size</em>, |
| <em>big piece</em> etc. Note that <strong>value</strong> (<em>small</em>, <em>medium</em> or <em>large</em> in this example) is passed in created <a href="../NCEntity.html">NCEntity</a> as |
| a property with a key <em>element-type:value</em> (<code>ord:pizza:size:value</code> in this example).</p> |
| <p><strong>NOTE</strong>: these examples show how semantic elements can be defined via YAML format |
| when these elements passed in <a href="parsers/NCSemanticEntityParser.html">NCSemanticEntityParser</a> via resource definition, |
| but there aren't any differences when semantic elements defined via JSON/YAML files or prepared programmatically.</p> |
| <p>See detailed description on the website <a href="https://nlpcraft.apache.org/built-in-entity-parser.html#parser-semantic">Semantic Parser</a>.</p> |
| </div><dl class="attributes"><dt>See also:</dt><dd><div><div><p><a href="parsers/NCSemanticEntityParser.html">NCSemanticEntityParser</a></p> |
| </div></div></dd><dt>Source:</dt><dd><a href="https://github.com/apache/incubator-nlpcraft/blob/master/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCSemanticElement.scala#L81">NCSemanticElement.scala</a></dd></dl></div></div></div></div></div><div class="documentableElement"><div><span class="annotations monospace"></span></div><div class="header monospace"><div class="signature"><span class="modifiers"></span><span class="kind"><span t="k">class </span></span><a href="parsers/NCSemanticEntityParser.html" class="documentableName ">NCSemanticEntityParser</a><span><span t="k"> extends </span><a href="../NCEntityParser.html" t="t">NCEntityParser</a><span t="k"> with </span><span data-unresolved-link="" t="t">LazyLogging</span></span></div></div><div class="docs"><span class="modifiers"></span><div><div class="originInfo"></div><div class="memberDocumentation"><div class="documentableBrief doc"><p>Semantic entity parser implementation.</p> |
| </div><div class="cover"><div class="doc"><p>Semantic entity parser implementation.</p> |
| <p>This synonyms based parser provides simple yet powerful way to find domain specific data in the input text. |
| It is configured via <a href="parsers/NCSemanticElement.html">NCSemanticElement</a> list which represents all possible <a href="../NCEntity.html">named entities</a> that |
| this parser can detect.</p> |
| <p><a href="parsers/NCSemanticElement.html">Semantic elements</a> can be configured via YAML or JSON files in special format or |
| passed in this parser as programmatically prepared list. <a href="parsers/NCSemanticElement.html">Semantic elements</a> contain set of |
| synonyms which can use special <a href="https://nlpcraft.apache.org/built-in-entity-parser.html#macros">macros</a>. |
| These macros also can be provided via YAML and JSON files or passed directly in case of programmatically prepared |
| <a href="parsers/NCSemanticElement.html">NCSemanticElement</a> list.</p> |
| <p>Example of YAML elements definition.</p> |
| <pre> |
| macros: |
| "<OF>": "{of|for|per}" |
| "<CUR>": "{current|present|now|local}" |
| "<TIME>": "{time <OF> day|day time|date|time|moment|datetime|hour|o'clock|clock|date time}" |
| elements: |
| - id: "x:time" |
| description: "Date and/or time token indicator." |
| synonyms: |
| - "{<CUR>|_} <TIME>" |
| - "what <TIME> {is it now|now|is it|_}" |
| </pre> |
| <p>Given this simple definition the <strong>x:time</strong> element can be detected by a large number of synonyms like <em>day time</em>, |
| <em>local day time</em>, <em>time of day</em>, <em>local time of day</em>, <em>what hour is it</em>, etc.</p> |
| </div><dl class="attributes"><dt>Value parameters:</dt><dd><dl class="attributes"><dt>elements</dt><dd><p>Programmatically prepared <a href="parsers/NCSemanticElement.html">NCSemanticElement</a> instances. Note that either the model or elements |
| must be supplied at least.</p> |
| </dd><dt>macros</dt><dd><p>Macros map which are used for extracting <a href="parsers/NCSemanticElement.html">NCSemanticElement</a> synonyms defined via <strong>macros</strong>. |
| More information at <a href="https://nlpcraft.apache.org/built-in-entity-parser.html#macros">https://nlpcraft.apache.org/built-in-entity-parser.html#macros</a>.</p> |
| </dd><dt>mdlResOpt</dt><dd><p>Optional relative path, absolute path, classpath resource or URL to YAML or JSON semantic model |
| which contains <a href="parsers/NCSemanticElement.html">NCSemanticElement</a> definitions. Note that either the model or elements must be supplied at least.</p> |
| </dd><dt>parser</dt><dd><p><a href="../NCTokenParser.html">NCTokenParser</a> implementation which will be used for <a href="parsers/NCSemanticElement.html">NCSemanticElement</a> synonyms tokenization. |
| It should be same implementation as used in <a href="../NCPipeline.html#getTokenParser-0">NCPipeline.getTokenParser</a>.</p> |
| </dd><dt>stemmer</dt><dd><p><span data-unresolved-link="" title="Problem linking NCStemmer: No DRI found for query">NCStemmer</span> implementation which used to match tokens and given <a href="parsers/NCSemanticElement.html">NCSemanticElement</a> synonyms.</p> |
| </dd></dl></dd><dt>See also:</dt><dd><div><div><p><a href="parsers/NCSemanticElement.html">NCSemanticElement</a></p> |
| </div></div></dd><dt>Source:</dt><dd><a href="https://github.com/apache/incubator-nlpcraft/blob/master/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCSemanticEntityParser.scala#L166">NCSemanticEntityParser.scala</a></dd></dl></div></div></div></div></div></div></div></div></div></div></div></div></main><footer><div id="generated-by"><span class="footer-text">Generated by</span><a href="https://github.com/lampepfl/dotty/tree/master/scaladoc"><img src="../../../../images/scaladoc_logo.svg" alt="scaladoc" class="scaladoc_logo"></img><img src="../../../../images/scaladoc_logo_dark.svg" alt="scaladoc" class="scaladoc_logo_dark"></img></a></div><span id="footer-text">Apache NLPCraft</span><div class="socials"><span class="footer-text">Social links</span><a href="https://github.com/apache/incubator-nlpcraft"><span class="social-icon" data-icon-path="github-icon-black.png"></span></a></div><div class="mode"><span class="footer-text">Mode</span><label id="theme-toggle" class="switch"><input type="checkbox"></input><span class="slider"></span></label></div><span class="go-to-top-icon"><a href="#container"><span class="icon-vertical_align_top"></span><span class="footer-text">Back to top</span></a></span></footer></div></div></body></html> |