aboutsummaryrefslogtreecommitdiff
path: root/search/types.ts
blob: d90afd607e8ce8218f40f13a6c0038c998a25ef1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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>;
};