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.
- package/LICENSE +21 -0
- package/README.md +190 -0
- package/dist/cli.cjs +1139 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1116 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +1139 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +319 -0
- package/dist/index.d.ts +319 -0
- package/dist/index.js +1048 -0
- package/dist/index.js.map +1 -0
- package/package.json +63 -0
package/dist/index.d.ts
ADDED
|
@@ -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 };
|