UNPKG

wn-ts-node

Version:
112 lines 5.62 kB
import { Word, Sense, Synset, ILI, Project, PartOfSpeech, Lexicon, WordQuery, SynsetQuery, SenseQuery, QueryStrategy, Definition, NodeDatabaseConfig } from 'wn-ts-core'; import { Kysely } from 'kysely'; import { NodeKyselyDatabase } from './database/node-kysely-database.js'; import { KyselyQueryService } from './database/kysely-query-service.js'; import { Database } from './database/types/database.js'; export interface NodeWordnetConfig extends NodeDatabaseConfig { journalMode?: 'DELETE' | 'WAL' | 'MEMORY' | 'OFF'; synchronous?: 'OFF' | 'NORMAL' | 'FULL' | 'EXTRA'; cacheSize?: number; tempStore?: 'DEFAULT' | 'FILE' | 'MEMORY'; mmapSize?: number; foreignKeys?: boolean; recursiveTriggers?: boolean; forceRecreate?: boolean; strategy?: QueryStrategy; } export declare abstract class LocalBaseWordnet { protected database: NodeKyselyDatabase; protected initialized: boolean; protected lexicon: string[]; protected expand: string[]; protected normalizer?: (form: string) => string; constructor(lexicon?: string | string[], options?: any); abstract initialize(): Promise<void>; protected getDb(): Kysely<Database>; abstract getWord(id: string): Promise<Word | undefined>; abstract getSynset(id: string): Promise<Synset | undefined>; abstract getSense(id: string): Promise<Sense | undefined>; abstract getIli(id: string): Promise<ILI | undefined>; protected getSynsetOrUndefined(id: string): Promise<Synset | undefined>; abstract words(query?: any): Promise<Word[]>; abstract synsets(query?: any): Promise<Synset[]>; abstract senses(query?: any): Promise<Sense[]>; abstract lexicons(): Promise<Lexicon[]>; normalizeForm(form: string): Promise<string>; } export declare class KyselyWordnet extends LocalBaseWordnet { private nodeDatabase; private queryService; private strategy; constructor(lexicon?: string | string[], options?: Partial<NodeWordnetConfig>); initialize(): Promise<void>; private configureSQLite; getWord(id: string): Promise<Word | undefined>; getSynset(id: string): Promise<Synset | undefined>; synset(id: string): Promise<Synset | undefined>; getSense(id: string): Promise<Sense | undefined>; getIli(id: string): Promise<ILI | undefined>; words(query?: WordQuery): Promise<Word[]>; synsets(query?: SynsetQuery): Promise<Synset[]>; senses(query?: SenseQuery): Promise<Sense[]>; lexicons(): Promise<Lexicon[]>; getStatistics(): Promise<{ totalWords: number; totalSynsets: number; totalSenses: number; totalILIs: number; totalLexicons: number; }>; ilis(status?: string): Promise<ILI[]>; synsetsByILI(iliId: string): Promise<Synset[]>; getProjects(): Promise<Project[]>; searchWords(query: any): Promise<Word[]>; searchSynsets(query: any): Promise<Synset[]>; wordsByForm(form: string, options?: any): Promise<Word[]>; synsetsByForm(form: string, options?: any): Promise<Synset[]>; getWordForms(wordId: string): Promise<string[]>; getWordLemma(wordId: string): Promise<string>; morphy(form: string, pos?: PartOfSpeech): Promise<Record<PartOfSpeech, Set<string>>>; getDerivedWords(_wordId: string): Promise<Word[]>; getHypernyms(synsetId: string): Promise<Synset[]>; getHyponyms(synsetId: string): Promise<Synset[]>; getRelatedSynsets(synsetId: string, relationType: string): Promise<Synset[]>; getRelatedSenses(_senseId: string, _relationType: string): Promise<Sense[]>; getShortestPath(_synsetId1: string, _synsetId2: string): Promise<Synset[]>; getSynsetDepth(_synsetId: string): Promise<number>; translateWord(_wordId: string, _targetLang: string): Promise<Record<string, Word[]>>; translateSynset(synsetId: string, _targetLang: string): Promise<Synset[]>; translateSense(_senseId: string, _targetLang: string): Promise<Sense[]>; getCrossLingualSynsets(_iliId: string, _targetLangs?: string[]): Promise<Record<string, Synset[]>>; getDefinitions(synsetId: string): Promise<Definition[]>; getExamples(synsetId: string): Promise<string[]>; getSenseExamples(_senseId: string): Promise<string[]>; getSynsetWords(synsetId: string): Promise<Word[]>; getSynsetLemmas(synsetId: string): Promise<string[]>; getSynsetSenses(synsetId: string): Promise<Sense[]>; hasLexicon(lexiconId: string): Promise<boolean>; getSupportedLanguages(): Promise<string[]>; getLexiconDependencies(_lexiconId: string): Promise<string[]>; getRawDatabase(): Promise<Kysely<Database>>; executeRawQuery<T = any>(_sqlString: string, _params?: any[]): Promise<T[]>; executeRawTransaction<T>(callback: (db: Kysely<Database>) => Promise<T>): Promise<T>; batchInsertWords(words: any[]): Promise<void>; batchInsertSynsets(synsets: any[]): Promise<void>; batchInsertSenses(senses: any[]): Promise<void>; batchInsertForms(forms: any[]): Promise<void>; batchInsertDefinitions(definitions: any[]): Promise<void>; batchInsertExamples(examples: any[]): Promise<void>; batchInsertRelations(relations: any[]): Promise<void>; batchInsertILIs(ilis: any[]): Promise<void>; batchInsertLexicons(lexicons: any[]): Promise<void>; close(): Promise<void>; /** * Get the query service for direct database operations */ getQueryService(): KyselyQueryService; /** * Get words by ILI and language using the query service */ getWordsByIliAndLanguage(ili: string, language?: string): Promise<Word[]>; } //# sourceMappingURL=kysely-wordnet.d.ts.map