10000 updated examples and text · arangodb/docs@3b5b741 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Dec 13, 2023. It is now read-only.

Commit 3b5b741

Browse files
alexbakharewKVS85
authored andcommitted
updated examples and text
1 parent c796912 commit 3b5b741

File tree

1 file changed

+36
-53
lines changed

1 file changed

+36
-53
lines changed

3.10/analyzers.md

Lines changed: 36 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,31 +1008,24 @@ The *properties* allowed for this Analyzer are an object with the following attr
10081008
Create and use a `classification` Analyzer with a stored "cooking" classifier
10091009
to classify items.
10101010
1011-
```js
1012-
var analyzers = require("@arangodb/analyzers");
1013-
var classifier_single = analyzers.save("classifier_single", "classification", { "model_location": "/path_to_local_fasttext_model_directory/model_cooking.bin" }, ["frequency", "norm", "position"]);
1014-
var classifier_top_two = analyzers.save("classifi 10000 er_double", "classification", { "model_location": "/path_to_local_fasttext_model_directory/model_cooking.bin", "top_k": 2 }, ["frequency", "norm", "position"]);
1015-
db._query(`LET str = "Which baking dish is best to bake a banana bread ?"
1016-
RETURN {
1017-
"all": TOKENS(str, "classifier_single"),
1018-
"double": TOKENS(str, "classifier_double")
1019-
}
1020-
`);
1021-
```
1022-
1023-
```json
1024-
[
1025-
{
1026-
"all" : [
1027-
"__label__baking"
1028-
],
1029-
"double" : [
1030-
"__label__baking",
1031-
"__label__bananas"
1032-
]
1033-
}
1034-
]
1035-
```
1011+
{% arangoshexample examplevar="examplevar" script="script" result="result" %}
1012+
@startDocuBlockInline analyzerClassification
1013+
@EXAMPLE_ARANGOSH_OUTPUT{analyzerClassification}
1014+
var analyzers = require("@arangodb/analyzers");
1015+
var classifier_single = analyzers.save("classifier_single", "classification", { "model_location": "tests/js/common/aql/iresearch/model_cooking.bin" }, ["frequency", "norm", "position"]);
1016+
var classifier_top_two = analyzers.save("classifier_double", "classification", { "model_location": "tests/js/common/aql/iresearch/model_cooking.bin", "top_k": 2 }, ["frequency", "norm", "position"]);
1017+
|db._query(`LET str = "Which baking dish is best to bake a banana bread ?"
1018+
| RETURN {
1019+
| "all": TOKENS(str, "classifier_single"),
1020+
| "double": TOKENS(str, "classifier_double")
1021+
| }
1022+
`);
1023+
~ analyzers.remove(classifier_single.name);
1024+
~ analyzers.remove(classifier_top_two.name);
1025+
@END_EXAMPLE_ARANGOSH_OUTPUT
1026+
@endDocuBlock analyzerClassification
1027+
{% endarangoshexample %}
1028+
{% include arangoshexample.html id=examplevar script=script result=result %}
10361029
10371030
### `nearest_neighbors`
10381031
@@ -1065,34 +1058,24 @@ The *properties* allowed for this Analyzer are an object with the following attr
10651058
Create and use a `nearest_neighbors` Analyzer with a stored "cooking" classifier
10661059
to find similar terms.
10671060
1068-
```js
1069-
var analyzers = require("@arangodb/analyzers");
1070-
var nn_single = analyzers.save("nn_single", "nearest_neighbors", { "model_location": "/path_to_local_fasttext_model_directory/model_cooking.bin" }, ["frequency", "norm", "position"]);
1071-
var nn_top_two = analyzers.save("nn_double", "nearest_neighbors", { "model_location": "/path_to_local_fasttext_model_directory/model_cooking.bin", "top_k": 2 }, ["frequency", "norm", "position"]);
1072-
db._query(`LET str = "salt, oil"
1073-
RETURN {
1074-
"all": TOKENS(str, "nn_single"),
1075-
"double": TOKENS(str, "nn_double")
1076-
}
1077-
`);
1078-
```
1079-
1080-
```json
1081-
[
1082-
{
1083-
"all" : [
1084-
"pepper",
1085-
"olive"
1086-
],
1087-
"double" : [
1088-
"pepper",
1089-
"table",
1090-
"olive",
1091-
"avocado"
1092-
]
1093-
}
1094-
]
1095-
```
1061+
{% arangoshexample examplevar="examplevar" script="script" result="result" %}
1062+
@startDocuBlockInline analyzerNearestNeighbors
1063+
@EXAMPLE_ARANGOSH_OUTPUT{analyzerNearestNeighbors}
1064+
var analyzers = require("@arangodb/analyzers");
1065+
var nn_single = analyzers.save("nn_single", "nearest_neighbors", { "model_location": "tests/js/common/aql/iresearch/model_cooking.bin" }, ["frequency", "norm", "position"]);
1066+
var nn_top_two = analyzers.save("nn_double", "nearest_neighbors", { "model_location": "tests/js/common/aql/iresearch/model_cooking.bin", "top_k": 2 }, ["frequency", "norm", "position"]);
1067+
|db._query(`LET str = "salt, oil"
1068+
| RETURN {
1069+
| "all": TOKENS(str, "nn_single"),
1070+
| "double": TOKENS(str, "nn_double")
1071+
| }
1072+
`);
1073+
~ analyzers.remove(nn_single.name);
1074+
~ analyzers.remove(nn_top_two.name);
1075+
@END_EXAMPLE_ARANGOSH_OUTPUT
1076+
@endDocuBlock analyzerNearestNeighbors
1077+
{% endarangoshexample %}
1078+
{% include arangoshexample.html id=examplevar script=script result=result %}
10961079
10971080
### `geojson`
10981081

0 commit comments

Comments
 (0)
0