synset 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/types.ts","../src/literals.ts","../src/loader.ts","../node_modules/@dbushell/xml-streamify/src/node.ts","../node_modules/@dbushell/xml-streamify/src/stream.ts","../node_modules/@dbushell/xml-streamify/src/parse.ts","../src/helpers.ts","../src/query.ts"],"sourcesContent":["// Types and schemas\nexport {\n // Zod schemas for validation\n Lexicon,\n LexicalEntry,\n Lemma,\n Sense,\n SenseRelation,\n Synset,\n SynsetRelation,\n Definition,\n Example,\n Form,\n Pronunciation,\n ILIDefinition,\n SyntacticBehavior,\n // ID schemas\n LexiconId,\n LexicalEntryId,\n SynsetId,\n SenseId,\n SyntacticBehaviorId,\n // Enum schemas\n PartsOfSpeech,\n SenseRelationRelType,\n SynsetRelationRelType,\n AdjPosition,\n // Utility\n partsOfSpeechList,\n} from \"./types\";\n\n// Re-export types (inferred from Zod schemas)\nexport type {\n Lexicon as LexiconType,\n LexicalEntry as LexicalEntryType,\n Lemma as LemmaType,\n Sense as SenseType,\n SenseRelation as SenseRelationType,\n Synset as SynsetType,\n SynsetRelation as SynsetRelationObjectType,\n Definition as DefinitionType,\n Example as ExampleType,\n Form as FormType,\n Pronunciation as PronunciationType,\n ILIDefinition as ILIDefinitionType,\n SyntacticBehavior as SyntacticBehaviorType,\n} from \"./types\";\n\n// Literals (human-readable labels)\nexport {\n PartsOfSpeech as PartsOfSpeechLabels,\n SenseRelationRelType as SenseRelationLabels,\n SynsetRelationRelType as SynsetRelationLabels,\n AdjPosition as AdjPositionLabels,\n} from \"./literals\";\n\n// Data loading\nexport {\n loadWordNet,\n fetchWordNet,\n ensureWordNetCached,\n findLatestVersion,\n createParser,\n parseLexicon,\n getFilename,\n getDownloadUrl,\n getDefaultCacheDir,\n // Version constants\n BASE_VERSION,\n WORDNET_VERSION, // legacy alias for BASE_VERSION\n WORDNET_FILENAME, // legacy\n WORDNET_URL, // legacy\n} from \"./loader\";\nexport type { LoadOptions, LoadResult } from \"./loader\";\n\n// Query utilities\nexport {\n buildIndex,\n getSynset,\n getSense,\n getLexicalEntry,\n findWord,\n findSenses,\n findSynsets,\n getDefinitions,\n getRelated,\n getHypernyms,\n getHyponyms,\n getSynonyms,\n getSynsetWords,\n} from \"./query\";\nexport type { WordNetIndex, DefinitionResult, SynonymResult } from \"./query\";\n\n// Low-level XML helpers (for advanced usage)\nexport { decodeXmlEntities, LexiconNode } from \"./helpers\";\n","import { z } from \"zod\";\n\nexport const LexiconId = z.string();\nexport const LexicalEntryId = z.string();\nexport const SynsetId = z.string();\nexport const SenseId = z.string();\nexport const SyntacticBehaviorId = z.string();\n\n/** Note: only the literals that are found in the test wordnet xml file are listed */\nexport const PartsOfSpeech = z.union([\n z.literal(\"a\"),\n z.literal(\"c\"),\n z.literal(\"n\"),\n z.literal(\"p\"),\n z.literal(\"r\"),\n z.literal(\"s\"),\n z.literal(\"u\"),\n z.literal(\"v\"),\n z.literal(\"x\"),\n]);\n\n/** Note: only the literals that are found in the test wordnet xml file are listed */\nexport const SenseRelationRelType = z.union([\n z.literal(\"also\"),\n z.literal(\"antonym\"),\n z.literal(\"derivation\"),\n z.literal(\"domain_member_region\"),\n z.literal(\"domain_member_topic\"),\n z.literal(\"domain_region\"),\n z.literal(\"domain_topic\"),\n z.literal(\"exemplifies\"),\n z.literal(\"is_exemplified_by\"),\n z.literal(\"other\"), // TODO: Then \"dc:type\" attribute should define what relation\n z.literal(\"participle\"),\n z.literal(\"pertainym\"),\n z.literal(\"similar\"),\n]);\n\n/** Note: only the literals that are found in the test wordnet xml file are listed */\nexport const SynsetRelationRelType = z.union([\n z.literal(\"also\"),\n z.literal(\"attribute\"),\n z.literal(\"cause\"),\n z.literal(\"causes\"),\n z.literal(\"domain_member_region\"),\n z.literal(\"domain_member_topic\"),\n z.literal(\"domain_region\"),\n z.literal(\"domain_topic\"),\n z.literal(\"entail\"),\n z.literal(\"entails\"),\n z.literal(\"exemplifies\"),\n z.literal(\"has_domain_region\"),\n z.literal(\"has_domain_topic\"),\n z.literal(\"holo_member\"),\n z.literal(\"holo_part\"),\n z.literal(\"holo_substance\"),\n z.literal(\"hypernym\"),\n z.literal(\"hyponym\"),\n z.literal(\"instance_hypernym\"),\n z.literal(\"instance_hyponym\"),\n z.literal(\"is_caused_by\"),\n z.literal(\"is_entailed_by\"),\n z.literal(\"is_exemplified_by\"),\n z.literal(\"member_holonym\"),\n z.literal(\"member_meronym\"),\n z.literal(\"mero_member\"),\n z.literal(\"mero_part\"),\n z.literal(\"mero_substance\"),\n z.literal(\"part_holonym\"),\n z.literal(\"part_meronym\"),\n z.literal(\"similar\"),\n z.literal(\"substance_holonym\"),\n z.literal(\"substance_meronym\"),\n]);\n\nexport const AdjPosition = z.union([\n z.literal(\"a\"),\n z.literal(\"ip\"),\n z.literal(\"p\"),\n]);\n\nexport const Pronunciation = z.object({\n variety: z.string().optional(), // TODO: \"GB\", \"US\", ...\n inner: z.string(), // Actual value\n});\n\nexport const Lemma = z.object({\n writtenForm: z.string(), // Actual value\n partOfSpeech: PartsOfSpeech,\n pronunciations: z.array(Pronunciation).min(0),\n});\n\nexport const SenseRelation = z.object({\n relType: SenseRelationRelType,\n dcType: z.string().optional(), // TODO: This is only when relType is \"other\"\n target: SenseId,\n});\n\nexport const Sense = z.object({\n id: SenseId,\n synset: SynsetId,\n subCat: SyntacticBehaviorId.optional(),\n adjPosition: AdjPosition.optional(),\n senseRelations: z.array(SenseRelation).min(0),\n});\n\nexport const Form = z.object({\n writtenForm: z.string(), // This is where huge variety lives\n});\n\nexport const LexicalEntry = z.object({\n id: LexicalEntryId,\n lemmas: z.array(Lemma).length(1),\n senses: z.array(Sense).min(1),\n forms: z.array(Form).min(0),\n});\n\nexport const Definition = z.object({\n inner: z.string(), // Actual value\n});\n\nexport const Example = z.object({\n inner: z.string(), // Actual value\n dcSource: z.string().optional(),\n});\n\nexport const ILIDefinition = z.object({\n inner: z.string(), // Actual value\n});\n\nexport const SynsetRelation = z.object({\n relType: SynsetRelationRelType,\n target: SynsetId,\n});\n\nexport const Synset = z.object({\n id: SynsetId,\n ili: z.string(),\n members: z.array(LexicalEntryId).min(1), // space-separated list of refs that we unwrap to array\n partOfSpeech: PartsOfSpeech,\n lexfile: z.string(),\n dcSource: z.string().optional(),\n definitions: z.array(Definition).min(1),\n examples: z.array(Example).min(0),\n iliDefinitions: z.array(ILIDefinition).min(0),\n synsetRelations: z.array(SynsetRelation).min(0),\n});\n\nexport const SyntacticBehavior = z.object({\n id: SyntacticBehaviorId,\n subcategorizationFrame: z.string(), // Sentence structure. This is where (not very huge) variety lives\n});\n\nexport const Lexicon = z.object({\n id: LexiconId, // \"oewn\"\n label: z.string(), // \"Open English WordNet\"\n language: z.string(), // \"en\"\n email: z.string(), // \"english-wordnet@googlegroups.com\"\n license: z.string(), // \"https://creativecommons.org/licenses/by/4.0/\"\n version: z.string(), // \"2023\"\n url: z.string(), // \"https://github.com/globalwordnet/english-wordnet\">\n citation: z.string().optional(), // \"John P. McCrae, Alexandre Rademaker, Francis Bond, Ewa Rudnicka and Christiane Fellbaum (2019) English WordNet 2019 – An Open-Source WordNet for English, *Proceedings of the 10th Global WordNet Conference* – GWC 2019\"\n lexicalEntries: z.array(LexicalEntry).min(0),\n synsets: z.array(Synset).min(0),\n syntacticBehaviors: z.array(SyntacticBehavior).min(0),\n});\n\nexport type Lemma = z.infer<typeof Lemma>;\nexport type LexicalEntry = z.infer<typeof LexicalEntry>;\nexport type Sense = z.infer<typeof Sense>;\nexport type SenseRelation = z.infer<typeof SenseRelation>;\nexport type Pronunciation = z.infer<typeof Pronunciation>;\nexport type Form = z.infer<typeof Form>;\nexport type Synset = z.infer<typeof Synset>;\nexport type Definition = z.infer<typeof Definition>;\nexport type Example = z.infer<typeof Example>;\nexport type ILIDefinition = z.infer<typeof ILIDefinition>;\nexport type SynsetRelation = z.infer<typeof SynsetRelation>;\nexport type SyntacticBehavior = z.infer<typeof SyntacticBehavior>;\nexport type Lexicon = z.infer<typeof Lexicon>;\n\nexport const partsOfSpeechList: string[] = PartsOfSpeech.options.map((v) => v.value);\n","// Literals are as discovered in WN-LMF-1.3.dtd.\n//\n// Note: types.ts is not necessarily lists all of these\n\nexport const PartsOfSpeech: Record<string, string> = {\n n: \"Noun\",\n v: \"Verb\",\n a: \"Adjective\",\n r: \"Adverb\",\n s: \"Adjective Satellite\",\n t: \"?\",\n c: \"Conjunction\",\n p: \"Adposition (Preposition, postposition, etc.)\",\n x: \"Other (inc. particle, classifier, bound morphemes, determiners)\",\n u: \"Unknown\",\n};\n\nexport const SenseRelationRelType: Record<string, string> = {\n also: \"See also\",\n anto_converse: \"Converse antonym\",\n anto_gradable: \"Gradable antonym\",\n anto_simple: \"Simple antonym\",\n antonym: \"Antonym\",\n augmentative: \"Augmentative\",\n derivation: \"Derivation\",\n diminutive: \"Diminutive\",\n domain_region: \"Domain region\",\n domain_topic: \"Domain topic\",\n exemplifies: \"Exemplifies\",\n feminine: \"Feminine\",\n has_augmentative: \"Has augmentative\",\n has_diminutive: \"Has diminutive\",\n has_domain_region: \"Has domain region\",\n has_domain_topic: \"Has domain topic\",\n has_feminine: \"Has feminine\",\n has_masculine: \"Has masculine\",\n has_young: \"Has young\",\n is_exemplified_by: \"Is exemplified by\",\n masculine: \"Masculine\",\n other: \"Other\",\n participle: \"Participle\",\n pertainym: \"Pertainym\",\n secondary_aspect_ip: \"Secondary aspect IP\",\n secondary_aspect_pi: \"Secondary aspect PI\",\n similar: \"Similar\",\n simple_aspect_ip: \"Simple aspect IP\",\n simple_aspect_pi: \"Simple aspect PI\",\n young: \"Young\",\n domain_member_region: \"Domain member region\",\n domain_member_topic: \"Domain member topic\",\n};\n\nexport const SynsetRelationRelType: Record<string, string> = {\n agent: \"Agent\",\n also: \"See also\",\n anto_converse: \"Converse antonym\",\n anto_gradable: \"Gradable antonym\",\n anto_simple: \"Simple antonym\",\n antonym: \"Antonym\",\n attribute: \"Attribute\",\n augmentative: \"Augmentative\",\n be_in_state: \"Be in state\",\n cause: \"Cause\",\n causes: \"Causes\",\n classified_by: \"Classified by\",\n classifies: \"Classifies\",\n co_agent_instrument: \"Co-agent instrument\",\n co_agent_patient: \"Co-agent patient\",\n co_agent_result: \"Co-agent result\",\n co_instrument_agent: \"Co-instrument agent\",\n co_instrument_patient: \"Co-instrument patient\",\n co_instrument_result: \"Co-instrument result\",\n co_patient_agent: \"Co-patient agent\",\n co_patient_instrument: \"Co-patient instrument\",\n co_result_agent: \"Co-result agent\",\n co_result_instrument: \"Co-result instrument\",\n co_role: \"Co-role\",\n diminutive: \"Diminutive\",\n direction: \"Direction\",\n domain_member_region: \"Domain member region\",\n domain_member_topic: \"Domain member topic\",\n domain_region: \"Domain region\",\n domain_topic: \"Domain topic\",\n entail: \"Entail\",\n entails: \"Entails\",\n eq_synonym: \"Equivalent synonym\",\n exemplifies: \"Exemplifies\",\n feminine: \"Feminine\",\n has_augmentative: \"Has augmentative\",\n has_diminutive: \"Has diminutive\",\n has_domain_region: \"Has domain region\",\n has_domain_topic: \"Has domain topic\",\n has_feminine: \"Has feminine\",\n has_masculine: \"Has masculine\",\n has_young: \"Has young\",\n holo_location: \"Holonym location\",\n holo_member: \"Member holonym\",\n holo_part: \"Part holonym\",\n holo_portion: \"Portion holonym\",\n holo_substance: \"Substance holonym\",\n holonym: \"Holonym\",\n hypernym: \"Hypernym\",\n hyponym: \"Hyponym\",\n in_manner: \"In manner\",\n instance_hypernym: \"Instance hypernym\",\n instance_hyponym: \"Instance hyponym\",\n instrument: \"Instrument\",\n involved: \"Involved\",\n involved_agent: \"Involved agent\",\n involved_direction: \"Involved direction\",\n involved_instrument: \"Involved instrument\",\n involved_location: \"Involved location\",\n involved_patient: \"Involved patient\",\n involved_result: \"Involved result\",\n involved_source_direction: \"Involved source direction\",\n involved_target_direction: \"Involved target direction\",\n ir_synonym: \"IR synonym\",\n is_caused_by: \"Is caused by\",\n is_entailed_by: \"Is entailed by\",\n is_exemplified_by: \"Is exemplified by\",\n is_subevent_of: \"Is subevent of\",\n location: \"Location\",\n manner_of: \"Manner of\",\n masculine: \"Masculine\",\n member_holonym: \"Member holonym\",\n member_meronym: \"Member meronym\",\n mero_location: \"Meronym location\",\n mero_member: \"Member meronym\",\n mero_part: \"Part meronym\",\n mero_portion: \"Portion meronym\",\n mero_substance: \"Substance meronym\",\n meronym: \"Meronym\",\n other: \"Other\",\n part_holonym: \"Part holonym\",\n part_meronym: \"Part meronym\",\n patient: \"Patient\",\n restricted_by: \"Restricted by\",\n restricts: \"Restricts\",\n result: \"Result\",\n role: \"Role\",\n similar: \"Similar\",\n source_direction: \"Source direction\",\n state_of: \"State of\",\n subevent: \"Subevent\",\n substance_holonym: \"Substance holonym\",\n substance_meronym: \"Substance meronym\",\n target_direction: \"Target direction\",\n young: \"Young\",\n};\n\nexport const AdjPosition: Record<string, string> = {\n a: \"Attributive\",\n ip: \"Immediate postnominal\",\n p: \"Predicative\",\n};\n","import { existsSync, statSync, writeFileSync, mkdirSync, readdirSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { parse, Node } from \"@dbushell/xml-streamify\";\nimport { LexiconNode } from \"./helpers\";\nimport type { Lexicon } from \"./types\";\n\n/** Base version to start searching from */\nexport const BASE_VERSION = \"2024\";\n\n/** Generate filename for a given version */\nexport function getFilename(version: string): string {\n return `english-wordnet-${version}.xml`;\n}\n\n/** Generate download URL for a given version */\nexport function getDownloadUrl(version: string): string {\n return `https://en-word.net/static/${getFilename(version)}.gz`;\n}\n\n/** Default cache directory for downloaded WordNet data */\nexport function getDefaultCacheDir(): string {\n const homeDir = process.env.HOME || process.env.USERPROFILE || \".\";\n return path.join(homeDir, \".cache\", \"synset\");\n}\n\n/** Check if file exists and is a file */\nfunction fileExists(filePath: string): boolean {\n if (existsSync(filePath)) {\n const stat = statSync(filePath);\n return stat.isFile();\n }\n return false;\n}\n\n/** Check if a remote URL exists (HEAD request) */\nasync function urlExists(url: string): Promise<boolean> {\n try {\n const response = await fetch(url, { method: \"HEAD\" });\n return response.ok;\n } catch {\n return false;\n }\n}\n\n/** Extract version year from filename (e.g., \"english-wordnet-2024.xml\" -> 2024) */\nfunction extractVersionFromFilename(filename: string): number | null {\n const match = filename.match(/english-wordnet-(\\d{4})\\.xml/);\n return match ? parseInt(match[1], 10) : null;\n}\n\n/** Find any cached WordNet file and return its version */\nfunction findCachedVersion(cacheDir: string): string | null {\n if (!existsSync(cacheDir)) return null;\n\n const files = readdirSync(cacheDir);\n const wordnetFiles = files\n .map((f) => ({ file: f, year: extractVersionFromFilename(f) }))\n .filter((x): x is { file: string; year: number } => x.year !== null)\n .sort((a, b) => b.year - a.year); // newest first\n\n return wordnetFiles.length > 0 ? wordnetFiles[0].year.toString() : null;\n}\n\n/**\n * Find the best available WordNet version.\n * - WordNet releases come out at END of year, so we only check up to (currentYear - 1)\n * - If cached version exists and no newer year has passed, use cache (no network)\n * - If a new year has passed since cache, check for that year's release\n * - If no cache, discover latest available\n */\nexport async function findLatestVersion(\n onProgress?: (message: string) => void,\n cacheDir?: string\n): Promise<string> {\n const log = onProgress || (() => {});\n const currentYear = new Date().getFullYear();\n const lastReleasableYear = currentYear - 1; // Can't have 2026 release until end of 2026\n const baseYear = parseInt(BASE_VERSION, 10);\n const dir = cacheDir || getDefaultCacheDir();\n\n // Check for existing cache\n const cachedVersion = findCachedVersion(dir);\n if (cachedVersion) {\n const cachedYear = parseInt(cachedVersion, 10);\n\n // If cached version is already at or beyond last releasable year, use it\n if (cachedYear >= lastReleasableYear) {\n return cachedVersion;\n }\n\n // Check for versions between cache and last releasable year\n log(`Checking for newer version...`);\n for (let year = cachedYear + 1; year <= lastReleasableYear; year++) {\n const version = year.toString();\n if (await urlExists(getDownloadUrl(version))) {\n log(`Found ${version}`);\n return version;\n }\n }\n // No newer version found, use cache\n return cachedVersion;\n }\n\n // No cache - discover from BASE_VERSION\n log(`Checking available versions...`);\n if (await urlExists(getDownloadUrl(BASE_VERSION))) {\n // Check if there's a newer version (up to last releasable year)\n for (let year = baseYear + 1; year <= lastReleasableYear; year++) {\n const version = year.toString();\n if (await urlExists(getDownloadUrl(version))) {\n continue; // Keep checking for even newer\n } else {\n return (year - 1).toString();\n }\n }\n // All years up to lastReleasableYear exist, return that\n return lastReleasableYear.toString();\n }\n\n // Base version doesn't exist, try incrementing\n for (let year = baseYear + 1; year <= lastReleasableYear; year++) {\n const version = year.toString();\n if (await urlExists(getDownloadUrl(version))) {\n return version;\n }\n }\n\n throw new Error(\n `No WordNet version found between ${BASE_VERSION} and ${lastReleasableYear}`\n );\n}\n\n/** Download and decompress WordNet XML from remote URL */\nasync function downloadWordNet(version: string, destPath: string): Promise<void> {\n const url = getDownloadUrl(version);\n const response = await fetch(url);\n if (!response.ok || !response.body) {\n throw new Error(`Failed to download WordNet ${version}: ${response.statusText}`);\n }\n\n const decompressed = response.body.pipeThrough(new DecompressionStream(\"gzip\"));\n const arrayBuffer = await new Response(decompressed).arrayBuffer();\n\n // Ensure directory exists\n const dir = path.dirname(destPath);\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n\n writeFileSync(destPath, Buffer.from(arrayBuffer));\n}\n\n/** Create XML streaming parser for WordNet file */\nexport function createParser(filePath: string) {\n const resolvedPath = path.resolve(filePath);\n // On Unix, paths start with /, so file:// + /path = file:///path\n // On Windows, paths start with C:, so file:/// + C:/path = file:///C:/path\n const fileUrl = resolvedPath.startsWith(\"/\")\n ? `file://${resolvedPath}`\n : `file:///${resolvedPath.replace(/\\\\/g, \"/\")}`;\n return parse(fileUrl, {\n ignoreDeclaration: false,\n silent: false,\n });\n}\n\n/** Parse Lexicon from XML stream */\nexport async function parseLexicon(\n parser: AsyncGenerator<Node, void | Node, void>\n): Promise<Lexicon | undefined> {\n for await (const node of parser) {\n if (node.type === \"Lexicon\") {\n return LexiconNode(node);\n }\n }\n return undefined;\n}\n\nexport interface LoadOptions {\n /** Specific version to download (e.g., \"2024\"). If not set, finds latest. */\n version?: string;\n /** Custom cache directory for downloaded data */\n cacheDir?: string;\n /** Force re-download even if cached */\n forceDownload?: boolean;\n /** Callback for progress updates */\n onProgress?: (message: string) => void;\n}\n\nexport interface LoadResult {\n lexicon: Lexicon;\n version: string;\n filePath: string;\n}\n\n/**\n * Load WordNet from a local file path.\n * @param filePath Path to the WordNet XML file\n */\nexport async function loadWordNet(filePath: string): Promise<Lexicon> {\n if (!fileExists(filePath)) {\n throw new Error(`WordNet file not found: ${filePath}`);\n }\n\n const parser = createParser(filePath);\n const lexicon = await parseLexicon(parser);\n\n if (!lexicon) {\n throw new Error(\"Failed to parse WordNet: no Lexicon node found\");\n }\n\n return lexicon;\n}\n\n/**\n * Fetch WordNet from remote URL, cache locally, and parse.\n * If no version specified, finds the latest available version.\n * @param options Loading options\n * @returns LoadResult with lexicon, version, and file path\n */\nexport async function fetchWordNet(options: LoadOptions = {}): Promise<LoadResult> {\n const cacheDir = options.cacheDir || getDefaultCacheDir();\n const log = options.onProgress || (() => {});\n\n // Determine version to use\n const version = options.version || await findLatestVersion(log, cacheDir);\n const filename = getFilename(version);\n const cachedPath = path.join(cacheDir, filename);\n\n if (!fileExists(cachedPath) || options.forceDownload) {\n const url = getDownloadUrl(version);\n log(`Downloading WordNet ${version} from ${url}`);\n await downloadWordNet(version, cachedPath);\n log(`Saved to ${cachedPath}`);\n } else {\n log(`Using cached ${cachedPath}`);\n }\n\n const lexicon = await loadWordNet(cachedPath);\n return { lexicon, version, filePath: cachedPath };\n}\n\n/**\n * Get path to cached WordNet file (downloads if not present).\n * Useful when you want to work with the file directly.\n * @returns Object with file path and version\n */\nexport async function ensureWordNetCached(\n options: LoadOptions = {}\n): Promise<{ filePath: string; version: string }> {\n const cacheDir = options.cacheDir || getDefaultCacheDir();\n const log = options.onProgress || (() => {});\n\n // Determine version to use\n const version = options.version || await findLatestVersion(log, cacheDir);\n const filename = getFilename(version);\n const cachedPath = path.join(cacheDir, filename);\n\n if (!fileExists(cachedPath) || options.forceDownload) {\n const url = getDownloadUrl(version);\n log(`Downloading WordNet ${version} from ${url}`);\n await downloadWordNet(version, cachedPath);\n log(`Saved to ${cachedPath}`);\n } else {\n log(`Using cached ${cachedPath}`);\n }\n\n return { filePath: cachedPath, version };\n}\n\n// Legacy exports for backwards compatibility\nexport const WORDNET_VERSION = BASE_VERSION;\nexport const WORDNET_FILENAME = getFilename(BASE_VERSION);\nexport const WORDNET_URL = getDownloadUrl(BASE_VERSION);\n","/**\n * Module exports an XML Node class.\n *\n * @module\n */\n/** XML node with helper methods to read data and traverse the tree */\nexport class Node {\n #type: string;\n #children: Array<Node>;\n #parent?: Node;\n #attr?: Record<string, string>;\n #raw?: string;\n\n constructor(type: string, parent?: Node, raw?: string) {\n this.#type = type;\n this.#parent = parent;\n this.#raw = raw;\n this.#children = [];\n }\n\n get type(): string {\n return this.#type;\n }\n\n get raw(): string {\n return this.#raw ?? '';\n }\n\n get parent(): Node | undefined {\n return this.#parent;\n }\n\n get children(): Array<Node> {\n return this.#children;\n }\n\n get attributes(): Record<string, string> {\n if (this.#attr) {\n return this.#attr;\n }\n // Setup and parse attributes on first access\n this.#attr = {};\n if (this.raw) {\n const regex = /([\\w:.-]+)\\s*=\\s*([\"'])(.*?)\\2/g;\n let match: RegExpExecArray | null;\n while ((match = regex.exec(this.raw)) !== null) {\n this.#attr[match[1]] = match[3];\n }\n }\n return this.#attr;\n }\n\n get innerText(): string {\n if (this.children.length) {\n let text = '';\n for (const child of this.children) {\n text += child.innerText;\n }\n return text;\n }\n return (this.raw.match(/<!\\[CDATA\\[(.*?)]]>/s) ?? [, this.raw])[1];\n }\n\n addChild(child: Node): void {\n this.#children.push(child);\n }\n\n /**\n * Returns true if node and parents match the key hierarchy\n * @param keys - XML tag names\n */\n is(...keys: Array<string>): boolean {\n if (!keys.length) return false;\n let parent: Node | undefined;\n for (const key of keys.toReversed()) {\n parent = parent ? parent.parent : this;\n if (parent?.type !== key) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Return the first child matching the key\n * @param key - XML tag name\n */\n first(key: string): Node | undefined {\n return this.children.find((n) => n.type === key);\n }\n\n /**\n * Return all children matching the key hierarchy\n * @param keys - XML tag names\n */\n all(...keys: Array<string>): Array<Node> {\n let nodes: Array<Node> | undefined = this.children;\n let found: Array<Node> = [];\n for (const [i, k] of Object.entries(keys)) {\n if (Number.parseInt(i) === keys.length - 1) {\n found = nodes.filter((n) => n.type === k);\n break;\n }\n nodes = nodes?.find((n) => n.type === k)?.children;\n if (!nodes) return [];\n }\n return found;\n }\n}\n","/**\n * Module exports a `TransformStream` class for decoding binary XML streams into structured data.\n *\n * @module\n */\nimport {NodeType, StateType} from './types.ts';\n\ntype State = NodeType | StateType;\n\nconst ENTITIES = {\n cdata: {\n end: ']]>',\n start: /^<!\\[CDATA\\[/\n },\n comment: {\n end: '-->',\n start: /^<!--/\n },\n declaration: {\n end: '?>',\n start: /^<\\?/\n },\n doctype: {\n end: '>',\n start: /^<!DOCTYPE/i\n },\n element: {\n end: '>',\n start: /^<[\\w:.-/]/\n }\n} as const;\n\n/** Transformer object for `TransformStream` constructed by `XMLStream` */\nexport const transformer: Transformer<string, [NodeType, string]> & {\n buf: string;\n state: State;\n previous: [State, number];\n} = {\n buf: '',\n state: StateType.SKIP,\n previous: [StateType.SKIP, -1],\n flush(controller) {\n // Buffer should be empty if document is well-formed\n if (this.buf.length > 0) {\n controller.enqueue([NodeType.TEXT, this.buf]);\n }\n },\n transform(chunk, controller) {\n this.buf += chunk;\n while (this.buf.length) {\n // Break if no progress is made (entity may straddle chunk boundary)\n if (\n this.state === this.previous[0] &&\n this.buf.length === this.previous[1]\n ) {\n break;\n }\n this.previous = [this.state, this.buf.length];\n // Skip to next entity\n if (this.state === StateType.SKIP) {\n const index = this.buf.indexOf('<');\n if (index < 0) break;\n // Clear buffer up to index of next entity\n controller.enqueue([NodeType.TEXT, this.buf.substring(0, index)]);\n this.buf = this.buf.substring(index);\n this.state = StateType.SEARCH;\n }\n // Search for start of entity\n if (this.state === StateType.SEARCH) {\n if (this.buf.length < 3) break;\n for (const [state, entity] of Object.entries(ENTITIES)) {\n if (this.buf.match(entity.start)) {\n this.state = state as State;\n break;\n }\n }\n continue;\n }\n // Search for end of entity\n if (Object.hasOwn(ENTITIES, this.state)) {\n const {end} = ENTITIES[this.state as keyof typeof ENTITIES];\n const index = this.buf.indexOf(end);\n if (index < 0) break;\n controller.enqueue([\n this.state,\n this.buf.substring(0, index + end.length)\n ]);\n this.buf = this.buf.substring(index + end.length);\n this.state = StateType.SKIP;\n continue;\n }\n // We should never be here something is very wrong!\n throw new Error();\n }\n }\n};\n\n/** Transform a binary XML stream into a stream of structured XML data */\nexport class XMLStream extends TransformStream<string, [NodeType, string]> {\n constructor() {\n super({...transformer});\n }\n}\n","/**\n * Module export an async generator function for parsing a streamed XML document.\n *\n * @module\n */\nimport type {ParseOptions} from './types.ts';\nimport {NodeType} from './types.ts';\nimport {Node} from './node.ts';\nimport {XMLStream} from './stream.ts';\n\nconst ignoreTypes: Partial<Record<NodeType, keyof ParseOptions>> = {\n [NodeType.COMMENT]: 'ignoreComments',\n [NodeType.DECLARATION]: 'ignoreDeclaration',\n [NodeType.DOCTYPE]: 'ignoreDoctype'\n} as const;\n\n/**\n * Async generator function for parsing a streamed XML document\n * @param input URL to fetch and parse (or a ReadableStream)\n * @param options Parsing options {@link ParseOptions}\n * @returns Yields parsed XML nodes {@link Node}\n */\nexport async function* parse(\n input: string | URL | ReadableStream,\n options?: ParseOptions\n): AsyncGenerator<Node, Node | void, void> {\n const document = new Node('@document');\n try {\n const init = {...options?.fetchOptions};\n if (options?.signal) {\n init.signal = options.signal;\n }\n\n let source: ReadableStream;\n\n // Fetch stream if URL is provided as input\n if (typeof input === 'string' || input instanceof URL) {\n input = new URL(input);\n const response = await fetch(input, init);\n if (!response.ok || !response.body) {\n throw new Error(`Bad response`);\n }\n source = response.body;\n } else {\n source = input;\n }\n\n const stream = source\n .pipeThrough(new TextDecoderStream())\n .pipeThrough(new XMLStream(), {\n signal: options?.signal\n });\n\n // Set root document as current node\n let node = document;\n\n for await (const [type, value] of stream) {\n if (options?.signal?.aborted) {\n break;\n }\n // Skip whitespace\n if (type === NodeType.TEXT) {\n if (options?.ignoreWhitespace !== false && value.trim().length === 0) {\n continue;\n }\n }\n // Handle other ignored types\n if (type in ignoreTypes && options?.[ignoreTypes[type]!] === false) {\n const newNode = new Node(type, node, value);\n node.addChild(newNode);\n yield newNode;\n continue;\n }\n // Handle elements\n if (type === NodeType.ELEMENT) {\n const name = value.match(/<\\/?([\\w:.-]+)/)![1];\n // Handle self-closing element\n if (value.endsWith('/>')) {\n const newNode = new Node(name, node, value);\n node.addChild(newNode);\n yield newNode;\n continue;\n }\n // Handle closing element\n if (value.startsWith('</')) {\n yield node;\n node = node.parent!;\n continue;\n }\n // Handle opening element\n const newNode = new Node(name, node, value);\n node.addChild(newNode);\n node = newNode;\n continue;\n }\n // Handle other types\n node.addChild(new Node(type, node, value));\n }\n } catch (err) {\n if (options?.silent === false) {\n throw err;\n }\n }\n return document;\n}\n","import { Node } from \"@dbushell/xml-streamify\";\nimport {\n AdjPosition,\n Definition,\n Example,\n Form,\n ILIDefinition,\n Lemma,\n LexicalEntry,\n Lexicon,\n PartsOfSpeech,\n Pronunciation,\n Sense,\n SenseRelation,\n SenseRelationRelType,\n Synset,\n SynsetId,\n SynsetRelation,\n SynsetRelationRelType,\n SyntacticBehavior,\n} from \"./types\";\n\nexport function PronunciationNode(node: Node): Pronunciation {\n const obj: Pronunciation = {\n variety: optAttr(node, \"variety\"),\n inner: node.innerText,\n };\n return Pronunciation.parse(extendWithRestAttr(node, obj, (s) => s));\n}\n\nexport function LemmaNode(node: Node): Lemma {\n const obj: Lemma = {\n writtenForm: attr(node, \"writtenForm\"),\n partOfSpeech: PartsOfSpeech.parse(attr(node, \"partOfSpeech\")),\n pronunciations: //\n children(node, \"Pronunciation\", (v) => PronunciationNode(v)),\n };\n return Lemma.parse(extendWithRestAttr(node, obj, (s) => s));\n}\n\nexport function SenseRelationNode(node: Node): SenseRelation {\n const obj: SenseRelation = {\n relType: SenseRelationRelType.parse(attr(node, \"relType\")),\n target: attr(node, \"target\"),\n dcType: optAttr(node, \"dc:type\"),\n };\n return SenseRelation.parse(\n extendWithRestAttr(node, obj, (s) => (s == \"dc:type\" ? \"dcType\" : s))\n );\n}\n\nexport function SenseNode(node: Node): Sense {\n const adjPos = optAttr(node, \"adjposition\");\n const obj: Sense = {\n id: attr(node, \"id\"),\n synset: SynsetId.parse(attr(node, \"synset\")),\n senseRelations: children(node, \"SenseRelation\", SenseRelationNode),\n subCat: optAttr(node, \"subcat\"),\n adjPosition: adjPos ? AdjPosition.parse(adjPos) : undefined,\n };\n return Sense.parse(\n extendWithRestAttr(\n node,\n obj,\n (s) => (s == \"subcat\" ? \"subCat\" : s == \"adjposition\" ? \"adjPosition\" : s)\n )\n );\n}\n\nexport function FormNode(node: Node): Form {\n const obj: Form = {\n writtenForm: attr(node, \"writtenForm\"),\n };\n return Form.parse(extendWithRestAttr(node, obj, (s) => s));\n}\n\nexport function LexicalEntryNode(node: Node): LexicalEntry {\n const obj: LexicalEntry = {\n id: attr(node, \"id\"),\n lemmas: children(node, \"Lemma\", LemmaNode),\n senses: children(node, \"Sense\", SenseNode),\n forms: children(node, \"Form\", FormNode),\n };\n return LexicalEntry.parse(extendWithRestAttr(node, obj, (s) => s));\n}\n\nexport function DefinitionNode(node: Node): Definition {\n const obj: Definition = {\n inner: node.innerText,\n };\n return Definition.parse(extendWithRestAttr(node, obj, (s) => s));\n}\n\nexport function ExampleNode(node: Node): Example {\n const obj: Example = {\n inner: node.innerText,\n dcSource: optAttr(node, \"dc:source\"),\n };\n return Example.parse(\n extendWithRestAttr(node, obj, (s) => (s == \"dc:source\" ? \"dcSource\" : s))\n );\n}\n\nexport function ILIDefinitionNode(node: Node): ILIDefinition {\n const obj: ILIDefinition = {\n inner: node.innerText,\n };\n return ILIDefinition.parse(extendWithRestAttr(node, obj, (s) => s));\n}\n\nexport function SynsetRelationNode(node: Node): SynsetRelation {\n const obj: SynsetRelation = {\n relType: SynsetRelationRelType.parse(attr(node, \"relType\")),\n target: attr(node, \"target\"),\n };\n return SynsetRelation.parse(extendWithRestAttr(node, obj, (s) => s));\n}\n\nexport function SyntacticBehaviorNode(node: Node): SyntacticBehavior {\n const obj: SyntacticBehavior = {\n id: attr(node, \"id\"),\n subcategorizationFrame: attr(node, \"subcategorizationFrame\"),\n };\n return SyntacticBehavior.parse(extendWithRestAttr(node, obj, (s) => s));\n}\n\nexport function SynsetNode(node: Node): Synset {\n const obj: Synset = {\n id: attr(node, \"id\"),\n ili: attr(node, \"ili\"),\n lexfile: attr(node, \"lexfile\"),\n members: attr(node, \"members\").split(\" \"),\n dcSource: optAttr(node, \"dc:source\"),\n partOfSpeech: PartsOfSpeech.parse(attr(node, \"partOfSpeech\")),\n definitions: children(node, \"Definition\", (v) => DefinitionNode(v)),\n examples: children(node, \"Example\", (v) => ExampleNode(v)),\n iliDefinitions: children(node, \"ILIDefinition\", ILIDefinitionNode),\n synsetRelations: children(node, \"SynsetRelation\", SynsetRelationNode),\n };\n return Synset.parse(\n extendWithRestAttr(node, obj, (s) => (s == \"dc:source\" ? \"dcSource\" : s))\n );\n}\n\n/** LexiconNode is used as a root node for the whole WordNet document structure,\n * omitting the `LexicalResource` parent (and its virtual grandparent representing the\n * whole document). */\nexport function LexiconNode(node: Node): Lexicon {\n const obj: Lexicon = {\n id: attr(node, \"id\"),\n label: attr(node, \"label\"),\n language: attr(node, \"language\"),\n email: attr(node, \"email\"),\n license: attr(node, \"license\"),\n version: attr(node, \"version\"),\n citation: optAttr(node, \"citation\"),\n url: attr(node, \"url\"),\n lexicalEntries: children(node, \"LexicalEntry\", LexicalEntryNode),\n synsets: children(node, \"Synset\", SynsetNode),\n syntacticBehaviors: //\n children(node, \"SyntacticBehaviour\", SyntacticBehaviorNode),\n };\n return Lexicon.parse(extendWithRestAttr(node, obj, (s) => s));\n}\n\nexport const decodeXmlEntities = (s: string | undefined): string | undefined => {\n if (s === undefined) return undefined;\n return s\n .replace(/&amp;/g, \"&\")\n .replace(/&lt;/g, \"<\")\n .replace(/&gt;/g, \">\")\n .replace(/&apos;/g, \"'\")\n .replace(/&quot;/g, '\"');\n};\n\nconst attr = (node: Node, attrName: string): string => {\n const value = decodeXmlEntities(node.attributes[attrName]);\n if (value === undefined) {\n throw new Error(`Missing required attribute \"${attrName}\" on node \"${node.type}\"`);\n }\n return value;\n};\n\nconst optAttr = (node: Node, attrName: string): string | undefined => {\n return decodeXmlEntities(node.attributes[attrName]);\n};\n\n/** restAttrs appends the rest of the attributes, taking into account that some has been renamed.\n * The proxy function provided is expected to return the renamed result for an original xml key.\n */\nconst restAttrs = (\n node: Node,\n obj: object,\n proxy: (from: string) => string\n): Record<string, string> => {\n const result: Record<string, string> = {};\n Object.keys(node.attributes) // These keys are still unmodified\n .filter((a) => !(proxy(a) in obj)) // Here we can't trust the 'in' because obj already has modified keys.\n .forEach((k) => {\n result[k] = decodeXmlEntities(node.attributes[k]) ?? node.attributes[k];\n });\n return result;\n};\n\nconst extendWithRestAttr = (\n node: Node,\n obj: object,\n proxy: (from: string) => string\n) => {\n return Object.assign(obj, restAttrs(node, obj, proxy));\n};\n\nconst children = <T, Fn extends (node: Node) => T>(\n node: Node,\n type: string,\n fn: Fn\n) => {\n return node.children.filter((v: Node) => v.type == type).map((v: Node) => fn(v));\n};\n","import type {\n Lexicon,\n LexicalEntry,\n Sense,\n Synset,\n SynsetRelation,\n} from \"./types\";\nimport { SynsetRelationRelType as SynsetRelationRelTypeSchema } from \"./types\";\nimport { z } from \"zod\";\n\nexport type SynsetRelationRelType = z.infer<typeof SynsetRelationRelTypeSchema>;\n\n/** Definition with its source synset */\nexport interface DefinitionResult {\n text: string;\n synset: Synset;\n partOfSpeech: string;\n}\n\n/** Synonym with its source context */\nexport interface SynonymResult {\n word: string;\n entry: LexicalEntry;\n synset: Synset;\n}\n\n/** Indexed WordNet data for fast lookups */\nexport interface WordNetIndex {\n /** All synsets indexed by ID */\n synsets: Map<string, Synset>;\n /** All senses indexed by ID */\n senses: Map<string, Sense>;\n /** All lexical entries indexed by ID */\n entries: Map<string, LexicalEntry>;\n /** Lexical entries indexed by word (lowercase) */\n byWord: Map<string, LexicalEntry[]>;\n /** Senses indexed by word (lowercase) */\n sensesByWord: Map<string, Sense[]>;\n /** Synsets indexed by word (lowercase) */\n synsetsByWord: Map<string, Synset[]>;\n /** Original lexicon */\n lexicon: Lexicon;\n}\n\n/**\n * Build an indexed structure for fast lookups.\n * Call this once after loading the lexicon.\n */\nexport function buildIndex(lexicon: Lexicon): WordNetIndex {\n const synsets = new Map<string, Synset>();\n const senses = new Map<string, Sense>();\n const entries = new Map<string, LexicalEntry>();\n const byWord = new Map<string, LexicalEntry[]>();\n const sensesByWord = new Map<string, Sense[]>();\n const synsetsByWord = new Map<string, Synset[]>();\n\n // Index synsets\n for (const synset of lexicon.synsets) {\n synsets.set(synset.id, synset);\n }\n\n // Index lexical entries and senses\n for (const entry of lexicon.lexicalEntries) {\n entries.set(entry.id, entry);\n\n const word = entry.lemmas[0]?.writtenForm.toLowerCase();\n if (word) {\n // Index by word\n const existing = byWord.get(word) || [];\n existing.push(entry);\n byWord.set(word, existing);\n\n // Index senses by word\n for (const sense of entry.senses) {\n senses.set(sense.id, sense);\n\n const existingSenses = sensesByWord.get(word) || [];\n existingSenses.push(sense);\n sensesByWord.set(word, existingSenses);\n\n // Index synsets by word\n const synset = synsets.get(sense.synset);\n if (synset) {\n const existingSynsets = synsetsByWord.get(word) || [];\n if (!existingSynsets.includes(synset)) {\n existingSynsets.push(synset);\n synsetsByWord.set(word, existingSynsets);\n }\n }\n }\n }\n }\n\n return {\n synsets,\n senses,\n entries,\n byWord,\n sensesByWord,\n synsetsByWord,\n lexicon,\n };\n}\n\n/** Get a synset by ID */\nexport function getSynset(index: WordNetIndex, id: string): Synset | undefined {\n return index.synsets.get(id);\n}\n\n/** Get a sense by ID */\nexport function getSense(index: WordNetIndex, id: string): Sense | undefined {\n return index.senses.get(id);\n}\n\n/** Get a lexical entry by ID */\nexport function getLexicalEntry(\n index: WordNetIndex,\n id: string\n): LexicalEntry | undefined {\n return index.entries.get(id);\n}\n\n/** Find all lexical entries for a word */\nexport function findWord(index: WordNetIndex, word: string): LexicalEntry[] {\n return index.byWord.get(word.toLowerCase()) || [];\n}\n\n/** Find all senses for a word */\nexport function findSenses(index: WordNetIndex, word: string): Sense[] {\n return index.sensesByWord.get(word.toLowerCase()) || [];\n}\n\n/** Find all synsets for a word */\nexport function findSynsets(index: WordNetIndex, word: string): Synset[] {\n return index.synsetsByWord.get(word.toLowerCase()) || [];\n}\n\n/** Get all definitions for a word */\nexport function getDefinitions(index: WordNetIndex, word: string): DefinitionResult[] {\n const synsets = findSynsets(index, word);\n return synsets.flatMap((synset) =>\n synset.definitions.map((d) => ({\n text: d.inner,\n synset,\n partOfSpeech: synset.partOfSpeech,\n }))\n );\n}\n\n/** Get related synsets by relation type */\nexport function getRelated(\n index: WordNetIndex,\n synset: Synset,\n relType: SynsetRelationRelType\n): Synset[] {\n return synset.synsetRelations\n .filter((r: SynsetRelation) => r.relType === relType)\n .map((r: SynsetRelation) => index.synsets.get(r.target))\n .filter((s): s is Synset => s !== undefined);\n}\n\n/** Get hypernyms (more general terms) for a word */\nexport function getHypernyms(index: WordNetIndex, word: string): Synset[] {\n const synsets = findSynsets(index, word);\n return synsets.flatMap((s) => getRelated(index, s, \"hypernym\"));\n}\n\n/** Get hyponyms (more specific terms) for a word */\nexport function getHyponyms(index: WordNetIndex, word: string): Synset[] {\n const synsets = findSynsets(index, word);\n return synsets.flatMap((s) => getRelated(index, s, \"hyponym\"));\n}\n\n/** Get synonyms for a word (words in the same synsets) */\nexport function getSynonyms(index: WordNetIndex, word: string): SynonymResult[] {\n const synsets = findSynsets(index, word);\n const lowerWord = word.toLowerCase();\n const seen = new Set<string>();\n const results: SynonymResult[] = [];\n\n for (const synset of synsets) {\n for (const memberId of synset.members) {\n const entry = index.entries.get(memberId);\n if (entry) {\n const lemma = entry.lemmas[0]?.writtenForm;\n if (lemma && lemma.toLowerCase() !== lowerWord && !seen.has(lemma)) {\n seen.add(lemma);\n results.push({ word: lemma, entry, synset });\n }\n }\n }\n }\n\n return results;\n}\n\n/** Get the written form of the first lemma for a synset */\nexport function getSynsetWords(index: WordNetIndex, synset: Synset): string[] {\n return synset.members\n .map((id) => index.entries.get(id))\n .filter((e): e is LexicalEntry => e !== undefined)\n .map((e) => e.lemmas[0]?.writtenForm)\n .filter((w): w is string => w !== undefined);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,2BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,6BAAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,8BAAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAkB;AAEX,IAAM,YAAY,aAAE,OAAO;AAC3B,IAAM,iBAAiB,aAAE,OAAO;AAChC,IAAM,WAAW,aAAE,OAAO;AAC1B,IAAM,UAAU,aAAE,OAAO;AACzB,IAAM,sBAAsB,aAAE,OAAO;AAGrC,IAAM,gBAAgB,aAAE,MAAM;AAAA,EACnC,aAAE,QAAQ,GAAG;AAAA,EACb,aAAE,QAAQ,GAAG;AAAA,EACb,aAAE,QAAQ,GAAG;AAAA,EACb,aAAE,QAAQ,GAAG;AAAA,EACb,aAAE,QAAQ,GAAG;AAAA,EACb,aAAE,QAAQ,GAAG;AAAA,EACb,aAAE,QAAQ,GAAG;AAAA,E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AS,MAAM,YAAY,MAAM,aAAa,CAAC,KAAK,IAAI,KAAK,GAAG;AAClE,eAAK,IAAI,KAAK;AACd,kBAAQ,KAAK,EAAE,MAAM,OAAO,OAAO,OAAO,CAAC;AAAA,QAC7C;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAGO,SAAS,eAAe,OAAqB,QAA0B;AAC5E,SAAO,OAAO,QACX,IAAI,CAAC,OAAO,MAAM,QAAQ,IAAI,EAAE,CAAC,EACjC,OAAO,CAAC,MAAyB,MAAM,MAAS,EAChD,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,EACnC,OAAO,CAAC,MAAmB,MAAM,MAAS;AAC/C;","names":["AdjPosition","PartsOfSpeech","SenseRelationRelType","SynsetRelationRelType","PartsOfSpeech","SenseRelationRelType","SynsetRelationRelType","AdjPosition","newNode","path"]}
@@ -0,0 +1,319 @@
1
+ import { z } from 'zod';
2
+ import { Node } from '@dbushell/xml-streamify';
3
+
4
+ declare const LexiconId: z.ZodString;
5
+ declare const LexicalEntryId: z.ZodString;
6
+ declare const SynsetId: z.ZodString;
7
+ declare const SenseId: z.ZodString;
8
+ declare const SyntacticBehaviorId: z.ZodString;
9
+ /** Note: only the literals that are found in the test wordnet xml file are listed */
10
+ declare const PartsOfSpeech$1: z.ZodUnion<readonly [z.ZodLiteral<"a">, z.ZodLiteral<"c">, z.ZodLiteral<"n">, z.ZodLiteral<"p">, z.ZodLiteral<"r">, z.ZodLiteral<"s">, z.ZodLiteral<"u">, z.ZodLiteral<"v">, z.ZodLiteral<"x">]>;
11
+ /** Note: only the literals that are found in the test wordnet xml file are listed */
12
+ declare const SenseRelationRelType$1: z.ZodUnion<readonly [z.ZodLiteral<"also">, z.ZodLiteral<"antonym">, z.ZodLiteral<"derivation">, z.ZodLiteral<"domain_member_region">, z.ZodLiteral<"domain_member_topic">, z.ZodLiteral<"domain_region">, z.ZodLiteral<"domain_topic">, z.ZodLiteral<"exemplifies">, z.ZodLiteral<"is_exemplified_by">, z.ZodLiteral<"other">, z.ZodLiteral<"participle">, z.ZodLiteral<"pertainym">, z.ZodLiteral<"similar">]>;
13
+ /** Note: only the literals that are found in the test wordnet xml file are listed */
14
+ declare const SynsetRelationRelType$2: z.ZodUnion<readonly [z.ZodLiteral<"also">, z.ZodLiteral<"attribute">, z.ZodLiteral<"cause">, z.ZodLiteral<"causes">, z.ZodLiteral<"domain_member_region">, z.ZodLiteral<"domain_member_topic">, z.ZodLiteral<"domain_region">, z.ZodLiteral<"domain_topic">, z.ZodLiteral<"entail">, z.ZodLiteral<"entails">, z.ZodLiteral<"exemplifies">, z.ZodLiteral<"has_domain_region">, z.ZodLiteral<"has_domain_topic">, z.ZodLiteral<"holo_member">, z.ZodLiteral<"holo_part">, z.ZodLiteral<"holo_substance">, z.ZodLiteral<"hypernym">, z.ZodLiteral<"hyponym">, z.ZodLiteral<"instance_hypernym">, z.ZodLiteral<"instance_hyponym">, z.ZodLiteral<"is_caused_by">, z.ZodLiteral<"is_entailed_by">, z.ZodLiteral<"is_exemplified_by">, z.ZodLiteral<"member_holonym">, z.ZodLiteral<"member_meronym">, z.ZodLiteral<"mero_member">, z.ZodLiteral<"mero_part">, z.ZodLiteral<"mero_substance">, z.ZodLiteral<"part_holonym">, z.ZodLiteral<"part_meronym">, z.ZodLiteral<"similar">, z.ZodLiteral<"substance_holonym">, z.ZodLiteral<"substance_meronym">]>;
15
+ declare const AdjPosition$1: z.ZodUnion<readonly [z.ZodLiteral<"a">, z.ZodLiteral<"ip">, z.ZodLiteral<"p">]>;
16
+ declare const Lemma: z.ZodObject<{
17
+ writtenForm: z.ZodString;
18
+ partOfSpeech: z.ZodUnion<readonly [z.ZodLiteral<"a">, z.ZodLiteral<"c">, z.ZodLiteral<"n">, z.ZodLiteral<"p">, z.ZodLiteral<"r">, z.ZodLiteral<"s">, z.ZodLiteral<"u">, z.ZodLiteral<"v">, z.ZodLiteral<"x">]>;
19
+ pronunciations: z.ZodArray<z.ZodObject<{
20
+ variety: z.ZodOptional<z.ZodString>;
21
+ inner: z.ZodString;
22
+ }, z.core.$strip>>;
23
+ }, z.core.$strip>;
24
+ type Lemma = z.infer<typeof Lemma>;
25
+ declare const LexicalEntry: z.ZodObject<{
26
+ id: z.ZodString;
27
+ lemmas: z.ZodArray<z.ZodObject<{
28
+ writtenForm: z.ZodString;
29
+ partOfSpeech: z.ZodUnion<readonly [z.ZodLiteral<"a">, z.ZodLiteral<"c">, z.ZodLiteral<"n">, z.ZodLiteral<"p">, z.ZodLiteral<"r">, z.ZodLiteral<"s">, z.ZodLiteral<"u">, z.ZodLiteral<"v">, z.ZodLiteral<"x">]>;
30
+ pronunciations: z.ZodArray<z.ZodObject<{
31
+ variety: z.ZodOptional<z.ZodString>;
32
+ inner: z.ZodString;
33
+ }, z.core.$strip>>;
34
+ }, z.core.$strip>>;
35
+ senses: z.ZodArray<z.ZodObject<{
36
+ id: z.ZodString;
37
+ synset: z.ZodString;
38
+ subCat: z.ZodOptional<z.ZodString>;
39
+ adjPosition: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"a">, z.ZodLiteral<"ip">, z.ZodLiteral<"p">]>>;
40
+ senseRelations: z.ZodArray<z.ZodObject<{
41
+ relType: z.ZodUnion<readonly [z.ZodLiteral<"also">, z.ZodLiteral<"antonym">, z.ZodLiteral<"derivation">, z.ZodLiteral<"domain_member_region">, z.ZodLiteral<"domain_member_topic">, z.ZodLiteral<"domain_region">, z.ZodLiteral<"domain_topic">, z.ZodLiteral<"exemplifies">, z.ZodLiteral<"is_exemplified_by">, z.ZodLiteral<"other">, z.ZodLiteral<"participle">, z.ZodLiteral<"pertainym">, z.ZodLiteral<"similar">]>;
42
+ dcType: z.ZodOptional<z.ZodString>;
43
+ target: z.ZodString;
44
+ }, z.core.$strip>>;
45
+ }, z.core.$strip>>;
46
+ forms: z.ZodArray<z.ZodObject<{
47
+ writtenForm: z.ZodString;
48
+ }, z.core.$strip>>;
49
+ }, z.core.$strip>;
50
+ type LexicalEntry = z.infer<typeof LexicalEntry>;
51
+ declare const Sense: z.ZodObject<{
52
+ id: z.ZodString;
53
+ synset: z.ZodString;
54
+ subCat: z.ZodOptional<z.ZodString>;
55
+ adjPosition: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"a">, z.ZodLiteral<"ip">, z.ZodLiteral<"p">]>>;
56
+ senseRelations: z.ZodArray<z.ZodObject<{
57
+ relType: z.ZodUnion<readonly [z.ZodLiteral<"also">, z.ZodLiteral<"antonym">, z.ZodLiteral<"derivation">, z.ZodLiteral<"domain_member_region">, z.ZodLiteral<"domain_member_topic">, z.ZodLiteral<"domain_region">, z.ZodLiteral<"domain_topic">, z.ZodLiteral<"exemplifies">, z.ZodLiteral<"is_exemplified_by">, z.ZodLiteral<"other">, z.ZodLiteral<"participle">, z.ZodLiteral<"pertainym">, z.ZodLiteral<"similar">]>;
58
+ dcType: z.ZodOptional<z.ZodString>;
59
+ target: z.ZodString;
60
+ }, z.core.$strip>>;
61
+ }, z.core.$strip>;
62
+ type Sense = z.infer<typeof Sense>;
63
+ declare const SenseRelation: z.ZodObject<{
64
+ relType: z.ZodUnion<readonly [z.ZodLiteral<"also">, z.ZodLiteral<"antonym">, z.ZodLiteral<"derivation">, z.ZodLiteral<"domain_member_region">, z.ZodLiteral<"domain_member_topic">, z.ZodLiteral<"domain_region">, z.ZodLiteral<"domain_topic">, z.ZodLiteral<"exemplifies">, z.ZodLiteral<"is_exemplified_by">, z.ZodLiteral<"other">, z.ZodLiteral<"participle">, z.ZodLiteral<"pertainym">, z.ZodLiteral<"similar">]>;
65
+ dcType: z.ZodOptional<z.ZodString>;
66
+ target: z.ZodString;
67
+ }, z.core.$strip>;
68
+ type SenseRelation = z.infer<typeof SenseRelation>;
69
+ declare const Pronunciation: z.ZodObject<{
70
+ variety: z.ZodOptional<z.ZodString>;
71
+ inner: z.ZodString;
72
+ }, z.core.$strip>;
73
+ type Pronunciation = z.infer<typeof Pronunciation>;
74
+ declare const Form: z.ZodObject<{
75
+ writtenForm: z.ZodString;
76
+ }, z.core.$strip>;
77
+ type Form = z.infer<typeof Form>;
78
+ declare const Synset: z.ZodObject<{
79
+ id: z.ZodString;
80
+ ili: z.ZodString;
81
+ members: z.ZodArray<z.ZodString>;
82
+ partOfSpeech: z.ZodUnion<readonly [z.ZodLiteral<"a">, z.ZodLiteral<"c">, z.ZodLiteral<"n">, z.ZodLiteral<"p">, z.ZodLiteral<"r">, z.ZodLiteral<"s">, z.ZodLiteral<"u">, z.ZodLiteral<"v">, z.ZodLiteral<"x">]>;
83
+ lexfile: z.ZodString;
84
+ dcSource: z.ZodOptional<z.ZodString>;
85
+ definitions: z.ZodArray<z.ZodObject<{
86
+ inner: z.ZodString;
87
+ }, z.core.$strip>>;
88
+ examples: z.ZodArray<z.ZodObject<{
89
+ inner: z.ZodString;
90
+ dcSource: z.ZodOptional<z.ZodString>;
91
+ }, z.core.$strip>>;
92
+ iliDefinitions: z.ZodArray<z.ZodObject<{
93
+ inner: z.ZodString;
94
+ }, z.core.$strip>>;
95
+ synsetRelations: z.ZodArray<z.ZodObject<{
96
+ relType: z.ZodUnion<readonly [z.ZodLiteral<"also">, z.ZodLiteral<"attribute">, z.ZodLiteral<"cause">, z.ZodLiteral<"causes">, z.ZodLiteral<"domain_member_region">, z.ZodLiteral<"domain_member_topic">, z.ZodLiteral<"domain_region">, z.ZodLiteral<"domain_topic">, z.ZodLiteral<"entail">, z.ZodLiteral<"entails">, z.ZodLiteral<"exemplifies">, z.ZodLiteral<"has_domain_region">, z.ZodLiteral<"has_domain_topic">, z.ZodLiteral<"holo_member">, z.ZodLiteral<"holo_part">, z.ZodLiteral<"holo_substance">, z.ZodLiteral<"hypernym">, z.ZodLiteral<"hyponym">, z.ZodLiteral<"instance_hypernym">, z.ZodLiteral<"instance_hyponym">, z.ZodLiteral<"is_caused_by">, z.ZodLiteral<"is_entailed_by">, z.ZodLiteral<"is_exemplified_by">, z.ZodLiteral<"member_holonym">, z.ZodLiteral<"member_meronym">, z.ZodLiteral<"mero_member">, z.ZodLiteral<"mero_part">, z.ZodLiteral<"mero_substance">, z.ZodLiteral<"part_holonym">, z.ZodLiteral<"part_meronym">, z.ZodLiteral<"similar">, z.ZodLiteral<"substance_holonym">, z.ZodLiteral<"substance_meronym">]>;
97
+ target: z.ZodString;
98
+ }, z.core.$strip>>;
99
+ }, z.core.$strip>;
100
+ type Synset = z.infer<typeof Synset>;
101
+ declare const Definition: z.ZodObject<{
102
+ inner: z.ZodString;
103
+ }, z.core.$strip>;
104
+ type Definition = z.infer<typeof Definition>;
105
+ declare const Example: z.ZodObject<{
106
+ inner: z.ZodString;
107
+ dcSource: z.ZodOptional<z.ZodString>;
108
+ }, z.core.$strip>;
109
+ type Example = z.infer<typeof Example>;
110
+ declare const ILIDefinition: z.ZodObject<{
111
+ inner: z.ZodString;
112
+ }, z.core.$strip>;
113
+ type ILIDefinition = z.infer<typeof ILIDefinition>;
114
+ declare const SynsetRelation: z.ZodObject<{
115
+ relType: z.ZodUnion<readonly [z.ZodLiteral<"also">, z.ZodLiteral<"attribute">, z.ZodLiteral<"cause">, z.ZodLiteral<"causes">, z.ZodLiteral<"domain_member_region">, z.ZodLiteral<"domain_member_topic">, z.ZodLiteral<"domain_region">, z.ZodLiteral<"domain_topic">, z.ZodLiteral<"entail">, z.ZodLiteral<"entails">, z.ZodLiteral<"exemplifies">, z.ZodLiteral<"has_domain_region">, z.ZodLiteral<"has_domain_topic">, z.ZodLiteral<"holo_member">, z.ZodLiteral<"holo_part">, z.ZodLiteral<"holo_substance">, z.ZodLiteral<"hypernym">, z.ZodLiteral<"hyponym">, z.ZodLiteral<"instance_hypernym">, z.ZodLiteral<"instance_hyponym">, z.ZodLiteral<"is_caused_by">, z.ZodLiteral<"is_entailed_by">, z.ZodLiteral<"is_exemplified_by">, z.ZodLiteral<"member_holonym">, z.ZodLiteral<"member_meronym">, z.ZodLiteral<"mero_member">, z.ZodLiteral<"mero_part">, z.ZodLiteral<"mero_substance">, z.ZodLiteral<"part_holonym">, z.ZodLiteral<"part_meronym">, z.ZodLiteral<"similar">, z.ZodLiteral<"substance_holonym">, z.ZodLiteral<"substance_meronym">]>;
116
+ target: z.ZodString;
117
+ }, z.core.$strip>;
118
+ type SynsetRelation = z.infer<typeof SynsetRelation>;
119
+ declare const SyntacticBehavior: z.ZodObject<{
120
+ id: z.ZodString;
121
+ subcategorizationFrame: z.ZodString;
122
+ }, z.core.$strip>;
123
+ type SyntacticBehavior = z.infer<typeof SyntacticBehavior>;
124
+ declare const Lexicon: z.ZodObject<{
125
+ id: z.ZodString;
126
+ label: z.ZodString;
127
+ language: z.ZodString;
128
+ email: z.ZodString;
129
+ license: z.ZodString;
130
+ version: z.ZodString;
131
+ url: z.ZodString;
132
+ citation: z.ZodOptional<z.ZodString>;
133
+ lexicalEntries: z.ZodArray<z.ZodObject<{
134
+ id: z.ZodString;
135
+ lemmas: z.ZodArray<z.ZodObject<{
136
+ writtenForm: z.ZodString;
137
+ partOfSpeech: z.ZodUnion<readonly [z.ZodLiteral<"a">, z.ZodLiteral<"c">, z.ZodLiteral<"n">, z.ZodLiteral<"p">, z.ZodLiteral<"r">, z.ZodLiteral<"s">, z.ZodLiteral<"u">, z.ZodLiteral<"v">, z.ZodLiteral<"x">]>;
138
+ pronunciations: z.ZodArray<z.ZodObject<{
139
+ variety: z.ZodOptional<z.ZodString>;
140
+ inner: z.ZodString;
141
+ }, z.core.$strip>>;
142
+ }, z.core.$strip>>;
143
+ senses: z.ZodArray<z.ZodObject<{
144
+ id: z.ZodString;
145
+ synset: z.ZodString;
146
+ subCat: z.ZodOptional<z.ZodString>;
147
+ adjPosition: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"a">, z.ZodLiteral<"ip">, z.ZodLiteral<"p">]>>;
148
+ senseRelations: z.ZodArray<z.ZodObject<{
149
+ relType: z.ZodUnion<readonly [z.ZodLiteral<"also">, z.ZodLiteral<"antonym">, z.ZodLiteral<"derivation">, z.ZodLiteral<"domain_member_region">, z.ZodLiteral<"domain_member_topic">, z.ZodLiteral<"domain_region">, z.ZodLiteral<"domain_topic">, z.ZodLiteral<"exemplifies">, z.ZodLiteral<"is_exemplified_by">, z.ZodLiteral<"other">, z.ZodLiteral<"participle">, z.ZodLiteral<"pertainym">, z.ZodLiteral<"similar">]>;
150
+ dcType: z.ZodOptional<z.ZodString>;
151
+ target: z.ZodString;
152
+ }, z.core.$strip>>;
153
+ }, z.core.$strip>>;
154
+ forms: z.ZodArray<z.ZodObject<{
155
+ writtenForm: z.ZodString;
156
+ }, z.core.$strip>>;
157
+ }, z.core.$strip>>;
158
+ synsets: z.ZodArray<z.ZodObject<{
159
+ id: z.ZodString;
160
+ ili: z.ZodString;
161
+ members: z.ZodArray<z.ZodString>;
162
+ partOfSpeech: z.ZodUnion<readonly [z.ZodLiteral<"a">, z.ZodLiteral<"c">, z.ZodLiteral<"n">, z.ZodLiteral<"p">, z.ZodLiteral<"r">, z.ZodLiteral<"s">, z.ZodLiteral<"u">, z.ZodLiteral<"v">, z.ZodLiteral<"x">]>;
163
+ lexfile: z.ZodString;
164
+ dcSource: z.ZodOptional<z.ZodString>;
165
+ definitions: z.ZodArray<z.ZodObject<{
166
+ inner: z.ZodString;
167
+ }, z.core.$strip>>;
168
+ examples: z.ZodArray<z.ZodObject<{
169
+ inner: z.ZodString;
170
+ dcSource: z.ZodOptional<z.ZodString>;
171
+ }, z.core.$strip>>;
172
+ iliDefinitions: z.ZodArray<z.ZodObject<{
173
+ inner: z.ZodString;
174
+ }, z.core.$strip>>;
175
+ synsetRelations: z.ZodArray<z.ZodObject<{
176
+ relType: z.ZodUnion<readonly [z.ZodLiteral<"also">, z.ZodLiteral<"attribute">, z.ZodLiteral<"cause">, z.ZodLiteral<"causes">, z.ZodLiteral<"domain_member_region">, z.ZodLiteral<"domain_member_topic">, z.ZodLiteral<"domain_region">, z.ZodLiteral<"domain_topic">, z.ZodLiteral<"entail">, z.ZodLiteral<"entails">, z.ZodLiteral<"exemplifies">, z.ZodLiteral<"has_domain_region">, z.ZodLiteral<"has_domain_topic">, z.ZodLiteral<"holo_member">, z.ZodLiteral<"holo_part">, z.ZodLiteral<"holo_substance">, z.ZodLiteral<"hypernym">, z.ZodLiteral<"hyponym">, z.ZodLiteral<"instance_hypernym">, z.ZodLiteral<"instance_hyponym">, z.ZodLiteral<"is_caused_by">, z.ZodLiteral<"is_entailed_by">, z.ZodLiteral<"is_exemplified_by">, z.ZodLiteral<"member_holonym">, z.ZodLiteral<"member_meronym">, z.ZodLiteral<"mero_member">, z.ZodLiteral<"mero_part">, z.ZodLiteral<"mero_substance">, z.ZodLiteral<"part_holonym">, z.ZodLiteral<"part_meronym">, z.ZodLiteral<"similar">, z.ZodLiteral<"substance_holonym">, z.ZodLiteral<"substance_meronym">]>;
177
+ target: z.ZodString;
178
+ }, z.core.$strip>>;
179
+ }, z.core.$strip>>;
180
+ syntacticBehaviors: z.ZodArray<z.ZodObject<{
181
+ id: z.ZodString;
182
+ subcategorizationFrame: z.ZodString;
183
+ }, z.core.$strip>>;
184
+ }, z.core.$strip>;
185
+ type Lexicon = z.infer<typeof Lexicon>;
186
+ declare const partsOfSpeechList: string[];
187
+
188
+ declare const PartsOfSpeech: Record<string, string>;
189
+ declare const SenseRelationRelType: Record<string, string>;
190
+ declare const SynsetRelationRelType$1: Record<string, string>;
191
+ declare const AdjPosition: Record<string, string>;
192
+
193
+ /** Base version to start searching from */
194
+ declare const BASE_VERSION = "2024";
195
+ /** Generate filename for a given version */
196
+ declare function getFilename(version: string): string;
197
+ /** Generate download URL for a given version */
198
+ declare function getDownloadUrl(version: string): string;
199
+ /** Default cache directory for downloaded WordNet data */
200
+ declare function getDefaultCacheDir(): string;
201
+ /**
202
+ * Find the best available WordNet version.
203
+ * - WordNet releases come out at END of year, so we only check up to (currentYear - 1)
204
+ * - If cached version exists and no newer year has passed, use cache (no network)
205
+ * - If a new year has passed since cache, check for that year's release
206
+ * - If no cache, discover latest available
207
+ */
208
+ declare function findLatestVersion(onProgress?: (message: string) => void, cacheDir?: string): Promise<string>;
209
+ /** Create XML streaming parser for WordNet file */
210
+ declare function createParser(filePath: string): AsyncGenerator<Node, void | Node, void>;
211
+ /** Parse Lexicon from XML stream */
212
+ declare function parseLexicon(parser: AsyncGenerator<Node, void | Node, void>): Promise<Lexicon | undefined>;
213
+ interface LoadOptions {
214
+ /** Specific version to download (e.g., "2024"). If not set, finds latest. */
215
+ version?: string;
216
+ /** Custom cache directory for downloaded data */
217
+ cacheDir?: string;
218
+ /** Force re-download even if cached */
219
+ forceDownload?: boolean;
220
+ /** Callback for progress updates */
221
+ onProgress?: (message: string) => void;
222
+ }
223
+ interface LoadResult {
224
+ lexicon: Lexicon;
225
+ version: string;
226
+ filePath: string;
227
+ }
228
+ /**
229
+ * Load WordNet from a local file path.
230
+ * @param filePath Path to the WordNet XML file
231
+ */
232
+ declare function loadWordNet(filePath: string): Promise<Lexicon>;
233
+ /**
234
+ * Fetch WordNet from remote URL, cache locally, and parse.
235
+ * If no version specified, finds the latest available version.
236
+ * @param options Loading options
237
+ * @returns LoadResult with lexicon, version, and file path
238
+ */
239
+ declare function fetchWordNet(options?: LoadOptions): Promise<LoadResult>;
240
+ /**
241
+ * Get path to cached WordNet file (downloads if not present).
242
+ * Useful when you want to work with the file directly.
243
+ * @returns Object with file path and version
244
+ */
245
+ declare function ensureWordNetCached(options?: LoadOptions): Promise<{
246
+ filePath: string;
247
+ version: string;
248
+ }>;
249
+ declare const WORDNET_VERSION = "2024";
250
+ declare const WORDNET_FILENAME: string;
251
+ declare const WORDNET_URL: string;
252
+
253
+ type SynsetRelationRelType = z.infer<typeof SynsetRelationRelType$2>;
254
+ /** Definition with its source synset */
255
+ interface DefinitionResult {
256
+ text: string;
257
+ synset: Synset;
258
+ partOfSpeech: string;
259
+ }
260
+ /** Synonym with its source context */
261
+ interface SynonymResult {
262
+ word: string;
263
+ entry: LexicalEntry;
264
+ synset: Synset;
265
+ }
266
+ /** Indexed WordNet data for fast lookups */
267
+ interface WordNetIndex {
268
+ /** All synsets indexed by ID */
269
+ synsets: Map<string, Synset>;
270
+ /** All senses indexed by ID */
271
+ senses: Map<string, Sense>;
272
+ /** All lexical entries indexed by ID */
273
+ entries: Map<string, LexicalEntry>;
274
+ /** Lexical entries indexed by word (lowercase) */
275
+ byWord: Map<string, LexicalEntry[]>;
276
+ /** Senses indexed by word (lowercase) */
277
+ sensesByWord: Map<string, Sense[]>;
278
+ /** Synsets indexed by word (lowercase) */
279
+ synsetsByWord: Map<string, Synset[]>;
280
+ /** Original lexicon */
281
+ lexicon: Lexicon;
282
+ }
283
+ /**
284
+ * Build an indexed structure for fast lookups.
285
+ * Call this once after loading the lexicon.
286
+ */
287
+ declare function buildIndex(lexicon: Lexicon): WordNetIndex;
288
+ /** Get a synset by ID */
289
+ declare function getSynset(index: WordNetIndex, id: string): Synset | undefined;
290
+ /** Get a sense by ID */
291
+ declare function getSense(index: WordNetIndex, id: string): Sense | undefined;
292
+ /** Get a lexical entry by ID */
293
+ declare function getLexicalEntry(index: WordNetIndex, id: string): LexicalEntry | undefined;
294
+ /** Find all lexical entries for a word */
295
+ declare function findWord(index: WordNetIndex, word: string): LexicalEntry[];
296
+ /** Find all senses for a word */
297
+ declare function findSenses(index: WordNetIndex, word: string): Sense[];
298
+ /** Find all synsets for a word */
299
+ declare function findSynsets(index: WordNetIndex, word: string): Synset[];
300
+ /** Get all definitions for a word */
301
+ declare function getDefinitions(index: WordNetIndex, word: string): DefinitionResult[];
302
+ /** Get related synsets by relation type */
303
+ declare function getRelated(index: WordNetIndex, synset: Synset, relType: SynsetRelationRelType): Synset[];
304
+ /** Get hypernyms (more general terms) for a word */
305
+ declare function getHypernyms(index: WordNetIndex, word: string): Synset[];
306
+ /** Get hyponyms (more specific terms) for a word */
307
+ declare function getHyponyms(index: WordNetIndex, word: string): Synset[];
308
+ /** Get synonyms for a word (words in the same synsets) */
309
+ declare function getSynonyms(index: WordNetIndex, word: string): SynonymResult[];
310
+ /** Get the written form of the first lemma for a synset */
311
+ declare function getSynsetWords(index: WordNetIndex, synset: Synset): string[];
312
+
313
+ /** LexiconNode is used as a root node for the whole WordNet document structure,
314
+ * omitting the `LexicalResource` parent (and its virtual grandparent representing the
315
+ * whole document). */
316
+ declare function LexiconNode(node: Node): Lexicon;
317
+ declare const decodeXmlEntities: (s: string | undefined) => string | undefined;
318
+
319
+ export { AdjPosition$1 as AdjPosition, AdjPosition as AdjPositionLabels, BASE_VERSION, Definition, type DefinitionResult, Definition as DefinitionType, Example, Example as ExampleType, Form, Form as FormType, ILIDefinition, ILIDefinition as ILIDefinitionType, Lemma, Lemma as LemmaType, LexicalEntry, LexicalEntryId, LexicalEntry as LexicalEntryType, Lexicon, LexiconId, LexiconNode, Lexicon as LexiconType, type LoadOptions, type LoadResult, PartsOfSpeech$1 as PartsOfSpeech, PartsOfSpeech as PartsOfSpeechLabels, Pronunciation, Pronunciation as PronunciationType, Sense, SenseId, SenseRelation, SenseRelationRelType as SenseRelationLabels, SenseRelationRelType$1 as SenseRelationRelType, SenseRelation as SenseRelationType, Sense as SenseType, type SynonymResult, Synset, SynsetId, SynsetRelation, SynsetRelationRelType$1 as SynsetRelationLabels, SynsetRelation as SynsetRelationObjectType, SynsetRelationRelType$2 as SynsetRelationRelType, Synset as SynsetType, SyntacticBehavior, SyntacticBehaviorId, SyntacticBehavior as SyntacticBehaviorType, WORDNET_FILENAME, WORDNET_URL, WORDNET_VERSION, type WordNetIndex, buildIndex, createParser, decodeXmlEntities, ensureWordNetCached, fetchWordNet, findLatestVersion, findSenses, findSynsets, findWord, getDefaultCacheDir, getDefinitions, getDownloadUrl, getFilename, getHypernyms, getHyponyms, getLexicalEntry, getRelated, getSense, getSynonyms, getSynset, getSynsetWords, loadWordNet, parseLexicon, partsOfSpeechList };