From 3139277844e439604344d03b41f5bb8a32ee35e3 Mon Sep 17 00:00:00 2001 From: cecile Date: Tue, 25 Apr 2017 00:19:30 -0700 Subject: [PATCH 1/6] corrections to future tense --- src/korean.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/korean.js b/src/korean.js index 0014088..8816d0b 100644 --- a/src/korean.js +++ b/src/korean.js @@ -25,11 +25,11 @@ const breakdown = (input) => { // input: array of 2 or 3 numbers representing modern jamo (components) that make up a hangul syllable // output: a hangul character const combineSymbols = (input) => { - const initialValue = input[0] * 588; - const medialValue = input[1] * 28; - const finalValue = input[2] ? input[2] : 0; - const total = initialValue + medialValue + finalValue + 44032; - const finalWord = String.fromCharCode(total); + let unicodeTotal = (input[0] * 588) + (input[1] * 28) + 44032; + if(input.length === 3) { + unicodeTotal += input[2]; + } + const finalWord = String.fromCharCode(unicodeTotal); return finalWord; }; @@ -129,10 +129,18 @@ class Korean { doFuture (word) { const stem = breakdown(word.slice(0, -1)); - if (stem[-1] !== 8) { + if (stem.length < 3) { stem.push(8); + return `${combineSymbols(stem)}꺼야`; + } else { + if (stem[stem.length-1] === 17) { + stem.pop(); + return `${combineSymbols(stem)}울꺼야`; + } else if (stem[stem.length-1] === 8) { + return `${combineSymbols(stem)}꺼야`; + } + return `${combineSymbols(stem)}을꺼야`; } - return `${combineSymbols(stem)}꺼야`; } } // end for class From 6c94bc852fc8894dfbdc2cba7bec876470cd8c31 Mon Sep 17 00:00:00 2001 From: cecile Date: Tue, 25 Apr 2017 00:20:43 -0700 Subject: [PATCH 2/6] added future tense tests --- test/korean_tests.js | 48 +++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/test/korean_tests.js b/test/korean_tests.js index 23a8048..63a02db 100644 --- a/test/korean_tests.js +++ b/test/korean_tests.js @@ -107,28 +107,48 @@ describe('Korean', () => { }); }); describe('Future Tense', () => { - it('should conjugate regular verbs correctly', () => { + it('should conjugate verbs with stem ending with a vowel correctly', () => { const kc = new Korean(); - let presentWord = kc.conjugate('하다', {tense: 'future'}); - expect(presentWord).to.equal('할꺼야'); + let futureWord = kc.conjugate('하다', {tense: 'future'}); + expect(futureWord).to.equal('할꺼야'); - presentWord = kc.conjugate('오다', {tense: 'future'}); - expect(presentWord).to.equal('올꺼야'); + futureWord = kc.conjugate('오다', {tense: 'future'}); + expect(futureWord).to.equal('올꺼야'); - presentWord = kc.conjugate('비다', {tense: 'future'}); - expect(presentWord).to.equal('빌꺼야'); + futureWord = kc.conjugate('비다', {tense: 'future'}); + expect(futureWord).to.equal('빌꺼야'); + }); + it('should conjugate verbs with stem ending with a ㄹ consonant correctly', + () => { + const kc = new Korean(); + let futureWord = kc.conjugate('놀다', {tense: 'future'}); + expect(futureWord).to.equal('놀꺼야'); + + futureWord = kc.conjugate('날다', {tense: 'future'}); + expect(futureWord).to.equal('날꺼야'); + + futureWord = kc.conjugate('울다', {tense: 'future'}); + expect(futureWord).to.equal('울꺼야'); }); - it('should conjugate words with ㄹ final vowel correctly', () => { + it('should conjugate verbs with stem ending with ㅂ consonant correctly', + () => { const kc = new Korean(); - let presentWord = kc.conjugate('놀다', {tense: 'future'}); - expect(presentWord).to.equal('놀꺼야'); + let futureWord = kc.conjugate('춥다', {tense: 'future'}); + expect(futureWord).to.equal('추울꺼야'); - presentWord = kc.conjugate('날다', {tense: 'future'}); - expect(presentWord).to.equal('날꺼야'); + futureWord = kc.conjugate('덥다', {tense: 'future'}); + expect(futureWord).to.equal('더울꺼야'); + }); + it('should conjugate verbs with stem ending with other consonants correctly', + () => { + const kc = new Korean(); + let futureWord = kc.conjugate('있다', {tense: 'future'}); + expect(futureWord).to.equal('있을꺼야'); - presentWord = kc.conjugate('울다', {tense: 'future'}); - expect(presentWord).to.equal('울꺼야'); + futureWord = kc.conjugate('먹다', {tense: 'future'}); + expect(futureWord).to.equal('먹을꺼야'); }); + }); describe('Present Continuous Tense', () => { it('should conjugate verbs correctly', () => { From 07ad3c7b757f4bdc1f34a383f70fcc9ae32cdebe Mon Sep 17 00:00:00 2001 From: cecile Date: Tue, 25 Apr 2017 11:24:36 -0700 Subject: [PATCH 3/6] koreanFuture space fix --- src/korean.js | 11 +++++------ test/korean_tests.js | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/korean.js b/src/korean.js index 8816d0b..7276676 100644 --- a/src/korean.js +++ b/src/korean.js @@ -29,8 +29,7 @@ const combineSymbols = (input) => { if(input.length === 3) { unicodeTotal += input[2]; } - const finalWord = String.fromCharCode(unicodeTotal); - return finalWord; + return String.fromCharCode(unicodeTotal); }; class Korean { @@ -131,15 +130,15 @@ class Korean { const stem = breakdown(word.slice(0, -1)); if (stem.length < 3) { stem.push(8); - return `${combineSymbols(stem)}꺼야`; + return `${combineSymbols(stem)} 꺼야`; } else { if (stem[stem.length-1] === 17) { stem.pop(); - return `${combineSymbols(stem)}울꺼야`; + return `${combineSymbols(stem)}울 꺼야`; } else if (stem[stem.length-1] === 8) { - return `${combineSymbols(stem)}꺼야`; + return `${combineSymbols(stem)} 꺼야`; } - return `${combineSymbols(stem)}을꺼야`; + return `${combineSymbols(stem)}을 꺼야`; } } } // end for class diff --git a/test/korean_tests.js b/test/korean_tests.js index 63a02db..f87de76 100644 --- a/test/korean_tests.js +++ b/test/korean_tests.js @@ -110,43 +110,43 @@ describe('Korean', () => { it('should conjugate verbs with stem ending with a vowel correctly', () => { const kc = new Korean(); let futureWord = kc.conjugate('하다', {tense: 'future'}); - expect(futureWord).to.equal('할꺼야'); + expect(futureWord).to.equal('할 꺼야'); futureWord = kc.conjugate('오다', {tense: 'future'}); - expect(futureWord).to.equal('올꺼야'); + expect(futureWord).to.equal('올 꺼야'); futureWord = kc.conjugate('비다', {tense: 'future'}); - expect(futureWord).to.equal('빌꺼야'); + expect(futureWord).to.equal('빌 꺼야'); }); it('should conjugate verbs with stem ending with a ㄹ consonant correctly', () => { const kc = new Korean(); let futureWord = kc.conjugate('놀다', {tense: 'future'}); - expect(futureWord).to.equal('놀꺼야'); + expect(futureWord).to.equal('놀 꺼야'); futureWord = kc.conjugate('날다', {tense: 'future'}); - expect(futureWord).to.equal('날꺼야'); + expect(futureWord).to.equal('날 꺼야'); futureWord = kc.conjugate('울다', {tense: 'future'}); - expect(futureWord).to.equal('울꺼야'); + expect(futureWord).to.equal('울 꺼야'); }); it('should conjugate verbs with stem ending with ㅂ consonant correctly', () => { const kc = new Korean(); let futureWord = kc.conjugate('춥다', {tense: 'future'}); - expect(futureWord).to.equal('추울꺼야'); + expect(futureWord).to.equal('추울 꺼야'); futureWord = kc.conjugate('덥다', {tense: 'future'}); - expect(futureWord).to.equal('더울꺼야'); + expect(futureWord).to.equal('더울 꺼야'); }); it('should conjugate verbs with stem ending with other consonants correctly', () => { const kc = new Korean(); let futureWord = kc.conjugate('있다', {tense: 'future'}); - expect(futureWord).to.equal('있을꺼야'); + expect(futureWord).to.equal('있을 꺼야'); futureWord = kc.conjugate('먹다', {tense: 'future'}); - expect(futureWord).to.equal('먹을꺼야'); + expect(futureWord).to.equal('먹을 꺼야'); }); }); From 6c1eb3de182133d98f6ede2fc6fc8a8e16a8a899 Mon Sep 17 00:00:00 2001 From: cecile Date: Tue, 25 Apr 2017 11:33:40 -0700 Subject: [PATCH 4/6] koreanFuture ending fix --- src/korean.js | 8 ++++---- test/korean_tests.js | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/korean.js b/src/korean.js index 7276676..3859cea 100644 --- a/src/korean.js +++ b/src/korean.js @@ -130,15 +130,15 @@ class Korean { const stem = breakdown(word.slice(0, -1)); if (stem.length < 3) { stem.push(8); - return `${combineSymbols(stem)} 꺼야`; + return `${combineSymbols(stem)} 거야`; } else { if (stem[stem.length-1] === 17) { stem.pop(); - return `${combineSymbols(stem)}울 꺼야`; + return `${combineSymbols(stem)}울 거야`; } else if (stem[stem.length-1] === 8) { - return `${combineSymbols(stem)} 꺼야`; + return `${combineSymbols(stem)} 거야`; } - return `${combineSymbols(stem)}을 꺼야`; + return `${combineSymbols(stem)}을 거야`; } } } // end for class diff --git a/test/korean_tests.js b/test/korean_tests.js index f87de76..345dd66 100644 --- a/test/korean_tests.js +++ b/test/korean_tests.js @@ -110,43 +110,43 @@ describe('Korean', () => { it('should conjugate verbs with stem ending with a vowel correctly', () => { const kc = new Korean(); let futureWord = kc.conjugate('하다', {tense: 'future'}); - expect(futureWord).to.equal('할 꺼야'); + expect(futureWord).to.equal('할 거야'); futureWord = kc.conjugate('오다', {tense: 'future'}); - expect(futureWord).to.equal('올 꺼야'); + expect(futureWord).to.equal('올 거야'); futureWord = kc.conjugate('비다', {tense: 'future'}); - expect(futureWord).to.equal('빌 꺼야'); + expect(futureWord).to.equal('빌 거야'); }); it('should conjugate verbs with stem ending with a ㄹ consonant correctly', () => { const kc = new Korean(); let futureWord = kc.conjugate('놀다', {tense: 'future'}); - expect(futureWord).to.equal('놀 꺼야'); + expect(futureWord).to.equal('놀 거야'); futureWord = kc.conjugate('날다', {tense: 'future'}); - expect(futureWord).to.equal('날 꺼야'); + expect(futureWord).to.equal('날 거야'); futureWord = kc.conjugate('울다', {tense: 'future'}); - expect(futureWord).to.equal('울 꺼야'); + expect(futureWord).to.equal('울 거야'); }); it('should conjugate verbs with stem ending with ㅂ consonant correctly', () => { const kc = new Korean(); let futureWord = kc.conjugate('춥다', {tense: 'future'}); - expect(futureWord).to.equal('추울 꺼야'); + expect(futureWord).to.equal('추울 거야'); futureWord = kc.conjugate('덥다', {tense: 'future'}); - expect(futureWord).to.equal('더울 꺼야'); + expect(futureWord).to.equal('더울 거야'); }); it('should conjugate verbs with stem ending with other consonants correctly', () => { const kc = new Korean(); let futureWord = kc.conjugate('있다', {tense: 'future'}); - expect(futureWord).to.equal('있을 꺼야'); + expect(futureWord).to.equal('있을 거야'); futureWord = kc.conjugate('먹다', {tense: 'future'}); - expect(futureWord).to.equal('먹을 꺼야'); + expect(futureWord).to.equal('먹을 거야'); }); }); From 333107964a1c70fa144d9fd646296be2499a54f3 Mon Sep 17 00:00:00 2001 From: Mason Shin Date: Tue, 25 Apr 2017 19:01:16 -0700 Subject: [PATCH 5/6] Fix eslint fails --- src/korean.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/korean.js b/src/korean.js index 37e416b..af7756f 100644 --- a/src/korean.js +++ b/src/korean.js @@ -26,7 +26,7 @@ const breakdown = (input) => { // output: a hangul character const combineSymbols = (input) => { let unicodeTotal = (input[0] * 588) + (input[1] * 28) + 44032; - if(input.length === 3) { + if (input.length === 3) { unicodeTotal += input[2]; } return String.fromCharCode(unicodeTotal); @@ -138,15 +138,14 @@ class Korean { if (stem.length < 3) { stem.push(8); return `${combineSymbols(stem)} 거야`; - } else { - if (stem[stem.length-1] === 17) { - stem.pop(); - return `${combineSymbols(stem)}울 거야`; - } else if (stem[stem.length-1] === 8) { - return `${combineSymbols(stem)} 거야`; - } - return `${combineSymbols(stem)}을 거야`; } + if (stem[stem.length - 1] === 17) { + stem.pop(); + return `${combineSymbols(stem)}울 거야`; + } else if (stem[stem.length - 1] === 8) { + return `${combineSymbols(stem)} 거야`; + } + return `${combineSymbols(stem)}을 거야`; } } // end for class From 13229c0768f59cec23e9a6fff080a5eb777eb0de Mon Sep 17 00:00:00 2001 From: Mason Shin Date: Wed, 26 Apr 2017 23:29:18 -0700 Subject: [PATCH 6/6] Introduce `doPast` for Korean past tense --- src/korean.js | 94 +++++++++++++++++- test/korean_tests.js | 221 ++++++++++++++++++++++++++++++------------- 2 files changed, 249 insertions(+), 66 deletions(-) diff --git a/src/korean.js b/src/korean.js index af7756f..d3e4bfe 100644 --- a/src/korean.js +++ b/src/korean.js @@ -32,6 +32,16 @@ const combineSymbols = (input) => { return String.fromCharCode(unicodeTotal); }; +const makePast = (syllable, stem, wordLength, replacement) => { + syllable.push(replacement); + syllable.push(20); // add ㅆ + syllable = combineSymbols(syllable); + if (wordLength <= 2) { + return `${syllable}어`; + } + return `${stem}${syllable}어`; +}; + class Korean { conjugate (word, info) { @@ -129,8 +139,88 @@ class Korean { } doPast (word) { - console.info(word); - // stuff for past tense + const wordLength = word.length; + let conjugate = ''; + // if the ending is 'ha' then convert to 'haet': '하' to '했' + if (word[wordLength - 2] === '하') { + conjugate = word.slice(0, wordLength - 2); + return `${conjugate}했어`; + } else if (word[wordLength - 2] === '르') { + const stem = breakdown(word.slice(0, wordLength - 2)); + stem.push(8); // ㄹ + const newSyllable = combineSymbols(stem); + switch (stem[stem.length - 2]) { + case 0: + case 8: + // ㅏ and ㅗ are followed by 라 + return `${newSyllable}랐어`; + default: + // other vowels are followed by 러 + return `${newSyllable}렀어`; + } + } else if (word[wordLength - 2] === '비') { + return `${word[wordLength - 2]}었어`; + } else if (word[wordLength - 2] === '있') { + return '있었어'; + } else { + /** breakdown the word to find out the 2nd to last character's letter **/ + const brokeWord = breakdown(word[wordLength - 2]); + const brokeLength = brokeWord.length; + const syllableEnd = brokeWord[brokeLength - 1]; + const newSyllable = brokeWord.slice(0, brokeLength - 1); + let stemWord = word.slice(0, wordLength - 2); + + switch (syllableEnd) { + case 0: + case 4: + // if last letter is ㅏ leave alone + return word.slice(0, wordLength - 1); + case 1: + case 8: + // ㄱ, ㄹ + switch (brokeWord[brokeLength - 2]) { + case 0: + case 8: + // ㅗㄹ, ㅏㄹ, ㅗㄱ, ㅏㄱ + stemWord = word.slice(0, wordLength - 1); + return `${stemWord}았어`; + case 4: + case 13: + case 18: + // ㅓㄹ, ㅜㄹ, ㅡㄹ, ㅓㄱ, ㅜㄱ, ㅡㄱ + stemWord = word.slice(0, wordLength - 1); + return `${stemWord}었어`; + default: + // replace with: ㅘ (9) + // concat back to word + return makePast(newSyllable, stemWord, wordLength, 9); + } + case 13: + // 13 (ㅜ) convert to 14 (ㅝ) + return makePast(newSyllable, stemWord, wordLength, 14); + case 17: + // ㅂ + switch (brokeWord[brokeLength - 2]) { + case 4: + case 13: + brokeWord.pop(); + return `${combineSymbols(brokeWord)}웠어`; + default: + break; + } + break; + case 18: + // vowel ㅡ replace with ㅓ (4) + return makePast(newSyllable, stemWord, wordLength, 4); + case 20: + // vowel ㅣ replace with ㅕ(6) + return makePast(newSyllable, stemWord, wordLength, 6); + default: + // if consonant + conjugate = word.slice(0, wordLength - 1); + return conjugate.concat('어'); + } + } } doFuture (word) { diff --git a/test/korean_tests.js b/test/korean_tests.js index 76ce2f9..30fc68d 100644 --- a/test/korean_tests.js +++ b/test/korean_tests.js @@ -105,68 +105,161 @@ describe('Korean', () => { presentWord = kc.conjugate('서두르다', {tense: 'present'}); presentWord = kc.conjugate('서둘러', {tense: 'present'}); }); - }); - describe('Future Tense', () => { - it('should conjugate verbs with stem ending with a vowel correctly', () => { - const kc = new Korean(); - let futureWord = kc.conjugate('하다', {tense: 'future'}); - expect(futureWord).to.equal('할 거야'); - - futureWord = kc.conjugate('오다', {tense: 'future'}); - expect(futureWord).to.equal('올 거야'); - - futureWord = kc.conjugate('비다', {tense: 'future'}); - expect(futureWord).to.equal('빌 거야'); - }); - it('should conjugate verbs with stem ending with a ㄹ consonant correctly', - () => { - const kc = new Korean(); - let futureWord = kc.conjugate('놀다', {tense: 'future'}); - expect(futureWord).to.equal('놀 거야'); - - futureWord = kc.conjugate('날다', {tense: 'future'}); - expect(futureWord).to.equal('날 거야'); - - futureWord = kc.conjugate('울다', {tense: 'future'}); - expect(futureWord).to.equal('울 거야'); - }); - it('should conjugate verbs with stem ending with ㅂ consonant correctly', - () => { - const kc = new Korean(); - let futureWord = kc.conjugate('춥다', {tense: 'future'}); - expect(futureWord).to.equal('추울 거야'); - - futureWord = kc.conjugate('덥다', {tense: 'future'}); - expect(futureWord).to.equal('더울 거야'); - }); - it('should conjugate verbs with stem ending with other consonants correctly', - () => { - const kc = new Korean(); - let futureWord = kc.conjugate('있다', {tense: 'future'}); - expect(futureWord).to.equal('있을 거야'); - - futureWord = kc.conjugate('먹다', {tense: 'future'}); - expect(futureWord).to.equal('먹을 거야'); - }); - - }); - describe('Present Continuous Tense', () => { - it('should conjugate verbs correctly', () => { - const kc = new Korean(); - let presentWord = kc.conjugate('하다', {tense: 'PresentContinuous'}); - expect(presentWord).to.equal('하고있어'); - - presentWord = kc.conjugate('오다', {tense: 'PresentContinuous'}); - expect(presentWord).to.equal('오고있어'); - - presentWord = kc.conjugate('비다', {tense: 'PresentContinuous'}); - expect(presentWord).to.equal('비고있어'); - - presentWord = kc.conjugate('먹다', {tense: 'PresentContinuous'}); - expect(presentWord).to.equal('먹고있어'); - - presentWord = kc.conjugate('좋아하다', {tense: 'PresentContinuous'}); - expect(presentWord).to.equal('좋아하고있어'); - }); - }); + }); + describe('Future Tense', () => { + it('should conjugate verbs with stem ending with a vowel correctly', () => { + const kc = new Korean(); + let futureWord = kc.conjugate('하다', {tense: 'future'}); + expect(futureWord).to.equal('할 거야'); + + futureWord = kc.conjugate('오다', {tense: 'future'}); + expect(futureWord).to.equal('올 거야'); + + futureWord = kc.conjugate('비다', {tense: 'future'}); + expect(futureWord).to.equal('빌 거야'); + }); + it('should conjugate verbs with stem ending with a ㄹ consonant correctly', () => { + const kc = new Korean(); + let futureWord = kc.conjugate('놀다', {tense: 'future'}); + expect(futureWord).to.equal('놀 거야'); + + futureWord = kc.conjugate('날다', {tense: 'future'}); + expect(futureWord).to.equal('날 거야'); + + futureWord = kc.conjugate('울다', {tense: 'future'}); + expect(futureWord).to.equal('울 거야'); + }); + it('should conjugate verbs with stem ending with ㅂ consonant correctly', () => { + const kc = new Korean(); + let futureWord = kc.conjugate('춥다', {tense: 'future'}); + expect(futureWord).to.equal('추울 거야'); + + futureWord = kc.conjugate('덥다', {tense: 'future'}); + expect(futureWord).to.equal('더울 거야'); + }); + it('should conjugate verbs with stem ending with other consonants correctly', () => { + const kc = new Korean(); + let futureWord = kc.conjugate('있다', {tense: 'future'}); + expect(futureWord).to.equal('있을 거야'); + + futureWord = kc.conjugate('먹다', {tense: 'future'}); + expect(futureWord).to.equal('먹을 거야'); + }); + }); + + describe('Present Continuous Tense', () => { + it('should conjugate verbs correctly', () => { + const kc = new Korean(); + let presentWord = kc.conjugate('하다', {tense: 'PresentContinuous'}); + expect(presentWord).to.equal('하고있어'); + + presentWord = kc.conjugate('오다', {tense: 'PresentContinuous'}); + expect(presentWord).to.equal('오고있어'); + + presentWord = kc.conjugate('비다', {tense: 'PresentContinuous'}); + expect(presentWord).to.equal('비고있어'); + + presentWord = kc.conjugate('먹다', {tense: 'PresentContinuous'}); + expect(presentWord).to.equal('먹고있어'); + + presentWord = kc.conjugate('좋아하다', {tense: 'PresentContinuous'}); + expect(presentWord).to.equal('좋아하고있어'); + }); + }); + + describe('Past Tense', () => { + it('should conjugate 하다 verbs correctly', () => { + const kc = new Korean(); + let pastWord = kc.conjugate('하다', { tense: 'past' }); + expect(pastWord).to.equal('했어'); + + pastWord = kc.conjugate('좋아하다', {tense: 'past'}); + expect(pastWord).to.equal('좋아했어'); + }); + it('should conjugate ㅗ다 words correctly', () => { + const kc = new Korean(); + let pastWord = kc.conjugate('오다', {tense: 'past'}); + expect(pastWord).to.equal('왔어'); + + pastWord = kc.conjugate('보다', {tense: 'past'}); + expect(pastWord).to.equal('봤어'); + }); + it('should conjugate ㅜ다 words correctly', () => { + const kc = new Korean(); + let pastWord = kc.conjugate('춤추다', {tense: 'past'}); + expect(pastWord).to.equal('춤췄어'); + + pastWord = kc.conjugate('도와주다', {tense: 'past'}); + expect(pastWord).to.equal('도와줬어'); + }); + it('should conjugate ㅡ다 words correctly', () => { + const kc = new Korean(); + let pastWord = kc.conjugate('쓰다', {tense: 'past'}); + expect(pastWord).to.equal('썼어'); + }); + it('should conjugate ㅣ다 words correctly', () => { + const kc = new Korean(); + let pastWord = kc.conjugate('우기다', {tense: 'past'}); + expect(pastWord).to.equal('우겼어'); + + pastWord = kc.conjugate('지다', {tense: 'past'}); + expect(pastWord).to.equal('졌어'); + }); + it('should conjugate ㅗ르 and ㅜ르 words correctly', () => { + const kc = new Korean(); + let pastWord = kc.conjugate('모르다', {tense: 'past'}); + expect(pastWord).to.equal('몰랐어'); + + pastWord = kc.conjugate('부르다', {tense: 'past'}); + expect(pastWord).to.equal('불렀어'); + }); + it('should conjugate words with ㅗㄹ and ㅏㄹ final vowel correctly', () => { + const kc = new Korean(); + let pastWord = kc.conjugate('놀다', {tense: 'past'}); + expect(pastWord).to.equal('놀았어'); + + pastWord = kc.conjugate('날다', {tense: 'past'}); + expect(pastWord).to.equal('날았어'); + }); + it('should conjugate words with ㅗㄱ and ㅏㄱ final vowel correctly', () => { + const kc = new Korean(); + let pastWord = kc.conjugate('녹다', {tense: 'past'}); + expect(pastWord).to.equal('녹았어'); + + pastWord = kc.conjugate('막다', {tense: 'past'}); + expect(pastWord).to.equal('막았어'); + }); + it('should conjugate words with ㅜㄹ, ㅓㄹ, and ㅡㄹ final vowel correctly', () => { + const kc = new Korean(); + let pastWord = kc.conjugate('울다', {tense: 'past'}); + expect(pastWord).to.equal('울었어'); + + pastWord = kc.conjugate('얼다', {tense: 'past'}); + expect(pastWord).to.equal('얼었어'); + + pastWord = kc.conjugate('늘다', {tense: 'past'}); + expect(pastWord).to.equal('늘었어'); + }); + it('should conjugate words with ㅜㄱ, ㅓㄱ, and ㅡㄱ final vowel correctly', () => { + const kc = new Korean(); + let pastWord = kc.conjugate('죽다', {tense: 'past'}); + expect(pastWord).to.equal('죽었어'); + + pastWord = kc.conjugate('먹다', {tense: 'past'}); + expect(pastWord).to.equal('먹었어'); + }); + it('should conjugate words with ㅂ다 words correctly', () => { + const kc = new Korean(); + let pastWord = kc.conjugate('춥다', {tense: 'past'}); + expect(pastWord).to.equal('추웠어'); + + pastWord = kc.conjugate('덥다', {tense: 'past'}); + expect(pastWord).to.equal('더웠어'); + }); + it('should conjugate words with 있다 words correctly', () => { + const kc = new Korean(); + let pastWord = kc.conjugate('있다', {tense: 'past'}); + expect(pastWord).to.equal('있었어'); + }); + }); });