aboutsummaryrefslogtreecommitdiff
path: root/search/types.ts
diff options
context:
space:
mode:
Diffstat (limited to 'search/types.ts')
-rw-r--r--search/types.ts60
1 files changed, 60 insertions, 0 deletions
diff --git a/search/types.ts b/search/types.ts
new file mode 100644
index 0000000..d90afd6
--- /dev/null
+++ b/search/types.ts
@@ -0,0 +1,60 @@
+import { TokenTags } from "./tags.ts";
+
+export interface SearchGlossaryDefinition {
+
+};
+
+export interface SearchGlossary {
+ id: number;
+ definitions: SearchGlossaryDefinition[];
+};
+
+export interface SearchTermResult {
+ /** @property dictionary term id */
+ id: number;
+ /** @property (preferably) kanji writing of term */
+ writing: string;
+ /** @property kana-only reading of term */
+ reading: string;
+ /** @property word tags including deconjugation tags */
+ tags: TokenTags;
+ /** @property original conjugated string */
+ source: string;
+ /** @property numeric sorting value for term */
+ sort: number;
+ /** @property amount of steps that were needed to deconjugate */
+ depth: number;
+ /** @property matching results */
+ match: {
+ /** @property term matched by writing */
+ writing: boolean;
+ /** @property term matched by reading */
+ reading: boolean;
+ }
+};
+
+export interface SearchWord extends SearchTermResult {
+ /** @property starting index of word in sentence */
+ start: number;
+};
+
+export interface SearchSentenceResult {
+ words: SearchWord[];
+ input: string;
+};
+
+/** @summary options for Search.sentence() */
+export interface SearchSentenceProps {
+ /** @prop max amount of characters to look ahead when attempting to deconjugate words */
+ lookahead: number;
+ /** @prop search bias values */
+ priorityMod: {
+ /** @prop offset for negative bias */
+ low: number;
+ /** @prop offset for positive bias */
+ high: number;
+ };
+ /** @prop list of breaks treated as delimiter */
+ breaks: Array<number>;
+};
+