Spaces:
Sleeping
Sleeping
| export type Quantifier = "any" | "all" | "none" | "exactly"; | |
| export type ViewName = "tree" | "radial" | "map" | "table" | "stats"; | |
| export type ColorBy = "relation" | "family" | "confidence" | "depth" | "macroarea"; | |
| export interface WalsClause { | |
| feature_id: string; | |
| values: number[]; | |
| } | |
| export interface NodePredicate { | |
| languages: string[]; | |
| families: string[]; | |
| macroareas: string[]; | |
| statuses: string[]; | |
| term_contains: string; | |
| term_regex?: string | null; | |
| require_coords: boolean; | |
| wals: WalsClause[]; | |
| phonemes_have: string[]; | |
| phonemes_lack: string[]; | |
| require_tone: boolean | null; | |
| min_zipf?: number | null; | |
| max_rank?: number | null; | |
| keep_unknown: boolean; | |
| } | |
| export interface TreeQuery { | |
| term: string; | |
| lang: string; | |
| edges: { | |
| relations: string[]; | |
| min_confidence: number; | |
| max_depth: number; | |
| max_visit: number; | |
| }; | |
| leaf: NodePredicate; | |
| path: { | |
| node: NodePredicate; | |
| quantifier: Quantifier; | |
| exactly_k: number; | |
| relations_any: string[]; | |
| relations_none: string[]; | |
| apply_to_root: boolean; | |
| }; | |
| expand: string[]; | |
| cluster_threshold: number; | |
| max_payload: number; | |
| color_by: ColorBy; | |
| } | |
| export interface GraphNode { | |
| id: number | string; | |
| parent: number | string | null; | |
| kind: "word" | "cluster"; | |
| term: string; | |
| lang: string; | |
| lang_display?: string | null; | |
| family_name?: string | null; | |
| macroarea?: string | null; | |
| status?: string | null; | |
| depth: number; | |
| relation?: string | null; | |
| confidence?: number | null; | |
| child_count?: number; | |
| visible_children?: number; | |
| latitude?: number | null; | |
| longitude?: number | null; | |
| glottocode?: string | null; | |
| iso_639_3?: string | null; | |
| zipf?: number | null; | |
| freq_rank?: number | null; | |
| count?: number; | |
| expand_key?: string; | |
| relation_mix?: Record<string, number>; | |
| sample?: string[]; | |
| } | |
| export type DefinitionSense = { pos: string; glosses: string[] }; | |
| export type DefinitionPayload = { | |
| term: string; | |
| lang?: string; | |
| matched_code?: string | null; | |
| senses?: DefinitionSense[]; | |
| fallback?: boolean; | |
| url?: string; | |
| error?: string | null; | |
| }; | |
| export interface TreeResponse { | |
| root: { | |
| id: number; | |
| term: string; | |
| lang: string; | |
| lang_display?: string; | |
| family_name?: string; | |
| macroarea?: string; | |
| latitude?: number; | |
| longitude?: number; | |
| } | null; | |
| nodes: GraphNode[]; | |
| stats: { | |
| visited: number; | |
| kept_leaves: number; | |
| surviving?: number; | |
| payload?: number; | |
| clustered?: number; | |
| elapsed_ms: number; | |
| truncated?: boolean; | |
| relations?: Record<string, number>; | |
| families?: Record<string, number>; | |
| depths?: Record<string, number>; | |
| error?: string; | |
| }; | |
| truncated: boolean; | |
| } | |
| export interface SuggestHit { | |
| id?: number; | |
| term: string; | |
| lang: string; | |
| lang_display?: string; | |
| family_name?: string; | |
| child_count: number; | |
| blurb?: string; | |
| } | |
| export interface Meta { | |
| relations: string[]; | |
| default_relations: string[]; | |
| macroareas: string[]; | |
| statuses: string[]; | |
| languages: { key: string; display: string; family?: string; nodes: number }[]; | |
| families: { name: string; nodes: number }[]; | |
| wals_features: { id: string; name: string; values: { value: number; label: string }[] }[]; | |
| top_phonemes: string[]; | |
| examples: SuggestHit[]; | |
| citation: { dataset: string; url: string; doi: string; license: string; author: string }; | |
| nodes: number; | |
| edges: number; | |
| } | |
| export function emptyPredicate(): NodePredicate { | |
| return { | |
| languages: [], | |
| families: [], | |
| macroareas: [], | |
| statuses: [], | |
| term_contains: "", | |
| require_coords: false, | |
| wals: [], | |
| phonemes_have: [], | |
| phonemes_lack: [], | |
| require_tone: null, | |
| min_zipf: null, | |
| max_rank: null, | |
| keep_unknown: false, | |
| }; | |
| } | |