remove duplicated t eg tittear -> titear

This commit is contained in:
Tan, Kian-ting 2021-01-13 22:15:02 +08:00
parent 1ca69339c9
commit 1fa6893201
3 changed files with 16 additions and 7 deletions

View file

@ -34,8 +34,8 @@ function emptyString(str) {
var isReallyEmpty = (str == "");
return isReallyEmpty || isContainedSpace;
}
original.addEventListener('keypress', generateConjMain);
conjStem.addEventListener('keypress', generateConjMain);
original.addEventListener('keyup', generateConjMain);
conjStem.addEventListener('keyup', generateConjMain);
original.addEventListener('change', generateConjMain);
conjStem.addEventListener('change', generateConjMain);
startConj.addEventListener('click', generateConjMain);
@ -244,6 +244,10 @@ function generateConj(orig_txt, stem_txt, conj_no) {
var currentSuffix = suffixTable[currentSuffixTableKey][j];
if (currentSuffix != null) {
item.innerHTML = stem_txt + currentSuffix;
// remove duplicated t
if (stem_txt.match(/.*[tT]$/) && currentSuffix[0] == 't') {
item.innerHTML = stem_txt + currentSuffix.substring(1);
}
}
}
}

11
conj.ts
View file

@ -40,8 +40,8 @@ function emptyString(str : string){
}
original.addEventListener('keypress', generateConjMain);
conjStem.addEventListener('keypress', generateConjMain);
original.addEventListener('keyup', generateConjMain);
conjStem.addEventListener('keyup', generateConjMain);
original.addEventListener('change', generateConjMain);
conjStem.addEventListener('change', generateConjMain);
startConj.addEventListener('click', generateConjMain);
@ -57,7 +57,8 @@ function generateConjMain(event : any){
conjstem_text = original_text;
};
generateConj(original_text, conjstem_text, conj_no);
}}
}
}
function checkedIfBroadEnd(str_array : string[]){
for (var i = str_array.length - 1; i >=0; i--){
@ -302,6 +303,10 @@ function generateConj(orig_txt : string, stem_txt : string, conj_no : Number){
if (currentSuffix != null) {
item.innerHTML = stem_txt + currentSuffix;
// remove duplicated t
if (stem_txt.match(/.*[tT]$/) && currentSuffix[0] == 't'){
item.innerHTML = stem_txt + currentSuffix.substring(1);
}
}
}

View file

@ -7,7 +7,7 @@
<div>
<h1>愛爾蘭語動詞變化產生器</h1>
<p><i>Gineadóir Réimniú na Gaeilge</i></p>
version 20210112<a href="https://github.com/Yoxem/irish-verb-conjugator">Github repo</a></div>
version 20210113<a href="https://github.com/Yoxem/irish-verb-conjugator">Github repo</a></div>
<div><br>
</div>
<div>詞彙原形:<input id="original" type="text"></div>
@ -196,7 +196,7 @@
<h3>註:</h3>
<ol>
<li> 以上動詞變化以凱里 (Ciarraí) 和科克 (Corcaigh) 的芒斯特方言 (Gaelainn na Mumhan, Munster Irish) 為準。參考資料:<a
href="http://corkirish.wordpress.com/">Cork Irish</a><a href="http://reimnigh.net">reimnigh.com</a></li>
href="http://corkirish.wordpress.com/">Cork Irish</a><a href="http://reimnigh.com">reimnigh.com</a></li>
<li><b>此表不含動名詞和過去分詞</b></li>
<li>前面接 do/d',接 do/d' 時動詞要軟音化 (seimhiıú, lenition)無人稱除外。d' 接在母音和 fh軟音化後前面do 接在子音前面。</li>
<li>前接連接詞 dá 時,動詞要暗音化 (urú, eclipsis)。</li>