fix: 초성 오토마타에서 head가 제때 정리되지 않는 버그

This commit is contained in:
2022-04-06 02:41:24 +09:00
parent c7df50d899
commit c96f6d9381
+2
View File
@@ -76,12 +76,14 @@ function automata초성(text: string, convList: Record<string, Record<string, st
result.push(head); result.push(head);
if(!(ch in convList)){ if(!(ch in convList)){
result.push(ch); result.push(ch);
head = undefined;
continue; continue;
} }
head = ch; head = ch;
} }
if(head !== undefined){ if(head !== undefined){
result.push(head); result.push(head);
head = undefined;
} }
return result.join(''); return result.join('');
} }