| <!-- |
| 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. |
| --> |
| |
| <!doctype html><html lang="en"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="description" content="An open source API to convert natural language into actions."><meta name="author" content="NLPCraft."><link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"><meta name="msapplication-TileColor" content="#2d89ef"><meta name="theme-color" content="#ffffff"><title>Apache NLPCraft - Natural Language Interface</title><link rel="stylesheet" href="/ext/bootstrap_4_6_0.css"> <script src="/ext/jquery-3.5.1.slim.min.js"></script> <script src="/ext/popper.min_1_14_0.js"></script> <script src="/ext/bootstrap.bundle.min_4_6_0.js"></script><link href="/ext/fontawesome_5_7_1.css" rel="stylesheet" type="text/css"><link href="/ext/syntaxhighlighter/styles/shCoreNLPCraft.css" rel="stylesheet" type="text/css"><link href="/ext/syntaxhighlighter/styles/shThemeNLPCraft.css" rel="stylesheet" type="text/css"> <script src="/ext/syntaxhighlighter/scripts/XRegExp.js" type="text/javascript"></script> <script src="/ext/syntaxhighlighter/scripts/shCore.js" type="text/javascript"></script> <script src="/ext/syntaxhighlighter/scripts/shBrushXml.js" type="text/javascript"></script> <script src="/ext/syntaxhighlighter/scripts/shBrushBash.js" type="text/javascript"></script> <script src="/ext/syntaxhighlighter/scripts/shBrushPlain.js" type="text/javascript"></script> <script src="/ext/syntaxhighlighter/scripts/shBrushJava.js" type="text/javascript"></script> <script src="/ext/syntaxhighlighter/scripts/shBrushScala.js" type="text/javascript"></script> <script src="/ext/syntaxhighlighter/scripts/shBrushIdl.js" type="text/javascript"></script> <script src="/ext/syntaxhighlighter/scripts/shBrushPython.js" type="text/javascript"></script> <script src="/ext/syntaxhighlighter/scripts/shBrushJScript.js" type="text/javascript"></script> <script async defer src="https://buttons.github.io/buttons.js"></script><link rel="stylesheet" type="text/css" href="/assets/css/style.css"/><nav class="navbar navbar-expand-lg navbar-light bg-light" id="top-header"> <a class="navbar-brand mr-4" href="/index.html"> <img src="/images/nlpcraft_logo_white-h24.png" alt=""> </a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"> <span class="navbar-toggler-icon"></span> </button><div class="collapse navbar-collapse" id="navbarSupportedContent"><ul class="navbar-nav mr-auto"><li class="nav-item"> <a class="nav-link" href="/docs.html">Docs</a><li class="nav-item"> <a class="nav-link" href="/community.html">Community</a><li class="nav-item"> <a class="nav-link" href="/use-cases.html">Use Cases</a><li class="nav-item"> <a class="nav-link" href="/download.html">Downloads</a></ul><ul class="navbar-nav ml-auto"><li class="nav-item mr-2"> <a class="nav-link" href="/download.html">v.1.0.0</a><li class="nav-item"> <a class="nav-link fork-link" target="github" href="https://github.com/apache/incubator-nlpcraft">GitHub <i class="fab fa-fw fa-github mr-2"></i></a></ul></div></nav><div class="container-fluid"><div class="navbar-aligned"><ol class="breadcrumb"><li class="mr-1"><a href="/index.html">Home</a><li class="mr-1 active">Intent Matching</ol><h1 class="page-title"> <span> <i class="fas fa-fw fa-book"></i> Intent Matching </span></h1><div class="row three-cols-container"><div class="col-md-2 first-column"><ul class="side-nav"><li class="side-nav-title">Introduction<li> <a href="/docs.html">Overview</a><li> <a href="/installation.html">Installation</a><li> <a href="/first-example.html">First Example</a><li class="side-nav-title">Developer Guide<li> <a href="/key-concepts.html">Key Concepts</a><li> <a class="active" href="/intent-matching.html">Intent Matching</a><li> <a href="/short-term-memory.html">Short-Term Memory</a><li class="side-nav-title">Examples<li> <a href="/examples/calculator.html">Calculator</a><li> <a href="/examples/time.html">Time</a><li> <a href="/examples/light_switch.html">Light Switch</a><li> <a href="/examples/light_switch_fr.html">Light Switch FR</a><li> <a href="/examples/light_switch_ru.html">Light Switch RU</a><li> <a href="/examples/pizzeria.html">Pizzeria</a></ul></div><div id="intent-matching" class="col-md-8 second-column"><section><h2 class="section-title">Overview <a href="#"><i class="top-link fas fa-fw fa-angle-double-up"></i></a></h2><p> <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCModel">NCModel</a> processing logic is defined as a pipeline and the collection of one or more intents to be matched on. The sections below explain what intent is, how to define it in your model, and how it works.</p></section><section id="intent"><h2 class="section-title">Intent <a href="#"><i class="top-link fas fa-fw fa-angle-double-up"></i></a></h2><p> The goal of the data model implementation is to take the user input text, pass it through processing pipeline and match the resulting variants to a specific user-defined code that will execute for that input. The mechanism that provides this matching is called an <em>intent</em>.</p><p> The intent generally refers to the goal that the end-user had in mind when speaking or typing the input utterance. The intent has a <em>declarative part or template</em> written in <a href="#idl">IDL - Intent Definition Language</a> that strictly defines a particular form the user input. Intent is also <a href="#binding">bound</a> to a callback method that will be executed when that intent, i.e. its template, is detected as the best match for a given input. A typical data model will have multiple intents defined for each form of the expected user input that model wants to react to.</p><p> For example, a data model for banking chatbot or analytics application can have multiple intents for each domain-specific group of input such as opening an account, closing an account, transferring money, getting statements, etc.</p><p> Intents can be specific or generic in terms of what input they match. Multiple intents can overlap and NLPCraft will disambiguate such cases to select the intent with the overall best match. In general, the most specific intent match wins.</p></section><section id="idl"><h2 class="section-title">IDL Syntax <a href="#"><i class="top-link fas fa-fw fa-angle-double-up"></i></a></h2><p> NLPCraft intents are written in Intent Definition Language (IDL). IDL is a relatively straightforward declarative language. For example, here's a simple intent <code>x</code> with two terms <code>a</code> and <code>b</code>:</p><pre class="brush: idl"> |
| /* Intent 'x' definition. */ |
| intent=x |
| term(a)~{# == 'my_elm'} // Term 'a'. |
| term(b)={has(ent_groups, "my_group")} // Term 'b'. |
| </pre><p> IDL intent defines a match between the parsed user input represented as the collection of <a target="scaladoc" class="not-code" href="/apis/latest/org/apache/nlpcraft/NCEntity">entities</a>, and the user-define callback method. IDL intents are <a href="#binding">bound</a> to their callbacks via <a href="#binding">Java annotation</a> and can be <a href="#idl_location">located</a> in the same Java annotations or in external <code>*.idl</code> files.</p><p> You can review the formal <a target="github" href="https://github.com/apache/incubator-nlpcraft/blob/master/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/compiler/antlr4/NCIDL.g4">ANTLR4 grammar</a> for IDL, but here are the general properties of IDL:</p><ul><li> IDL has <a target="wiki" href="https://en.wikipedia.org/wiki/Context-free_grammar">context-free grammar</a>. In simpler terms, all whitespaces outside of string literals are ignored.<li> IDL supports Java-style comments, both single line <code>// Comment.</code> as well as multi-line <code>/* Comment. */</code>.<li> String literals can use either single quotes (<code>'text'</code>) or double quotes (<code>"text"</code>) simplifying IDL usage in Scala - you don't have to escape double quotes. Both quotes can be escaped in string, i.e. <code>"text with \" quote"</code> or <code>'text with \' quote'</code><li> Built-in literals <code>true</code>, <code>false</code> and <code>null</code> for boolean and null values.<li> Algebraic and logical expression including operator precedence follow standard Java language conventions.<li> Both integer and real numeric literals can use underscore <code>'_'</code> character for separation as in <code>200_000</code>.<li> Numeric literals use Java string conversions.<li> IDL has only 10 reserved keywords: <code>flow fragment import intent meta options term true false null</code><li> Identifiers and literals can use the same Unicode space as Java.<li> IDL provides over 100 <a href="#idl_functions">built-in functions</a> to aid in intent matching. IDL functions are pure immutable mathematical functions that work on a runtime stack. In other words, they look like Python functions: IDL <code>length(trim(" text "))</code> vs. OOP-style <code>" text ".trim().length()</code>.<li> IDL is a lazily evaluated language, i.e. expressions are evaluated only when required during runtime. That means that evaluated left-to-right logical AND and OR operators, for example, skip their right-part expressions if the left expression result is determinative for the overall result - so-called short-circuit evaluation. Some IDL functions like <code>if</code> and <code>or_else</code> also provide the similar short-circuit evaluation.</ul><p> IDL program consists of <a href="#intent_statement">intent</a>, <a href="#fragment_statement">fragment</a>, or <a href="#import_statement">import</a> statements in any order or combination:</p><ul><li><p id="intent_statement"> <b><code>intent</code> statement</b></p><p> Intent is defined as one or more terms. Each term is a predicate over a instance of <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCEntity">NCEntity</a> trait. For an intent to match all of its terms have to evaluate to true. Intent definition can be informally explained using the following full-feature example:</p><pre class="brush: idl"> |
| intent=xa |
| flow="^(?:login)(^:logout)*$" |
| meta={'enabled': true} |
| term(a)={month >= 6 && !# != "z" && meta_intent('enabled') == true}[1,3] |
| term(b)~{ |
| @usrTypes = meta_req('user_types') |
| |
| (# == 'order' || # == 'order_cancel') && has_all(@usrTypes, list(1, 2, 3)) |
| } |
| |
| intent=xb |
| options={ |
| 'ordered': false, |
| 'unused_free_words': true, |
| 'unused_entities': false, |
| 'allow_stm_only': false |
| } |
| term(a)={length("some text") > 0} |
| fragment(frag, {'p1': 25, 'p2': {'a': false}}) |
| </pre><p><b>NOTES:</b></p><dl><dt> <code>intent=xa</code> <sup><small>line 1</small></sup><br/> <code>intent=xb</code> <sup><small>line 11</small></sup><dd> <code>xa</code> and <code>xb</code> are the mandatory intent IDs. Intent ID is any arbitrary unique string matching the following lexer template: <code>(UNI_CHAR|UNDERSCORE|LETTER|DOLLAR)+(UNI_CHAR|DOLLAR|LETTER|[0-9]|COLON|MINUS|UNDERSCORE)*</code><dt><code>options={...}</code> <sup><small>line 12</small></sup><dd> <em>Optional.</em> Matching options specified as JSON object. Entire JSON object as well as each individual JSON field is optional. Allows to customize the matching algorithm for this intent:<table class="gradient-table"><thead><tr><td>Option<td>Type<td>Description<td>Default Value<tbody><tr><td><code>ordered</code><td><code>Boolean</code><td><p> Whether or not this intent is ordered. For ordered intent the specified order of terms is important for matching this intent. If intent is unordered its terms can be found in any order in the input text. Note that ordered intent significantly limits the user input it can match. In most cases the ordered intent is only applicable to processing of a formal grammar (like a programming language) and mostly unsuitable for the natural language processing.</p><p> Note that while the <code>ordered</code> flag affect entire intent and all its terms, you can define the individual term that depends on the position of the entity. This, in fact, allows you have a subset of terms that order dependant. See the following <a href="#idl_functions">IDL functions</a> for details:</p><ul><li><code>ent_index()</code><li><code>ent_all()</code><li><code>ent_count()</code><li><code>ent_is_last()</code><li><code>ent_is_first()</code><li><code>ent_is_before_type()</code><li><code>ent_is_before_group()</code><li><code>ent_is_between_types()</code><li><code>ent_is_between_groups()</code><li><code>ent_is_after_type()</code><li><code>ent_is_after_group()</code></ul><td><code>false</code><tr><td><code>unused_free_words</code><td><code>Boolean</code><td> Whether or not free words - that are unused by intent matching - should be ignored (value <code>true</code>) or reject the intent match (value <code>false</code>). Free words are the words in the user input that were not recognized as any entity. Typically, for the natural language comprehension it is safe to ignore free words. For the formal grammar, however, this could make the matching logic too loose.<td><code>true</code><tr><td><code>unused_entities</code><td><code>Boolean</code><td> Whether or not unused entities should be ignored (value <code>true</code>) or reject the intent match (value <code>false</code>). By default, tne unused entities are not ignored since it is assumed that user would define pipeline entity parser on purpose and construct the intent logic appropriate.<td><code>false</code><tr><td><code>allow_stm_only</code><td><code>Boolean</code><td> Whether or not the intent can match when all of the matching entities came from STM. By default, this special case is disabled (value <code>false</code>). However, in specific intents designed for free-form language comprehension scenario, like, for example, SMS messaging - you may want to enable this option.<td><code>false</code></table><dt> <code>flow="^(?:login)(^:logout)*$"</code> <sup><small>line 2</small></sup><br/><dd><p> <em>Optional.</em> Dialog flow is a history of previously matched intents to match on. If provided, the intent will first match on the history of the previously matched intents before processing its terms by using <b>regular expressions</b>. Dialog flow specification is a string with the standard <a target=_blank href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/regex/Pattern.html">Java regular expression</a>. The history of previously matched intents is presented as a space separated string of intent IDs that were selected as the best match during the current conversation, in the chronological order with the most recent matched intent ID being the first element in the string. Dialog flow regular expression will be matched against that string representing intent IDs.</p><p> In the line 2, the <code>^(?:login)(^:logout)*$</code> dialog flow regular expression defines that intent should only match when the immediate previous intent was <code>login</code> and no <code>logout</code> intents are in the history. If the history is <code>"login order order"</code> - this intent will match. However, for <code>"login logout"</code> or <code>"order login"</code> history this dialog flow will not match.</p><p> Note that if dialog flow is defined and it doesn't match the history the terms of the intent won't be tested at all.</p><dt> <code>meta={'enabled': true}</code> <sup><small>line 3</small></sup><dd><p> <em>Optional.</em> Just like the most of the components in NLPCraft, the intent can have its own metadata. Intent metadata is defined as a standard JSON object which will be converted into <code>java.util.Map</code> instance and can be accessed in intent's terms via <a href="#idl_functions"><code>meta_intent()</code></a> IDL function. The typical use case for declarative intent metadata is to parameterize its behavior, i.e. the behavior of its terms, with a clearly defined properties that are provided inside intent definition itself.</p><dt> <code>term(a)={month >= 6 && !# != "z" && meta_intent('enabled') == true}[1,3]</code> <sup><small>line 4</small></sup><br> <code>term(b)~{</code> <sup><small>line 5</small></sup><br> <code style="padding-left: 20px">@usrTypes = meta_req('user_types')</code><br> <code style="padding-left: 20px">(# == 'order' || # == 'order_cancel') && has_all(@usrTypes, list(1, 2, 3))</code><br> <code>}</code><br> <code>term(a)={length("some text") > 0}</code> <sup><small>line 18</small></sup><dd><p> Term is a building block of the intent. Intent must have at least one term. Term has optional ID, an entity predicate and optional quantifiers. It supports conversation context if it uses <code>'~'</code> symbol or not if it uses <code>'='</code> symbol in its definition. For the conversational term the system will search for a match using entities from the current request as well as the entities from conversation STM (short-term-memory). For a non-conversational term - only entities from the current request will be considered.</p><p> A term is matched if its entity predicate returns true. The matched term represents one or more entities, sequential or not, that were detected in the user input. Intent has a list of terms (always at least one) that all have to be matched in the user input for the intent to match. Note that term can be optional if its min quantifier is zero. Whether the order of the terms is important for matching is governed by intent's <code>ordered</code> parameter.</p><p> Term ID (<code>a</code> and <code>b</code>) is optional. It is only required by <a href="#binding"><code>@NCIntentTerm</code></a> annotation to link term's entities to a formal parameter of the callback method. Note that term ID follows the same lexical rules as intent ID.</p><p> Inside of curly brackets <code>{</code> <code>}</code> you can have an optional list of term variables and the mandatory term expression that must evaluate to a boolean value. Term variable name must start with <code>@</code> symbol and be unique within the scope of the current term. All term variables must be defined and initialized before term expression which must be the last statement in the term:</p><pre class="brush: idl"> |
| term(b)~{ |
| @a = meta_req('a') |
| @lst = list(1, 2, 3, 4) |
| |
| has_all(@lst, list(@a, 2)) |
| } |
| </pre><p> Term variable initialization expression as well as term's expression follow <em>Java-like expression grammar</em> including precedence rules, brackets and logical combinators, as well as built-in <a href="#idl_functions">IDL functions</a> calls:</p><pre class="brush: idl"> |
| term={true} // Special case of 'constant' term. |
| term={ |
| // Variable declarations. |
| @a = round(1.25) |
| @b = meta_req('my_prop') |
| |
| // Last expression must evaluate to boolean. |
| (@a + 2) * @b > 0 |
| } |
| term={ |
| // Variable declarations. |
| @c = meta_ent('prop') |
| @lst = list(1, 2, 3) |
| |
| // Last expression must evaluate to boolean. |
| abs(@c) > 1 && size(@lst) != 5 |
| } |
| </pre><div class="bq info"><p> <b>NOTE:</b> while term variable initialization expressions can have any type - the term's expression itself, i.e. the last expression in the term's body, <em>must evaluate to a boolean result only.</em> Failure to do so will result in a runtime exception during intent evaluation. Note also that such errors cannot be detected during intent compilation phase.</p></div><p> <code>?</code> and <code>[1,3]</code> define an inclusive quantifier for that term, i.e. how many times the match for this term should found. You can use the following quick abbreviations:</p><ul class="recover-bottom-margin"><li><code>*</code> is equal to <code>[0,∞]</code><li><code>+</code> is equal to <code>[1,∞]</code><li><code>?</code> is equal to <code>[0,1]</code><li>No quantifier defaults to <code>[1,1]</code></ul><p> As mentioned above the quantifier is inclusive, i.e. the <code>[1,3]</code> means that the term should appear once, two times or three times.</p><dt> <code>fragment(frag, {'p1': 25, 'p2': {'a': false}})</code> <sup><small>line 19 </small></sup><br><dd><p> Fragment reference allows to insert the terms defined by that fragment in place of this fragment reference. Fragment reference has mandatory fragment ID parameter and optional JSON second parameter. Optional JSON parameter allows to parameterize the inserted terms' behavior and it is available to the terms via <code>meta_frag()</code> <a href="#idl_functions">IDL function.</a></p></dl><li><p id="fragment_statement"> <b><code>fragment</code> statement</b></p><p> Fragments allow to group and name a set of reusable terms. Such groups can be further parameterized at the place of reference and enable the reuse of one or more terms by multiple intents. For example:</p><pre class="brush: idl, highlight: [2, 3, 15, 18]"> |
| // Fragments. |
| fragment=buzz term~{# == meta_frag('id')} |
| fragment=when |
| term(nums)~{ |
| // Term variable. |
| @type = meta_ent('num:unittype') |
| @iseq = meta_ent('num:isequalcondition') |
| |
| # == 'num' && @type == 'datetime' && @iseq == true |
| }[0,7] |
| |
| // Intents. |
| intent=alarm |
| // Insert parameterized terms from fragment 'buzz'. |
| fragment(buzz, {"id": "x:alarm"}) |
| |
| // Insert terms from fragment 'when'. |
| fragment(when) |
| </pre><p><b>NOTES:</b></p><ul class="recover-bottom-margin"><li> Fragment statements (line 2 and 3) have a name (<code>buzz</code> and <code>when</code>) and a list of terms.<li> Terms follow the same syntax as in intent definition.<li> When a fragment is referenced in intent (lines 15 and 18) it is replaced with its terms.</ul><li><p id="import_statement"> <b><code>import</code> statement</b></p><p> Import statement allows to import IDL declarations from either local file, classpath resource or URL:</p><pre class="brush: idl"> |
| // Import using absolute path. |
| import('/opt/globals.idl') |
| |
| // Import using classpath resource. |
| import('org/apache/nlpcraft/examples/alarm/intents.idl') |
| |
| // Import using URL. |
| import('ftp://user:password@myhost:22/opt/globals.idl') |
| </pre><p> <b>NOTES:</b></p><ul class="recover-bottom-margin"><li> The effect of importing is the same as if the imported declarations were inserted in place of import statement.<li> Recursive and cyclic imports are detected and safely ignored.<li> Import statement starts with <code>import</code> keyword and has a string parameter that indicates the location of the resource to import.<li> For the classpath resource you don't need to specify leading forward slash.</ul><p></p></ul><h2 id="intent-lifecycle" class="section-sub-title">Intent Lifecycle <a href="#"><i class="top-link fas fa-fw fa-angle-double-up"></i></a></h2><p> During <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCModelClient">NCModelClient</a> initialization it scans the provided model class for the intents. All found intents are compiled into an internal representation.</p><p> Note that not all intent-related problems can be detected at the compilation phase, and <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCModelClient">NCModelClient</a> can be initialized with intents not being completely validated. For example, each term in the intent must evaluate to a boolean result. This can only be checked at runtime. Another example is the number and the types of parameters passed into IDL function which is only checked at runtime as well.</p><p> Intents are compiled only once during the <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCModelClient">NCModelClient</a> initialization and cannot be re-compiled. Model logic, however, can affect the intent behavior through <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCModel">NCModel</a> callback methods and metadata all of which can change at runtime and are accessible through <a href="#idl_functions">IDL functions.</a></p><h2 id="intent-examples" class="section-sub-title">Intent Examples <a href="#"><i class="top-link fas fa-fw fa-angle-double-up"></i></a></h2><p> Here's few of intent examples with explanations:</p><p> <b>Example 1:</b></p><pre class="brush: idl"> |
| intent=a |
| term~{# == 'x:type'} |
| term(nums)~{# == 'num' && lowercase(meta_ent('num:unittype')) == 'datetime'}[0,2] |
| </pre><p><b>NOTES:</b></p><ul><li> Intent has ID <code>a</code>.<li> Intent uses default conversational support (<code>true</code>) and default order (<code>false</code>).<li> Intent has two conversational terms (<code>~</code>) that have to be found for the intent to match. Note that second term is optional as it has <code>[0,2]</code> quantifier.<li> Both terms have to be found in the user input for the intent to match.<li> First term matches any single entity with type <code>x:type</code>.<li> Second term can appear zero, once or two times and it matches entity with ID <code>num</code> with <code>num:unittype</code> metadata property equal to <code>'datetime'</code> string.<li> IDL function <code>lowercase</code> used on <code>num:unittype</code> metadata property value.<li> Note that since second term has ID (<code>nums</code>) it can be references by <code>@NCIntentTerm</code> annotation by the callback formal parameter.</ul><br/><p> <b>Example 2:</b></p><pre class="brush: idl"> |
| intent=id2 |
| flow='id1 id2' |
| term={# == 'myent' && signum(get(meta_ent('score'), 'best')) != -1} |
| term={has_any(ent_groups, list('actors', 'owners'))} |
| </pre><p><b>NOTES:</b></p><ul><li> Intent has ID <code>id2</code>.<li> Intent has dialog flow pattern: <code>'id1 id2'</code>. It expects the sequence of intents <code>id1</code> and <code>id2</code> somewhere in the history of previously matched intents in the course of the current conversation.<li> Intent has two non-conversational terms (<code>=</code>). Both terms have to be present only once (their implicit quantifiers are <code>[1,1]</code>).<li> Both terms have to be found in the user input for the intent to match.<li> First term should be a entity with ID <code>myent</code> and have metadata property <code>score</code> of type map. This map should have a value with the string key <code>'best'</code>. <code>signum</code> of this map value should not equal <code>-1</code>. Note that <code>meta_ent()</code>, <code>get()</code> and <code>signum()</code> are all built-in <a href="#idl_functions">IDL functions</a>.<li> Second term should be an entity that belongs to either <code>actors</code> or <code>owners</code> group.</ul></section><section id="idl_functions" ><h2 class="section-title">IDL Functions <a href="#"><i class="top-link fas fa-fw fa-angle-double-up"></i></a></h2><p> IDL provides over 100 built-in functions that can be used in IDL intent definitions. IDL function call takes on traditional <code><b>fun_name</b>(p1, p2, ... pk)</code> syntax form. If function has no parameters, the brackets are optional. IDL function operates on stack - its parameters are taken from the stack and its result is put back onto stack which in turn can become a parameter for the next function call and so on. IDL functions can have zero or more parameters and always have one result value. Some IDL functions support variable number of parameters.</p><div class="bq info"><p><b>Special Shorthand <code>#</code></b></p><p> The frequently used IDL function <code>ent_type()</code> has a special shorthand <code>#</code>. For example, the following expressions are all equal:</p><pre class="brush: idl"> |
| ent_type() == 'type' |
| ent_type == 'type' // Remember - empty parens are optional. |
| # == 'type' |
| </pre></div><p> When chaining the function calls IDL uses mathematical notation (a-la Python) rather than object-oriented one: IDL <code>length(trim(" text "))</code> vs. OOP-style <code>" text ".trim().length()</code>.</p><p> IDL functions operate with the following types:</p><table class="gradient-table"><thead><tr><th>JVM Type<th>IDL Name<th>Notes<tbody><tr><td><code>java.lang.String</code><td><code>String</code><td><tr><td> <code>java.lang.Long</code><br/> <code>java.lang.Integer</code><br/> <code>java.lang.Short</code><br/> <code>java.lang.Byte</code><td><code>Long</code><td> Smaller numerical types will be converted to <code>java.lang.Long</code>.<tr><td> <code>java.lang.Double</code><br/> <code>java.lang.Float</code><td><code>Double</code><td> <code>java.lang.Float</code> will be converted to <code>java.lang.Double</code>.<tr><td><code>java.lang.Boolean</code><td><code>Boolean</code><td>You can use <code><b>true</b></code> or <code><b>false</b></code> literals.<tr><td><code>java.util.List<T></code><td><code>List[T]</code><td>Use <code>list(...)</code> IDL function to create new list.<tr><td><code>java.util.Map<K,V></code><td><code>Map[K,V]</code><td><tr><td><code><a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCEntity">NCEntity</a></code><td><code>Entity</code><td><tr><td><code>java.lang.Object</code><td><code>Any</code><td>Any of the supported types above. Use <code><b>null</b></code> literal for null value.</table><p> Some IDL functions are polymorphic, i.e. they can accept arguments and return result of multiple types. Encountering unsupported types will result in a runtime error during intent matching. It is especially important to watch out for the types when adding objects to various metadata containers and using that metadata in the IDL expressions.</p><div class="bq warn"><p><b>Unsupported Types</b></p><p> Detection of the unsupported types by IDL functions cannot be done during IDL compilation and can <em>only be done during runtime execution</em>. This means that even though the model compiles IDL intents and <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCModelClient">NCModelClient</a> starts successfully - it does not guarantee that intents will operate correctly.</p></div><p id="fn-list"> All IDL functions are organized into the following groups:</p><nav><div class="nav nav-tabs" role="tablist"> <a class="nav-item nav-link active" data-toggle="tab" id="fn_ent_tab" href="#fn_ent" role="tab">Entity</a> <a class="nav-item nav-link" data-toggle="tab" id="fn_text_tab" href="#fn_text" role="tab">Text</a> <a class="nav-item nav-link" data-toggle="tab" id="fn_math_tab" href="#fn_math" role="tab">Math</a> <a class="nav-item nav-link" data-toggle="tab" id="fn_collection_tab" href="#fn_collection" role="tab">Collection</a> <a class="nav-item nav-link" data-toggle="tab" id="fn_metadata_tab" href="#fn_metadata" role="tab">Metadata</a> <a class="nav-item nav-link" data-toggle="tab" id="fn_datetime_tab" href="#fn_datetime" role="tab">Date <span class="amp">&</span> Time</a> <a class="nav-item nav-link" data-toggle="tab" id="fn_request_tab" href="#fn_req" role="tab">Request</a> <a class="nav-item nav-link" data-toggle="tab" id="fn_other_tab" href="#fn_other" role="tab">Other</a></div></nav><div class="tab-content"><div class="tab-pane fade show active" id="fn_ent" role="tabpanel"><div class="accordion" id="ent_fns"><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_ent_type"> <span><code><b>ent_type</b>(t: Entity<em><sub>opt</sub></em>) ⇒ String, # ⇒ String </code></span> <span class="fn-short-desc">Returns <a href="/apis/latest/org/apache/nlpcraft/NCEntity.html#getType-0">entity type</a></span> </button></h2></div><div id="fn_ent_type" class="collapse" data-parent="#ent_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns <a href="/apis/latest/org/apache/nlpcraft/NCEntity.html#getType-0">entity type</a> for the current entity (default) or the provided one by the optional parameter <code><b>t</b></code>. Note that this functions has a special shorthand <code><b>#</b></code>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 'true' if the current entity type is equal to 'my_type'. |
| ent_type == 'my_type' |
| # == 'my_type' |
| ent_type(ent_this) == 'my_type' |
| #(ent_this) == 'my_type' |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_ent_groups"> <span><code><b>ent_groups</b>(t: Entity<em><sub>opt</sub></em>) ⇒ List[String] </code></span> <span class="fn-short-desc">Gets the list of <a class="not-code" href="/apis/latest/org/apache/nlpcraft/NCEntity.html#getGroups-0">groups</a> this entity belongs to</span> </button></h2></div><div id="fn_ent_groups" class="collapse" data-parent="#ent_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Gets the list of <a class="not-code" href="/apis/latest/org/apache/nlpcraft/NCEntity.html#getGroups-0">groups</a> the current entity (default) or the provided one by the optional parameter <code><b>t</b></code> belongs to. Note that, by default, if not specified explicitly, entity always belongs to one group with type equal to entity type. May return an empty list but never a <code>null</code>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: list of groups this entity belongs to. |
| ent_groups |
| ent_groups(ent_this) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_ent_this"> <span><code><b>ent_this</b> ⇒ Entity </code></span> <span class="fn-short-desc">Returns current entity</span> </button></h2></div><div id="fn_ent_this" class="collapse" data-parent="#ent_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns current entity.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: current entity. |
| ent_this |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_ent_text"> <span><code><b>ent_text</b>(t: Entity<em><sub>opt</sub></em>) ⇒ String </code></span> <span class="fn-short-desc">Returns entity's original text</span> </button></h2></div><div id="fn_ent_text" class="collapse" data-parent="#ent_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns <a class="not-code" href="/apis/latest/org/apache/nlpcraft/NCEntity.html#mkText-0">entity's original text</a>. If <code>t</code> is not provided the current entity is assumed.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: entity original input text. |
| ent_text |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_ent_index"> <span><code><b>ent_index</b>(t: Entity<em><sub>opt</sub></em>) ⇒ Long </code></span> <span class="fn-short-desc">Returns entity's index in the original input</span> </button></h2></div><div id="fn_ent_index" class="collapse" data-parent="#ent_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns entity's index in the original input. Note that this is an index of the entity and not of the character. If <code>t</code> is not provided the current entity is assumed.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 'true' if index of this entity in the original input is equal to 1. |
| ent_index == 1 |
| ent_index(ent_this) == 1 |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_ent_is_first"> <span><code><b>ent_is_first</b>(t: Entity<em><sub>opt</sub></em>) ⇒ Boolean </code></span> <span class="fn-short-desc">Returns <code>true</code> if this entity is the first in the original input</span> </button></h2></div><div id="fn_ent_is_first" class="collapse" data-parent="#ent_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns <code>true</code> if this entity is the first in the original input. Note that this checks index of the entity and not of the character. If <code>t</code> is not provided the current entity is assumed.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 'true' if this entity is the first entity in the original input. |
| ent_is_first |
| ent_is_first(ent_this) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_ent_is_last"> <span><code><b>ent_is_last</b>(t: Entity<em><sub>opt</sub></em>) ⇒ Boolean </code></span> <span class="fn-short-desc">Returns <code>true</code> if this entity is the last in the original input</span> </button></h2></div><div id="fn_ent_is_last" class="collapse" data-parent="#ent_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns <code>true</code> if this entity is the last in the original input. Note that this checks index of the entity and not of the character. If <code>t</code> is not provided the current entity is assumed</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 'true' if this entity is the last entity in the original input. |
| ent_is_last |
| ent_is_last(ent_this) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_ent_is_before_type"> <span><code><b>ent_is_before_type</b>(type: String) ⇒ Boolean </code></span> <span class="fn-short-desc">Returns <code>true</code> if there is a entity with type <code>type</code> after this entity</span> </button></h2></div><div id="fn_ent_is_before_type" class="collapse" data-parent="#ent_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns <code>true</code> if there is a entity with type <code>type</code> after this entity.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 'true' if there is a entity with type 'a' after this entity. |
| ent_is_before_type('a') |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_ent_is_after_type"> <span><code><b>ent_is_after_type</b>(type: String) ⇒ Boolean </code></span> <span class="fn-short-desc">Returns <code>true</code> if there is a entity with type <code>type</code> before this entity</span> </button></h2></div><div id="fn_ent_is_after_type" class="collapse" data-parent="#ent_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns <code>true</code> if there is a entity with type <code>type</code> before this entity.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 'true' if there is a entity with type 'a' before this entity. |
| ent_is_after_type('a') |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_ent_is_between_types"> <span><code><b>ent_is_between_types</b>(type1: String, type2: String) ⇒ Boolean </code></span> <span class="fn-short-desc">Returns <code>true</code> if this entity is located between entities with types <code>type1</code> and <code>type2</code></span> </button></h2></div><div id="fn_ent_is_between_types" class="collapse" data-parent="#ent_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns <code>true</code> if this entity is located between entities with types <code>type1</code> and <code>type2</code>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 'true' if this entity is located after entity with type 'before' and before the entity with type 'after'. |
| ent_is_between_types('before', 'after') |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_ent_is_between_groups"> <span><code><b>ent_is_between_groups</b>(grp1: String, grp2: String) ⇒ Boolean </code></span> <span class="fn-short-desc">Returns <code>true</code> if this entity is located between entities with group IDs <code>grp1</code> and <code>grp2</code></span> </button></h2></div><div id="fn_ent_is_between_groups" class="collapse" data-parent="#ent_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns <code>true</code> if this entity is located between entities with group IDs <code>grp1</code> and <code>grp2</code>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 'true' if this entity is located after entity belonging to the group 'before' and before the entity belonging to the group 'after'. |
| ent_is_between_groups('before', 'after') |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_ent_is_before_group"> <span><code><b>ent_is_before_group</b>(grp: String) ⇒ Boolean </code></span> <span class="fn-short-desc">Returns <code>true</code> if there is a entity that belongs to the <a class="not-code" href="/apis/latest/org/apache/nlpcraft/NCEntity.html#getGroups-0">group</a> <code>grp</code> after this entity </span> </button></h2></div><div id="fn_ent_is_before_group" class="collapse" data-parent="#ent_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns <code>true</code> if there is a entity that belongs to the <a class="not-code" href="/apis/latest/org/apache/nlpcraft/NCEntity.html#getGroups-0">group</a> <code>grp</code> after this entity.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 'true' if there is a entity that belongs to the group 'grp' after this entity. |
| ent_is_before_group('grp') |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_ent_is_after_group"> <span><code><b>ent_is_after_group</b>(grp: String) ⇒ Boolean </code></span> <span class="fn-short-desc">Returns <code>true</code> if there is a entity that belongs to the <a class="not-code" href="/apis/latest/org/apache/nlpcraft/NCEntity.html#getGroups-0">group</a> <code>grp</code> before this entity </span> </button></h2></div><div id="fn_ent_is_after_group" class="collapse" data-parent="#ent_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns <code>true</code> if there is a entity that belongs to the <a class="not-code" href="/apis/latest/org/apache/nlpcraft/NCEntity.html#getGroups-0">group</a> <code>grp</code> before this entity.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 'true' if there is a entity that belongs to the group 'grp' before this entity. |
| ent_is_after_group('grp') |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_ent_all"> <span><code><b>ent_all</b> ⇒ List[Entity] </code></span> <span class="fn-short-desc">Returns all entities from the original input </span> </button></h2></div><div id="fn_ent_all" class="collapse" data-parent="#ent_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns all entities from the original input.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: list of all entities for the original input. |
| ent_all |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_ent_count"> <span><code><b>ent_count</b> ⇒ Long </code></span> <span class="fn-short-desc">Returns number of entities from the original input </span> </button></h2></div><div id="fn_ent_count" class="collapse" data-parent="#ent_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns number of entities from the original input. It is equivalent to <code>size(ent_all)</code></p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: number of all entities for the original input. |
| ent_count |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_ent_all_for_type"> <span><code><b>ent_all_for_type</b>(type: String) ⇒ List[Entity] </code></span> <span class="fn-short-desc">Returns list of entities from the original input with type <code>type</code> </span> </button></h2></div><div id="fn_ent_all_for_type" class="collapse" data-parent="#ent_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns list of entities from the original input with type <code>type</code>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: list of entities for the original input that have type 'type'. |
| ent_all_for_type('type') |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_ent_all_for_group"> <span><code><b>ent_all_for_group</b>(grp: String) ⇒ List[Entity] </code></span> <span class="fn-short-desc">Returns list of entities from the original input that belong to the group <code>grp</code> </span> </button></h2></div><div id="fn_ent_all_for_group" class="collapse" data-parent="#ent_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns list of entities from the original input that belong to the group <code>grp</code>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: list of entities for the original input that belong to th group 'grp'. |
| ent_all_for_group('grp') |
| </pre></div></div></div></div></div><div class="tab-pane fade show" id="fn_text" role="tabpanel"><div class="accordion" id="text_fns"><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_length"> <span><code><b>length</b>(p: {String|List|Map}) ⇒ Long </code></span> <span class="fn-short-desc">Returns size or length of the given string, list or map</span> </button></h2></div><div id="fn_length" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns size or length of the given string, list or map. This function has aliases: <code><b>size</b></code> and <code><b>count</b></code>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 9 |
| length("some text") |
| |
| // Result: 3 |
| @lst = list(1, 2, 3) |
| size(@lst) |
| count(@lst) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_regex"> <span><code><b>regex</b>(s: String, rx: String) ⇒ Boolean </code></span> <span class="fn-short-desc">Checks whether string <code>s</code> matches Java regular expression <code>rx</code></span> </button></h2></div><div id="fn_regex" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns <code>true</code> if string <code><b>s</b></code> matches Java regular expression <code><b>rx</b></code>, <code>false</code> otherwise.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">regex('textabc', '^text.*$') // Returns 'true'. |
| regex('_textabc', '^text.*$') // Returns 'false'. |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_trim"> <span><code><b>trim</b>(p: String) ⇒ Long </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#trim()"><code>String.trim()</code></a></span> </button></h2></div><div id="fn_trim" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#trim()"><code>String.trim()</code></a> on given parameter <code><b>p</b></code> and returns its result. This function has alias: <code><b>strip</b></code></p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: "text" |
| trim(" text ") |
| strip(" text ") |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_uppercase"> <span><code><b>uppercase</b>(p: String) ⇒ String </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#toUpperCase()"><code>String.toUpperCase()</code></a></span> </button></h2></div><div id="fn_uppercase" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#toUpperCase()"><code>String.toUpperCase()</code></a> on given parameter <code><b>p</b></code> and returns its result.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: "TEXT" |
| uppercase("text") |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_lowercase"> <span><code><b>lowercase</b>(p: String) ⇒ String </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#toLowerCase()"><code>String.toLowerCase()</code></a></span> </button></h2></div><div id="fn_lowercase" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#toLowerCase()"><code>String.toLowerCase()</code></a> on given parameter <code><b>p</b></code> and returns its result.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: "text" |
| lowercase("TeXt") |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_is_alpha"> <span><code><b>is_alpha</b>(p: String) ⇒ Boolean </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlpha-java.lang.CharSequence-"><code>StringUtils.isAlpha()</code></a></span> </button></h2></div><div id="fn_is_alpha" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="asf" href="https://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlpha-java.lang.CharSequence-"><code>StringUtils.isAlpha()</code></a> on given parameter <code><b>p</b></code> and returns its result.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: true |
| is_alpha("text") |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_is_alphanum"> <span><code><b>is_alphanum</b>(p: String) ⇒ Boolean </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlphanumeric-java.lang.CharSequence-"><code>StringUtils.isAlphanumeric()</code></a></span> </button></h2></div><div id="fn_is_alphanum" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="asf" href="https://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlphanumeric-java.lang.CharSequence-"><code>StringUtils.isAlphanumeric()</code></a> on given parameter <code><b>p</b></code> and returns its result.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: true |
| is_alphanum("text123") |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_is_whitespace"> <span><code><b>is_whitespace</b>(p: String) ⇒ Boolean </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isWhitespace-java.lang.CharSequence-"><code>StringUtils.isWhitespace()</code></a></span> </button></h2></div><div id="fn_is_whitespace" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="asf" href="https://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isWhitespace-java.lang.CharSequence-"><code>StringUtils.isWhitespace()</code></a> on given parameter <code><b>p</b></code> and returns its result.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: false |
| is_whitespace("text123") |
| // Result: true |
| is_whitespace(" ") |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_is_num"> <span><code><b>is_num</b>(p: String) ⇒ Boolean </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isNumeric-java.lang.CharSequence-"><code>StringUtils.isNumeric()</code></a></span> </button></h2></div><div id="fn_is_num" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="asf" href="https://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isNumeric-java.lang.CharSequence-"><code>StringUtils.isNumeric()</code></a> on given parameter <code><b>p</b></code> and returns its result.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: true |
| is_num("123") |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_is_numspace"> <span><code><b>is_numspace</b>(p: String) ⇒ Boolean </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isNumericSpace-java.lang.CharSequence-"><code>StringUtils.isNumericSpace()</code></a></span> </button></h2></div><div id="fn_is_numspace" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="asf" href="https://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isNumericSpace-java.lang.CharSequence-"><code>StringUtils.isNumericSpace()</code></a> on given parameter <code><b>p</b></code> and returns its result.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: true |
| is_numspace(" 123") |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_is_alphaspace"> <span><code><b>is_alphaspace</b>(p: String) ⇒ Boolean </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlphaSpace-java.lang.CharSequence-"><code>StringUtils.isAlphaSpace()</code></a></span> </button></h2></div><div id="fn_is_alphaspace" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="asf" href="https://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlphaSpace-java.lang.CharSequence-"><code>StringUtils.isAlphaSpace()</code></a> on given parameter <code><b>p</b></code> and returns its result.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: true |
| is_alphaspace(" text ") |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_is_alphanumspace"> <span><code><b>is_alphanumspace</b>(p: String) ⇒ Boolean </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlphaNumericSpace-java.lang.CharSequence-"><code>StringUtils.isAlphaNumericSpace()</code></a></span> </button></h2></div><div id="fn_is_alphanumspace" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="asf" href="https://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlphaNumericSpace-java.lang.CharSequence-"><code>StringUtils.isAlphaNumericSpace()</code></a> on given parameter <code><b>p</b></code> and returns its result.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: true |
| is_alphanumspace(" 123 text ") |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_split"> <span><code><b>split</b>(p1: String, p2: String) ⇒ List[String] </code></span> <span class="fn-short-desc">Calls <code><b>p1</b></code>.<a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#split(java.lang.String)"><code>split(<b>p2</b>)</code></a></span> </button></h2></div><div id="fn_split" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <code><b>p1</b></code>.<a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#split(java.lang.String)"><code>split(<b>p2</b>)</code></a> and returns its result converted to the list.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: [ "a", "b", "c" ] |
| split("a|b|c", "|") |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_split_trim"> <span><code><b>split_trim</b>(p1: String, p2: String) ⇒ List[String] </code></span> <span class="fn-short-desc">Calls <code><b>p1</b></code>.<a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#split(java.lang.String)"><code>split(<b>p2</b>)</code></a></span> </button></h2></div><div id="fn_split_trim" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <code><b>p1</b></code>.<a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#split(java.lang.String)"><code>split(<b>p2</b>)</code></a> converting the result to the list. Then calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#strip()">String.strip()</a> on each element.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: ["a", "b", "c"] |
| split_trim("a | b | c", "|") |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_starts_with"> <span><code><b>starts_with</b>(p1: String, p2: String) ⇒ Boolean </code></span> <span class="fn-short-desc">Calls <code><b>p1</b></code>.<a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#split(java.lang.String)"><code>startsWith(<b>p2</b>)</code></a></span> </button></h2></div><div id="fn_starts_with" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <code><b>p1</b></code>.<a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#split(java.lang.String)"><code>startsWith(<b>p2</b>)</code></a> and returns its result.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: true |
| starts_width("abc", "ab") |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_ends_with"> <span><code><b>ends_with</b>(p1: String, p2: String) ⇒ Boolean </code></span> <span class="fn-short-desc">Calls <code><b>p1</b></code>.<a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#split(java.lang.String)"><code>endsWith(<b>p2</b>)</code></a></span> </button></h2></div><div id="fn_ends_with" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <code><b>p1</b></code>.<a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#split(java.lang.String)"><code>endsWith(<b>p2</b>)</code></a> and returns its result.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: true |
| ends_width("abc", "bc") |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_contains"> <span><code><b>contains</b>(p1: String, p2: String) ⇒ Boolean </code></span> <span class="fn-short-desc">Calls <code><b>p1</b></code>.<a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#contains(java.lang.CharSequence)"><code>contains(<b>p2</b>)</code></a></span> </button></h2></div><div id="fn_contains" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <code><b>p1</b></code>.<a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#contains(java.lang.CharSequence)"><code>contains(<b>p2</b>)</code></a> and returns its result.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: true |
| contains("abc", "bc") |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_index_of"> <span><code><b>index_of</b>(p1: String, p2: String) ⇒ Long </code></span> <span class="fn-short-desc">Calls <code><b>p1</b></code>.<a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#indexOf(java.lang.String)"><code>indexOf(<b>p2</b>)</code></a></span> </button></h2></div><div id="fn_index_of" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <code><b>p1</b></code>.<a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#indexOf(java.lang.String)"><code>indexOf(<b>p2</b>)</code></a> and returns its result.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 1 |
| index_of("abc", "bc") |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_substr"> <span><code><b>substr</b>(p1: String, p2: Long, p3: Long) ⇒ String </code></span> <span class="fn-short-desc">Calls <code><b>p1</b></code>.<a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#substring(int,int)"><code>substring(<b>p2</b>, <b>p3</b>)</code></a></span> </button></h2></div><div id="fn_substr" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <code><b>p1</b></code>.<a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#substring(int,int)"><code>substring(<b>p2</b>, <b>p3</b>)</code></a> and returns its result.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: "bc" |
| substr("abc", 1, 3) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_replace"> <span><code><b>replace</b>(p1: String, p2: String, p3: String) ⇒ String </code></span> <span class="fn-short-desc">Calls <code><b>p1</b></code>.<a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#replace(java.lang.CharSequence,java.lang.CharSequence)"><code>replace(<b>p2</b>, <b>p3</b>)</code></a></span> </button></h2></div><div id="fn_replace" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <code><b>p1</b></code>.<a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#replace(java.lang.CharSequence,java.lang.CharSequence)"><code>replace(<b>p2</b>, <b>p3</b>)</code></a> and returns its result.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: "aBC" |
| replace("abc", "bc", "BC") |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_to_double"> <span><code><b>to_double</b>(p1: {Long|String}) ⇒ Double </code></span> <span class="fn-short-desc">Converts given integer or string to double value</span> </button></h2></div><div id="fn_to_double" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Converts given integer or string to double value.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 1.2 |
| to_double("1.2") |
| // Result: 1.0 |
| to_double(1) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_to_int"> <span><code><b>to_int</b>(p1: {Double|String}) ⇒ Long </code></span> <span class="fn-short-desc">Converts given double or string to integer value</span> </button></h2></div><div id="fn_to_int" class="collapse" data-parent="#text_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Converts given double or string to integer value. In case of double value it will be rounded to the nearest integer value.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 1 |
| to_int("1.2") |
| to_int(1.2) |
| </pre></div></div></div></div></div><div class="tab-pane fade show" id="fn_math" role="tabpanel"><div class="accordion" id="math_fns"><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_abs"> <span><code><b>abs</b>(x: {Long|Double}) ⇒ {Long|Double} </code></span> <span class="fn-short-desc">Returns absolute value for parameter <code><b>x</b></code></span> </button></h2></div><div id="fn_abs" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns absolute value for parameter <code><b>x</b></code>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 1 |
| abs(-1) |
| // Result: 1.5 |
| abs(-1.5) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_ceil"> <span><code><b>ceil</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#ceil(double)"><code>Math.ceil(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_ceil" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#ceil(double)"><code>Math.ceil(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 2.0 |
| ceil(1.5) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_floor"> <span><code><b>floor</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#floor(double)"><code>Math.floor(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_floor" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#floor(double)"><code>Math.floor(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 1.0 |
| floor(1.5) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_rint"> <span><code><b>rint</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#rint(double)"><code>Math.rint(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_rint" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#rint(double)"><code>Math.rint(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 1.0 |
| rint(1.2) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_round"> <span><code><b>round</b>(d: Double) ⇒ Long </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#round(double)"><code>Math.round(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_round" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#round(double)"><code>Math.round(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 1 |
| round(1.2) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_signum"> <span><code><b>signum</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#signum(double)"><code>Math.signum(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_signum" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#signum(double)"><code>Math.signum(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 1.0 |
| signum(1.2) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_sqrt"> <span><code><b>sqrt</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#sqrt(double)"><code>Math.sqrt(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_sqrt" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#sqrt(double)"><code>Math.sqrt(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 4.0 |
| sqrt(2.0) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_cbrt"> <span><code><b>cbrt</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#cbrt(double)"><code>Math.cbrt(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_cbrt" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#cbrt(double)"><code>Math.cbrt(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: -3.0 |
| cbrt(-27.0) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_acos"> <span><code><b>acos</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#acos(double)"><code>Math.acos(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_acos" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#acos(double)"><code>Math.acos(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">acos(1.0) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_asin"> <span><code><b>asin</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#asin(double)"><code>Math.asin(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_asin" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#asin(double)"><code>Math.asin(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">asin(1.0) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_atan"> <span><code><b>atan</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#atan(double)"><code>Math.atan(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_atan" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#atan(double)"><code>Math.atan(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">atan(1.0) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_tan"> <span><code><b>tan</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#tan(double)"><code>Math.tan(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_tan" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#tan(double)"><code>Math.tan(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">tan(1.0) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_sin"> <span><code><b>sin</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#sin(double)"><code>Math.sin(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_sin" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#sin(double)"><code>Math.sin(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">sin(1.0) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_cos"> <span><code><b>cos</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#cos(double)"><code>Math.cos(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_cos" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#cos(double)"><code>Math.cos(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">cos(1.0) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_tanh"> <span><code><b>tanh</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#tanh(double)"><code>Math.tanh(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_tanh" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#tanh(double)"><code>Math.tanh(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">tanh(1.0) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_sinh"> <span><code><b>sinh</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#sinh(double)"><code>Math.sinh(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_sinh" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#sinh(double)"><code>Math.sinh(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">sinh(1.0) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_cosh"> <span><code><b>cosh</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#cosh(double)"><code>Math.cosh(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_cosh" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#cosh(double)"><code>Math.cosh(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">cosh(1.0) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_atan2"> <span><code><b>atan2</b>(d1: Double, d2: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#atan2(double, double)"><code>Math.atan2(<b>d2</b>, <b>d2</b>)</code></a></span> </button></h2></div><div id="fn_atan2" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#atan2(double, double)"><code>Math.atan2(<b>d1</b>, <b>d2</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">atan2(1.0, 1.0) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_degrees"> <span><code><b>degrees</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#toDegrees(double)"><code>Math.toDegrees(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_degrees" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#toDegrees(double)"><code>Math.toDegrees(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">degrees(1.0) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_radians"> <span><code><b>radians</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#toRadians(double)"><code>Math.toRadians(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_radians" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#toRadians(double)"><code>Math.toRadians(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">radians(1.0) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_exp"> <span><code><b>exp</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#exp(double)"><code>Math.exp(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_exp" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#exp(double)"><code>Math.exp(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">exp(1.0) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_expm1"> <span><code><b>expm1</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#expm1(double)"><code>Math.expm1(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_expm1" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#expm1(double)"><code>Math.expm1(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">expm1(1.0) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_log"> <span><code><b>log</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#log(double)"><code>Math.log(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_log" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#log(double)"><code>Math.log(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">log(1.0) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_log10"> <span><code><b>log10</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#log10(double)"><code>Math.log10(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_log10" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#log10(double)"><code>Math.log10(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">log10(1.0) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_square"> <span><code><b>square</b>(x: {Long|Double}) ⇒ {Long|Double} </code></span> <span class="fn-short-desc">Returns square of <code>><b>x</b></code></span> </button></h2></div><div id="fn_square" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns square of <code>><b>x</b></code></p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 4 |
| square(2) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_log1p"> <span><code><b>log1p</b>(d: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#log1p(double)"><code>Math.log1p(<b>d</b>)</code></a></span> </button></h2></div><div id="fn_log1p" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#log1p(double)"><code>Math.log1p(<b>d</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">log1p(1.0) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_pi"> <span><code><b>pi</b> ⇒ Double </code></span> <span class="fn-short-desc">Returns PI constant</span> </button></h2></div><div id="fn_pi" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns PI constant.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 3.14159265359 |
| pi |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_euler"> <span><code><b>pi</b> ⇒ Double </code></span> <span class="fn-short-desc">Returns Euler constant</span> </button></h2></div><div id="fn_euler" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns Euler constant.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 0.5772156649 |
| euler |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_max"> <span><code><b>max</b>(c: List) ⇒ Any </code></span> <span class="fn-short-desc">Returns maximum value for given list</span> </button></h2></div><div id="fn_max" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns maximum value for given list. Throws runtime exception if the list is empty. This function uses a natural ordering.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 3 |
| max(list(1, 2, 3)) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_min"> <span><code><b>min</b>(c: List) ⇒ Any </code></span> <span class="fn-short-desc">Returns minimum value for given list</span> </button></h2></div><div id="fn_min" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns minimum value for given list. Throws runtime exception if the list is empty. This function uses a natural ordering.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 1 |
| min(list(1, 2, 3)) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_avg"> <span><code><b>avg</b>(c: List[{Long|Double|String}]) ⇒ Double </code></span> <span class="fn-short-desc">Returns average (mean) value for given list</span> </button></h2></div><div id="fn_avg" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns average (mean) value for given list of ints, doubles or strings. Throws runtime exception if the list is empty. If list list contains strings, they have to be convertable to int or double.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 2.0 |
| avg(list(1, 2, 3)) |
| avg(list("1.0", 2, "3")) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_stdev"> <span><code><b>stdev</b>(c: List[{Long|Double|String}]) ⇒ Double </code></span> <span class="fn-short-desc">Returns standard deviation value for given list</span> </button></h2></div><div id="fn_stdev" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns standard deviation value for given list of ints, doubles or strings. Throws runtime exception if the list is empty. If list list contains strings, they have to be convertable to int or double.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">stdev(list(1, 2, 3)) |
| stdev(list("1.0", 2, "3")) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_pow"> <span><code><b>pow</b>(d1: Double, d2: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#pow(double, double)"><code>Math.pow(<b>d2</b>, <b>d2</b>)</code></a></span> </button></h2></div><div id="fn_pow" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#pow(double, double)"><code>Math.pow(<b>d1</b>, <b>d2</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 4.0 |
| pow(2.0, 2.0) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_hypot"> <span><code><b>hypot</b>(d1: Double, d2: Double) ⇒ Double </code></span> <span class="fn-short-desc">Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#hypot(double, double)"><code>Math.hypot(<b>d2</b>, <b>d2</b>)</code></a></span> </button></h2></div><div id="fn_hypot" class="collapse" data-parent="#math_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Math.html#hypot(double, double)"><code>Math.hypot(<b>d1</b>, <b>d2</b>)</code></a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">hypot(2.0, 2.0) |
| </pre></div></div></div></div></div><div class="tab-pane fade show" id="fn_collection" role="tabpanel"><div class="accordion" id="collections_fns"><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_list"> <span><code><b>list</b>(t: Any...<em><sub>opt</sub></em>) ⇒ List[Any] </code></span> <span class="fn-short-desc">Returns new list with given parameters</span> </button></h2></div><div id="fn_list" class="collapse" data-parent="#collections_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns new list with given parameters.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: [] |
| list |
| // Result: [1, 2, 3] |
| list(1, 2, 3) |
| // Result: ["1", true, 1.25] |
| list("1", 2 == 2, to_double('1.25')) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_get"> <span><code><b>get</b>(c: {List|Map}, k: {Long|Any}) ⇒ Any </code></span> <span class="fn-short-desc">Gets element <code><b>k</b></code> from either list or map <code><b>c</b></code></span> </button></h2></div><div id="fn_get" class="collapse" data-parent="#collections_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Gets element from either list or map <code><b>c</b></code>. For list the <code><b>k</b></code> must be 0-based integer index in the list.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 1 |
| get(list(1, 2, 3), 0) |
| // Result: true |
| get(json('{"a": true}'), "a") |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_has"> <span><code><b>has</b>(c: List, x: Any) ⇒ Boolean </code></span> <span class="fn-short-desc">Calls <code><b>c</b></code>.<a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/List.html#contains(java.lang.Object)"><code>contains(<b>x</b></code>)</a></span> </button></h2></div><div id="fn_has" class="collapse" data-parent="#collections_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <code><b>c</b></code>.<a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/List.html#contains(java.lang.Object)"><code>contains(<b>x</b></code>)</a> and returns its result.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: true |
| has(list("a", "b"), "a") |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_has_all"> <span><code><b>has_all</b>(c: List, x: Any) ⇒ Boolean </code></span> <span class="fn-short-desc">Calls <code><b>c</b></code>.<a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/List.html#containsAll(java.util.Collection)"><code>containsAll(<b>x</b></code>)</a></span> </button></h2></div><div id="fn_has_all" class="collapse" data-parent="#collections_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Calls <code><b>c</b></code>.<a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/List.html#containsAll(java.util.Collection)"><code>containsAll(<b>x</b></code>)</a> and returns its result.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: false |
| has_all(list("a", "b"), "a") |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_has_any"> <span><code><b>has_any</b>(c: List, x: List) ⇒ Boolean </code></span> <span class="fn-short-desc">Checks if list <code><b>c</b></code> contains any of the elements from the list <code><b>x</b></code></span> </button></h2></div><div id="fn_has_any" class="collapse" data-parent="#collections_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Checks if list <code><b>c</b></code> contains any of the elements from the list <code><b>x</b></code>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: true |
| has_any(list("a", "b"), list("a")) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_first"> <span><code><b>first</b>(c: List) ⇒ Any </code></span> <span class="fn-short-desc">Returns first element from the list <code><b>c</b></code> or <code>null</code></span> </button></h2></div><div id="fn_first" class="collapse" data-parent="#collections_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns first element from the list <code><b>c</b></code> or <code>null</code> if the list is empty.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: "a" |
| first(list("a", "b")) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_last"> <span><code><b>last</b>(c: List) ⇒ Any </code></span> <span class="fn-short-desc">Returns last element from the list <code><b>c</b></code> or <code>null</code></span> </button></h2></div><div id="fn_last" class="collapse" data-parent="#collections_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns last element from the list <code><b>c</b></code> or <code>null</code> if the list is empty.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: "b" |
| last(list("a", "b")) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_keys"> <span><code><b>keys</b>(m: Map) ⇒ Any </code></span> <span class="fn-short-desc">Returns list of keys for map <code><b>m</b></code></span> </button></h2></div><div id="fn_keys" class="collapse" data-parent="#collections_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns list of keys for map <code><b>m</b></code>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: ["a", "b"] |
| keys(json('{"a": true, "b": 1}')) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_values"> <span><code><b>values</b>(m: Map) ⇒ Any </code></span> <span class="fn-short-desc">Returns list of values for map <code><b>m</b></code></span> </button></h2></div><div id="fn_values" class="collapse" data-parent="#collections_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns list of values for map <code><b>m</b></code>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: [true, 1] |
| values(json('{"a": true, "b": 1}')) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_reverse"> <span><code><b>reverse</b>(x: List) ⇒ List </code></span> <span class="fn-short-desc">Reverses the list <code><b>x</b></code></span> </button></h2></div><div id="fn_reverse" class="collapse" data-parent="#collections_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns reversed list <code><b>x</b></code>. This function uses the natural sorting order.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: [3, 2, 1] |
| reverse(list(1, 2, 3)) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_sort"> <span><code><b>sort</b>(x: List) ⇒ List </code></span> <span class="fn-short-desc">Sorts the list <code><b>x</b></code></span> </button></h2></div><div id="fn_sort" class="collapse" data-parent="#collections_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns sorted list <code><b>x</b></code>. This function uses the natural sorting order.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: [1, 2, 3] |
| sort(list(2, 1, 3)) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_is_empty"> <span><code><b>is_empty</b>(x: {String|List|Map}) ⇒ Boolean </code></span> <span class="fn-short-desc">Checks if given string, list or map is <code><b>x</b></code> empty</span> </button></h2></div><div id="fn_is_empty" class="collapse" data-parent="#collections_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Checks if given string, list or map <code><b>x</b></code> is empty.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: false |
| is_empty("text") |
| is_empty(list(1)) |
| is_empty(json('{"a": 1}')) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_non_empty"> <span><code><b>non_empty</b>(x: {String|List|Map}) ⇒ Boolean </code></span> <span class="fn-short-desc">Checks if given string, list or map is <code><b>x</b></code> non empty</span> </button></h2></div><div id="fn_non_empty" class="collapse" data-parent="#collections_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Checks if given string, list or map <code><b>x</b></code> is non empty.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: true |
| non_empty("text") |
| non_empty(list(1)) |
| non_empty(json('{"a": 1}')) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_distinct"> <span><code><b>distinct</b>(x: List) ⇒ List </code></span> <span class="fn-short-desc">Makes list <code><b>x</b></code> distinct</span> </button></h2></div><div id="fn_distinct" class="collapse" data-parent="#collections_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Makes list <code><b>x</b></code> distinct.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: [1, 2, 3] |
| distinct(list(1, 2, 2, 3, 1)) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_concact"> <span><code><b>concat</b>(x1: List, x1: List) ⇒ List </code></span> <span class="fn-short-desc">Concatenates lists <code><b>x1</b></code> and <code><b>x2</b></code></span> </button></h2></div><div id="fn_concact" class="collapse" data-parent="#collections_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Concatenates lists <code><b>x1</b></code> and <code><b>x2</b></code>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: [1, 2, 3, 4] |
| concat(list(1, 2), list(3, 4)) |
| </pre></div></div></div></div></div><div class="tab-pane fade show" id="fn_metadata" role="tabpanel"><div class="accordion" id="metadata_fns"><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_meta_ent"> <span><code><b>meta_ent</b>(p: String) ⇒ Any </code></span> <span class="fn-short-desc">Gets entity metadata property <code><b>p</b></code></span> </button></h2></div><div id="fn_meta_ent" class="collapse" data-parent="#metadata_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Gets entity metadata property <code><b>p</b></code>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 'nlp:token:text' entity metadata property. |
| meta_ent('nlp:token:text') |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_meta_req"> <span><code><b>meta_req</b>(p: String) ⇒ Any </code></span> <span class="fn-short-desc">Gets request metadata property <code><b>p</b></code></span> </button></h2></div><div id="fn_meta_req" class="collapse" data-parent="#metadata_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Gets request metadata property <code><b>p</b></code>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 'my:prop' user request data property. |
| meta_req('my:prop') |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_meta_intent"> <span><code><b>meta_intent</b>(p: String) ⇒ Any </code></span> <span class="fn-short-desc">Gets intent metadata property <code><b>p</b></code></span> </button></h2></div><div id="fn_meta_intent" class="collapse" data-parent="#metadata_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Gets intent metadata property <code><b>p</b></code>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 'my:prop' intent metadata property. |
| meta_intent('my:prop') |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_meta_conv"> <span><code><b>meta_conv</b>(p: String) ⇒ Any </code></span> <span class="fn-short-desc">Gets conversation metadata property <code><b>p</b></code></span> </button></h2></div><div id="fn_meta_conv" class="collapse" data-parent="#metadata_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Gets conversation metadata property <code><b>p</b></code>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 'my:prop' conversation metadata property. |
| meta_conv('my:prop') |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_meta_frag"> <span><code><b>meta_frag</b>(p: String) ⇒ Any </code></span> <span class="fn-short-desc">Gets fragment metadata property <code><b>p</b></code></span> </button></h2></div><div id="fn_meta_frag" class="collapse" data-parent="#metadata_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Gets fragment metadata property <code><b>p</b></code>. Fragment metadata can be optionally passed in when referencing the fragment to parameterize it.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 'my:prop' fragment metadata property. |
| meta_frag('my:prop') |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_meta_sys"> <span><code><b>meta_sys</b>(p: String) ⇒ Any </code></span> <span class="fn-short-desc">Gets system property or environment variable <code><b>p</b></code></span> </button></h2></div><div id="fn_meta_sys" class="collapse" data-parent="#metadata_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Gets system property or environment variable <code><b>p</b></code>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 'java.home' system property. |
| meta_sys('java.home') |
| // Result: 'HOME' environment variable. |
| meta_sys('HOME') |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_meta_cfg"> <span><code><b>meta_cfg</b>(p: String) ⇒ Any </code></span> <span class="fn-short-desc">Gets configuration property <code><b>p</b></code></span> </button></h2></div><div id="fn_meta_cfg" class="collapse" data-parent="#metadata_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Gets configuration property <code><b>p</b></code>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 'my:prop' configuration property. |
| meta_cfg('my:prop') |
| </pre></div></div></div></div></div><div class="tab-pane fade show" id="fn_datetime" role="tabpanel"><div class="accordion" id="datetime_fns"><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_year"> <span><code><b>year</b> ⇒ Long </code></span> <span class="fn-short-desc">Returns current year</span> </button></h2></div><div id="fn_year" class="collapse" data-parent="#datetime_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns current year.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 2021 |
| year |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_month"> <span><code><b>month</b> ⇒ Long </code></span> <span class="fn-short-desc">Returns current month: 1 ... 12 </span> </button></h2></div><div id="fn_month" class="collapse" data-parent="#datetime_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns current month: 1 ... 12.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 5 |
| month |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_day_of_month"> <span><code><b>day_of_month</b> ⇒ Long </code></span> <span class="fn-short-desc">Returns current day of the month: 1 ... 31 </span> </button></h2></div><div id="fn_day_of_month" class="collapse" data-parent="#datetime_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns current day of the month: 1 ... 31.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 5 |
| day_of_month |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_day_of_week"> <span><code><b>day_of_week</b> ⇒ Long </code></span> <span class="fn-short-desc">Returns current day of the week: 1 ... 7 </span> </button></h2></div><div id="fn_day_of_week" class="collapse" data-parent="#datetime_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns current day of the week: 1 ... 7.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 5 |
| day_of_week |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_day_of_year"> <span><code><b>day_of_year</b> ⇒ Long </code></span> <span class="fn-short-desc">Returns current day of the year: 1 ... 365 </span> </button></h2></div><div id="fn_day_of_year" class="collapse" data-parent="#datetime_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns current day of the year: 1 ... 365.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 51 |
| day_of_year |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_hour"> <span><code><b>hour</b> ⇒ Long </code></span> <span class="fn-short-desc">Returns current hour: 0 ... 23 </span> </button></h2></div><div id="fn_hour" class="collapse" data-parent="#datetime_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns current hour: 0 ... 23.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 11 |
| hour |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_minute"> <span><code><b>minute</b> ⇒ Long </code></span> <span class="fn-short-desc">Returns current minute: 0 ... 59 </span> </button></h2></div><div id="fn_minute" class="collapse" data-parent="#datetime_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns current minute: 0 ... 59.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 11 |
| minute |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_second"> <span><code><b>second</b> ⇒ Long </code></span> <span class="fn-short-desc">Returns current second: 0 ... 59 </span> </button></h2></div><div id="fn_second" class="collapse" data-parent="#datetime_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns current second: 0 ... 59.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 11 |
| second |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_week_of_month"> <span><code><b>week_of_month</b> ⇒ Long </code></span> <span class="fn-short-desc">Returns current week of the month: 1 ... 4 </span> </button></h2></div><div id="fn_week_of_month" class="collapse" data-parent="#datetime_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns current week of the month: 1 ... 4.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 2 |
| week_of_month |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_week_of_year"> <span><code><b>week_of_year</b> ⇒ Long </code></span> <span class="fn-short-desc">Returns current week of the year: 1 ... 56 </span> </button></h2></div><div id="fn_week_of_year" class="collapse" data-parent="#datetime_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns current week of the year: 1 ... 56.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 21 |
| week_of_year |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_quarter"> <span><code><b>quarter</b> ⇒ Long </code></span> <span class="fn-short-desc">Returns current quarter: 1 ...4 </span> </button></h2></div><div id="fn_quarter" class="collapse" data-parent="#datetime_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns current quarter: 1 ... 4.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 2 |
| quarter |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_now"> <span><code><b>now</b> ⇒ Long </code></span> <span class="fn-short-desc">Returns current time in milliseconds </span> </button></h2></div><div id="fn_now" class="collapse" data-parent="#datetime_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns current time in milliseconds.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 122312341212 |
| now |
| </pre></div></div></div></div></div><div class="tab-pane fade show" id="fn_req" role="tabpanel"><div class="accordion" id="req_fns"><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_req_id"> <span><code><b>req_id</b> ⇒ String </code></span> <span class="fn-short-desc">Returns <a class="not-code" href="/apis/latest/org/apache/nlpcraft/NCRequest.html#getRequestId-0">request ID</a></span> </button></h2></div><div id="fn_req_id" class="collapse" data-parent="#req_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns <a class="not-code" href="/apis/latest/org/apache/nlpcraft/NCRequest.html#getRequestId-0">request ID</a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: request ID. |
| req_id |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_req_text"> <span><code><b>req_text</b> ⇒ String </code></span> <span class="fn-short-desc">Returns request <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/NCRequest.html#getText-0">text</a></span> </button></h2></div><div id="fn_req_text" class="collapse" data-parent="#req_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns request <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/NCRequest.html#getText-0">text</a>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: request text. |
| req_text |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_req_tstamp"> <span><code><b>req_tstamp</b> ⇒ Long </code></span> <span class="fn-short-desc">Gets UTC/GMT receive <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/NCRequest.html#getReceiveTimestamp-0">timestamp</a></span> </button></h2></div><div id="fn_req_tstamp" class="collapse" data-parent="#req_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Gets UTC/GMT <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/NCRequest.html#getReceiveTimestamp-0">timestamp</a> in ms when user input was received.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: input receive timsstamp in ms. |
| req_tstamp |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_user_id"> <span><code><b>user_id</b> ⇒ String </code></span> <span class="fn-short-desc">Returns <code>user ID</code></span> </button></h2></div><div id="fn_user_id" class="collapse" data-parent="#req_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns <code>user ID</code></p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: user ID. |
| user_id |
| </pre></div></div></div></div></div><div class="tab-pane fade show" id="fn_other" role="tabpanel"><div class="accordion" id="other_fns"><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_if"> <span><code><b>if</b>(c: Boolean, then: Any: else: Any) ⇒ Any </code></span> <span class="fn-short-desc">This function provides 'if-then-else' equivalent</span> </button></h2></div><div id="fn_if" class="collapse" data-parent="#other_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> This function provides 'if-then-else' equivalent as IDL does not provide branching on the language level. This function will evaluate <code><b>c</b></code> parameter and either return <code><b>then</b></code> value if it evaluates to <code>true</code> or <code><b>else</b></code> value in case if it evaluates to <code>false</code>. Note that evaluation will be short-circuit, i.e. either <code><b>then</b></code> or <code><b>else</b></code> will actually be computed but not both.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: |
| // - 'list(1, 2, 3)' if 1st parameter is 'true'. |
| // - 'null' if 1st parameter is 'false'. |
| if(meta_model('my_prop') == true, list(1, 2, 3), null) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_json"> <span><code><b>json</b>(p: String) ⇒ Map[String, Any] </code></span> <span class="fn-short-desc">Converts JSON in <code><b>p</b></code> parameter to a map</span> </button></h2></div><div id="fn_json" class="collapse" data-parent="#other_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Converts JSON in <code><b>p</b></code> parameter to a map. Use single quoted string to avoid escaping double quotes in JSON.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: Map. |
| json('{"a": 2, "b": [1, 2, 3]}') |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_to_string"> <span><code><b>to_string</b>(p: Any) ⇒ {String|List[String]} </code></span> <span class="fn-short-desc">Converts <code><b>p</b></code> parameter to a string</span> </button></h2></div><div id="fn_to_string" class="collapse" data-parent="#other_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Converts <code><b>p</b></code> parameter to a string. In case of a list this function will convert individual list elements to string and return the list of strings.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: "1.25" |
| to_string(1.25) |
| // Result: list("1", "2", "3") |
| to_string(list(1, 2, 3)) |
| </pre></div></div></div><div class="card"><div class="card-header"><h2 class="mb-0"> <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#fn_or_else"> <span><code><b>or_else</b>(p: Any, a: Any) ⇒ Any </code></span> <span class="fn-short-desc">Returns <code><b>p</b></code> if it is not <code>null</code>, <code><b>a</b></code> otherwise</span> </button></h2></div><div id="fn_or_else" class="collapse" data-parent="#other_fns"><div class="card-body"><p class="fn-desc"> <em>Description:</em><br> Returns <code><b>p</b></code> if it is not <code>null</code>, <code><b>a</b></code> otherwise. Note that evaluation will be short-circuit, i.e. <code><b>a</b></code> will be evaluated only if <code><b>p</b></code> is <code>null</code>.</p><p class="fn-usage"> <em>Usage:</em><br></p><pre class="brush:idl">// Result: 'some_prop' model metadata or 'text' if one is 'null'. |
| @dflt = 'text' |
| or_else(meta_model('some_prop'), @dflt) |
| </pre></div></div></div></div></div></div></section><section id="idl_location" ><h2 class="section-title">IDL Location <a href="#"><i class="top-link fas fa-fw fa-angle-double-up"></i></a></h2><p> IDL declarations can be placed in different locations based on user preferences:</p><ul><li><p> <code>NCIntent</code> java annotation takes a string as its parameter that should be a valid IDL declaration. For example, Scala code snippet:</p><pre class="brush: scala, highlight: [1, 2]"> |
| @NCIntent("import('/opt/myproj/global_fragments.idl')") // Importing. |
| @NCIntent("intent=act term(act)={has(ent_groups, 'act')} fragment(f1)") // Defining in place. |
| def onMatch( |
| @NCIntentTerm("act") actEnt: NCEntity, |
| @NCIntentTerm("loc") locEnts: List[NCEntity] |
| ): NCResult = { |
| ... |
| } |
| </pre><li> External <code>*.idl</code> files contain IDL declarations and can be imported in any other places where IDL declarations are allowed. See <code>import()</code> statement explanation below. For example:<pre class="brush: idl"> |
| /* |
| * File 'my_intents.idl'. |
| * ====================== |
| */ |
| |
| import('/opt/globals.idl') // Import global intents and fragments. |
| |
| // Fragments. |
| // ---------- |
| fragment=buzz term~{# == 'x:alarm'} |
| fragment=when |
| term(nums)~{ |
| // Term variables. |
| @type = meta_ent('num:unittype') |
| @iseq = meta_ent('num:isequalcondition') |
| |
| # == 'num' && @type != 'datetime' && @iseq == true |
| }[0,7] |
| |
| // Intents. |
| // -------- |
| intent=alarm |
| fragment(buzz) |
| fragment(when) |
| </pre></ul></section><section id="binding"><h2 class="section-title">Binding Intent <a href="#"><i class="top-link fas fa-fw fa-angle-double-up"></i></a></h2><p> IDL intents must be bound to their callback methods. This binding is accomplished using the following Java annotations:</p><table class="gradient-table"><thead><tr><th>Annotation<th>Target<th>Description<tbody><tr><td><code>@NCIntent</code><td>Callback method or model class<td><p> When applied to a method this annotation allows to define IDL intent in-place on the method serving as its callback. This annotation can also be applied to a model's class in which case it will just declare the intent without binding it and the callback method will need to use <code>@NCIntentRef</code> annotation to actually bind it to the declared intent above. Note that multiple intents can be bound to the same callback method, but only one callback method can be bound with a given intent.</p><p> This method is ideal for simple intents and quick declaration right in the source code and has all the benefits of having IDL to be part of the source code. However, multi-line IDL declaration can be awkward to add and maintain depending on Scala language, i.e. multi-line string literal support. In such cases it is advisable to move IDL declarations into separate <code>*.idl</code> file or files and import them at the model class level.</p><tr><td><code>@NCIntentRef</code><td>Callback method<td> This annotation allows to reference an intent defined elsewhere like an external <code>*.idl</code> file, or other <code>@NCIntent</code> annotations. In real applications, this is a most common way to bound an externally defined intent to its callback method.<tr><td><code>@NCIntentObject</code><td>Model class field<td> Marker annotation that can be applied to class member of main model. The fields objects annotated with this annotation are scanned the same way as main model.<tr><td><code>@NCIntentTerm</code><td>Callback method parameter<td> This annotation marks a formal callback method parameter to receive term's entities when the intent to which this term belongs is selected as the best match.</table><p> Here's a couple of examples of intent declarations to illustrate the basics of intent declaration and usage.</p><p> An intent from <a href="examples/light_switch.html">Light Switch</a> example:</p><pre class="brush: scala"> |
| @NCIntent("intent=ls term(act)={has(ent_groups, 'act')} term(loc)={# == 'ls:loc'}*") |
| def onMatch( |
| @ctx: NCContext, |
| @im: NCIntentMatch, |
| @NCIntentTerm("act") actEnt: NCEntity, |
| @NCIntentTerm("loc") locEnts: List[NCEntity] |
| ): NCResult = { |
| ... |
| } |
| </pre><p> <b>NOTES:</b></p><ul><li> The intent is defined in-place using <code>@NCIntent</code> annotation.<li> A term match is defined as one or more entities. Term can be optional if its min quantifier is zero.<li> An intent <code>act</code> has two non-conversational terms: one mandatory term and another that can match zero or more entities with method <code>onMatch(...)</code> as its callback.<li> Terms is conversational if it uses <code>'~'</code> and non-conversational if it uses <code>'='</code> 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 entities for this term. Note that the terms that were fully or partially matched using entities 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 entities found only in the current user input without looking at the conversation context.<li> Method <code>onMatch(...)</code> will be called if and when this intent is selected as the best match.<li> Note that terms have <code>min=1, max=1</code> quantifiers by default, i.e. one and only one.<li> First term defines any single entity that belongs to the group <code>act</code>. Note that model elements can belong to multiple groups.<li> Note that both terms have IDs (<code>act</code> and <code>loc</code>) that are used in <code>onMatch(...)</code> method parameters to automatically assign terms' entities to the formal method parameters using <code>@NCIntentTerm</code> annotations.</ul><p> In the following <a href="examples/time.html">Time</a> example the intent is defined model class and referenced in code using <code>@NCIntentRef</code> annotation:</p><pre class="brush: js, highlight: [2, 5]"> |
| @NCIntent("fragment=city term(city)~{# == 'opennlp:location'}") |
| @NCIntent("intent=intent2 term~{# == 'x:time'} fragment(city)") |
| class TimeModel extends NCModel( |
| ... |
| @NCIntentRef("intent2") |
| private def onRemoteMatch( |
| ctx: NCContext, im: NCIntentMatch, @NCIntentTerm("city") cityEnt: NCEntity |
| ): NCResult = |
| ... |
| </pre><p> <b>NOTES:</b></p><ul><li> Intent is defined in the model, <code>line 2</code>.<li> This intent is referenced by annotation <code>@NCIntentRef("intent2")</code> with method <code>onMatch(...)</code> as its callback, <code>line 5</code>.<li> This example defines an intent with two conversational terms both of which have to found for the intent to match.<li> Terms is conversational if it uses <code>'~'</code> and non-conversational if it uses <code>'='</code> 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 entities for this term. Note that the terms that were fully or partially matched using entities 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 entities found only in the current user input without looking at the conversation context.<li> Method <code>onMatch(...)</code> will be called when this intent is the best match detected.<li> Note that terms have <code>min=1, max=1</code> quantifiers by default.<li> First term is defined as a single mandatory (<code>min=1, max=1</code>) entity with ID <code>x:time</code> whose element is defined in the model.<li> Second term is defined as a single mandatory (<code>min=1, max=1</code>) entity with entity<code>opennlp:location</code>.<li> Given data model definition above the following sentences will be matched by this intent:<ul><li><code>What time is it now in New York City?</code><li><code>Show me time of the day in London.</code><li><code>Can you please give me the Tokyo's current date and time.</code></ul></ul></section><section id="logic"><h2 class="section-title">Intent Matching Logic <a href="#"><i class="top-link fas fa-fw fa-angle-double-up"></i></a></h2><p> <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCPipeline">NCPipeline</a> processing result is collection of <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCVariant">NCVariant</a> instances. <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/nlp/parsers/NCSemanticEntityParser">NCSemanticEntityParser</a> is used for following example configured via <i>JSON</i> file. Let's consider the input text <code>'A B C D'</code> and the following elements defined in our model:</p><pre class="brush: js"> |
| "elements": [ |
| { |
| "id": "elm1", |
| "synonyms": ["A B"] |
| }, |
| { |
| "id": "elm2", |
| "synonyms": ["B C"] |
| }, |
| { |
| "id": "elm3", |
| "synonyms": ["D"] |
| } |
| ], |
| </pre><p> All of these elements will be detected but since two of them are overlapping (<code>elm1</code> and <code>elm2</code>) there should be <b>two</b> parsing variants at the output of this step:</p><ol><li><code>elm1</code>('A', 'B') <code>freeword</code>('C') <code>elm3</code>('D')<li><code>freeword</code>('A') <code>elm2</code>('B', 'C') <code>elm3</code>('D')</ol><p></p><p> Note that initially 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. So, each parsing variant is matched against each intent. Each matching pair of a variant and an intent produce a match with a <em>certain weight</em>. If there are no matches at all - an error is returned. If matches were found, the match with the biggest weight is selected as a winning match. If multiple matches have the same weight, their respective variants' weights will be used to further sort them out. Finally, the intent's callback from the winning match is called.</p><p> Although details on exact algorithm on weight calculation are too complex, here's the general guidelines on what determines the weight of the match between a parsing variant and the intent. Note that these rules coalesce around the principle idea that the <b>more specific match always wins</b>:</p><ul><li> A match that captures more entities has more weight than a match with less entities. As a corollary, the match with less free words (i.e. unused words) has bigger weight than a match with more free words.<li> Entities for user-defined elements are more important than built-in entities.<li> A more specific match has bigger weight. In other words, a match that uses an entity from the conversation context (i.e short-term-memory) has less weight than a match that only uses entities from the current request. In the same way older entities from the conversation give less weight than the more recent ones.</ul></section><section id="intent_callback"><h2 class="section-title">Intent Callback <a href="#"><i class="top-link fas fa-fw fa-angle-double-up"></i></a></h2><p> Whether the intent is defined directly in <code>@NCIntent</code> annotation or indirectly via <code>@NCIntentRef</code> annotation - it is always bound to a callback method:</p><ul><li> Callback can only be an instance method on the class implementing <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCModel">NCModel</a> trait.<li> Method must have return type of <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCResult">NCResult</a>.<li> Method should have at least two parameters:<ul><li> Parameter of type <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCContext">NCContext</a> must be first.<li> Parameter of type <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCIntentMatch">NCIntentMatch</a> must be second.<li> Any other parameters must have <code>@NCIntentTerm</code> annotation.</ul><li> Method must support reflection-based invocation.</ul><p> <code>@NCIntentTerm</code> annotation marks callback parameter to receive term's entities. This annotations can only be used for the parameters of the callbacks, i.e. methods that are annotated with <code>@NCIntnet</code> or <code>@NCIntentRef</code>. <code>@NCIntentTerm</code> takes a term ID as its only mandatory parameter and should be applied to callback method parameters to get the entities associated with that term (if and when the intent was matched and that callback was invoked).</p><p> Depending on the term quantifier the method parameter type can only be one of the following types:</p><table class="gradient-table"><thead><tr><th>Quantifier<th>Scala Type<tbody><tr><td><code>[1,1]</code><td><code>NCEntity</code><tr><td><code>[0,1]</code><td><code>Option[NCEntity]</code><tr><td><code>[1,∞]</code> or <code>[0,∞]</code><td><code>List[NCEntity]</code></table><p> For example:</p><pre class="brush: scala"> |
| NCIntent("intent=id term(termId)~{# == 'my_ent'}?") |
| private def onMatch( |
| ctx: NCContext, |
| im: NCIntentMatch, |
| @NCIntentTerm("termId") myEnt: Option[NCEntity] |
| ): NCResult = { |
| ... |
| } |
| </pre><p><b>NOTES:</b></p><ul><li> Conversational term <code>termId</code> has <code>[0,1]</code> quantifier (it's optional).<li> The formal parameter on the callback has a type of <code>Option[NCEntity]</code> because the term's quantifier is <code>[0,1]</code>.</ul><h2 class="section-sub-title"><code>NCRejection</code> and <code>NCIntentSkip</code> Exceptions <a href="#"><i class="top-link fas fa-fw fa-angle-double-up"></i></a></h2><p> There are two exceptions that can be used by intent callback logic to control intent matching process.</p><p> When <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCRejection">NCRejection</a> exception is thrown by the callback it indicates that user input cannot be processed as is. This exception typically indicates that user has not provided enough information in the input string to have it processed automatically. In most cases this means that the user's input is either too short or too simple, too long or too complex, missing required context, or is unrelated to the requested data model.</p><p> <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCIntentSkip">NCIntentSkip</a> is a control flow exception to skip current intent. This exception can be thrown by the intent callback to indicate that current intent should be skipped (even though it was matched and its callback was called). If there's more than one intent matched the next best matching intent will be selected and its callback will be called.<p><p> This exception becomes useful when it is hard or impossible to encode the entire matching logic using only declarative IDL. In these cases the intent definition can be relaxed and the "last mile" of intent matching can happen inside of the intent callback's user logic. If it is determined that intent in fact does not match then throwing this exception allows to try next best matching intent, if any.</p><p> Note that there's a significant difference between <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCIntentSkip">NCIntentSkip</a> exception and model's <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCModel#onMatchedIntent-946">NCModel#onMatchedIntent</a> callback. Unlike this callback, the exception does not force re-matching of all intents, it simply picks the next best intent from the list of already matched ones. The model's callback can force a full reevaluation of all intents against the user input.</p><div class="bq info"><p> <b>IDL Expressiveness</b></p><p> Note that usage of <code>NCIntentSkip</code> exception (as well as model's life-cycle callbacks) is a required technique when you cannot express the desired matching logic with only IDL alone. IDL is a high-level declarative language and it does not support a complex programmable logic or other types of sophisticated matching algorithms. In such cases, you can define a broad intent that would <em>broadly match</em> and then define the rest of the more complex matching logic in the callback using <code>NCIntentSkip</code> exception to effectively indicate when intent doesn't match and other intents, if any, have to be tried.</p><p> There are many use cases where IDL is not expressive enough. For example, if your intent matching depends on financial market conditions, weather, state from external systems or details of the current user geographical location or social network status - you will need to use <code>NCIntentSkip</code>-based logic or model's callbacks to support that type of matching.</p></div><h2 class="section-sub-title"><code>NCContext</code> Trait <a href="#"><i class="top-link fas fa-fw fa-angle-double-up"></i></a></h2><p> <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCContext">NCContext</a> trait passed into intent callback as its first parameter. This trait provide runtime information about the model configuration, request, extracted tokens and all entities variants, conversation control trait <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCConversation">NCConversation</a>.</p><h2 class="section-sub-title"><code>NCIntentMatch</code> Trait <a href="#"><i class="top-link fas fa-fw fa-angle-double-up"></i></a></h2><p> <a target="scaladoc" href="/apis/latest/org/apache/nlpcraft/NCIntentMatch">NCIntentMatch</a> trait passed into intent callback as its second parameter. This trait provide runtime information about the intent that was matched (i.e. the intent with which this callback was annotated with).</p></section></div><div class="col-md-2 third-column"><ul class="side-nav"><li class="side-nav-title">On This Page<li><a href="#intent">Overview</a><li><a href="#idl">IDL Syntax</a><li><a class="toc2" href="#intent-lifecycle">Intent Lifecycle</a><li><a class="toc2" href="#intent-examples">Intent Examples</a><li><a href="#idl_functions">IDL Functions</a><li><a class="toc2" onclick="$('#fn_ent_tab').trigger('click')" href="#fn-list"><code><b>Entity</b></code> Functions</a><li><a class="toc2" onclick="$('#fn_text_tab').trigger('click')" href="#fn-list"><code><b>Text</b></code> Functions</a><li><a class="toc2" onclick="$('#fn_math_tab').trigger('click')" href="#fn-list"><code><b>Math</b></code> Functions</a><li><a class="toc2" onclick="$('#fn_collection_tab').trigger('click')" href="#fn-list"><code><b>Collection</b></code> Functions</a><li><a class="toc2" onclick="$('#fn_metadata_tab').trigger('click')" href="#fn-list"><code><b>Metadata</b></code> Functions</a><li><a class="toc2" onclick="$('#fn_datetime_tab').trigger('click')" href="#fn-list"><code><b>Datetime</b></code> Functions</a><li><a class="toc2" onclick="$('#fn_request_tab').trigger('click')" href="#fn-list"><code><b>Request</b></code> Functions</a><li><a class="toc2" onclick="$('#fn_other_tab').trigger('click')" href="#fn-list"><code><b>Other</b></code> Functions</a><li><a href="#idl_location">IDL Location</a><li><a href="#binding">Intent Binding</a><li><a href="#logic">Intent Matching</a><li><a href="#intent_callback">Intent Callback</a><li class="side-nav-title">Quick Links<li> <i class="fab fa-fw fa-github mr-2"></i><a target="github" href="https://github.com/apache/incubator-nlpcraft/tree/master/nlpcraft-examples">Examples</a><li> <i class="fas fa-fw fa-book mr-2"></i><a target="_" href="/apis/latest/index.html">Scaladoc</a><li> <i class="fas fa-fw fa-download mr-2"></i><a href="/download.html">Download</a><li> <i class="fas fa-fw fa-cog mr-2"></i><a href="/installation.html">Installation</a><li class="side-nav-title">Support<li> <nobr> <i class="fab fa-fw fa-jira mr-2"></i><a target="jira" href="https://issues.apache.org/jira/projects/NLPCRAFT/issues">JIRA</a> </nobr><li> <nobr> <i class="far fa-fw fa-envelope mr-2"></i><a target="dev-list" href="https://mail-archives.apache.org/mod_mbox/nlpcraft-dev/">Dev List</a> </nobr><li> <nobr> <i class="fab fa-fw fa-stack-overflow mr-2"></i><a target="so" href="https://stackoverflow.com/questions/ask">Stack Overflow</a> </nobr><li> <nobr> <i class="fab fa-fw fa-github mr-2"></i><a target="github" href="https://github.com/apache/incubator-nlpcraft">GitHub</a> </nobr><li> <nobr> <i class="fab fa-fw fa-gitter mr-2"></i><a target="gitter" href="https://gitter.im/apache-nlpcraft/community">Gitter</a> </nobr><li> <nobr> <i class="fab fa-fw fa-twitter mr-2"></i><a target="twitter" href="https://twitter.com/ApacheNLPCraft">Twitter</a> </nobr></ul></div></div></div></div><div id="footer"><div class="container"><div class="text-muted text-center"> <span>Copyright © 2023 Apache Software Foundation</span> <span> <a target=_new href="https://apache.org"><img alt="asf" src="/images/asf_logo-h24.png"></a> </span> <a target="asf" href="https://www.apache.org/events/current-event.html" class="btn btn-link ml-4">Events</a> <span class="sep">•</span> <a target="asf" href="https://apache.org/foundation/policies/privacy.html" class="btn btn-link">Privacy</a> <span class="sep">•</span> <a href="/index.html#news" class="btn btn-link">News</a> <span class="sep">•</span> <a href="/docs.html" class="btn btn-link">Docs</a> <span class="ml-4">release: <a href="/download.html"><code>1.0.0</code></a></span> <span class="ml-2"> <a target="github" href="https://github.com/apache/incubator-nlpcraft/actions"><img alt="" src="https://github.com/apache/incubator-nlpcraft/workflows/build/badge.svg"></a> <a target=_ href="https://gitter.im/apache-nlpcraft/community"><img alt="Gitter" src="https://badges.gitter.im/apache-nlpcraft/community.svg"></a> </span> <span class="ml-2"> Built in:<a target="scala" href="https://scala-lang.org/"><img style="margin-left: 5px" src="/images/scala-logo-h16.png" alt=""></a> </span></div></div></div><script src="/ext/jquery-3.5.1.slim.min.js"></script> <script src="/ext/popper.min_1_14_0.js"></script> <script src="/ext/bootstrap.bundle.min_4_6_0.js"></script> <script src="/ext//lodash.min_4_17_4.js" type="text/javascript"></script> <script src="/ext/moment.min_2_12_0.js" type="text/javascript"></script> <script src="/ext/moment-timezone-with-data.min_0_5_5.js" type="text/javascript"></script> <script type="text/javascript"> SyntaxHighlighter.defaults["auto-links"] = false; SyntaxHighlighter.defaults["tab-size"] = 2; SyntaxHighlighter.all(); </script> |