This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft-website.git
The following commit(s) were added to refs/heads/master by this push:
new 1dc4e89 WIP.
1dc4e89 is described below
commit 1dc4e89d21ae13f02835901419fc5a28d374094f
Author: Aaron Radzinzski <[email protected]>
AuthorDate: Sun Apr 18 10:11:51 2021 +0300
WIP.
---
_data/idl-fns.yml | 56 ++++++++++++++++++++++++++++++++++++++
intent-matching.html | 76 ++++++----------------------------------------------
2 files changed, 64 insertions(+), 68 deletions(-)
diff --git a/_data/idl-fns.yml b/_data/idl-fns.yml
index 92695ff..155a6f1 100644
--- a/_data/idl-fns.yml
+++ b/_data/idl-fns.yml
@@ -375,6 +375,62 @@ fn-token:
fn-datetime:
fn-math:
+fn-other:
+ - name: if
+ sig: |
+ <b>if</b>(c: Boolean, then: Any: else: Any) ⇒ Any
+ synopsis: This function provides 'if-then-else' equivalent
+ desc: |
+ 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.
+ usage: |
+ // 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)
+
+ - name: json
+ sig: |
+ <b>json</b>(p: String) ⇒ Map[String, Any]
+ synopsis: Converts JSON in <code><b>p</b></code> parameter to a map
+ desc: |
+ Converts JSON in <code><b>p</b></code> parameter to a map. Use single
quoted
+ string to avoid escaping double quotes in JSON.
+ usage: |
+ // Result: Map.
+ json('{"a": 2, "b": [1, 2, 3]}')
+
+ - name: to_string
+ sig: |
+ <b>to_string</b>(p: Any) ⇒ {String|List[String]}
+ synopsis: Converts <code><b>p</b></code> parameter to a string
+ desc: |
+ 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.
+ usage: |
+ // Result: "1.25"
+ to_string(1.25)
+ // Result: list("1", "2", "3")
+ to_string(list(1, 2, 3))
+
+ - name: or_else
+ sig: |
+ <b>or_else</b>(p: Any, a: Any) ⇒ Any
+ synopsis: Returns <code><b>p</b></code> if it is not <code>null</code>,
<code><b>a</b></code> otherwise
+ desc: |
+ 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>.
+ usage: |
+ // Result: 'some_prop' model metadata or 'text' if one does not exist.
+ @dflt = 'text'
+ or_else(meta_model('some_prop'), @dflt)
+
fn-text:
- name: length
sig: |
diff --git a/intent-matching.html b/intent-matching.html
index 4b8df58..fe4775b 100644
--- a/intent-matching.html
+++ b/intent-matching.html
@@ -695,90 +695,30 @@ id: intent_matching
</div>
<div class="tab-pane fade show" id="fn_other" role="tabpanel">
<div class="accordion" id="other_fns">
+ {% for fn in site.data.idl-fns.fn-other %}
<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">
- <code><b>if</b>(c: Boolean, then: Any:
else: Any) ⇒ Any</code>
- </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>c</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">
- <code><b>json</b>(p: String) ⇒ Map</code>
- </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">
- <code><b>to_string</b>(p: Any) ⇒
{String|List}</code>
+ <button class="btn btn-link btn-block
text-left" type="button" data-toggle="collapse" data-target="#fn_{{fn.name}}">
+ <span><code>{{fn.sig}}</code></span>
+ <span
class="fn-short-desc">{{fn.synopsis}}</span>
</button>
</h2>
</div>
- <div id="fn_to_string" class="collapse"
data-parent="#other_fns">
+ <div id="fn_{{fn.name}}" 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.
+ {{fn.desc}}
</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>
+ <pre class="brush:idl">{{fn.usage}}</pre>
</div>
</div>
</div>
+ {% endfor %}
</div>
</div>
</div>