Skip to content

Commit 3586992

Browse files
author
Alan Plum
committed
Implement new Analyzer types
1 parent 905f2ed commit 3586992

File tree

2 files changed

+134
-0
lines changed

2 files changed

+134
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@ This driver uses semantic versioning:
218218

219219
- Added support for new ArangoDB 3.10 `offset` Analyzer feature
220220

221+
- Added support for new ArangoDB 3.10 `minhash`, `classification` and
222+
`nearest_neighbors` Analyzer types
223+
221224
- Added missing `replicationFactor` and `writeConcern` options to
222225
`CollectionPropertiesOptions` type
223226

src/analyzer.ts

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ export type CreateAnalyzerOptions =
4242
| CreatePipelineAnalyzerOptions
4343
| CreateStopwordsAnalyzerOptions
4444
| CreateCollationAnalyzerOptions
45+
| CreateMinHashAnalyzerOptions
46+
| CreateClassificationAnalyzerOptions
47+
| CreateNearestNeighborsAnalyzerOptions
4548
| CreateGeoJsonAnalyzerOptions
4649
| CreateGeoPointAnalyzerOptions;
4750

@@ -399,6 +402,97 @@ export type CreateCollationAnalyzerOptions = {
399402
};
400403
};
401404

405+
/**
406+
* Options for creating a MinHash Analyzer
407+
*/
408+
export type CreateMinHashAnalyzerOptions = {
409+
/**
410+
* Type of the Analyzer.
411+
*/
412+
type: "minhash";
413+
/**
414+
* Features to enable for this Analyzer.
415+
*/
416+
features?: AnalyzerFeature[];
417+
/**
418+
* Additional properties for the Analyzer.
419+
*/
420+
properties: {
421+
/**
422+
* An Analyzer definition-like object with `type` and `properties` attributes.
423+
*/
424+
analyzer: Omit<CreateAnalyzerOptions, "features">;
425+
/**
426+
* Size of the MinHash signature.
427+
*/
428+
numHashes: number;
429+
};
430+
};
431+
432+
/**
433+
* Options for creating a Classification Analyzer
434+
*/
435+
export type CreateClassificationAnalyzerOptions = {
436+
/**
437+
* Type of the Analyzer.
438+
*/
439+
type: "classification";
440+
/**
441+
* Features to enable for this Analyzer.
442+
*/
443+
features?: AnalyzerFeature[];
444+
/**
445+
* Additional properties for the Analyzer.
446+
*/
447+
properties: {
448+
/**
449+
* On-disk path to the trained fastText supervised model.
450+
*/
451+
model_location: string;
452+
/**
453+
* Number of class labels that will be produced per input.
454+
*
455+
* Default: `1`
456+
*/
457+
top_k?: number;
458+
/**
459+
* Probability threshold for which a label will be assigned to an input.
460+
*
461+
* Default: `0.99`
462+
*/
463+
threshold?: number;
464+
};
465+
};
466+
467+
/**
468+
* Options for creating a NearestNeighbors Analyzer
469+
*/
470+
export type CreateNearestNeighborsAnalyzerOptions = {
471+
/**
472+
* Type of the Analyzer.
473+
*/
474+
type: "nearest_neighbors";
475+
/**
476+
* Features to enable for this Analyzer.
477+
*/
478+
features?: AnalyzerFeature[];
479+
/**
480+
* Additional properties for the Analyzer.
481+
*/
482+
properties: {
483+
/**
484+
* On-disk path to the trained fastText supervised model.
485+
*/
486+
model_location: string;
487+
/**
488+
* Number of class labels that will be produced per input.
489+
*
490+
* Default: `1`
491+
*/
492+
top_k?: number;
493+
};
494+
};
495+
402496
/**
403497
* Options for creating a GeoJSON Analyzer
404498
*/
@@ -498,6 +592,9 @@ export type AnalyzerDescription =
498592
| PipelineAnalyzerDescription
499593
| StopwordsAnalyzerDescription
500594
| CollationAnalyzerDescription
595+
| MinHashAnalyzerDescription
596+
| ClassificationAnalyzerDescription
597+
| NearestNeighborsAnalyzerDescription
501598
| GeoJsonAnalyzerDescription
502599
| GeoPointAnalyzerDescription;
503600

@@ -622,6 +719,40 @@ export type CollationAnalyzerDescription = GenericAnalyzerDescription & {
622719
};
623720
};
624721

722+
/**
723+
* (Enterprise Edition only.) An object describing a MinHash Analyzer
724+
*/
725+
export type MinHashAnalyzerDescription = GenericAnalyzerDescription & {
726+
type: "minhash";
727+
properties: {
728+
analyzer: Omit<AnalyzerDescription, "name" | "features">;
729+
numHashes: number;
730+
};
731+
};
732+
733+
/**
734+
* (Enterprise Edition only.) An object describing a Classification Analyzer
735+
*/
736+
export type ClassificationAnalyzerDescription = GenericAnalyzerDescription & {
737+
type: "classification";
738+
properties: {
739+
model_location: string;
740+
top_k: number;
741+
threshold: number;
742+
};
743+
};
744+
745+
/**
746+
* (Enterprise Edition only.) An object describing a NearestNeighbors Analyzer
747+
*/
748+
export type NearestNeighborsAnalyzerDescription = GenericAnalyzerDescription & {
749+
type: "nearest_neighbors";
750+
properties: {
751+
model_location: string;
752+
top_k: number;
753+
};
754+
};
755+
625756
/**
626757
* An object describing a GeoJSON Analyzer
627758
*/

0 commit comments

Comments
 (0)