nlptoolkit-morphologicalanalysis 1.0.1 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,218 @@
1
+ import {TxtWord} from "nlptoolkit-dictionary/dist/Dictionary/TxtWord";
2
+ import {Word} from "nlptoolkit-dictionary/dist/Dictionary/Word";
3
+ import {TurkishLanguage} from "nlptoolkit-dictionary/dist/Language/TurkishLanguage";
4
+
5
+ export class MorphotacticEngine {
6
+
7
+ static resolveD(root: TxtWord, formation: string, formationToCheck: string): string{
8
+ if (root.isAbbreviation()) {
9
+ return formation + 'd';
10
+ }
11
+ if (Word.lastPhoneme(formationToCheck) >= '0' && Word.lastPhoneme(formationToCheck) <= '9') {
12
+ switch (Word.lastPhoneme(formationToCheck)) {
13
+ case '3':
14
+ case '4':
15
+ case '5':
16
+ //3->3'tü, 5->5'ti, 4->4'tü
17
+ return formation + 't';
18
+ case '0':
19
+ if (root.getName().endsWith("40") || root.getName().endsWith("60") || root.getName().endsWith("70"))
20
+ //40->40'tı, 60->60'tı, 70->70'ti
21
+ return formation + 't';
22
+ else
23
+ //30->30'du, 50->50'ydi, 80->80'di
24
+ return formation + 'd';
25
+ default:
26
+ return formation + 'd';
27
+ }
28
+ } else {
29
+ if (TurkishLanguage.isSertSessiz(Word.lastPhoneme(formationToCheck))) {
30
+ //yap+DH->yaptı
31
+ return formation + 't';
32
+ } else {
33
+ //sar+DH->sardı
34
+ return formation + 'd';
35
+ }
36
+ }
37
+ }
38
+
39
+ static resolveA(root: TxtWord, formation: string, rootWord: boolean, formationToCheck: string): string{
40
+ if (root.isAbbreviation()) {
41
+ return formation + 'e';
42
+ }
43
+ if (Word.lastVowel(formationToCheck) >= '0' && Word.lastVowel(formationToCheck) <= '9') {
44
+ switch (Word.lastVowel(formationToCheck)) {
45
+ case '6':
46
+ case '9':
47
+ //6'ya, 9'a
48
+ return formation + 'a';
49
+ case '0':
50
+ if (root.getName().endsWith("10") || root.getName().endsWith("30") || root.getName().endsWith("40") ||
51
+ root.getName().endsWith("60") || root.getName().endsWith("90"))
52
+ //10'a, 30'a, 40'a, 60'a, 90'a
53
+ return formation + 'a';
54
+ else
55
+ //20'ye, 50'ye, 80'e, 70'e
56
+ return formation + 'e';
57
+ default:
58
+ //3'e, 8'e, 4'e, 2'ye
59
+ return formation + 'e';
60
+ }
61
+ }
62
+ if (TurkishLanguage.isBackVowel(Word.lastVowel(formationToCheck))) {
63
+ if (root.notObeysVowelHarmonyDuringAgglutination() && rootWord) {
64
+ //alkole, anormale
65
+ return formation + 'e';
66
+ } else {
67
+ //sakala, kabala
68
+ return formation + 'a';
69
+ }
70
+ }
71
+ if (TurkishLanguage.isFrontVowel(Word.lastVowel(formationToCheck))) {
72
+ if (root.notObeysVowelHarmonyDuringAgglutination() && rootWord) {
73
+ //faika, halika
74
+ return formation + 'a';
75
+ } else {
76
+ //kediye, eve
77
+ return formation + 'e';
78
+ }
79
+ }
80
+ if (root.isNumeral() || root.isFraction() || root.isReal()) {
81
+ if (root.getName().endsWith("6") || root.getName().endsWith("9") || root.getName().endsWith("10") ||
82
+ root.getName().endsWith("30") || root.getName().endsWith("40") || root.getName().endsWith("60") ||
83
+ root.getName().endsWith("90")) {
84
+ return formation + 'a';
85
+ } else {
86
+ return formation + 'e';
87
+ }
88
+ }
89
+ return formation;
90
+ }
91
+
92
+ static resolveH(root: TxtWord, formation: string, beginningOfSuffix: boolean,
93
+ specialCaseTenseSuffix: boolean, rootWord: boolean, formationToCheck: string): string{
94
+ if (root.isAbbreviation())
95
+ return formation + 'i';
96
+ if (beginningOfSuffix && TurkishLanguage.isVowel(Word.lastPhoneme(formationToCheck)) &&
97
+ !specialCaseTenseSuffix) {
98
+ return formation;
99
+ }
100
+ if (specialCaseTenseSuffix) {
101
+ //eğer ek Hyor eki ise,
102
+ if (rootWord) {
103
+ if (root.vowelAChangesToIDuringYSuffixation()) {
104
+ if (TurkishLanguage.isFrontRoundedVowel(Word.beforeLastVowel(formationToCheck))) {
105
+ //büyülüyor, bölümlüyor, çözümlüyor, döşüyor
106
+ return formation.substring(0, formation.length - 1) + 'ü';
107
+ }
108
+ if (TurkishLanguage.isFrontUnroundedVowel(Word.beforeLastVowel(formationToCheck))) {
109
+ //adresliyor, alevliyor, ateşliyor, bekliyor
110
+ return formation.substring(0, formation.length - 1) + 'i';
111
+ }
112
+ if (TurkishLanguage.isBackRoundedVowel(Word.beforeLastVowel(formationToCheck))) {
113
+ //buğuluyor, bulguluyor, çamurluyor, aforozluyor
114
+ return formation.substring(0, formation.length - 1) + 'u';
115
+ }
116
+ if (TurkishLanguage.isBackUnroundedVowel(Word.beforeLastVowel(formationToCheck))) {
117
+ //açıklıyor, çalkalıyor, gazlıyor, gıcırdıyor
118
+ return formation.substring(0, formation.length - 1) + 'ı';
119
+ }
120
+ }
121
+ }
122
+ if (TurkishLanguage.isVowel(Word.lastPhoneme(formationToCheck))) {
123
+ if (TurkishLanguage.isFrontRoundedVowel(Word.beforeLastVowel(formationToCheck))) {
124
+ return formation.substring(0, formation.length - 1) + 'ü';
125
+ }
126
+ if (TurkishLanguage.isFrontUnroundedVowel(Word.beforeLastVowel(formationToCheck))) {
127
+ return formation.substring(0, formation.length - 1) + 'i';
128
+ }
129
+ if (TurkishLanguage.isBackRoundedVowel(Word.beforeLastVowel(formationToCheck))) {
130
+ return formation.substring(0, formation.length - 1) + 'u';
131
+ }
132
+ if (TurkishLanguage.isBackUnroundedVowel(Word.beforeLastVowel(formationToCheck))) {
133
+ return formation.substring(0, formation.length - 1) + 'ı';
134
+ }
135
+ }
136
+ }
137
+ if (TurkishLanguage.isFrontRoundedVowel(Word.lastVowel(formationToCheck)) ||
138
+ (TurkishLanguage.isBackRoundedVowel(Word.lastVowel(formationToCheck)) && root.notObeysVowelHarmonyDuringAgglutination())) {
139
+ return formation + 'ü';
140
+ }
141
+ if (TurkishLanguage.isFrontUnroundedVowel(Word.lastVowel(formationToCheck)) ||
142
+ (Word.lastVowel(formationToCheck) == 'a' && root.notObeysVowelHarmonyDuringAgglutination())) {
143
+ return formation + 'i';
144
+ }
145
+ if (TurkishLanguage.isBackRoundedVowel(Word.lastVowel(formationToCheck))) {
146
+ return formation + 'u';
147
+ }
148
+ if (TurkishLanguage.isBackUnroundedVowel(Word.lastVowel(formationToCheck))) {
149
+ return formation + 'ı';
150
+ }
151
+ if (root.isNumeral() || root.isFraction() || root.isReal()) {
152
+ if (root.getName().endsWith("6") || root.getName().endsWith("40") || root.getName().endsWith("60") ||
153
+ root.getName().endsWith("90")) {
154
+ //6'yı, 40'ı, 60'ı
155
+ return formation + 'ı';
156
+ } else {
157
+ if (root.getName().endsWith("3") || root.getName().endsWith("4") || root.getName().endsWith("00")) {
158
+ //3'ü, 4'ü, 100'ü
159
+ return formation + 'ü';
160
+ } else {
161
+ if (root.getName().endsWith("9") || root.getName().endsWith("10") || root.getName().endsWith("30")) {
162
+ //9'u, 10'u, 30'u
163
+ return formation + 'u';
164
+ } else {
165
+ //2'yi, 5'i, 8'i
166
+ return formation + 'i';
167
+ }
168
+ }
169
+ }
170
+ }
171
+ return formation;
172
+ }
173
+
174
+ /**
175
+ * The resolveC method takes a {@link String} formation as an input. If the last phoneme is on of the "çfhkpsşt", it
176
+ * concatenates given formation with 'ç', if not it concatenates given formation with 'c'.
177
+ *
178
+ * @param formation {@link String} input.
179
+ * @param formationToCheck {@link String} input.
180
+ * @return resolved String.
181
+ */
182
+ static resolveC(formation: string, formationToCheck: string): string{
183
+ if (TurkishLanguage.isSertSessiz(Word.lastPhoneme(formationToCheck))) {
184
+ return formation + 'ç';
185
+ } else {
186
+ return formation + 'c';
187
+ }
188
+ }
189
+
190
+ /**
191
+ * The resolveS method takes a {@link String} formation as an input. It then concatenates given formation with 's'.
192
+ *
193
+ * @param formation {@link String} input.
194
+ * @return resolved String.
195
+ */
196
+ static resolveS(formation: string): string{
197
+ return formation + 's';
198
+ }
199
+
200
+ /**
201
+ * The resolveSh method takes a {@link String} formation as an input. If the last character is a vowel, it concatenates
202
+ * given formation with ş, if the last character is not a vowel, and not 't' it directly returns given formation, but if it
203
+ * is equal to 't', it transforms it to 'd'.
204
+ *
205
+ * @param formation {@link String} input.
206
+ * @return resolved String.
207
+ */
208
+ static resolveSh(formation: string): string{
209
+ if (TurkishLanguage.isVowel(formation.charAt(formation.length - 1))) {
210
+ return formation + 'ş';
211
+ } else {
212
+ if (formation.charAt(formation.length - 1) != 't')
213
+ return formation;
214
+ else
215
+ return formation.substring(0, formation.length - 1) + 'd';
216
+ }
217
+ }
218
+ }
@@ -2,6 +2,8 @@ import {State} from "./State";
2
2
  import {TxtWord} from "nlptoolkit-dictionary/dist/Dictionary/TxtWord";
3
3
  import {TurkishLanguage} from "nlptoolkit-dictionary/dist/Language/TurkishLanguage";
4
4
  import {FsmParse} from "./FsmParse";
5
+ import {Word} from "nlptoolkit-dictionary/dist/Dictionary/Word";
6
+ import {MorphotacticEngine} from "./MorphotacticEngine";
5
7
 
6
8
  export class Transition {
7
9
 
@@ -151,67 +153,6 @@ export class Transition {
151
153
  return true;
152
154
  }
153
155
 
154
- /**
155
- * The beforeLastVowel method takes a {@link String} stem as an input. It loops through the given stem and returns
156
- * the second last vowel.
157
- *
158
- * @param stem String input.
159
- * @return Vowel before the last vowel.
160
- */
161
- private beforeLastVowel(stem: string): string{
162
- let before = 1;
163
- let last = '0';
164
- for (let i = stem.length - 1; i >= 0; i--) {
165
- if (TurkishLanguage.isVowel(stem.charAt(i))) {
166
- if (before == 1) {
167
- last = stem.charAt(i);
168
- before--;
169
- continue;
170
- }
171
- return stem.charAt(i);
172
- }
173
- }
174
- return last;
175
- }
176
-
177
- /**
178
- * The lastVowel method takes a {@link String} stem as an input. It loops through the given stem and returns
179
- * the last vowel.
180
- *
181
- * @param stem String input.
182
- * @return the last vowel.
183
- */
184
- private lastVowel(stem: string): string{
185
- for (let i = stem.length - 1; i >= 0; i--) {
186
- if (TurkishLanguage.isVowel(stem.charAt(i))) {
187
- return stem.charAt(i);
188
- }
189
- }
190
- for (let i = stem.length - 1; i >= 0; i--) {
191
- if (stem.charAt(i) >= '0' && stem.charAt(i) <= '9') {
192
- return stem.charAt(i);
193
- }
194
- }
195
- return '0';
196
- }
197
-
198
- /**
199
- * The lastPhoneme method takes a {@link String} stem as an input. It then returns the last phoneme of the given stem.
200
- *
201
- * @param stem String input.
202
- * @return the last phoneme.
203
- */
204
- private lastPhoneme(stem: string): string{
205
- if (stem.length == 0) {
206
- return ' ';
207
- }
208
- if (stem.charAt(stem.length - 1) != '\'') {
209
- return stem.charAt(stem.length - 1);
210
- } else {
211
- return stem.charAt(stem.length - 2);
212
- }
213
- }
214
-
215
156
  /**
216
157
  * The withFirstChar method returns the first character of the with variable.
217
158
  *
@@ -345,7 +286,7 @@ export class Transition {
345
286
  //---duplicatesDuringSuffixation---
346
287
  if (this.softenDuringSuffixation(root)) {
347
288
  //--extra softenDuringSuffixation
348
- switch (this.lastPhoneme(stem)) {
289
+ switch (Word.lastPhoneme(stem)) {
349
290
  case 'p':
350
291
  //tıp->tıbbı
351
292
  formation = stem.substring(0, stem.length - 1) + "bb";
@@ -368,7 +309,7 @@ export class Transition {
368
309
  //---lastIdropsDuringSuffixation---
369
310
  if (this.softenDuringSuffixation(root)) {
370
311
  //---softenDuringSuffixation---
371
- switch (this.lastPhoneme(stem)) {
312
+ switch (Word.lastPhoneme(stem)) {
372
313
  case 'p':
373
314
  //hizip->hizbi, kayıp->kaybı, kayıt->kaydı, kutup->kutbu
374
315
  formation = stem.substring(0, stem.length - 2) + 'b';
@@ -389,7 +330,7 @@ export class Transition {
389
330
  }
390
331
  this.formationToCheck = stem;
391
332
  } else {
392
- switch (this.lastPhoneme(stem)) {
333
+ switch (Word.lastPhoneme(stem)) {
393
334
  //---nounSoftenDuringSuffixation or verbSoftenDuringSuffixation
394
335
  case 'p':
395
336
  //adap->adabı, amip->amibi, azap->azabı, gazap->gazabı
@@ -452,7 +393,7 @@ export class Transition {
452
393
  i = 1;
453
394
  }
454
395
  } else {
455
- if ((TurkishLanguage.isConsonantDrop(this.withFirstChar()) && TurkishLanguage.isConsonant(this.lastPhoneme(stem))) ||
396
+ if ((TurkishLanguage.isConsonantDrop(this.withFirstChar()) && TurkishLanguage.isConsonant(Word.lastPhoneme(stem))) ||
456
397
  (rootWord && root.consonantSMayInsertedDuringPossesiveSuffixation())) {
457
398
  if (this._with.charAt(0) == '\'') {
458
399
  formation = formation + '\'';
@@ -468,26 +409,26 @@ export class Transition {
468
409
  for (; i < this._with.length; i++) {
469
410
  switch (this._with.charAt(i)) {
470
411
  case 'D':
471
- formation = this.resolveD(root, formation);
412
+ formation = MorphotacticEngine.resolveD(root, formation, this.formationToCheck);
472
413
  break;
473
414
  case 'A':
474
- formation = this.resolveA(root, formation, rootWord);
415
+ formation = MorphotacticEngine.resolveA(root, formation, rootWord, this.formationToCheck);
475
416
  break;
476
417
  case 'H':
477
418
  if (this._with.charAt(0) != '\'') {
478
- formation = this.resolveH(root, formation, i == 0, this._with.startsWith("Hyor"), rootWord);
419
+ formation = MorphotacticEngine.resolveH(root, formation, i == 0, this._with.startsWith("Hyor"), rootWord, this.formationToCheck);
479
420
  } else {
480
- formation = this.resolveH(root, formation, i == 1, false, rootWord);
421
+ formation = MorphotacticEngine.resolveH(root, formation, i == 1, false, rootWord, this.formationToCheck);
481
422
  }
482
423
  break;
483
424
  case 'C':
484
- formation = this.resolveC(formation);
425
+ formation = MorphotacticEngine.resolveC(formation, this.formationToCheck);
485
426
  break;
486
427
  case 'S':
487
- formation = this.resolveS(formation);
428
+ formation = MorphotacticEngine.resolveS(formation);
488
429
  break;
489
430
  case 'Ş':
490
- formation = this.resolveSh(formation);
431
+ formation = MorphotacticEngine.resolveSh(formation);
491
432
  break;
492
433
  default:
493
434
  if (i == this._with.length - 1 && this._with.charAt(i) == 's') {
@@ -502,217 +443,6 @@ export class Transition {
502
443
  }
503
444
  }
504
445
 
505
- private resolveD(root: TxtWord, formation: string): string{
506
- if (root.isAbbreviation()) {
507
- return formation + 'd';
508
- }
509
- if (this.lastPhoneme(this.formationToCheck) >= '0' && this.lastPhoneme(this.formationToCheck) <= '9') {
510
- switch (this.lastPhoneme(this.formationToCheck)) {
511
- case '3':
512
- case '4':
513
- case '5':
514
- //3->3'tü, 5->5'ti, 4->4'tü
515
- return formation + 't';
516
- case '0':
517
- if (root.getName().endsWith("40") || root.getName().endsWith("60") || root.getName().endsWith("70"))
518
- //40->40'tı, 60->60'tı, 70->70'ti
519
- return formation + 't';
520
- else
521
- //30->30'du, 50->50'ydi, 80->80'di
522
- return formation + 'd';
523
- default:
524
- return formation + 'd';
525
- }
526
- } else {
527
- if (TurkishLanguage.isSertSessiz(this.lastPhoneme(this.formationToCheck))) {
528
- //yap+DH->yaptı
529
- return formation + 't';
530
- } else {
531
- //sar+DH->sardı
532
- return formation + 'd';
533
- }
534
- }
535
- }
536
-
537
- private resolveA(root: TxtWord, formation: string, rootWord: boolean): string{
538
- if (root.isAbbreviation()) {
539
- return formation + 'e';
540
- }
541
- if (this.lastVowel(this.formationToCheck) >= '0' && this.lastVowel(this.formationToCheck) <= '9') {
542
- switch (this.lastVowel(this.formationToCheck)) {
543
- case '6':
544
- case '9':
545
- //6'ya, 9'a
546
- return formation + 'a';
547
- case '0':
548
- if (root.getName().endsWith("10") || root.getName().endsWith("30") || root.getName().endsWith("40") ||
549
- root.getName().endsWith("60") || root.getName().endsWith("90"))
550
- //10'a, 30'a, 40'a, 60'a, 90'a
551
- return formation + 'a';
552
- else
553
- //20'ye, 50'ye, 80'e, 70'e
554
- return formation + 'e';
555
- default:
556
- //3'e, 8'e, 4'e, 2'ye
557
- return formation + 'e';
558
- }
559
- }
560
- if (TurkishLanguage.isBackVowel(this.lastVowel(this.formationToCheck))) {
561
- if (root.notObeysVowelHarmonyDuringAgglutination() && rootWord) {
562
- //alkole, anormale
563
- return formation + 'e';
564
- } else {
565
- //sakala, kabala
566
- return formation + 'a';
567
- }
568
- }
569
- if (TurkishLanguage.isFrontVowel(this.lastVowel(this.formationToCheck))) {
570
- if (root.notObeysVowelHarmonyDuringAgglutination() && rootWord) {
571
- //faika, halika
572
- return formation + 'a';
573
- } else {
574
- //kediye, eve
575
- return formation + 'e';
576
- }
577
- }
578
- if (root.isNumeral() || root.isFraction() || root.isReal()) {
579
- if (root.getName().endsWith("6") || root.getName().endsWith("9") || root.getName().endsWith("10") ||
580
- root.getName().endsWith("30") || root.getName().endsWith("40") || root.getName().endsWith("60") ||
581
- root.getName().endsWith("90")) {
582
- return formation + 'a';
583
- } else {
584
- return formation + 'e';
585
- }
586
- }
587
- return formation;
588
- }
589
-
590
- private resolveH(root: TxtWord, formation: string, beginningOfSuffix: boolean,
591
- specialCaseTenseSuffix: boolean, rootWord: boolean): string{
592
- if (root.isAbbreviation())
593
- return formation + 'i';
594
- if (beginningOfSuffix && TurkishLanguage.isVowel(this.lastPhoneme(this.formationToCheck)) &&
595
- !specialCaseTenseSuffix) {
596
- return formation;
597
- }
598
- if (specialCaseTenseSuffix) {
599
- //eğer ek Hyor eki ise,
600
- if (rootWord) {
601
- if (root.vowelAChangesToIDuringYSuffixation()) {
602
- if (TurkishLanguage.isFrontRoundedVowel(this.beforeLastVowel(this.formationToCheck))) {
603
- //büyülüyor, bölümlüyor, çözümlüyor, döşüyor
604
- return formation.substring(0, formation.length - 1) + 'ü';
605
- }
606
- if (TurkishLanguage.isFrontUnroundedVowel(this.beforeLastVowel(this.formationToCheck))) {
607
- //adresliyor, alevliyor, ateşliyor, bekliyor
608
- return formation.substring(0, formation.length - 1) + 'i';
609
- }
610
- if (TurkishLanguage.isBackRoundedVowel(this.beforeLastVowel(this.formationToCheck))) {
611
- //buğuluyor, bulguluyor, çamurluyor, aforozluyor
612
- return formation.substring(0, formation.length - 1) + 'u';
613
- }
614
- if (TurkishLanguage.isBackUnroundedVowel(this.beforeLastVowel(this.formationToCheck))) {
615
- //açıklıyor, çalkalıyor, gazlıyor, gıcırdıyor
616
- return formation.substring(0, formation.length - 1) + 'ı';
617
- }
618
- }
619
- }
620
- if (TurkishLanguage.isVowel(this.lastPhoneme(this.formationToCheck))) {
621
- if (TurkishLanguage.isFrontRoundedVowel(this.beforeLastVowel(this.formationToCheck))) {
622
- return formation.substring(0, formation.length - 1) + 'ü';
623
- }
624
- if (TurkishLanguage.isFrontUnroundedVowel(this.beforeLastVowel(this.formationToCheck))) {
625
- return formation.substring(0, formation.length - 1) + 'i';
626
- }
627
- if (TurkishLanguage.isBackRoundedVowel(this.beforeLastVowel(this.formationToCheck))) {
628
- return formation.substring(0, formation.length - 1) + 'u';
629
- }
630
- if (TurkishLanguage.isBackUnroundedVowel(this.beforeLastVowel(this.formationToCheck))) {
631
- return formation.substring(0, formation.length - 1) + 'ı';
632
- }
633
- }
634
- }
635
- if (TurkishLanguage.isFrontRoundedVowel(this.lastVowel(this.formationToCheck)) ||
636
- (TurkishLanguage.isBackRoundedVowel(this.lastVowel(this.formationToCheck)) && root.notObeysVowelHarmonyDuringAgglutination())) {
637
- return formation + 'ü';
638
- }
639
- if (TurkishLanguage.isFrontUnroundedVowel(this.lastVowel(this.formationToCheck)) ||
640
- (this.lastVowel(this.formationToCheck) == 'a' && root.notObeysVowelHarmonyDuringAgglutination())) {
641
- return formation + 'i';
642
- }
643
- if (TurkishLanguage.isBackRoundedVowel(this.lastVowel(this.formationToCheck))) {
644
- return formation + 'u';
645
- }
646
- if (TurkishLanguage.isBackUnroundedVowel(this.lastVowel(this.formationToCheck))) {
647
- return formation + 'ı';
648
- }
649
- if (root.isNumeral() || root.isFraction() || root.isReal()) {
650
- if (root.getName().endsWith("6") || root.getName().endsWith("40") || root.getName().endsWith("60") ||
651
- root.getName().endsWith("90")) {
652
- //6'yı, 40'ı, 60'ı
653
- return formation + 'ı';
654
- } else {
655
- if (root.getName().endsWith("3") || root.getName().endsWith("4") || root.getName().endsWith("00")) {
656
- //3'ü, 4'ü, 100'ü
657
- return formation + 'ü';
658
- } else {
659
- if (root.getName().endsWith("9") || root.getName().endsWith("10") || root.getName().endsWith("30")) {
660
- //9'u, 10'u, 30'u
661
- return formation + 'u';
662
- } else {
663
- //2'yi, 5'i, 8'i
664
- return formation + 'i';
665
- }
666
- }
667
- }
668
- }
669
- return formation;
670
- }
671
-
672
- /**
673
- * The resolveC method takes a {@link String} formation as an input. If the last phoneme is on of the "çfhkpsşt", it
674
- * concatenates given formation with 'ç', if not it concatenates given formation with 'c'.
675
- *
676
- * @param formation {@link String} input.
677
- * @return resolved String.
678
- */
679
- private resolveC(formation: string): string{
680
- if (TurkishLanguage.isSertSessiz(this.lastPhoneme(this.formationToCheck))) {
681
- return formation + 'ç';
682
- } else {
683
- return formation + 'c';
684
- }
685
- }
686
-
687
- /**
688
- * The resolveS method takes a {@link String} formation as an input. It then concatenates given formation with 's'.
689
- *
690
- * @param formation {@link String} input.
691
- * @return resolved String.
692
- */
693
- private resolveS(formation: string): string{
694
- return formation + 's';
695
- }
696
-
697
- /**
698
- * The resolveSh method takes a {@link String} formation as an input. If the last character is a vowel, it concatenates
699
- * given formation with ş, if the last character is not a vowel, and not 't' it directly returns given formation, but if it
700
- * is equal to 't', it transforms it to 'd'.
701
- *
702
- * @param formation {@link String} input.
703
- * @return resolved String.
704
- */
705
- private resolveSh(formation: string): string{
706
- if (TurkishLanguage.isVowel(formation.charAt(formation.length - 1))) {
707
- return formation + 'ş';
708
- } else {
709
- if (formation.charAt(formation.length - 1) != 't')
710
- return formation;
711
- else
712
- return formation.substring(0, formation.length - 1) + 'd';
713
- }
714
- }
715
-
716
446
  /**
717
447
  * An overridden toString method which returns the with variable.
718
448
  *