@@ -1008,31 +1008,24 @@ The *properties* allowed for this Analyzer are an object with the following attr
1008
1008
Create and use a `classification` Analyzer with a stored "cooking" classifier
1009
1009
to classify items.
1010
1010
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 %}
1036
1029
1037
1030
### `nearest_neighbors`
1038
1031
@@ -1065,34 +1058,24 @@ The *properties* allowed for this Analyzer are an object with the following attr
1065
1058
Create and use a `nearest_neighbors` Analyzer with a stored "cooking" classifier
1066
1059
to find similar terms.
1067
1060
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 %}
1096
1079
1097
1080
### `geojson`
1098
1081
0 commit comments