nlptoolkit-morphologicalanalysis 1.0.18 → 1.0.20
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/dist/Corpus/DisambiguatedWord.js +26 -35
- package/dist/Corpus/DisambiguatedWord.js.map +1 -1
- package/dist/Corpus/DisambiguationCorpus.js +70 -47
- package/dist/Corpus/DisambiguationCorpus.js.map +1 -1
- package/dist/MorphologicalAnalysis/FiniteStateMachine.js +148 -158
- package/dist/MorphologicalAnalysis/FiniteStateMachine.js.map +1 -1
- package/dist/MorphologicalAnalysis/FsmMorphologicalAnalyzer.js +1281 -1254
- package/dist/MorphologicalAnalysis/FsmMorphologicalAnalyzer.js.map +1 -1
- package/dist/MorphologicalAnalysis/FsmParse.js +596 -603
- package/dist/MorphologicalAnalysis/FsmParse.js.map +1 -1
- package/dist/MorphologicalAnalysis/FsmParseList.js +263 -273
- package/dist/MorphologicalAnalysis/FsmParseList.js.map +1 -1
- package/dist/MorphologicalAnalysis/InflectionalGroup.js +152 -162
- package/dist/MorphologicalAnalysis/InflectionalGroup.js.map +1 -1
- package/dist/MorphologicalAnalysis/MetamorphicParse.js +120 -129
- package/dist/MorphologicalAnalysis/MetamorphicParse.js.map +1 -1
- package/dist/MorphologicalAnalysis/MorphologicalParse.js +1037 -1046
- package/dist/MorphologicalAnalysis/MorphologicalParse.js.map +1 -1
- package/dist/MorphologicalAnalysis/MorphologicalTag.js +530 -540
- package/dist/MorphologicalAnalysis/MorphologicalTag.js.map +1 -1
- package/dist/MorphologicalAnalysis/MorphotacticEngine.js +230 -240
- package/dist/MorphologicalAnalysis/MorphotacticEngine.js.map +1 -1
- package/dist/MorphologicalAnalysis/State.js +54 -60
- package/dist/MorphologicalAnalysis/State.js.map +1 -1
- package/dist/MorphologicalAnalysis/Transition.js +408 -418
- package/dist/MorphologicalAnalysis/Transition.js.map +1 -1
- package/dist/index.js +19 -25
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
- package/tests/FsmParseListTest.ts +3 -3
- package/tests/FsmParseTest.ts +1 -1
- package/tsconfig.json +4 -3
- package/turkish_dictionary.txt +9114 -9114
- package/source/tsconfig.json +0 -13
|
@@ -1,516 +1,507 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
while (st.includes("^DB+")) {
|
|
51
|
-
iGs.push(st.substring(0, st.indexOf("^DB+")));
|
|
52
|
-
st = st.substring(st.indexOf("^DB+") + 4);
|
|
53
|
-
}
|
|
54
|
-
iGs.push(st);
|
|
55
|
-
if (iGs[0] == "++Punc") {
|
|
56
|
-
this.root = new Word_1.Word("+");
|
|
57
|
-
this.inflectionalGroups.push(new InflectionalGroup_1.InflectionalGroup("Punc"));
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
if (iGs[0].indexOf('+') != -1) {
|
|
61
|
-
this.root = new Word_1.Word(iGs[0].substring(0, iGs[0].indexOf('+')));
|
|
62
|
-
this.inflectionalGroups.push(new InflectionalGroup_1.InflectionalGroup(iGs[0].substring(iGs[0].indexOf('+') + 1)));
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
this.root = new Word_1.Word(iGs[0]);
|
|
66
|
-
}
|
|
67
|
-
for (let i = 1; i < iGs.length; i++) {
|
|
68
|
-
this.inflectionalGroups.push(new InflectionalGroup_1.InflectionalGroup(iGs[i]));
|
|
69
|
-
}
|
|
70
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MorphologicalParse = void 0;
|
|
4
|
+
const InflectionalGroup_1 = require("./InflectionalGroup");
|
|
5
|
+
const Word_1 = require("nlptoolkit-dictionary/dist/Dictionary/Word");
|
|
6
|
+
const MorphologicalTag_1 = require("./MorphologicalTag");
|
|
7
|
+
class MorphologicalParse {
|
|
8
|
+
inflectionalGroups = new Array();
|
|
9
|
+
root;
|
|
10
|
+
/**
|
|
11
|
+
* Another constructor of {@link MorphologicalParse} class which takes a {@link String} parse as an input. First it creates
|
|
12
|
+
* an {@link Array} as iGs for inflectional groups, and while given String contains derivational boundary (^DB+), it
|
|
13
|
+
*.pushs the substring to the iGs {@link Array} and continue to use given String from 4th index. If it does not contain ^DB+,
|
|
14
|
+
* it directly.pushs the given String to the iGs {@link Array}. Then, it creates a new {@link Array} as
|
|
15
|
+
* inflectionalGroups and checks for some cases.
|
|
16
|
+
* <p>
|
|
17
|
+
* If the first item of iGs {@link Array} is ++Punc, it creates a new root as +, and by calling
|
|
18
|
+
* {@link InflectionalGroup} method with Punc it initializes the IG {@link Array} by parsing given input
|
|
19
|
+
* String IG by + and calling the getMorphologicalTag method with these substrings. If getMorphologicalTag method returns
|
|
20
|
+
* a tag, it.pushs this tag to the IG {@link Array} and also to the inflectionalGroups {@link Array}.
|
|
21
|
+
* <p>
|
|
22
|
+
* If the first item of iGs {@link Array} has +, it creates a new word of first item's substring from index 0 to +,
|
|
23
|
+
* and assigns it to root. Then, by calling {@link InflectionalGroup} method with substring from index 0 to +,
|
|
24
|
+
* it initializes the IG {@link Array} by parsing given input String IG by + and calling the getMorphologicalTag
|
|
25
|
+
* method with these substrings. If getMorphologicalTag method returns a tag, it.pushs this tag to the IG {@link Array}
|
|
26
|
+
* and also to the inflectionalGroups {@link Array}.
|
|
27
|
+
* <p>
|
|
28
|
+
* If the first item of iGs {@link Array} does not contain +, it creates a new word with first item and assigns it as root.
|
|
29
|
+
* <p>
|
|
30
|
+
* At the end, it loops through the items of iGs and by calling {@link InflectionalGroup} method with these items
|
|
31
|
+
* it initializes the IG {@link Array} by parsing given input String IG by + and calling the getMorphologicalTag
|
|
32
|
+
* method with these substrings. If getMorphologicalTag method returns a tag, it.pushs this tag to the IG {@link Array}
|
|
33
|
+
* and also to the inflectionalGroups {@link Array}.
|
|
34
|
+
*
|
|
35
|
+
* @param parseOrInflectionalGroups String input.
|
|
36
|
+
*/
|
|
37
|
+
constructor(parseOrInflectionalGroups) {
|
|
38
|
+
if (parseOrInflectionalGroups != undefined) {
|
|
39
|
+
if (!Array.isArray(parseOrInflectionalGroups)) {
|
|
40
|
+
let iGs = new Array();
|
|
41
|
+
let st = parseOrInflectionalGroups;
|
|
42
|
+
while (st.includes("^DB+")) {
|
|
43
|
+
iGs.push(st.substring(0, st.indexOf("^DB+")));
|
|
44
|
+
st = st.substring(st.indexOf("^DB+") + 4);
|
|
45
|
+
}
|
|
46
|
+
iGs.push(st);
|
|
47
|
+
if (iGs[0] == "++Punc") {
|
|
48
|
+
this.root = new Word_1.Word("+");
|
|
49
|
+
this.inflectionalGroups.push(new InflectionalGroup_1.InflectionalGroup("Punc"));
|
|
71
50
|
}
|
|
72
51
|
else {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
this.
|
|
76
|
-
|
|
52
|
+
if (iGs[0].indexOf('+') != -1) {
|
|
53
|
+
this.root = new Word_1.Word(iGs[0].substring(0, iGs[0].indexOf('+')));
|
|
54
|
+
this.inflectionalGroups.push(new InflectionalGroup_1.InflectionalGroup(iGs[0].substring(iGs[0].indexOf('+') + 1)));
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.root = new Word_1.Word(iGs[0]);
|
|
77
58
|
}
|
|
78
|
-
for (let i = 1; i <
|
|
79
|
-
this.inflectionalGroups.push(new InflectionalGroup_1.InflectionalGroup(
|
|
59
|
+
for (let i = 1; i < iGs.length; i++) {
|
|
60
|
+
this.inflectionalGroups.push(new InflectionalGroup_1.InflectionalGroup(iGs[i]));
|
|
80
61
|
}
|
|
81
62
|
}
|
|
82
63
|
}
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* The no-arg getWord method returns root {@link Word}.
|
|
86
|
-
*
|
|
87
|
-
* @return root {@link Word}.
|
|
88
|
-
*/
|
|
89
|
-
getWord() {
|
|
90
|
-
return this.root;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* The getTransitionList method gets the first item of inflectionalGroups {@link Array} as a {@link String},
|
|
94
|
-
* then loops through the items of inflectionalGroups and concatenates them by using +.
|
|
95
|
-
*
|
|
96
|
-
* @return String that contains transition list.
|
|
97
|
-
*/
|
|
98
|
-
getMorphologicalParseTransitionList() {
|
|
99
|
-
let result = this.inflectionalGroups[0].toString();
|
|
100
|
-
for (let i = 1; i < this.inflectionalGroups.length; i++) {
|
|
101
|
-
result = result + "+" + this.inflectionalGroups[i].toString();
|
|
102
|
-
}
|
|
103
|
-
return result;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* The getInflectionalGroupString method takes an {@link number} index as an input and if index is 0, it directly
|
|
107
|
-
* returns the root and the first item of inflectionalGroups {@link Array}. If the index is not 0, it then returns
|
|
108
|
-
* the corresponding item of inflectionalGroups {@link Array} as a {@link String}.
|
|
109
|
-
*
|
|
110
|
-
* @param index Integer input.
|
|
111
|
-
* @return corresponding item of inflectionalGroups at given index as a {@link String}.
|
|
112
|
-
*/
|
|
113
|
-
getInflectionalGroupString(index) {
|
|
114
|
-
if (index == 0) {
|
|
115
|
-
return this.root.getName() + "+" + this.inflectionalGroups[0].toString();
|
|
116
|
-
}
|
|
117
64
|
else {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
* The getInflectionalGroup method takes an {@link number} index as an input and it directly returns the
|
|
123
|
-
* {@link InflectionalGroup} at given index.
|
|
124
|
-
*
|
|
125
|
-
* @param index Integer input.
|
|
126
|
-
* @return InflectionalGroup at given index.
|
|
127
|
-
*/
|
|
128
|
-
getInflectionalGroup(index) {
|
|
129
|
-
if (index == undefined) {
|
|
130
|
-
index = this.inflectionalGroups.length - 1;
|
|
131
|
-
}
|
|
132
|
-
return this.inflectionalGroups[index];
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* The getTag method takes an {@link number} index as an input and and if the given index is 0, it directly return
|
|
136
|
-
* the root. Then, it loops through the inflectionalGroups {@link Array} it returns the MorphologicalTag of the
|
|
137
|
-
* corresponding inflectional group.
|
|
138
|
-
*
|
|
139
|
-
* @param index Integer input.
|
|
140
|
-
* @return the MorphologicalTag of the corresponding inflectional group, or null of invalid index inputs.
|
|
141
|
-
*/
|
|
142
|
-
getTag(index) {
|
|
143
|
-
let size = 1;
|
|
144
|
-
if (index == 0)
|
|
145
|
-
return this.root.getName();
|
|
146
|
-
for (let group of this.inflectionalGroups) {
|
|
147
|
-
if (index < size + group.size()) {
|
|
148
|
-
return InflectionalGroup_1.InflectionalGroup.getTag(group.getTag(index - size));
|
|
65
|
+
let groups = parseOrInflectionalGroups;
|
|
66
|
+
if (groups[0].indexOf('+') != -1) {
|
|
67
|
+
this.root = new Word_1.Word(groups[0].substring(0, groups[0].indexOf('+')));
|
|
68
|
+
this.inflectionalGroups.push(new InflectionalGroup_1.InflectionalGroup(groups[0].substring(groups[0].indexOf('+') + 1)));
|
|
149
69
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
return undefined;
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* The tagSize method loops through the inflectionalGroups {@link Array} and accumulates the sizes of each inflectional group
|
|
156
|
-
* in the inflectionalGroups.
|
|
157
|
-
*
|
|
158
|
-
* @return total size of the inflectionalGroups {@link Array}.
|
|
159
|
-
*/
|
|
160
|
-
tagSize() {
|
|
161
|
-
let size = 1;
|
|
162
|
-
for (let group of this.inflectionalGroups) {
|
|
163
|
-
size += group.size();
|
|
164
|
-
}
|
|
165
|
-
return size;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* The size method returns the size of the inflectionalGroups {@link Array}.
|
|
169
|
-
*
|
|
170
|
-
* @return the size of the inflectionalGroups {@link Array}.
|
|
171
|
-
*/
|
|
172
|
-
size() {
|
|
173
|
-
return this.inflectionalGroups.length;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* The firstInflectionalGroup method returns the first inflectional group of inflectionalGroups {@link Array}.
|
|
177
|
-
*
|
|
178
|
-
* @return the first inflectional group of inflectionalGroups {@link Array}.
|
|
179
|
-
*/
|
|
180
|
-
firstInflectionalGroup() {
|
|
181
|
-
return this.inflectionalGroups[0];
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* The lastInflectionalGroup method returns the last inflectional group of inflectionalGroups {@link Array}.
|
|
185
|
-
*
|
|
186
|
-
* @return the last inflectional group of inflectionalGroups {@link Array}.
|
|
187
|
-
*/
|
|
188
|
-
lastInflectionalGroup() {
|
|
189
|
-
return this.inflectionalGroups[this.inflectionalGroups.length - 1];
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* The getWordWithPos method returns root with the MorphologicalTag of the first inflectional as a new word.
|
|
193
|
-
*
|
|
194
|
-
* @return root with the MorphologicalTag of the first inflectional as a new word.
|
|
195
|
-
*/
|
|
196
|
-
getWordWithPos() {
|
|
197
|
-
return new Word_1.Word(this.root.getName() + "+" + InflectionalGroup_1.InflectionalGroup.getTag(this.firstInflectionalGroup().getTag(0)));
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* The getPos method returns the MorphologicalTag of the last inflectional group.
|
|
201
|
-
*
|
|
202
|
-
* @return the MorphologicalTag of the last inflectional group.
|
|
203
|
-
*/
|
|
204
|
-
getPos() {
|
|
205
|
-
return InflectionalGroup_1.InflectionalGroup.getTag(this.lastInflectionalGroup().getTag(0));
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* The getRootPos method returns the MorphologicalTag of the first inflectional group.
|
|
209
|
-
*
|
|
210
|
-
* @return the MorphologicalTag of the first inflectional group.
|
|
211
|
-
*/
|
|
212
|
-
getRootPos() {
|
|
213
|
-
return InflectionalGroup_1.InflectionalGroup.getTag(this.firstInflectionalGroup().getTag(0));
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* The lastIGContainsCase method returns the MorphologicalTag of last inflectional group if it is one of the NOMINATIVE,
|
|
217
|
-
* ACCUSATIVE, DATIVE, LOCATIVE or ABLATIVE cases, null otherwise.
|
|
218
|
-
*
|
|
219
|
-
* @return the MorphologicalTag of last inflectional group if it is one of the NOMINATIVE,
|
|
220
|
-
* ACCUSATIVE, DATIVE, LOCATIVE or ABLATIVE cases, null otherwise.
|
|
221
|
-
*/
|
|
222
|
-
lastIGContainsCase() {
|
|
223
|
-
let caseTag = this.lastInflectionalGroup().containsCase();
|
|
224
|
-
if (caseTag != undefined)
|
|
225
|
-
return InflectionalGroup_1.InflectionalGroup.getTag(caseTag);
|
|
226
|
-
else
|
|
227
|
-
return "NULL";
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* The lastIGContainsTag method takes a MorphologicalTag as an input and returns true if the last inflectional group's
|
|
231
|
-
* MorphologicalTag matches with one of the tags in the IG {@link Array}, false otherwise.
|
|
232
|
-
*
|
|
233
|
-
* @param tag {@link MorphologicalTag} type input.
|
|
234
|
-
* @return true if the last inflectional group's MorphologicalTag matches with one of the tags in the
|
|
235
|
-
* IG {@link Array}, false otherwise.
|
|
236
|
-
*/
|
|
237
|
-
lastIGContainsTag(tag) {
|
|
238
|
-
return this.lastInflectionalGroup().containsTag(tag);
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* lastIGContainsPossessive method returns true if the last inflectional group contains one of the
|
|
242
|
-
* possessives: P1PL, P1SG, P2PL, P2SG, P3PL AND P3SG, false otherwise.
|
|
243
|
-
*
|
|
244
|
-
* @return true if the last inflectional group contains one of the possessives: P1PL, P1SG, P2PL, P2SG, P3PL AND P3SG, false otherwise.
|
|
245
|
-
*/
|
|
246
|
-
lastIGContainsPossessive() {
|
|
247
|
-
return this.lastInflectionalGroup().containsPossessive();
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* The isCapitalWord method returns true if the character at first index o f root is an uppercase letter, false otherwise.
|
|
251
|
-
*
|
|
252
|
-
* @return true if the character at first index o f root is an uppercase letter, false otherwise.
|
|
253
|
-
*/
|
|
254
|
-
isCapitalWord() {
|
|
255
|
-
let ch = this.root.getName().charAt(0);
|
|
256
|
-
return ch == ch.toLocaleUpperCase("tr");
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* The isNoun method returns true if the part of speech is NOUN, false otherwise.
|
|
260
|
-
*
|
|
261
|
-
* @return true if the part of speech is NOUN, false otherwise.
|
|
262
|
-
*/
|
|
263
|
-
isNoun() {
|
|
264
|
-
return this.getPos() == "NOUN";
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* The isVerb method returns true if the part of speech is VERB, false otherwise.
|
|
268
|
-
*
|
|
269
|
-
* @return true if the part of speech is VERB, false otherwise.
|
|
270
|
-
*/
|
|
271
|
-
isVerb() {
|
|
272
|
-
return this.getPos() == "VERB";
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* The isRootVerb method returns true if the part of speech of root is BERV, false otherwise.
|
|
276
|
-
*
|
|
277
|
-
* @return true if the part of speech of root is VERB, false otherwise.
|
|
278
|
-
*/
|
|
279
|
-
isRootVerb() {
|
|
280
|
-
return this.getRootPos() == "VERB";
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* The isAdjective method returns true if the part of speech is ADJ, false otherwise.
|
|
284
|
-
*
|
|
285
|
-
* @return true if the part of speech is ADJ, false otherwise.
|
|
286
|
-
*/
|
|
287
|
-
isAdjective() {
|
|
288
|
-
return this.getPos() == "ADJ";
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* The isProperNoun method returns true if the first inflectional group's MorphologicalTag is a PROPERNOUN, false otherwise.
|
|
292
|
-
*
|
|
293
|
-
* @return true if the first inflectional group's MorphologicalTag is a PROPERNOUN, false otherwise.
|
|
294
|
-
*/
|
|
295
|
-
isProperNoun() {
|
|
296
|
-
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.PROPERNOUN);
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* The isPunctuation method returns true if the first inflectional group's MorphologicalTag is a PUNCTUATION, false otherwise.
|
|
300
|
-
*
|
|
301
|
-
* @return true if the first inflectional group's MorphologicalTag is a PUNCTUATION, false otherwise.
|
|
302
|
-
*/
|
|
303
|
-
isPunctuation() {
|
|
304
|
-
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.PUNCTUATION);
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* The isCardinal method returns true if the first inflectional group's MorphologicalTag is a CARDINAL, false otherwise.
|
|
308
|
-
*
|
|
309
|
-
* @return true if the first inflectional group's MorphologicalTag is a CARDINAL, false otherwise.
|
|
310
|
-
*/
|
|
311
|
-
isCardinal() {
|
|
312
|
-
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.CARDINAL);
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* The isOrdinal method returns true if the first inflectional group's MorphologicalTag is a ORDINAL, false otherwise.
|
|
316
|
-
*
|
|
317
|
-
* @return true if the first inflectional group's MorphologicalTag is a ORDINAL, false otherwise.
|
|
318
|
-
*/
|
|
319
|
-
isOrdinal() {
|
|
320
|
-
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.ORDINAL);
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* The isReal method returns true if the first inflectional group's MorphologicalTag is a REAL, false otherwise.
|
|
324
|
-
*
|
|
325
|
-
* @return true if the first inflectional group's MorphologicalTag is a REAL, false otherwise.
|
|
326
|
-
*/
|
|
327
|
-
isReal() {
|
|
328
|
-
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.REAL);
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* The isNumber method returns true if the first inflectional group's MorphologicalTag is REAL or CARDINAL, false otherwise.
|
|
332
|
-
*
|
|
333
|
-
* @return true if the first inflectional group's MorphologicalTag is a REAL or CARDINAL, false otherwise.
|
|
334
|
-
*/
|
|
335
|
-
isNumber() {
|
|
336
|
-
return this.isReal() || this.isCardinal();
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* The isTime method returns true if the first inflectional group's MorphologicalTag is a TIME, false otherwise.
|
|
340
|
-
*
|
|
341
|
-
* @return true if the first inflectional group's MorphologicalTag is a TIME, false otherwise.
|
|
342
|
-
*/
|
|
343
|
-
isTime() {
|
|
344
|
-
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.TIME);
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* The isDate method returns true if the first inflectional group's MorphologicalTag is a DATE, false otherwise.
|
|
348
|
-
*
|
|
349
|
-
* @return true if the first inflectional group's MorphologicalTag is a DATE, false otherwise.
|
|
350
|
-
*/
|
|
351
|
-
isDate() {
|
|
352
|
-
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.DATE);
|
|
353
|
-
}
|
|
354
|
-
/**
|
|
355
|
-
* The isHashTag method returns true if the first inflectional group's MorphologicalTag is a HASHTAG, false otherwise.
|
|
356
|
-
*
|
|
357
|
-
* @return true if the first inflectional group's MorphologicalTag is a HASHTAG, false otherwise.
|
|
358
|
-
*/
|
|
359
|
-
isHashTag() {
|
|
360
|
-
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.HASHTAG);
|
|
361
|
-
}
|
|
362
|
-
/**
|
|
363
|
-
* The isEmail method returns true if the first inflectional group's MorphologicalTag is a EMAIL, false otherwise.
|
|
364
|
-
*
|
|
365
|
-
* @return true if the first inflectional group's MorphologicalTag is a EMAIL, false otherwise.
|
|
366
|
-
*/
|
|
367
|
-
isEmail() {
|
|
368
|
-
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.EMAIL);
|
|
369
|
-
}
|
|
370
|
-
/**
|
|
371
|
-
* The isPercent method returns true if the first inflectional group's MorphologicalTag is a PERCENT, false otherwise.
|
|
372
|
-
*
|
|
373
|
-
* @return true if the first inflectional group's MorphologicalTag is a PERCENT, false otherwise.
|
|
374
|
-
*/
|
|
375
|
-
isPercent() {
|
|
376
|
-
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.PERCENT);
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* The isFraction method returns true if the first inflectional group's MorphologicalTag is a FRACTION, false otherwise.
|
|
380
|
-
*
|
|
381
|
-
* @return true if the first inflectional group's MorphologicalTag is a FRACTION, false otherwise.
|
|
382
|
-
*/
|
|
383
|
-
isFraction() {
|
|
384
|
-
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.FRACTION);
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* The isRange method returns true if the first inflectional group's MorphologicalTag is a RANGE, false otherwise.
|
|
388
|
-
*
|
|
389
|
-
* @return true if the first inflectional group's MorphologicalTag is a RANGE, false otherwise.
|
|
390
|
-
*/
|
|
391
|
-
isRange() {
|
|
392
|
-
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.RANGE);
|
|
393
|
-
}
|
|
394
|
-
/**
|
|
395
|
-
* The isPlural method returns true if {@link InflectionalGroup}'s MorphologicalTags are from the agreement plural
|
|
396
|
-
* or possessive plural, i.e A1PL, A2PL, A3PL, P1PL, P2PL or P3PL, and false otherwise.
|
|
397
|
-
*
|
|
398
|
-
* @return true if {@link InflectionalGroup}'s MorphologicalTags are from the agreement plural or possessive plural.
|
|
399
|
-
*/
|
|
400
|
-
isPlural() {
|
|
401
|
-
for (let inflectionalGroup of this.inflectionalGroups) {
|
|
402
|
-
if (inflectionalGroup.containsPlural()) {
|
|
403
|
-
return true;
|
|
70
|
+
for (let i = 1; i < groups.length; i++) {
|
|
71
|
+
this.inflectionalGroups.push(new InflectionalGroup_1.InflectionalGroup(groups[i]));
|
|
404
72
|
}
|
|
405
73
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The no-arg getWord method returns root {@link Word}.
|
|
78
|
+
*
|
|
79
|
+
* @return root {@link Word}.
|
|
80
|
+
*/
|
|
81
|
+
getWord() {
|
|
82
|
+
return this.root;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The getTransitionList method gets the first item of inflectionalGroups {@link Array} as a {@link String},
|
|
86
|
+
* then loops through the items of inflectionalGroups and concatenates them by using +.
|
|
87
|
+
*
|
|
88
|
+
* @return String that contains transition list.
|
|
89
|
+
*/
|
|
90
|
+
getMorphologicalParseTransitionList() {
|
|
91
|
+
let result = this.inflectionalGroups[0].toString();
|
|
92
|
+
for (let i = 1; i < this.inflectionalGroups.length; i++) {
|
|
93
|
+
result = result + "+" + this.inflectionalGroups[i].toString();
|
|
94
|
+
}
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The getInflectionalGroupString method takes an {@link number} index as an input and if index is 0, it directly
|
|
99
|
+
* returns the root and the first item of inflectionalGroups {@link Array}. If the index is not 0, it then returns
|
|
100
|
+
* the corresponding item of inflectionalGroups {@link Array} as a {@link String}.
|
|
101
|
+
*
|
|
102
|
+
* @param index Integer input.
|
|
103
|
+
* @return corresponding item of inflectionalGroups at given index as a {@link String}.
|
|
104
|
+
*/
|
|
105
|
+
getInflectionalGroupString(index) {
|
|
106
|
+
if (index == 0) {
|
|
107
|
+
return this.root.getName() + "+" + this.inflectionalGroups[0].toString();
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
return this.inflectionalGroups[index].toString();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* The getInflectionalGroup method takes an {@link number} index as an input and it directly returns the
|
|
115
|
+
* {@link InflectionalGroup} at given index.
|
|
116
|
+
*
|
|
117
|
+
* @param index Integer input.
|
|
118
|
+
* @return InflectionalGroup at given index.
|
|
119
|
+
*/
|
|
120
|
+
getInflectionalGroup(index) {
|
|
121
|
+
if (index == undefined) {
|
|
122
|
+
index = this.inflectionalGroups.length - 1;
|
|
123
|
+
}
|
|
124
|
+
return this.inflectionalGroups[index];
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The getTag method takes an {@link number} index as an input and and if the given index is 0, it directly return
|
|
128
|
+
* the root. Then, it loops through the inflectionalGroups {@link Array} it returns the MorphologicalTag of the
|
|
129
|
+
* corresponding inflectional group.
|
|
130
|
+
*
|
|
131
|
+
* @param index Integer input.
|
|
132
|
+
* @return the MorphologicalTag of the corresponding inflectional group, or null of invalid index inputs.
|
|
133
|
+
*/
|
|
134
|
+
getTag(index) {
|
|
135
|
+
let size = 1;
|
|
136
|
+
if (index == 0)
|
|
137
|
+
return this.root.getName();
|
|
138
|
+
for (let group of this.inflectionalGroups) {
|
|
139
|
+
if (index < size + group.size()) {
|
|
140
|
+
return InflectionalGroup_1.InflectionalGroup.getTag(group.getTag(index - size));
|
|
141
|
+
}
|
|
142
|
+
size += group.size();
|
|
143
|
+
}
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* The tagSize method loops through the inflectionalGroups {@link Array} and accumulates the sizes of each inflectional group
|
|
148
|
+
* in the inflectionalGroups.
|
|
149
|
+
*
|
|
150
|
+
* @return total size of the inflectionalGroups {@link Array}.
|
|
151
|
+
*/
|
|
152
|
+
tagSize() {
|
|
153
|
+
let size = 1;
|
|
154
|
+
for (let group of this.inflectionalGroups) {
|
|
155
|
+
size += group.size();
|
|
156
|
+
}
|
|
157
|
+
return size;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The size method returns the size of the inflectionalGroups {@link Array}.
|
|
161
|
+
*
|
|
162
|
+
* @return the size of the inflectionalGroups {@link Array}.
|
|
163
|
+
*/
|
|
164
|
+
size() {
|
|
165
|
+
return this.inflectionalGroups.length;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The firstInflectionalGroup method returns the first inflectional group of inflectionalGroups {@link Array}.
|
|
169
|
+
*
|
|
170
|
+
* @return the first inflectional group of inflectionalGroups {@link Array}.
|
|
171
|
+
*/
|
|
172
|
+
firstInflectionalGroup() {
|
|
173
|
+
return this.inflectionalGroups[0];
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The lastInflectionalGroup method returns the last inflectional group of inflectionalGroups {@link Array}.
|
|
177
|
+
*
|
|
178
|
+
* @return the last inflectional group of inflectionalGroups {@link Array}.
|
|
179
|
+
*/
|
|
180
|
+
lastInflectionalGroup() {
|
|
181
|
+
return this.inflectionalGroups[this.inflectionalGroups.length - 1];
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* The getWordWithPos method returns root with the MorphologicalTag of the first inflectional as a new word.
|
|
185
|
+
*
|
|
186
|
+
* @return root with the MorphologicalTag of the first inflectional as a new word.
|
|
187
|
+
*/
|
|
188
|
+
getWordWithPos() {
|
|
189
|
+
return new Word_1.Word(this.root.getName() + "+" + InflectionalGroup_1.InflectionalGroup.getTag(this.firstInflectionalGroup().getTag(0)));
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* The getPos method returns the MorphologicalTag of the last inflectional group.
|
|
193
|
+
*
|
|
194
|
+
* @return the MorphologicalTag of the last inflectional group.
|
|
195
|
+
*/
|
|
196
|
+
getPos() {
|
|
197
|
+
return InflectionalGroup_1.InflectionalGroup.getTag(this.lastInflectionalGroup().getTag(0));
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* The getRootPos method returns the MorphologicalTag of the first inflectional group.
|
|
201
|
+
*
|
|
202
|
+
* @return the MorphologicalTag of the first inflectional group.
|
|
203
|
+
*/
|
|
204
|
+
getRootPos() {
|
|
205
|
+
return InflectionalGroup_1.InflectionalGroup.getTag(this.firstInflectionalGroup().getTag(0));
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* The lastIGContainsCase method returns the MorphologicalTag of last inflectional group if it is one of the NOMINATIVE,
|
|
209
|
+
* ACCUSATIVE, DATIVE, LOCATIVE or ABLATIVE cases, null otherwise.
|
|
210
|
+
*
|
|
211
|
+
* @return the MorphologicalTag of last inflectional group if it is one of the NOMINATIVE,
|
|
212
|
+
* ACCUSATIVE, DATIVE, LOCATIVE or ABLATIVE cases, null otherwise.
|
|
213
|
+
*/
|
|
214
|
+
lastIGContainsCase() {
|
|
215
|
+
let caseTag = this.lastInflectionalGroup().containsCase();
|
|
216
|
+
if (caseTag != undefined)
|
|
217
|
+
return InflectionalGroup_1.InflectionalGroup.getTag(caseTag);
|
|
218
|
+
else
|
|
219
|
+
return "NULL";
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* The lastIGContainsTag method takes a MorphologicalTag as an input and returns true if the last inflectional group's
|
|
223
|
+
* MorphologicalTag matches with one of the tags in the IG {@link Array}, false otherwise.
|
|
224
|
+
*
|
|
225
|
+
* @param tag {@link MorphologicalTag} type input.
|
|
226
|
+
* @return true if the last inflectional group's MorphologicalTag matches with one of the tags in the
|
|
227
|
+
* IG {@link Array}, false otherwise.
|
|
228
|
+
*/
|
|
229
|
+
lastIGContainsTag(tag) {
|
|
230
|
+
return this.lastInflectionalGroup().containsTag(tag);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* lastIGContainsPossessive method returns true if the last inflectional group contains one of the
|
|
234
|
+
* possessives: P1PL, P1SG, P2PL, P2SG, P3PL AND P3SG, false otherwise.
|
|
235
|
+
*
|
|
236
|
+
* @return true if the last inflectional group contains one of the possessives: P1PL, P1SG, P2PL, P2SG, P3PL AND P3SG, false otherwise.
|
|
237
|
+
*/
|
|
238
|
+
lastIGContainsPossessive() {
|
|
239
|
+
return this.lastInflectionalGroup().containsPossessive();
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* The isCapitalWord method returns true if the character at first index o f root is an uppercase letter, false otherwise.
|
|
243
|
+
*
|
|
244
|
+
* @return true if the character at first index o f root is an uppercase letter, false otherwise.
|
|
245
|
+
*/
|
|
246
|
+
isCapitalWord() {
|
|
247
|
+
let ch = this.root.getName().charAt(0);
|
|
248
|
+
return ch == ch.toLocaleUpperCase("tr");
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* The isNoun method returns true if the part of speech is NOUN, false otherwise.
|
|
252
|
+
*
|
|
253
|
+
* @return true if the part of speech is NOUN, false otherwise.
|
|
254
|
+
*/
|
|
255
|
+
isNoun() {
|
|
256
|
+
return this.getPos() == "NOUN";
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* The isVerb method returns true if the part of speech is VERB, false otherwise.
|
|
260
|
+
*
|
|
261
|
+
* @return true if the part of speech is VERB, false otherwise.
|
|
262
|
+
*/
|
|
263
|
+
isVerb() {
|
|
264
|
+
return this.getPos() == "VERB";
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* The isRootVerb method returns true if the part of speech of root is BERV, false otherwise.
|
|
268
|
+
*
|
|
269
|
+
* @return true if the part of speech of root is VERB, false otherwise.
|
|
270
|
+
*/
|
|
271
|
+
isRootVerb() {
|
|
272
|
+
return this.getRootPos() == "VERB";
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* The isAdjective method returns true if the part of speech is ADJ, false otherwise.
|
|
276
|
+
*
|
|
277
|
+
* @return true if the part of speech is ADJ, false otherwise.
|
|
278
|
+
*/
|
|
279
|
+
isAdjective() {
|
|
280
|
+
return this.getPos() == "ADJ";
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* The isProperNoun method returns true if the first inflectional group's MorphologicalTag is a PROPERNOUN, false otherwise.
|
|
284
|
+
*
|
|
285
|
+
* @return true if the first inflectional group's MorphologicalTag is a PROPERNOUN, false otherwise.
|
|
286
|
+
*/
|
|
287
|
+
isProperNoun() {
|
|
288
|
+
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.PROPERNOUN);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* The isPunctuation method returns true if the first inflectional group's MorphologicalTag is a PUNCTUATION, false otherwise.
|
|
292
|
+
*
|
|
293
|
+
* @return true if the first inflectional group's MorphologicalTag is a PUNCTUATION, false otherwise.
|
|
294
|
+
*/
|
|
295
|
+
isPunctuation() {
|
|
296
|
+
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.PUNCTUATION);
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* The isCardinal method returns true if the first inflectional group's MorphologicalTag is a CARDINAL, false otherwise.
|
|
300
|
+
*
|
|
301
|
+
* @return true if the first inflectional group's MorphologicalTag is a CARDINAL, false otherwise.
|
|
302
|
+
*/
|
|
303
|
+
isCardinal() {
|
|
304
|
+
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.CARDINAL);
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* The isOrdinal method returns true if the first inflectional group's MorphologicalTag is a ORDINAL, false otherwise.
|
|
308
|
+
*
|
|
309
|
+
* @return true if the first inflectional group's MorphologicalTag is a ORDINAL, false otherwise.
|
|
310
|
+
*/
|
|
311
|
+
isOrdinal() {
|
|
312
|
+
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.ORDINAL);
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* The isReal method returns true if the first inflectional group's MorphologicalTag is a REAL, false otherwise.
|
|
316
|
+
*
|
|
317
|
+
* @return true if the first inflectional group's MorphologicalTag is a REAL, false otherwise.
|
|
318
|
+
*/
|
|
319
|
+
isReal() {
|
|
320
|
+
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.REAL);
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* The isNumber method returns true if the first inflectional group's MorphologicalTag is REAL or CARDINAL, false otherwise.
|
|
324
|
+
*
|
|
325
|
+
* @return true if the first inflectional group's MorphologicalTag is a REAL or CARDINAL, false otherwise.
|
|
326
|
+
*/
|
|
327
|
+
isNumber() {
|
|
328
|
+
return this.isReal() || this.isCardinal();
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* The isTime method returns true if the first inflectional group's MorphologicalTag is a TIME, false otherwise.
|
|
332
|
+
*
|
|
333
|
+
* @return true if the first inflectional group's MorphologicalTag is a TIME, false otherwise.
|
|
334
|
+
*/
|
|
335
|
+
isTime() {
|
|
336
|
+
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.TIME);
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* The isDate method returns true if the first inflectional group's MorphologicalTag is a DATE, false otherwise.
|
|
340
|
+
*
|
|
341
|
+
* @return true if the first inflectional group's MorphologicalTag is a DATE, false otherwise.
|
|
342
|
+
*/
|
|
343
|
+
isDate() {
|
|
344
|
+
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.DATE);
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* The isHashTag method returns true if the first inflectional group's MorphologicalTag is a HASHTAG, false otherwise.
|
|
348
|
+
*
|
|
349
|
+
* @return true if the first inflectional group's MorphologicalTag is a HASHTAG, false otherwise.
|
|
350
|
+
*/
|
|
351
|
+
isHashTag() {
|
|
352
|
+
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.HASHTAG);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* The isEmail method returns true if the first inflectional group's MorphologicalTag is a EMAIL, false otherwise.
|
|
356
|
+
*
|
|
357
|
+
* @return true if the first inflectional group's MorphologicalTag is a EMAIL, false otherwise.
|
|
358
|
+
*/
|
|
359
|
+
isEmail() {
|
|
360
|
+
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.EMAIL);
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* The isPercent method returns true if the first inflectional group's MorphologicalTag is a PERCENT, false otherwise.
|
|
364
|
+
*
|
|
365
|
+
* @return true if the first inflectional group's MorphologicalTag is a PERCENT, false otherwise.
|
|
366
|
+
*/
|
|
367
|
+
isPercent() {
|
|
368
|
+
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.PERCENT);
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* The isFraction method returns true if the first inflectional group's MorphologicalTag is a FRACTION, false otherwise.
|
|
372
|
+
*
|
|
373
|
+
* @return true if the first inflectional group's MorphologicalTag is a FRACTION, false otherwise.
|
|
374
|
+
*/
|
|
375
|
+
isFraction() {
|
|
376
|
+
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.FRACTION);
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* The isRange method returns true if the first inflectional group's MorphologicalTag is a RANGE, false otherwise.
|
|
380
|
+
*
|
|
381
|
+
* @return true if the first inflectional group's MorphologicalTag is a RANGE, false otherwise.
|
|
382
|
+
*/
|
|
383
|
+
isRange() {
|
|
384
|
+
return this.getInflectionalGroup(0).containsTag(MorphologicalTag_1.MorphologicalTag.RANGE);
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* The isPlural method returns true if {@link InflectionalGroup}'s MorphologicalTags are from the agreement plural
|
|
388
|
+
* or possessive plural, i.e A1PL, A2PL, A3PL, P1PL, P2PL or P3PL, and false otherwise.
|
|
389
|
+
*
|
|
390
|
+
* @return true if {@link InflectionalGroup}'s MorphologicalTags are from the agreement plural or possessive plural.
|
|
391
|
+
*/
|
|
392
|
+
isPlural() {
|
|
393
|
+
for (let inflectionalGroup of this.inflectionalGroups) {
|
|
394
|
+
if (inflectionalGroup.containsPlural()) {
|
|
395
|
+
return true;
|
|
428
396
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
397
|
+
}
|
|
398
|
+
return false;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* The isAuxiliary method returns true if the root equals to the et, ol, or yap, and false otherwise.
|
|
402
|
+
*
|
|
403
|
+
* @return true if the root equals to the et, ol, or yap, and false otherwise.
|
|
404
|
+
*/
|
|
405
|
+
isAuxiliary() {
|
|
406
|
+
return this.root.getName() == "et" || this.root.getName() == "ol" || this.root.getName() == "yap";
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* The containsTag method takes a MorphologicalTag as an input and loops through the inflectionalGroups {@link ArrayList},
|
|
410
|
+
* returns true if the input matches with on of the tags in the IG, false otherwise.
|
|
411
|
+
*
|
|
412
|
+
* @param tag checked tag
|
|
413
|
+
* @return true if the input matches with on of the tags in the IG, false otherwise.
|
|
414
|
+
*/
|
|
415
|
+
containsTag(tag) {
|
|
416
|
+
for (let inflectionalGroup of this.inflectionalGroups) {
|
|
417
|
+
if (inflectionalGroup.containsTag(tag)) {
|
|
418
|
+
return true;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
return false;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* The getTreePos method returns the tree pos tag of a morphological analysis.
|
|
425
|
+
*
|
|
426
|
+
* @return Tree pos tag of the morphological analysis in string form.
|
|
427
|
+
*/
|
|
428
|
+
getTreePos() {
|
|
429
|
+
if (this.isProperNoun()) {
|
|
430
|
+
return "NP";
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
if (this.root.getName() == "değil") {
|
|
434
|
+
return "NEG";
|
|
439
435
|
}
|
|
440
436
|
else {
|
|
441
|
-
if (this.
|
|
442
|
-
|
|
437
|
+
if (this.isVerb()) {
|
|
438
|
+
if (this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.ZERO)) {
|
|
439
|
+
return "NOMP";
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
return "VP";
|
|
443
|
+
}
|
|
443
444
|
}
|
|
444
445
|
else {
|
|
445
|
-
if (this.
|
|
446
|
-
|
|
447
|
-
return "NOMP";
|
|
448
|
-
}
|
|
449
|
-
else {
|
|
450
|
-
return "VP";
|
|
451
|
-
}
|
|
446
|
+
if (this.isAdjective()) {
|
|
447
|
+
return "ADJP";
|
|
452
448
|
}
|
|
453
449
|
else {
|
|
454
|
-
if (this.
|
|
455
|
-
return "
|
|
450
|
+
if (this.isNoun() || this.isPercent()) {
|
|
451
|
+
return "NP";
|
|
456
452
|
}
|
|
457
453
|
else {
|
|
458
|
-
if (this.
|
|
459
|
-
return "
|
|
454
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.ADVERB)) {
|
|
455
|
+
return "ADVP";
|
|
460
456
|
}
|
|
461
457
|
else {
|
|
462
|
-
if (this.
|
|
463
|
-
return "
|
|
458
|
+
if (this.isNumber() || this.isFraction()) {
|
|
459
|
+
return "NUM";
|
|
464
460
|
}
|
|
465
461
|
else {
|
|
466
|
-
if (this.
|
|
467
|
-
return "
|
|
462
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.POSTPOSITION)) {
|
|
463
|
+
return "PP";
|
|
468
464
|
}
|
|
469
465
|
else {
|
|
470
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.
|
|
471
|
-
return "
|
|
466
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.CONJUNCTION)) {
|
|
467
|
+
return "CONJP";
|
|
472
468
|
}
|
|
473
469
|
else {
|
|
474
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.
|
|
475
|
-
return "
|
|
470
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.DETERMINER)) {
|
|
471
|
+
return "DP";
|
|
476
472
|
}
|
|
477
473
|
else {
|
|
478
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.
|
|
479
|
-
return "
|
|
474
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.INTERJECTION)) {
|
|
475
|
+
return "INTJP";
|
|
480
476
|
}
|
|
481
477
|
else {
|
|
482
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.
|
|
483
|
-
return "
|
|
478
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.QUESTIONPRONOUN)) {
|
|
479
|
+
return "WP";
|
|
484
480
|
}
|
|
485
481
|
else {
|
|
486
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.
|
|
487
|
-
return "
|
|
482
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.PRONOUN)) {
|
|
483
|
+
return "NP";
|
|
488
484
|
}
|
|
489
485
|
else {
|
|
490
|
-
if (this.
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
case "-rrb-":
|
|
510
|
-
return "-RRB-";
|
|
511
|
-
default:
|
|
512
|
-
return this.root.getName();
|
|
513
|
-
}
|
|
486
|
+
if (this.isPunctuation()) {
|
|
487
|
+
switch (this.root.getName()) {
|
|
488
|
+
case "!":
|
|
489
|
+
case "?":
|
|
490
|
+
return ".";
|
|
491
|
+
case ";":
|
|
492
|
+
case "-":
|
|
493
|
+
case "--":
|
|
494
|
+
return ":";
|
|
495
|
+
case "(":
|
|
496
|
+
case "-LRB-":
|
|
497
|
+
case "-lrb-":
|
|
498
|
+
return "-LRB-";
|
|
499
|
+
case ")":
|
|
500
|
+
case "-RRB-":
|
|
501
|
+
case "-rrb-":
|
|
502
|
+
return "-RRB-";
|
|
503
|
+
default:
|
|
504
|
+
return this.root.getName();
|
|
514
505
|
}
|
|
515
506
|
}
|
|
516
507
|
}
|
|
@@ -525,596 +516,596 @@
|
|
|
525
516
|
}
|
|
526
517
|
}
|
|
527
518
|
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
519
|
+
}
|
|
520
|
+
return "-XXX-";
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Returns the pronoun type of the parse for universal dependency feature ProType.
|
|
524
|
+
* @return "Art" if the pronoun is also a determiner; "Prs" if the pronoun is personal pronoun; "Rcp" if the
|
|
525
|
+
* pronoun is 'birbiri'; "Ind" if the pronoun is an indeterminate pronoun; "Neg" if the pronoun is 'hiçbiri';
|
|
526
|
+
* "Int" if the pronoun is a question pronoun; "Dem" if the pronoun is a demonstrative pronoun.
|
|
527
|
+
*/
|
|
528
|
+
getPronType() {
|
|
529
|
+
let lemma = this.root.getName();
|
|
530
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.DETERMINER)) {
|
|
531
|
+
return "Art";
|
|
532
|
+
}
|
|
533
|
+
if (lemma == "kendi" || this.containsTag(MorphologicalTag_1.MorphologicalTag.PERSONALPRONOUN)) {
|
|
534
|
+
return "Prs";
|
|
535
|
+
}
|
|
536
|
+
if (lemma == "birbiri" || lemma == "birbirleri") {
|
|
537
|
+
return "Rcp";
|
|
538
|
+
}
|
|
539
|
+
if (lemma == "birçoğu" || lemma == "hep" || lemma == "kimse"
|
|
540
|
+
|| lemma == "bazı" || lemma == "biri" || lemma == "çoğu"
|
|
541
|
+
|| lemma == "hepsi" || lemma == "diğeri" || lemma == "tümü"
|
|
542
|
+
|| lemma == "herkes" || lemma == "kimi" || lemma == "öbür"
|
|
543
|
+
|| lemma == "öteki" || lemma == "birkaçı" || lemma == "topu"
|
|
544
|
+
|| lemma == "başkası") {
|
|
545
|
+
return "Ind";
|
|
546
|
+
}
|
|
547
|
+
if (lemma == "hiçbiri") {
|
|
548
|
+
return "Neg";
|
|
549
|
+
}
|
|
550
|
+
if (lemma == "kim" || lemma == "nere" || lemma == "ne"
|
|
551
|
+
|| lemma == "hangi" || lemma == "nasıl" || lemma == "kaç"
|
|
552
|
+
|| lemma == "mi" || lemma == "mı" || lemma == "mu" || lemma == "mü") {
|
|
553
|
+
return "Int";
|
|
554
|
+
}
|
|
555
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.DEMONSTRATIVEPRONOUN)) {
|
|
556
|
+
return "Dem";
|
|
557
|
+
}
|
|
558
|
+
return undefined;
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Returns the numeral type of the parse for universal dependency feature NumType.
|
|
562
|
+
* @return "Ord" if the parse is Time, Ordinal or the word is '%' or 'kaçıncı'; "Dist" if the word is a
|
|
563
|
+
* distributive number such as 'beşinci'; "Card" if the number is cardinal or any number or the word is 'kaç'.
|
|
564
|
+
*/
|
|
565
|
+
getNumType() {
|
|
566
|
+
let lemma = this.root.getName();
|
|
567
|
+
if (lemma == "%" || this.containsTag(MorphologicalTag_1.MorphologicalTag.TIME)) {
|
|
568
|
+
return "Ord";
|
|
569
|
+
}
|
|
570
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.ORDINAL) || lemma == "kaçıncı") {
|
|
571
|
+
return "Ord";
|
|
572
|
+
}
|
|
573
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.DISTRIBUTIVE)) {
|
|
574
|
+
return "Dist";
|
|
575
|
+
}
|
|
576
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.CARDINAL) || this.containsTag(MorphologicalTag_1.MorphologicalTag.NUMBER) || lemma == "kaç") {
|
|
577
|
+
return "Card";
|
|
578
|
+
}
|
|
579
|
+
return undefined;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Returns the value for the dependency feature Reflex.
|
|
583
|
+
* @return "Yes" if the root word is 'kendi', null otherwise.
|
|
584
|
+
*/
|
|
585
|
+
getReflex() {
|
|
586
|
+
let lemma = this.root.getName();
|
|
587
|
+
if (lemma == "kendi") {
|
|
588
|
+
return "Yes";
|
|
589
|
+
}
|
|
590
|
+
return undefined;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Returns the agreement of the parse for the universal dependency feature Number.
|
|
594
|
+
* @return "Sing" if the agreement of the parse is singular (contains A1SG, A2SG, A3SG); "Plur" if the agreement
|
|
595
|
+
* of the parse is plural (contains A1PL, A2PL, A3PL).
|
|
596
|
+
*/
|
|
597
|
+
getNumber() {
|
|
598
|
+
if (this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.A1SG) || this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.A2SG) ||
|
|
599
|
+
this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.A3SG)) {
|
|
600
|
+
return "Sing";
|
|
601
|
+
}
|
|
602
|
+
if (this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.A1PL) || this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.A2PL) ||
|
|
603
|
+
this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.A3PL)) {
|
|
604
|
+
return "Plur";
|
|
605
|
+
}
|
|
606
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.A1SG) || this.containsTag(MorphologicalTag_1.MorphologicalTag.A2SG) ||
|
|
607
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.A3SG)) {
|
|
608
|
+
return "Sing";
|
|
609
|
+
}
|
|
610
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.A1PL) || this.containsTag(MorphologicalTag_1.MorphologicalTag.A2PL) ||
|
|
611
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.A3PL)) {
|
|
612
|
+
return "Plur";
|
|
613
|
+
}
|
|
614
|
+
return undefined;
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Returns the possessive agreement of the parse for the universal dependency feature [Pos].
|
|
618
|
+
* @return "Sing" if the possessive agreement of the parse is singular (contains P1SG, P2SG, P3SG); "Plur" if the
|
|
619
|
+
* possessive agreement of the parse is plural (contains P1PL, P2PL, P3PL).
|
|
620
|
+
*/
|
|
621
|
+
getPossessiveNumber() {
|
|
622
|
+
if (this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.P1SG) || this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.P2SG) ||
|
|
623
|
+
this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.P3SG)) {
|
|
624
|
+
return "Sing";
|
|
625
|
+
}
|
|
626
|
+
if (this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.P1PL) || this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.P2PL) ||
|
|
627
|
+
this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.P3PL)) {
|
|
628
|
+
return "Plur";
|
|
629
|
+
}
|
|
630
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.P1SG) || this.containsTag(MorphologicalTag_1.MorphologicalTag.P2SG) ||
|
|
631
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.P3SG)) {
|
|
632
|
+
return "Sing";
|
|
633
|
+
}
|
|
634
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.P1PL) || this.containsTag(MorphologicalTag_1.MorphologicalTag.P2PL) ||
|
|
635
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.P3PL)) {
|
|
636
|
+
return "Plur";
|
|
637
|
+
}
|
|
638
|
+
return undefined;
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Returns the case marking of the parse for the universal dependency feature case.
|
|
642
|
+
* @return "Acc" for accusative marker; "Dat" for dative marker; "Gen" for genitive marker; "Loc" for locative
|
|
643
|
+
* marker; "Ins" for instrumentative marker; "Abl" for ablative marker; "Nom" for nominative marker.
|
|
644
|
+
*/
|
|
645
|
+
getCase() {
|
|
646
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.ACCUSATIVE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PCACCUSATIVE)) {
|
|
647
|
+
return "Acc";
|
|
648
|
+
}
|
|
649
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.DATIVE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PCDATIVE)) {
|
|
650
|
+
return "Dat";
|
|
651
|
+
}
|
|
652
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.GENITIVE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PCGENITIVE)) {
|
|
653
|
+
return "Gen";
|
|
654
|
+
}
|
|
655
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.LOCATIVE)) {
|
|
656
|
+
return "Loc";
|
|
657
|
+
}
|
|
658
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.INSTRUMENTAL) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PCINSTRUMENTAL)) {
|
|
659
|
+
return "Ins";
|
|
660
|
+
}
|
|
661
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.ABLATIVE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PCABLATIVE)) {
|
|
662
|
+
return "Abl";
|
|
663
|
+
}
|
|
664
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.NOMINATIVE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PCNOMINATIVE)) {
|
|
665
|
+
return "Nom";
|
|
666
|
+
}
|
|
667
|
+
return undefined;
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Returns the definiteness of the parse for the universal dependency feature definite. It applies only for
|
|
671
|
+
* determiners in Turkish.
|
|
672
|
+
* @return "Ind" for 'bir', 'bazı', or 'birkaç'. "Def" for 'her', 'bu', 'şu', 'o', 'bütün'.
|
|
673
|
+
*/
|
|
674
|
+
getDefinite() {
|
|
675
|
+
let lemma = this.root.getName();
|
|
676
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.DETERMINER)) {
|
|
677
|
+
if (lemma == "bir" || lemma == "bazı" || lemma == "birkaç") {
|
|
553
678
|
return "Ind";
|
|
554
679
|
}
|
|
555
|
-
if (lemma == "
|
|
556
|
-
return "
|
|
557
|
-
}
|
|
558
|
-
if (lemma == "kim" || lemma == "nere" || lemma == "ne"
|
|
559
|
-
|| lemma == "hangi" || lemma == "nasıl" || lemma == "kaç"
|
|
560
|
-
|| lemma == "mi" || lemma == "mı" || lemma == "mu" || lemma == "mü") {
|
|
561
|
-
return "Int";
|
|
680
|
+
if (lemma == "her" || lemma == "bu" || lemma == "şu" || lemma == "o" || lemma == "bütün") {
|
|
681
|
+
return "Def";
|
|
562
682
|
}
|
|
563
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.DEMONSTRATIVEPRONOUN)) {
|
|
564
|
-
return "Dem";
|
|
565
|
-
}
|
|
566
|
-
return undefined;
|
|
567
|
-
}
|
|
568
|
-
/**
|
|
569
|
-
* Returns the numeral type of the parse for universal dependency feature NumType.
|
|
570
|
-
* @return "Ord" if the parse is Time, Ordinal or the word is '%' or 'kaçıncı'; "Dist" if the word is a
|
|
571
|
-
* distributive number such as 'beşinci'; "Card" if the number is cardinal or any number or the word is 'kaç'.
|
|
572
|
-
*/
|
|
573
|
-
getNumType() {
|
|
574
|
-
let lemma = this.root.getName();
|
|
575
|
-
if (lemma == "%" || this.containsTag(MorphologicalTag_1.MorphologicalTag.TIME)) {
|
|
576
|
-
return "Ord";
|
|
577
|
-
}
|
|
578
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.ORDINAL) || lemma == "kaçıncı") {
|
|
579
|
-
return "Ord";
|
|
580
|
-
}
|
|
581
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.DISTRIBUTIVE)) {
|
|
582
|
-
return "Dist";
|
|
583
|
-
}
|
|
584
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.CARDINAL) || this.containsTag(MorphologicalTag_1.MorphologicalTag.NUMBER) || lemma == "kaç") {
|
|
585
|
-
return "Card";
|
|
586
|
-
}
|
|
587
|
-
return undefined;
|
|
588
|
-
}
|
|
589
|
-
/**
|
|
590
|
-
* Returns the value for the dependency feature Reflex.
|
|
591
|
-
* @return "Yes" if the root word is 'kendi', null otherwise.
|
|
592
|
-
*/
|
|
593
|
-
getReflex() {
|
|
594
|
-
let lemma = this.root.getName();
|
|
595
|
-
if (lemma == "kendi") {
|
|
596
|
-
return "Yes";
|
|
597
|
-
}
|
|
598
|
-
return undefined;
|
|
599
|
-
}
|
|
600
|
-
/**
|
|
601
|
-
* Returns the agreement of the parse for the universal dependency feature Number.
|
|
602
|
-
* @return "Sing" if the agreement of the parse is singular (contains A1SG, A2SG, A3SG); "Plur" if the agreement
|
|
603
|
-
* of the parse is plural (contains A1PL, A2PL, A3PL).
|
|
604
|
-
*/
|
|
605
|
-
getNumber() {
|
|
606
|
-
if (this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.A1SG) || this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.A2SG) ||
|
|
607
|
-
this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.A3SG)) {
|
|
608
|
-
return "Sing";
|
|
609
|
-
}
|
|
610
|
-
if (this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.A1PL) || this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.A2PL) ||
|
|
611
|
-
this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.A3PL)) {
|
|
612
|
-
return "Plur";
|
|
613
|
-
}
|
|
614
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.A1SG) || this.containsTag(MorphologicalTag_1.MorphologicalTag.A2SG) ||
|
|
615
|
-
this.containsTag(MorphologicalTag_1.MorphologicalTag.A3SG)) {
|
|
616
|
-
return "Sing";
|
|
617
|
-
}
|
|
618
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.A1PL) || this.containsTag(MorphologicalTag_1.MorphologicalTag.A2PL) ||
|
|
619
|
-
this.containsTag(MorphologicalTag_1.MorphologicalTag.A3PL)) {
|
|
620
|
-
return "Plur";
|
|
621
|
-
}
|
|
622
|
-
return undefined;
|
|
623
|
-
}
|
|
624
|
-
/**
|
|
625
|
-
* Returns the possessive agreement of the parse for the universal dependency feature [Pos].
|
|
626
|
-
* @return "Sing" if the possessive agreement of the parse is singular (contains P1SG, P2SG, P3SG); "Plur" if the
|
|
627
|
-
* possessive agreement of the parse is plural (contains P1PL, P2PL, P3PL).
|
|
628
|
-
*/
|
|
629
|
-
getPossessiveNumber() {
|
|
630
|
-
if (this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.P1SG) || this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.P2SG) ||
|
|
631
|
-
this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.P3SG)) {
|
|
632
|
-
return "Sing";
|
|
633
|
-
}
|
|
634
|
-
if (this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.P1PL) || this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.P2PL) ||
|
|
635
|
-
this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.P3PL)) {
|
|
636
|
-
return "Plur";
|
|
637
|
-
}
|
|
638
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.P1SG) || this.containsTag(MorphologicalTag_1.MorphologicalTag.P2SG) ||
|
|
639
|
-
this.containsTag(MorphologicalTag_1.MorphologicalTag.P3SG)) {
|
|
640
|
-
return "Sing";
|
|
641
|
-
}
|
|
642
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.P1PL) || this.containsTag(MorphologicalTag_1.MorphologicalTag.P2PL) ||
|
|
643
|
-
this.containsTag(MorphologicalTag_1.MorphologicalTag.P3PL)) {
|
|
644
|
-
return "Plur";
|
|
645
|
-
}
|
|
646
|
-
return undefined;
|
|
647
|
-
}
|
|
648
|
-
/**
|
|
649
|
-
* Returns the case marking of the parse for the universal dependency feature case.
|
|
650
|
-
* @return "Acc" for accusative marker; "Dat" for dative marker; "Gen" for genitive marker; "Loc" for locative
|
|
651
|
-
* marker; "Ins" for instrumentative marker; "Abl" for ablative marker; "Nom" for nominative marker.
|
|
652
|
-
*/
|
|
653
|
-
getCase() {
|
|
654
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.ACCUSATIVE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PCACCUSATIVE)) {
|
|
655
|
-
return "Acc";
|
|
656
|
-
}
|
|
657
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.DATIVE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PCDATIVE)) {
|
|
658
|
-
return "Dat";
|
|
659
|
-
}
|
|
660
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.GENITIVE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PCGENITIVE)) {
|
|
661
|
-
return "Gen";
|
|
662
|
-
}
|
|
663
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.LOCATIVE)) {
|
|
664
|
-
return "Loc";
|
|
665
|
-
}
|
|
666
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.INSTRUMENTAL) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PCINSTRUMENTAL)) {
|
|
667
|
-
return "Ins";
|
|
668
|
-
}
|
|
669
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.ABLATIVE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PCABLATIVE)) {
|
|
670
|
-
return "Abl";
|
|
671
|
-
}
|
|
672
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.NOMINATIVE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PCNOMINATIVE)) {
|
|
673
|
-
return "Nom";
|
|
674
|
-
}
|
|
675
|
-
return undefined;
|
|
676
|
-
}
|
|
677
|
-
/**
|
|
678
|
-
* Returns the definiteness of the parse for the universal dependency feature definite. It applies only for
|
|
679
|
-
* determiners in Turkish.
|
|
680
|
-
* @return "Ind" for 'bir', 'bazı', or 'birkaç'. "Def" for 'her', 'bu', 'şu', 'o', 'bütün'.
|
|
681
|
-
*/
|
|
682
|
-
getDefinite() {
|
|
683
|
-
let lemma = this.root.getName();
|
|
684
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.DETERMINER)) {
|
|
685
|
-
if (lemma == "bir" || lemma == "bazı" || lemma == "birkaç") {
|
|
686
|
-
return "Ind";
|
|
687
|
-
}
|
|
688
|
-
if (lemma == "her" || lemma == "bu" || lemma == "şu" || lemma == "o" || lemma == "bütün") {
|
|
689
|
-
return "Def";
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
return undefined;
|
|
693
|
-
}
|
|
694
|
-
/**
|
|
695
|
-
* Returns the degree of the parse for the universal dependency feature degree.
|
|
696
|
-
* @return "Cmp" for comparative adverb 'daha'; "Sup" for superlative adjective or adverb 'en'.
|
|
697
|
-
*/
|
|
698
|
-
getDegree() {
|
|
699
|
-
let lemma = this.root.getName();
|
|
700
|
-
if (lemma == "daha") {
|
|
701
|
-
return "Cmp";
|
|
702
|
-
}
|
|
703
|
-
if (lemma == "en" && !this.isNoun()) {
|
|
704
|
-
return "Sup";
|
|
705
|
-
}
|
|
706
|
-
return undefined;
|
|
707
683
|
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
684
|
+
return undefined;
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Returns the degree of the parse for the universal dependency feature degree.
|
|
688
|
+
* @return "Cmp" for comparative adverb 'daha'; "Sup" for superlative adjective or adverb 'en'.
|
|
689
|
+
*/
|
|
690
|
+
getDegree() {
|
|
691
|
+
let lemma = this.root.getName();
|
|
692
|
+
if (lemma == "daha") {
|
|
693
|
+
return "Cmp";
|
|
694
|
+
}
|
|
695
|
+
if (lemma == "en" && !this.isNoun()) {
|
|
696
|
+
return "Sup";
|
|
697
|
+
}
|
|
698
|
+
return undefined;
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* Returns the polarity of the verb for the universal dependency feature polarity.
|
|
702
|
+
* @return "Pos" for positive polarity containing tag POS; "Neg" for negative polarity containing tag NEG.
|
|
703
|
+
*/
|
|
704
|
+
getPolarity() {
|
|
705
|
+
if (this.root.getName() == "değil") {
|
|
706
|
+
return "Neg";
|
|
707
|
+
}
|
|
708
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.POSITIVE)) {
|
|
709
|
+
return "Pos";
|
|
710
|
+
}
|
|
711
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.NEGATIVE)) {
|
|
712
|
+
return "Neg";
|
|
713
|
+
}
|
|
714
|
+
return undefined;
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Returns the person of the agreement of the parse for the universal dependency feature person.
|
|
718
|
+
* @return "1" for first person; "2" for second person; "3" for third person.
|
|
719
|
+
*/
|
|
720
|
+
getPerson() {
|
|
721
|
+
if (this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.A1SG) || this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.A1PL)) {
|
|
722
|
+
return "1";
|
|
723
|
+
}
|
|
724
|
+
if (this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.A2SG) || this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.A2PL)) {
|
|
725
|
+
return "2";
|
|
726
|
+
}
|
|
727
|
+
if (this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.A3SG) || this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.A3PL)) {
|
|
728
|
+
return "3";
|
|
729
|
+
}
|
|
730
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.A1SG) || this.containsTag(MorphologicalTag_1.MorphologicalTag.A1PL)) {
|
|
731
|
+
return "1";
|
|
732
|
+
}
|
|
733
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.A2SG) || this.containsTag(MorphologicalTag_1.MorphologicalTag.A2PL)) {
|
|
734
|
+
return "2";
|
|
735
|
+
}
|
|
736
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.A3SG) || this.containsTag(MorphologicalTag_1.MorphologicalTag.A3PL)) {
|
|
737
|
+
return "3";
|
|
738
|
+
}
|
|
739
|
+
return undefined;
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Returns the person of the possessive agreement of the parse for the universal dependency feature [pos].
|
|
743
|
+
* @return "1" for first person; "2" for second person; "3" for third person.
|
|
744
|
+
*/
|
|
745
|
+
getPossessivePerson() {
|
|
746
|
+
if (this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.P1SG) || this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.P1PL)) {
|
|
747
|
+
return "1";
|
|
748
|
+
}
|
|
749
|
+
if (this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.P2SG) || this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.P2PL)) {
|
|
750
|
+
return "2";
|
|
751
|
+
}
|
|
752
|
+
if (this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.P3SG) || this.lastIGContainsTag(MorphologicalTag_1.MorphologicalTag.P3PL)) {
|
|
753
|
+
return "3";
|
|
754
|
+
}
|
|
755
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.P1SG) || this.containsTag(MorphologicalTag_1.MorphologicalTag.P1PL)) {
|
|
756
|
+
return "1";
|
|
757
|
+
}
|
|
758
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.P2SG) || this.containsTag(MorphologicalTag_1.MorphologicalTag.P2PL)) {
|
|
759
|
+
return "2";
|
|
760
|
+
}
|
|
761
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.P3SG) || this.containsTag(MorphologicalTag_1.MorphologicalTag.P3PL)) {
|
|
762
|
+
return "3";
|
|
763
|
+
}
|
|
764
|
+
return undefined;
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* Returns the voice of the verb parse for the universal dependency feature voice.
|
|
768
|
+
* @return "CauPass" if the verb parse is both causative and passive; "Pass" if the verb parse is only passive;
|
|
769
|
+
* "Rcp" if the verb parse is reciprocal; "Cau" if the verb parse is only causative; "Rfl" if the verb parse is
|
|
770
|
+
* reflexive.
|
|
771
|
+
*/
|
|
772
|
+
getVoice() {
|
|
773
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.CAUSATIVE) && this.containsTag(MorphologicalTag_1.MorphologicalTag.PASSIVE)) {
|
|
774
|
+
return "CauPass";
|
|
775
|
+
}
|
|
776
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.PASSIVE)) {
|
|
777
|
+
return "Pass";
|
|
778
|
+
}
|
|
779
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.RECIPROCAL)) {
|
|
780
|
+
return "Rcp";
|
|
781
|
+
}
|
|
782
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.CAUSATIVE)) {
|
|
783
|
+
return "Cau";
|
|
784
|
+
}
|
|
785
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.REFLEXIVE)) {
|
|
786
|
+
return "Rfl";
|
|
787
|
+
}
|
|
788
|
+
return undefined;
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* Returns the aspect of the verb parse for the universal dependency feature aspect.
|
|
792
|
+
* @return "Perf" for past, narrative and future tenses; "Prog" for progressive tenses; "Hab" for Aorist; "Rapid"
|
|
793
|
+
* for parses containing HASTILY tag; "Dur" for parses containing START, STAY or REPEAT tags.
|
|
794
|
+
*/
|
|
795
|
+
getAspect() {
|
|
796
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.PASTTENSE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.NARRATIVE) ||
|
|
797
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.FUTURE)) {
|
|
798
|
+
return "Perf";
|
|
799
|
+
}
|
|
800
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.PROGRESSIVE1) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PROGRESSIVE2)) {
|
|
801
|
+
return "Prog";
|
|
802
|
+
}
|
|
803
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.AORIST)) {
|
|
804
|
+
return "Hab";
|
|
805
|
+
}
|
|
806
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.HASTILY)) {
|
|
807
|
+
return "Rapid";
|
|
808
|
+
}
|
|
809
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.START) || this.containsTag(MorphologicalTag_1.MorphologicalTag.STAY) ||
|
|
810
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.REPEAT)) {
|
|
811
|
+
return "Dur";
|
|
812
|
+
}
|
|
813
|
+
return undefined;
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Returns the tense of the verb parse for universal dependency feature tense.
|
|
817
|
+
* @return "Past" for simple past tense; "Fut" for future tense; "Pqp" for narrative past tense; "Pres" for other
|
|
818
|
+
* past tenses.
|
|
819
|
+
*/
|
|
820
|
+
getTense() {
|
|
821
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.NARRATIVE) && this.containsTag(MorphologicalTag_1.MorphologicalTag.PASTTENSE)) {
|
|
822
|
+
return "Pqp";
|
|
823
|
+
}
|
|
824
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.NARRATIVE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PASTTENSE)) {
|
|
825
|
+
return "Past";
|
|
826
|
+
}
|
|
827
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.FUTURE)) {
|
|
828
|
+
return "Fut";
|
|
829
|
+
}
|
|
830
|
+
if (!this.containsTag(MorphologicalTag_1.MorphologicalTag.PASTTENSE) && !this.containsTag(MorphologicalTag_1.MorphologicalTag.FUTURE)) {
|
|
831
|
+
return "Pres";
|
|
832
|
+
}
|
|
833
|
+
return undefined;
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* Returns the modality of the verb parse for the universal dependency feature mood.
|
|
837
|
+
* @return "GenNecPot" if both necessitative and potential is combined with a suffix of general modality;
|
|
838
|
+
* "CndGenPot" if both conditional and potential is combined with a suffix of general modality;
|
|
839
|
+
* "GenNec" if necessitative is combined with a suffix of general modality;
|
|
840
|
+
* "GenPot" if potential is combined with a suffix of general modality;
|
|
841
|
+
* "NecPot" if necessitative is combined with potential;
|
|
842
|
+
* "DesPot" if desiderative is combined with potential;
|
|
843
|
+
* "CndPot" if conditional is combined with potential;
|
|
844
|
+
* "CndGen" if conditional is combined with a suffix of general modality;
|
|
845
|
+
* "Imp" for imperative; "Cnd" for simple conditional; "Des" for simple desiderative; "Opt" for optative; "Nec" for
|
|
846
|
+
* simple necessitative; "Pot" for simple potential; "Gen" for simple suffix of a general modality.
|
|
847
|
+
*/
|
|
848
|
+
getMood() {
|
|
849
|
+
if ((this.containsTag(MorphologicalTag_1.MorphologicalTag.COPULA) || this.containsTag(MorphologicalTag_1.MorphologicalTag.AORIST)) &&
|
|
850
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.NECESSITY) && this.containsTag(MorphologicalTag_1.MorphologicalTag.ABLE)) {
|
|
851
|
+
return "GenNecPot";
|
|
852
|
+
}
|
|
853
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.CONDITIONAL) && (this.containsTag(MorphologicalTag_1.MorphologicalTag.COPULA) ||
|
|
854
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.AORIST)) && this.containsTag(MorphologicalTag_1.MorphologicalTag.ABLE)) {
|
|
855
|
+
return "CndGenPot";
|
|
856
|
+
}
|
|
857
|
+
if ((this.containsTag(MorphologicalTag_1.MorphologicalTag.COPULA) || this.containsTag(MorphologicalTag_1.MorphologicalTag.AORIST)) &&
|
|
858
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.NECESSITY)) {
|
|
859
|
+
return "GenNec";
|
|
860
|
+
}
|
|
861
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.NECESSITY) && this.containsTag(MorphologicalTag_1.MorphologicalTag.ABLE)) {
|
|
862
|
+
return "NecPot";
|
|
863
|
+
}
|
|
864
|
+
if ((this.containsTag(MorphologicalTag_1.MorphologicalTag.COPULA) || this.containsTag(MorphologicalTag_1.MorphologicalTag.AORIST)) &&
|
|
865
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.ABLE)) {
|
|
866
|
+
return "GenPot";
|
|
867
|
+
}
|
|
868
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.DESIRE) && this.containsTag(MorphologicalTag_1.MorphologicalTag.ABLE)) {
|
|
869
|
+
return "DesPot";
|
|
870
|
+
}
|
|
871
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.CONDITIONAL) && this.containsTag(MorphologicalTag_1.MorphologicalTag.ABLE)) {
|
|
872
|
+
return "CndPot";
|
|
873
|
+
}
|
|
874
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.CONDITIONAL) && (this.containsTag(MorphologicalTag_1.MorphologicalTag.COPULA) ||
|
|
875
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.AORIST))) {
|
|
876
|
+
return "CndGen";
|
|
877
|
+
}
|
|
878
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.IMPERATIVE)) {
|
|
879
|
+
return "Imp";
|
|
880
|
+
}
|
|
881
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.CONDITIONAL)) {
|
|
882
|
+
return "Cnd";
|
|
883
|
+
}
|
|
884
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.DESIRE)) {
|
|
885
|
+
return "Des";
|
|
886
|
+
}
|
|
887
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.OPTATIVE)) {
|
|
888
|
+
return "Opt";
|
|
889
|
+
}
|
|
890
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.NECESSITY)) {
|
|
891
|
+
return "Nec";
|
|
892
|
+
}
|
|
893
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.ABLE)) {
|
|
894
|
+
return "Pot";
|
|
895
|
+
}
|
|
896
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.PASTTENSE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.NARRATIVE) ||
|
|
897
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.PROGRESSIVE1) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PROGRESSIVE2) ||
|
|
898
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.FUTURE)) {
|
|
899
|
+
return "Ind";
|
|
900
|
+
}
|
|
901
|
+
if ((this.containsTag(MorphologicalTag_1.MorphologicalTag.COPULA) || this.containsTag(MorphologicalTag_1.MorphologicalTag.AORIST))) {
|
|
902
|
+
return "Gen";
|
|
903
|
+
}
|
|
904
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.ZERO) && !this.containsTag(MorphologicalTag_1.MorphologicalTag.A3PL)) {
|
|
905
|
+
return "Gen";
|
|
906
|
+
}
|
|
907
|
+
return undefined;
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Returns the form of the verb parse for the universal dependency feature verbForm.
|
|
911
|
+
* @return "Part" for participles; "Vnoun" for infinitives; "Conv" for parses contaning tags SINCEDOINGSO,
|
|
912
|
+
* WITHOUTHAVINGDONESO, WITHOUTBEINGABLETOHAVEDONESO, BYDOINGSO, AFTERDOINGSO, INFINITIVE3; "Fin" for others.
|
|
913
|
+
*/
|
|
914
|
+
getVerbForm() {
|
|
915
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.PASTPARTICIPLE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.FUTUREPARTICIPLE) ||
|
|
916
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.PRESENTPARTICIPLE)) {
|
|
917
|
+
return "Part";
|
|
918
|
+
}
|
|
919
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.INFINITIVE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.INFINITIVE2)) {
|
|
920
|
+
return "Vnoun";
|
|
921
|
+
}
|
|
922
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.SINCEDOINGSO) || this.containsTag(MorphologicalTag_1.MorphologicalTag.WITHOUTHAVINGDONESO) ||
|
|
923
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.WITHOUTBEINGABLETOHAVEDONESO) || this.containsTag(MorphologicalTag_1.MorphologicalTag.BYDOINGSO) ||
|
|
924
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.AFTERDOINGSO) || this.containsTag(MorphologicalTag_1.MorphologicalTag.INFINITIVE3)) {
|
|
925
|
+
return "Conv";
|
|
926
|
+
}
|
|
927
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.COPULA) || this.containsTag(MorphologicalTag_1.MorphologicalTag.ABLE) ||
|
|
928
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.AORIST) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PROGRESSIVE2) ||
|
|
929
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.DESIRE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.NECESSITY) ||
|
|
930
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.CONDITIONAL) || this.containsTag(MorphologicalTag_1.MorphologicalTag.IMPERATIVE) ||
|
|
931
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.OPTATIVE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PASTTENSE) ||
|
|
932
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.NARRATIVE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PROGRESSIVE1) ||
|
|
933
|
+
this.containsTag(MorphologicalTag_1.MorphologicalTag.FUTURE) || (this.containsTag(MorphologicalTag_1.MorphologicalTag.ZERO) &&
|
|
934
|
+
!this.containsTag(MorphologicalTag_1.MorphologicalTag.A3PL))) {
|
|
935
|
+
return "Fin";
|
|
936
|
+
}
|
|
937
|
+
return undefined;
|
|
938
|
+
}
|
|
939
|
+
getEvident() {
|
|
940
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.NARRATIVE)) {
|
|
941
|
+
return "Nfh";
|
|
942
|
+
}
|
|
943
|
+
else {
|
|
944
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.COPULA) || this.containsTag(MorphologicalTag_1.MorphologicalTag.ABLE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.AORIST) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PROGRESSIVE2)
|
|
945
|
+
|| this.containsTag(MorphologicalTag_1.MorphologicalTag.DESIRE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.NECESSITY) || this.containsTag(MorphologicalTag_1.MorphologicalTag.CONDITIONAL) || this.containsTag(MorphologicalTag_1.MorphologicalTag.IMPERATIVE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.OPTATIVE)
|
|
946
|
+
|| this.containsTag(MorphologicalTag_1.MorphologicalTag.PASTTENSE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.NARRATIVE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PROGRESSIVE1) || this.containsTag(MorphologicalTag_1.MorphologicalTag.FUTURE)) {
|
|
947
|
+
return "Fh";
|
|
885
948
|
}
|
|
886
|
-
|
|
887
|
-
|
|
949
|
+
}
|
|
950
|
+
return undefined;
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* Construct the universal dependency features as an array of strings. Each element represents a single feature.
|
|
954
|
+
* Every feature is given as featureType = featureValue.
|
|
955
|
+
* @param uPos Universal dependency part of speech tag for the parse.
|
|
956
|
+
* @return An array of universal dependency features for this parse.
|
|
957
|
+
*/
|
|
958
|
+
getUniversalDependencyFeatures(uPos) {
|
|
959
|
+
let featureList = new Array();
|
|
960
|
+
let pronType = this.getPronType();
|
|
961
|
+
if (pronType != undefined && uPos.toUpperCase() != "NOUN" && uPos.toUpperCase() != "ADJ" && uPos.toUpperCase() != "VERB" && uPos.toUpperCase() != "CCONJ" && uPos.toUpperCase() != "PROPN") {
|
|
962
|
+
featureList.push("PronType=" + pronType);
|
|
963
|
+
}
|
|
964
|
+
let numType = this.getNumType();
|
|
965
|
+
if (numType != undefined && uPos.toUpperCase() != "VERB" && uPos.toUpperCase() != "NOUN" && uPos.toUpperCase() != "ADV") {
|
|
966
|
+
featureList.push("NumType=" + numType);
|
|
967
|
+
}
|
|
968
|
+
let reflex = this.getReflex();
|
|
969
|
+
if (reflex != undefined && uPos.toUpperCase() != "ADJ" && uPos.toUpperCase() != "VERB") {
|
|
970
|
+
featureList.push("Reflex=" + reflex);
|
|
971
|
+
}
|
|
972
|
+
let degree = this.getDegree();
|
|
973
|
+
if (degree != undefined && uPos.toUpperCase() != "ADJ") {
|
|
974
|
+
featureList.push("Degree=" + degree);
|
|
975
|
+
}
|
|
976
|
+
if (this.isNoun() || this.isVerb() || this.root.getName() == "mi" || (pronType != undefined && pronType != "Art")) {
|
|
977
|
+
let number = this.getNumber();
|
|
978
|
+
if (number != undefined) {
|
|
979
|
+
featureList.push("Number=" + number);
|
|
888
980
|
}
|
|
889
|
-
|
|
890
|
-
|
|
981
|
+
let possessiveNumber = this.getPossessiveNumber();
|
|
982
|
+
if (possessiveNumber != undefined) {
|
|
983
|
+
featureList.push("Number[psor]=" + possessiveNumber);
|
|
891
984
|
}
|
|
892
|
-
|
|
893
|
-
|
|
985
|
+
let person = this.getPerson();
|
|
986
|
+
if (person != undefined && uPos.toUpperCase() != "PROPN") {
|
|
987
|
+
featureList.push("Person=" + person);
|
|
894
988
|
}
|
|
895
|
-
|
|
896
|
-
|
|
989
|
+
let possessivePerson = this.getPossessivePerson();
|
|
990
|
+
if (possessivePerson != undefined && uPos.toUpperCase() != "PROPN") {
|
|
991
|
+
featureList.push("Person[psor]=" + possessivePerson);
|
|
897
992
|
}
|
|
898
|
-
|
|
899
|
-
|
|
993
|
+
}
|
|
994
|
+
if (this.isNoun() || (pronType != undefined && pronType != "Art")) {
|
|
995
|
+
let case_ = this.getCase();
|
|
996
|
+
if (case_ != undefined) {
|
|
997
|
+
featureList.push("Case=" + case_);
|
|
900
998
|
}
|
|
901
|
-
|
|
902
|
-
|
|
999
|
+
}
|
|
1000
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.DETERMINER)) {
|
|
1001
|
+
let definite = this.getDefinite();
|
|
1002
|
+
if (definite != undefined) {
|
|
1003
|
+
featureList.push("Definite=" + definite);
|
|
903
1004
|
}
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
1005
|
+
}
|
|
1006
|
+
if (this.isVerb() || this.root.getName() == "mi") {
|
|
1007
|
+
let polarity = this.getPolarity();
|
|
1008
|
+
if (polarity != undefined) {
|
|
1009
|
+
featureList.push("Polarity=" + polarity);
|
|
908
1010
|
}
|
|
909
|
-
|
|
910
|
-
|
|
1011
|
+
let voice = this.getVoice();
|
|
1012
|
+
if (voice != undefined && this.root.getName() != "mi") {
|
|
1013
|
+
featureList.push("Voice=" + voice);
|
|
911
1014
|
}
|
|
912
|
-
|
|
913
|
-
|
|
1015
|
+
let aspect = this.getAspect();
|
|
1016
|
+
if (aspect != undefined && uPos.toUpperCase() != "PROPN" && this.root.getName() != "mi") {
|
|
1017
|
+
featureList.push("Aspect=" + aspect);
|
|
914
1018
|
}
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
* Returns the form of the verb parse for the universal dependency feature verbForm.
|
|
919
|
-
* @return "Part" for participles; "Vnoun" for infinitives; "Conv" for parses contaning tags SINCEDOINGSO,
|
|
920
|
-
* WITHOUTHAVINGDONESO, WITHOUTBEINGABLETOHAVEDONESO, BYDOINGSO, AFTERDOINGSO, INFINITIVE3; "Fin" for others.
|
|
921
|
-
*/
|
|
922
|
-
getVerbForm() {
|
|
923
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.PASTPARTICIPLE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.FUTUREPARTICIPLE) ||
|
|
924
|
-
this.containsTag(MorphologicalTag_1.MorphologicalTag.PRESENTPARTICIPLE)) {
|
|
925
|
-
return "Part";
|
|
1019
|
+
let tense = this.getTense();
|
|
1020
|
+
if (tense != undefined && uPos.toUpperCase() != "PROPN") {
|
|
1021
|
+
featureList.push("Tense=" + tense);
|
|
926
1022
|
}
|
|
927
|
-
|
|
928
|
-
|
|
1023
|
+
let mood = this.getMood();
|
|
1024
|
+
if (mood != undefined && uPos.toUpperCase() != "PROPN" && this.root.getName() != "mi") {
|
|
1025
|
+
featureList.push("Mood=" + mood);
|
|
929
1026
|
}
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
return "Conv";
|
|
1027
|
+
let verbForm = this.getVerbForm();
|
|
1028
|
+
if (verbForm != undefined && uPos.toUpperCase() != "PROPN") {
|
|
1029
|
+
featureList.push("VerbForm=" + verbForm);
|
|
934
1030
|
}
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
this.containsTag(MorphologicalTag_1.MorphologicalTag.CONDITIONAL) || this.containsTag(MorphologicalTag_1.MorphologicalTag.IMPERATIVE) ||
|
|
939
|
-
this.containsTag(MorphologicalTag_1.MorphologicalTag.OPTATIVE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PASTTENSE) ||
|
|
940
|
-
this.containsTag(MorphologicalTag_1.MorphologicalTag.NARRATIVE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PROGRESSIVE1) ||
|
|
941
|
-
this.containsTag(MorphologicalTag_1.MorphologicalTag.FUTURE) || (this.containsTag(MorphologicalTag_1.MorphologicalTag.ZERO) &&
|
|
942
|
-
!this.containsTag(MorphologicalTag_1.MorphologicalTag.A3PL))) {
|
|
943
|
-
return "Fin";
|
|
1031
|
+
let evident = this.getEvident();
|
|
1032
|
+
if (evident != undefined && this.root.getName() != "mi") {
|
|
1033
|
+
featureList.push("Evident=" + evident);
|
|
944
1034
|
}
|
|
945
|
-
return undefined;
|
|
946
1035
|
}
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
1036
|
+
featureList.sort();
|
|
1037
|
+
return featureList;
|
|
1038
|
+
}
|
|
1039
|
+
/**
|
|
1040
|
+
* Returns the universal dependency part of speech for this parse.
|
|
1041
|
+
* @return "AUX" for word 'değil; "PROPN" for proper nouns; "NOUN for nouns; "ADJ" for adjectives; "ADV" for
|
|
1042
|
+
* adverbs; "INTJ" for interjections; "VERB" for verbs; "PUNCT" for punctuation symbols; "DET" for determiners;
|
|
1043
|
+
* "NUM" for numerals; "PRON" for pronouns; "ADP" for post participles; "SCONJ" or "CCONJ" for conjunctions.
|
|
1044
|
+
*/
|
|
1045
|
+
getUniversalDependencyPos() {
|
|
1046
|
+
let lemma = this.root.getName();
|
|
1047
|
+
if (lemma == "değil") {
|
|
1048
|
+
return "AUX";
|
|
1049
|
+
}
|
|
1050
|
+
if (this.isProperNoun()) {
|
|
1051
|
+
return "PROPN";
|
|
1052
|
+
}
|
|
1053
|
+
if (this.isNoun()) {
|
|
1054
|
+
return "NOUN";
|
|
1055
|
+
}
|
|
1056
|
+
if (this.isAdjective()) {
|
|
1057
|
+
return "ADJ";
|
|
1058
|
+
}
|
|
1059
|
+
if (this.getPos() == "ADV") {
|
|
1060
|
+
return "ADV";
|
|
1061
|
+
}
|
|
1062
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.INTERJECTION)) {
|
|
1063
|
+
return "INTJ";
|
|
1064
|
+
}
|
|
1065
|
+
if (this.isVerb()) {
|
|
1066
|
+
return "VERB";
|
|
1067
|
+
}
|
|
1068
|
+
if (this.isPunctuation() || this.isHashTag()) {
|
|
1069
|
+
return "PUNCT";
|
|
1070
|
+
}
|
|
1071
|
+
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.DETERMINER)) {
|
|
1072
|
+
return "DET";
|
|
1073
|
+
}
|
|
1074
|
+
if (this.isNumber() || this.isDate() || this.isTime() || this.isOrdinal() || this.isFraction() || lemma == "%") {
|
|
1075
|
+
return "NUM";
|
|
1076
|
+
}
|
|
1077
|
+
if (this.getPos() == "PRON") {
|
|
1078
|
+
return "PRON";
|
|
1079
|
+
}
|
|
1080
|
+
if (this.getPos() == "POSTP") {
|
|
1081
|
+
return "ADP";
|
|
1082
|
+
}
|
|
1083
|
+
if (this.getPos() == "QUES") {
|
|
1084
|
+
return "AUX";
|
|
1085
|
+
}
|
|
1086
|
+
if (this.getPos() == "CONJ") {
|
|
1087
|
+
if (lemma == "ki" || lemma == "eğer" || lemma == "diye") {
|
|
1088
|
+
return "SCONJ";
|
|
950
1089
|
}
|
|
951
1090
|
else {
|
|
952
|
-
|
|
953
|
-
|| this.containsTag(MorphologicalTag_1.MorphologicalTag.DESIRE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.NECESSITY) || this.containsTag(MorphologicalTag_1.MorphologicalTag.CONDITIONAL) || this.containsTag(MorphologicalTag_1.MorphologicalTag.IMPERATIVE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.OPTATIVE)
|
|
954
|
-
|| this.containsTag(MorphologicalTag_1.MorphologicalTag.PASTTENSE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.NARRATIVE) || this.containsTag(MorphologicalTag_1.MorphologicalTag.PROGRESSIVE1) || this.containsTag(MorphologicalTag_1.MorphologicalTag.FUTURE)) {
|
|
955
|
-
return "Fh";
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
return undefined;
|
|
959
|
-
}
|
|
960
|
-
/**
|
|
961
|
-
* Construct the universal dependency features as an array of strings. Each element represents a single feature.
|
|
962
|
-
* Every feature is given as featureType = featureValue.
|
|
963
|
-
* @param uPos Universal dependency part of speech tag for the parse.
|
|
964
|
-
* @return An array of universal dependency features for this parse.
|
|
965
|
-
*/
|
|
966
|
-
getUniversalDependencyFeatures(uPos) {
|
|
967
|
-
let featureList = new Array();
|
|
968
|
-
let pronType = this.getPronType();
|
|
969
|
-
if (pronType != undefined && uPos.toUpperCase() != "NOUN" && uPos.toUpperCase() != "ADJ" && uPos.toUpperCase() != "VERB" && uPos.toUpperCase() != "CCONJ" && uPos.toUpperCase() != "PROPN") {
|
|
970
|
-
featureList.push("PronType=" + pronType);
|
|
971
|
-
}
|
|
972
|
-
let numType = this.getNumType();
|
|
973
|
-
if (numType != undefined && uPos.toUpperCase() != "VERB" && uPos.toUpperCase() != "NOUN" && uPos.toUpperCase() != "ADV") {
|
|
974
|
-
featureList.push("NumType=" + numType);
|
|
975
|
-
}
|
|
976
|
-
let reflex = this.getReflex();
|
|
977
|
-
if (reflex != undefined && uPos.toUpperCase() != "ADJ" && uPos.toUpperCase() != "VERB") {
|
|
978
|
-
featureList.push("Reflex=" + reflex);
|
|
1091
|
+
return "CCONJ";
|
|
979
1092
|
}
|
|
980
|
-
let degree = this.getDegree();
|
|
981
|
-
if (degree != undefined && uPos.toUpperCase() != "ADJ") {
|
|
982
|
-
featureList.push("Degree=" + degree);
|
|
983
|
-
}
|
|
984
|
-
if (this.isNoun() || this.isVerb() || this.root.getName() == "mi" || (pronType != undefined && pronType != "Art")) {
|
|
985
|
-
let number = this.getNumber();
|
|
986
|
-
if (number != undefined) {
|
|
987
|
-
featureList.push("Number=" + number);
|
|
988
|
-
}
|
|
989
|
-
let possessiveNumber = this.getPossessiveNumber();
|
|
990
|
-
if (possessiveNumber != undefined) {
|
|
991
|
-
featureList.push("Number[psor]=" + possessiveNumber);
|
|
992
|
-
}
|
|
993
|
-
let person = this.getPerson();
|
|
994
|
-
if (person != undefined && uPos.toUpperCase() != "PROPN") {
|
|
995
|
-
featureList.push("Person=" + person);
|
|
996
|
-
}
|
|
997
|
-
let possessivePerson = this.getPossessivePerson();
|
|
998
|
-
if (possessivePerson != undefined && uPos.toUpperCase() != "PROPN") {
|
|
999
|
-
featureList.push("Person[psor]=" + possessivePerson);
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
if (this.isNoun() || (pronType != undefined && pronType != "Art")) {
|
|
1003
|
-
let case_ = this.getCase();
|
|
1004
|
-
if (case_ != undefined) {
|
|
1005
|
-
featureList.push("Case=" + case_);
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.DETERMINER)) {
|
|
1009
|
-
let definite = this.getDefinite();
|
|
1010
|
-
if (definite != undefined) {
|
|
1011
|
-
featureList.push("Definite=" + definite);
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
if (this.isVerb() || this.root.getName() == "mi") {
|
|
1015
|
-
let polarity = this.getPolarity();
|
|
1016
|
-
if (polarity != undefined) {
|
|
1017
|
-
featureList.push("Polarity=" + polarity);
|
|
1018
|
-
}
|
|
1019
|
-
let voice = this.getVoice();
|
|
1020
|
-
if (voice != undefined && this.root.getName() != "mi") {
|
|
1021
|
-
featureList.push("Voice=" + voice);
|
|
1022
|
-
}
|
|
1023
|
-
let aspect = this.getAspect();
|
|
1024
|
-
if (aspect != undefined && uPos.toUpperCase() != "PROPN" && this.root.getName() != "mi") {
|
|
1025
|
-
featureList.push("Aspect=" + aspect);
|
|
1026
|
-
}
|
|
1027
|
-
let tense = this.getTense();
|
|
1028
|
-
if (tense != undefined && uPos.toUpperCase() != "PROPN") {
|
|
1029
|
-
featureList.push("Tense=" + tense);
|
|
1030
|
-
}
|
|
1031
|
-
let mood = this.getMood();
|
|
1032
|
-
if (mood != undefined && uPos.toUpperCase() != "PROPN" && this.root.getName() != "mi") {
|
|
1033
|
-
featureList.push("Mood=" + mood);
|
|
1034
|
-
}
|
|
1035
|
-
let verbForm = this.getVerbForm();
|
|
1036
|
-
if (verbForm != undefined && uPos.toUpperCase() != "PROPN") {
|
|
1037
|
-
featureList.push("VerbForm=" + verbForm);
|
|
1038
|
-
}
|
|
1039
|
-
let evident = this.getEvident();
|
|
1040
|
-
if (evident != undefined && this.root.getName() != "mi") {
|
|
1041
|
-
featureList.push("Evident=" + evident);
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
featureList.sort();
|
|
1045
|
-
return featureList;
|
|
1046
|
-
}
|
|
1047
|
-
/**
|
|
1048
|
-
* Returns the universal dependency part of speech for this parse.
|
|
1049
|
-
* @return "AUX" for word 'değil; "PROPN" for proper nouns; "NOUN for nouns; "ADJ" for adjectives; "ADV" for
|
|
1050
|
-
* adverbs; "INTJ" for interjections; "VERB" for verbs; "PUNCT" for punctuation symbols; "DET" for determiners;
|
|
1051
|
-
* "NUM" for numerals; "PRON" for pronouns; "ADP" for post participles; "SCONJ" or "CCONJ" for conjunctions.
|
|
1052
|
-
*/
|
|
1053
|
-
getUniversalDependencyPos() {
|
|
1054
|
-
let lemma = this.root.getName();
|
|
1055
|
-
if (lemma == "değil") {
|
|
1056
|
-
return "AUX";
|
|
1057
|
-
}
|
|
1058
|
-
if (this.isProperNoun()) {
|
|
1059
|
-
return "PROPN";
|
|
1060
|
-
}
|
|
1061
|
-
if (this.isNoun()) {
|
|
1062
|
-
return "NOUN";
|
|
1063
|
-
}
|
|
1064
|
-
if (this.isAdjective()) {
|
|
1065
|
-
return "ADJ";
|
|
1066
|
-
}
|
|
1067
|
-
if (this.getPos() == "ADV") {
|
|
1068
|
-
return "ADV";
|
|
1069
|
-
}
|
|
1070
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.INTERJECTION)) {
|
|
1071
|
-
return "INTJ";
|
|
1072
|
-
}
|
|
1073
|
-
if (this.isVerb()) {
|
|
1074
|
-
return "VERB";
|
|
1075
|
-
}
|
|
1076
|
-
if (this.isPunctuation() || this.isHashTag()) {
|
|
1077
|
-
return "PUNCT";
|
|
1078
|
-
}
|
|
1079
|
-
if (this.containsTag(MorphologicalTag_1.MorphologicalTag.DETERMINER)) {
|
|
1080
|
-
return "DET";
|
|
1081
|
-
}
|
|
1082
|
-
if (this.isNumber() || this.isDate() || this.isTime() || this.isOrdinal() || this.isFraction() || lemma == "%") {
|
|
1083
|
-
return "NUM";
|
|
1084
|
-
}
|
|
1085
|
-
if (this.getPos() == "PRON") {
|
|
1086
|
-
return "PRON";
|
|
1087
|
-
}
|
|
1088
|
-
if (this.getPos() == "POSTP") {
|
|
1089
|
-
return "ADP";
|
|
1090
|
-
}
|
|
1091
|
-
if (this.getPos() == "QUES") {
|
|
1092
|
-
return "AUX";
|
|
1093
|
-
}
|
|
1094
|
-
if (this.getPos() == "CONJ") {
|
|
1095
|
-
if (lemma == "ki" || lemma == "eğer" || lemma == "diye") {
|
|
1096
|
-
return "SCONJ";
|
|
1097
|
-
}
|
|
1098
|
-
else {
|
|
1099
|
-
return "CCONJ";
|
|
1100
|
-
}
|
|
1101
|
-
}
|
|
1102
|
-
return "X";
|
|
1103
|
-
}
|
|
1104
|
-
/**
|
|
1105
|
-
* The overridden toString method gets the root and the first inflectional group as a result {@link String} then concatenates
|
|
1106
|
-
* with ^DB+ and the following inflectional groups.
|
|
1107
|
-
*
|
|
1108
|
-
* @return result {@link String}.
|
|
1109
|
-
*/
|
|
1110
|
-
toString() {
|
|
1111
|
-
let result = this.root.getName() + "+" + this.inflectionalGroups[0].toString();
|
|
1112
|
-
for (let i = 1; i < this.inflectionalGroups.length; i++) {
|
|
1113
|
-
result = result + "^DB+" + this.inflectionalGroups[i].toString();
|
|
1114
|
-
}
|
|
1115
|
-
return result;
|
|
1116
1093
|
}
|
|
1094
|
+
return "X";
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* The overridden toString method gets the root and the first inflectional group as a result {@link String} then concatenates
|
|
1098
|
+
* with ^DB+ and the following inflectional groups.
|
|
1099
|
+
*
|
|
1100
|
+
* @return result {@link String}.
|
|
1101
|
+
*/
|
|
1102
|
+
toString() {
|
|
1103
|
+
let result = this.root.getName() + "+" + this.inflectionalGroups[0].toString();
|
|
1104
|
+
for (let i = 1; i < this.inflectionalGroups.length; i++) {
|
|
1105
|
+
result = result + "^DB+" + this.inflectionalGroups[i].toString();
|
|
1106
|
+
}
|
|
1107
|
+
return result;
|
|
1117
1108
|
}
|
|
1118
|
-
|
|
1119
|
-
|
|
1109
|
+
}
|
|
1110
|
+
exports.MorphologicalParse = MorphologicalParse;
|
|
1120
1111
|
//# sourceMappingURL=MorphologicalParse.js.map
|