nlptoolkit-morphologicalanalysis 1.0.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/README.md +144 -0
- package/dist/Corpus/DisambiguatedWord.d.ts +20 -0
- package/dist/Corpus/DisambiguatedWord.js +38 -0
- package/dist/Corpus/DisambiguatedWord.js.map +1 -0
- package/dist/Corpus/DisambiguationCorpus.d.ts +4 -0
- package/dist/Corpus/DisambiguationCorpus.js +54 -0
- package/dist/Corpus/DisambiguationCorpus.js.map +1 -0
- package/dist/MorphologicalAnalysis/FiniteStateMachine.d.ts +63 -0
- package/dist/MorphologicalAnalysis/FiniteStateMachine.js +178 -0
- package/dist/MorphologicalAnalysis/FiniteStateMachine.js.map +1 -0
- package/dist/MorphologicalAnalysis/FsmMorphologicalAnalyzer.d.ts +399 -0
- package/dist/MorphologicalAnalysis/FsmMorphologicalAnalyzer.js +1255 -0
- package/dist/MorphologicalAnalysis/FsmMorphologicalAnalyzer.js.map +1 -0
- package/dist/MorphologicalAnalysis/FsmParse.d.ts +290 -0
- package/dist/MorphologicalAnalysis/FsmParse.js +684 -0
- package/dist/MorphologicalAnalysis/FsmParse.js.map +1 -0
- package/dist/MorphologicalAnalysis/FsmParseList.d.ts +96 -0
- package/dist/MorphologicalAnalysis/FsmParseList.js +242 -0
- package/dist/MorphologicalAnalysis/FsmParseList.js.map +1 -0
- package/dist/MorphologicalAnalysis/InflectionalGroup.d.ts +77 -0
- package/dist/MorphologicalAnalysis/InflectionalGroup.js +213 -0
- package/dist/MorphologicalAnalysis/InflectionalGroup.js.map +1 -0
- package/dist/MorphologicalAnalysis/MetamorphicParse.d.ts +63 -0
- package/dist/MorphologicalAnalysis/MetamorphicParse.js +592 -0
- package/dist/MorphologicalAnalysis/MetamorphicParse.js.map +1 -0
- package/dist/MorphologicalAnalysis/MorphologicalParse.d.ts +301 -0
- package/dist/MorphologicalAnalysis/MorphologicalParse.js +969 -0
- package/dist/MorphologicalAnalysis/MorphologicalParse.js.map +1 -0
- package/dist/MorphologicalAnalysis/MorphologicalTag.d.ts +510 -0
- package/dist/MorphologicalAnalysis/MorphologicalTag.js +525 -0
- package/dist/MorphologicalAnalysis/MorphologicalTag.js.map +1 -0
- package/dist/MorphologicalAnalysis/State.d.ts +40 -0
- package/dist/MorphologicalAnalysis/State.js +64 -0
- package/dist/MorphologicalAnalysis/State.js.map +1 -0
- package/dist/MorphologicalAnalysis/Transition.d.ts +159 -0
- package/dist/MorphologicalAnalysis/Transition.js +751 -0
- package/dist/MorphologicalAnalysis/Transition.js.map +1 -0
- package/index.js +12 -0
- package/package.json +30 -0
- package/penntreebank.txt +208431 -0
- package/source/Corpus/DisambiguatedWord.ts +29 -0
- package/source/Corpus/DisambiguationCorpus.ts +39 -0
- package/source/MorphologicalAnalysis/FiniteStateMachine.ts +165 -0
- package/source/MorphologicalAnalysis/FsmMorphologicalAnalyzer.ts +1256 -0
- package/source/MorphologicalAnalysis/FsmParse.ts +664 -0
- package/source/MorphologicalAnalysis/FsmParseList.ts +238 -0
- package/source/MorphologicalAnalysis/InflectionalGroup.ts +210 -0
- package/source/MorphologicalAnalysis/MetamorphicParse.ts +589 -0
- package/source/MorphologicalAnalysis/MorphologicalParse.ts +995 -0
- package/source/MorphologicalAnalysis/MorphologicalTag.ts +510 -0
- package/source/MorphologicalAnalysis/State.ts +59 -0
- package/source/MorphologicalAnalysis/Transition.ts +733 -0
- package/source/tsconfig.json +13 -0
- package/tests/DisambiguationCorpusTest.ts +12 -0
- package/tests/FiniteStateMachineTest.ts +87 -0
- package/tests/FsmMorphologicalAnalyzerTest.ts +204 -0
- package/tests/FsmParseListTest.ts +90 -0
- package/tests/FsmParseTest.ts +66 -0
- package/tests/InflectionalGroupTest.ts +84 -0
- package/tests/MorphologicalParseTest.ts +152 -0
- package/tests/TransitionTest.ts +174 -0
- package/tsconfig.json +15 -0
- package/turkish_dictionary.txt +62120 -0
- package/turkish_finite_state_machine.xml +1887 -0
- package/turkish_misspellings.txt +148932 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { InflectionalGroup } from "./InflectionalGroup";
|
|
2
|
+
import { Word } from "nlptoolkit-dictionary/dist/Dictionary/Word";
|
|
3
|
+
import { MorphologicalTag } from "./MorphologicalTag";
|
|
4
|
+
export declare class MorphologicalParse {
|
|
5
|
+
protected inflectionalGroups: Array<InflectionalGroup>;
|
|
6
|
+
protected root: Word;
|
|
7
|
+
/**
|
|
8
|
+
* Another constructor of {@link MorphologicalParse} class which takes a {@link String} parse as an input. First it creates
|
|
9
|
+
* an {@link Array} as iGs for inflectional groups, and while given String contains derivational boundary (^DB+), it
|
|
10
|
+
*.pushs the substring to the iGs {@link Array} and continue to use given String from 4th index. If it does not contain ^DB+,
|
|
11
|
+
* it directly.pushs the given String to the iGs {@link Array}. Then, it creates a new {@link Array} as
|
|
12
|
+
* inflectionalGroups and checks for some cases.
|
|
13
|
+
* <p>
|
|
14
|
+
* If the first item of iGs {@link Array} is ++Punc, it creates a new root as +, and by calling
|
|
15
|
+
* {@link InflectionalGroup} method with Punc it initializes the IG {@link Array} by parsing given input
|
|
16
|
+
* String IG by + and calling the getMorphologicalTag method with these substrings. If getMorphologicalTag method returns
|
|
17
|
+
* a tag, it.pushs this tag to the IG {@link Array} and also to the inflectionalGroups {@link Array}.
|
|
18
|
+
* <p>
|
|
19
|
+
* If the first item of iGs {@link Array} has +, it creates a new word of first item's substring from index 0 to +,
|
|
20
|
+
* and assigns it to root. Then, by calling {@link InflectionalGroup} method with substring from index 0 to +,
|
|
21
|
+
* it initializes the IG {@link Array} by parsing given input String IG by + and calling the getMorphologicalTag
|
|
22
|
+
* method with these substrings. If getMorphologicalTag method returns a tag, it.pushs this tag to the IG {@link Array}
|
|
23
|
+
* and also to the inflectionalGroups {@link Array}.
|
|
24
|
+
* <p>
|
|
25
|
+
* If the first item of iGs {@link Array} does not contain +, it creates a new word with first item and assigns it as root.
|
|
26
|
+
* <p>
|
|
27
|
+
* At the end, it loops through the items of iGs and by calling {@link InflectionalGroup} method with these items
|
|
28
|
+
* it initializes the IG {@link Array} by parsing given input String IG by + and calling the getMorphologicalTag
|
|
29
|
+
* method with these substrings. If getMorphologicalTag method returns a tag, it.pushs this tag to the IG {@link Array}
|
|
30
|
+
* and also to the inflectionalGroups {@link Array}.
|
|
31
|
+
*
|
|
32
|
+
* @param parseOrInflectionalGroups String input.
|
|
33
|
+
*/
|
|
34
|
+
constructor(parseOrInflectionalGroups?: any);
|
|
35
|
+
/**
|
|
36
|
+
* The no-arg getWord method returns root {@link Word}.
|
|
37
|
+
*
|
|
38
|
+
* @return root {@link Word}.
|
|
39
|
+
*/
|
|
40
|
+
getWord(): Word;
|
|
41
|
+
/**
|
|
42
|
+
* The getTransitionList method gets the first item of inflectionalGroups {@link Array} as a {@link String},
|
|
43
|
+
* then loops through the items of inflectionalGroups and concatenates them by using +.
|
|
44
|
+
*
|
|
45
|
+
* @return String that contains transition list.
|
|
46
|
+
*/
|
|
47
|
+
getMorphologicalParseTransitionList(): string;
|
|
48
|
+
/**
|
|
49
|
+
* The getInflectionalGroupString method takes an {@link number} index as an input and if index is 0, it directly
|
|
50
|
+
* returns the root and the first item of inflectionalGroups {@link Array}. If the index is not 0, it then returns
|
|
51
|
+
* the corresponding item of inflectionalGroups {@link Array} as a {@link String}.
|
|
52
|
+
*
|
|
53
|
+
* @param index Integer input.
|
|
54
|
+
* @return corresponding item of inflectionalGroups at given index as a {@link String}.
|
|
55
|
+
*/
|
|
56
|
+
getInflectionalGroupString(index: number): string;
|
|
57
|
+
/**
|
|
58
|
+
* The getInflectionalGroup method takes an {@link number} index as an input and it directly returns the
|
|
59
|
+
* {@link InflectionalGroup} at given index.
|
|
60
|
+
*
|
|
61
|
+
* @param index Integer input.
|
|
62
|
+
* @return InflectionalGroup at given index.
|
|
63
|
+
*/
|
|
64
|
+
getInflectionalGroup(index?: number): InflectionalGroup;
|
|
65
|
+
/**
|
|
66
|
+
* The getTag method takes an {@link number} index as an input and and if the given index is 0, it directly return
|
|
67
|
+
* the root. Then, it loops through the inflectionalGroups {@link Array} it returns the MorphologicalTag of the
|
|
68
|
+
* corresponding inflectional group.
|
|
69
|
+
*
|
|
70
|
+
* @param index Integer input.
|
|
71
|
+
* @return the MorphologicalTag of the corresponding inflectional group, or null of invalid index inputs.
|
|
72
|
+
*/
|
|
73
|
+
getTag(index: number): string;
|
|
74
|
+
/**
|
|
75
|
+
* The tagSize method loops through the inflectionalGroups {@link Array} and accumulates the sizes of each inflectional group
|
|
76
|
+
* in the inflectionalGroups.
|
|
77
|
+
*
|
|
78
|
+
* @return total size of the inflectionalGroups {@link Array}.
|
|
79
|
+
*/
|
|
80
|
+
tagSize(): number;
|
|
81
|
+
/**
|
|
82
|
+
* The size method returns the size of the inflectionalGroups {@link Array}.
|
|
83
|
+
*
|
|
84
|
+
* @return the size of the inflectionalGroups {@link Array}.
|
|
85
|
+
*/
|
|
86
|
+
size(): number;
|
|
87
|
+
/**
|
|
88
|
+
* The firstInflectionalGroup method returns the first inflectional group of inflectionalGroups {@link Array}.
|
|
89
|
+
*
|
|
90
|
+
* @return the first inflectional group of inflectionalGroups {@link Array}.
|
|
91
|
+
*/
|
|
92
|
+
firstInflectionalGroup(): InflectionalGroup;
|
|
93
|
+
/**
|
|
94
|
+
* The lastInflectionalGroup method returns the last inflectional group of inflectionalGroups {@link Array}.
|
|
95
|
+
*
|
|
96
|
+
* @return the last inflectional group of inflectionalGroups {@link Array}.
|
|
97
|
+
*/
|
|
98
|
+
lastInflectionalGroup(): InflectionalGroup;
|
|
99
|
+
/**
|
|
100
|
+
* The getWordWithPos method returns root with the MorphologicalTag of the first inflectional as a new word.
|
|
101
|
+
*
|
|
102
|
+
* @return root with the MorphologicalTag of the first inflectional as a new word.
|
|
103
|
+
*/
|
|
104
|
+
getWordWithPos(): Word;
|
|
105
|
+
/**
|
|
106
|
+
* The getPos method returns the MorphologicalTag of the last inflectional group.
|
|
107
|
+
*
|
|
108
|
+
* @return the MorphologicalTag of the last inflectional group.
|
|
109
|
+
*/
|
|
110
|
+
getPos(): string;
|
|
111
|
+
/**
|
|
112
|
+
* The getRootPos method returns the MorphologicalTag of the first inflectional group.
|
|
113
|
+
*
|
|
114
|
+
* @return the MorphologicalTag of the first inflectional group.
|
|
115
|
+
*/
|
|
116
|
+
getRootPos(): string;
|
|
117
|
+
/**
|
|
118
|
+
* The lastIGContainsCase method returns the MorphologicalTag of last inflectional group if it is one of the NOMINATIVE,
|
|
119
|
+
* ACCUSATIVE, DATIVE, LOCATIVE or ABLATIVE cases, null otherwise.
|
|
120
|
+
*
|
|
121
|
+
* @return the MorphologicalTag of last inflectional group if it is one of the NOMINATIVE,
|
|
122
|
+
* ACCUSATIVE, DATIVE, LOCATIVE or ABLATIVE cases, null otherwise.
|
|
123
|
+
*/
|
|
124
|
+
lastIGContainsCase(): string;
|
|
125
|
+
/**
|
|
126
|
+
* The lastIGContainsTag method takes a MorphologicalTag as an input and returns true if the last inflectional group's
|
|
127
|
+
* MorphologicalTag matches with one of the tags in the IG {@link Array}, false otherwise.
|
|
128
|
+
*
|
|
129
|
+
* @param tag {@link MorphologicalTag} type input.
|
|
130
|
+
* @return true if the last inflectional group's MorphologicalTag matches with one of the tags in the
|
|
131
|
+
* IG {@link Array}, false otherwise.
|
|
132
|
+
*/
|
|
133
|
+
lastIGContainsTag(tag: MorphologicalTag): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* lastIGContainsPossessive method returns true if the last inflectional group contains one of the
|
|
136
|
+
* possessives: P1PL, P1SG, P2PL, P2SG, P3PL AND P3SG, false otherwise.
|
|
137
|
+
*
|
|
138
|
+
* @return true if the last inflectional group contains one of the possessives: P1PL, P1SG, P2PL, P2SG, P3PL AND P3SG, false otherwise.
|
|
139
|
+
*/
|
|
140
|
+
lastIGContainsPossessive(): boolean;
|
|
141
|
+
/**
|
|
142
|
+
* The isCapitalWord method returns true if the character at first index o f root is an uppercase letter, false otherwise.
|
|
143
|
+
*
|
|
144
|
+
* @return true if the character at first index o f root is an uppercase letter, false otherwise.
|
|
145
|
+
*/
|
|
146
|
+
isCapitalWord(): boolean;
|
|
147
|
+
/**
|
|
148
|
+
* The isNoun method returns true if the part of speech is NOUN, false otherwise.
|
|
149
|
+
*
|
|
150
|
+
* @return true if the part of speech is NOUN, false otherwise.
|
|
151
|
+
*/
|
|
152
|
+
isNoun(): boolean;
|
|
153
|
+
/**
|
|
154
|
+
* The isVerb method returns true if the part of speech is VERB, false otherwise.
|
|
155
|
+
*
|
|
156
|
+
* @return true if the part of speech is VERB, false otherwise.
|
|
157
|
+
*/
|
|
158
|
+
isVerb(): boolean;
|
|
159
|
+
/**
|
|
160
|
+
* The isRootVerb method returns true if the part of speech of root is BERV, false otherwise.
|
|
161
|
+
*
|
|
162
|
+
* @return true if the part of speech of root is VERB, false otherwise.
|
|
163
|
+
*/
|
|
164
|
+
isRootVerb(): boolean;
|
|
165
|
+
/**
|
|
166
|
+
* The isAdjective method returns true if the part of speech is ADJ, false otherwise.
|
|
167
|
+
*
|
|
168
|
+
* @return true if the part of speech is ADJ, false otherwise.
|
|
169
|
+
*/
|
|
170
|
+
isAdjective(): boolean;
|
|
171
|
+
/**
|
|
172
|
+
* The isProperNoun method returns true if the first inflectional group's MorphologicalTag is a PROPERNOUN, false otherwise.
|
|
173
|
+
*
|
|
174
|
+
* @return true if the first inflectional group's MorphologicalTag is a PROPERNOUN, false otherwise.
|
|
175
|
+
*/
|
|
176
|
+
isProperNoun(): boolean;
|
|
177
|
+
/**
|
|
178
|
+
* The isPunctuation method returns true if the first inflectional group's MorphologicalTag is a PUNCTUATION, false otherwise.
|
|
179
|
+
*
|
|
180
|
+
* @return true if the first inflectional group's MorphologicalTag is a PUNCTUATION, false otherwise.
|
|
181
|
+
*/
|
|
182
|
+
isPunctuation(): boolean;
|
|
183
|
+
/**
|
|
184
|
+
* The isCardinal method returns true if the first inflectional group's MorphologicalTag is a CARDINAL, false otherwise.
|
|
185
|
+
*
|
|
186
|
+
* @return true if the first inflectional group's MorphologicalTag is a CARDINAL, false otherwise.
|
|
187
|
+
*/
|
|
188
|
+
isCardinal(): boolean;
|
|
189
|
+
/**
|
|
190
|
+
* The isOrdinal method returns true if the first inflectional group's MorphologicalTag is a ORDINAL, false otherwise.
|
|
191
|
+
*
|
|
192
|
+
* @return true if the first inflectional group's MorphologicalTag is a ORDINAL, false otherwise.
|
|
193
|
+
*/
|
|
194
|
+
isOrdinal(): boolean;
|
|
195
|
+
/**
|
|
196
|
+
* The isReal method returns true if the first inflectional group's MorphologicalTag is a REAL, false otherwise.
|
|
197
|
+
*
|
|
198
|
+
* @return true if the first inflectional group's MorphologicalTag is a REAL, false otherwise.
|
|
199
|
+
*/
|
|
200
|
+
isReal(): boolean;
|
|
201
|
+
/**
|
|
202
|
+
* The isNumber method returns true if the first inflectional group's MorphologicalTag is REAL or CARDINAL, false otherwise.
|
|
203
|
+
*
|
|
204
|
+
* @return true if the first inflectional group's MorphologicalTag is a REAL or CARDINAL, false otherwise.
|
|
205
|
+
*/
|
|
206
|
+
isNumber(): boolean;
|
|
207
|
+
/**
|
|
208
|
+
* The isTime method returns true if the first inflectional group's MorphologicalTag is a TIME, false otherwise.
|
|
209
|
+
*
|
|
210
|
+
* @return true if the first inflectional group's MorphologicalTag is a TIME, false otherwise.
|
|
211
|
+
*/
|
|
212
|
+
isTime(): boolean;
|
|
213
|
+
/**
|
|
214
|
+
* The isDate method returns true if the first inflectional group's MorphologicalTag is a DATE, false otherwise.
|
|
215
|
+
*
|
|
216
|
+
* @return true if the first inflectional group's MorphologicalTag is a DATE, false otherwise.
|
|
217
|
+
*/
|
|
218
|
+
isDate(): boolean;
|
|
219
|
+
/**
|
|
220
|
+
* The isHashTag method returns true if the first inflectional group's MorphologicalTag is a HASHTAG, false otherwise.
|
|
221
|
+
*
|
|
222
|
+
* @return true if the first inflectional group's MorphologicalTag is a HASHTAG, false otherwise.
|
|
223
|
+
*/
|
|
224
|
+
isHashTag(): boolean;
|
|
225
|
+
/**
|
|
226
|
+
* The isEmail method returns true if the first inflectional group's MorphologicalTag is a EMAIL, false otherwise.
|
|
227
|
+
*
|
|
228
|
+
* @return true if the first inflectional group's MorphologicalTag is a EMAIL, false otherwise.
|
|
229
|
+
*/
|
|
230
|
+
isEmail(): boolean;
|
|
231
|
+
/**
|
|
232
|
+
* The isPercent method returns true if the first inflectional group's MorphologicalTag is a PERCENT, false otherwise.
|
|
233
|
+
*
|
|
234
|
+
* @return true if the first inflectional group's MorphologicalTag is a PERCENT, false otherwise.
|
|
235
|
+
*/
|
|
236
|
+
isPercent(): boolean;
|
|
237
|
+
/**
|
|
238
|
+
* The isFraction method returns true if the first inflectional group's MorphologicalTag is a FRACTION, false otherwise.
|
|
239
|
+
*
|
|
240
|
+
* @return true if the first inflectional group's MorphologicalTag is a FRACTION, false otherwise.
|
|
241
|
+
*/
|
|
242
|
+
isFraction(): boolean;
|
|
243
|
+
/**
|
|
244
|
+
* The isRange method returns true if the first inflectional group's MorphologicalTag is a RANGE, false otherwise.
|
|
245
|
+
*
|
|
246
|
+
* @return true if the first inflectional group's MorphologicalTag is a RANGE, false otherwise.
|
|
247
|
+
*/
|
|
248
|
+
isRange(): boolean;
|
|
249
|
+
/**
|
|
250
|
+
* The isPlural method returns true if {@link InflectionalGroup}'s MorphologicalTags are from the agreement plural
|
|
251
|
+
* or possessive plural, i.e A1PL, A2PL, A3PL, P1PL, P2PL or P3PL, and false otherwise.
|
|
252
|
+
*
|
|
253
|
+
* @return true if {@link InflectionalGroup}'s MorphologicalTags are from the agreement plural or possessive plural.
|
|
254
|
+
*/
|
|
255
|
+
isPlural(): boolean;
|
|
256
|
+
/**
|
|
257
|
+
* The isAuxiliary method returns true if the root equals to the et, ol, or yap, and false otherwise.
|
|
258
|
+
*
|
|
259
|
+
* @return true if the root equals to the et, ol, or yap, and false otherwise.
|
|
260
|
+
*/
|
|
261
|
+
isAuxiliary(): boolean;
|
|
262
|
+
/**
|
|
263
|
+
* The containsTag method takes a MorphologicalTag as an input and loops through the inflectionalGroups {@link ArrayList},
|
|
264
|
+
* returns true if the input matches with on of the tags in the IG, false otherwise.
|
|
265
|
+
*
|
|
266
|
+
* @param tag checked tag
|
|
267
|
+
* @return true if the input matches with on of the tags in the IG, false otherwise.
|
|
268
|
+
*/
|
|
269
|
+
containsTag(tag: MorphologicalTag): boolean;
|
|
270
|
+
/**
|
|
271
|
+
* The getTreePos method returns the tree pos tag of a morphological analysis.
|
|
272
|
+
*
|
|
273
|
+
* @return Tree pos tag of the morphological analysis in string form.
|
|
274
|
+
*/
|
|
275
|
+
getTreePos(): string;
|
|
276
|
+
private getPronType;
|
|
277
|
+
private getNumType;
|
|
278
|
+
private getReflex;
|
|
279
|
+
private getNumber;
|
|
280
|
+
private getPossessiveNumber;
|
|
281
|
+
private getCase;
|
|
282
|
+
private getDefinite;
|
|
283
|
+
private getDegree;
|
|
284
|
+
private getPolarity;
|
|
285
|
+
private getPerson;
|
|
286
|
+
private getPossessivePerson;
|
|
287
|
+
private getVoice;
|
|
288
|
+
private getAspect;
|
|
289
|
+
private getTense;
|
|
290
|
+
private getMood;
|
|
291
|
+
private getVerbForm;
|
|
292
|
+
getUniversalDependencyFeatures(uPos: string): Array<string>;
|
|
293
|
+
getUniversalDependencyPos(): string;
|
|
294
|
+
/**
|
|
295
|
+
* The overridden toString method gets the root and the first inflectional group as a result {@link String} then concatenates
|
|
296
|
+
* with ^DB+ and the following inflectional groups.
|
|
297
|
+
*
|
|
298
|
+
* @return result {@link String}.
|
|
299
|
+
*/
|
|
300
|
+
toString(): string;
|
|
301
|
+
}
|