Skip to content

Commit

Permalink
fix: use standard IPA algorithm (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
noomorph authored Jul 14, 2023
1 parent 63b3709 commit 410f6dd
Showing 1 changed file with 3 additions and 53 deletions.
56 changes: 3 additions & 53 deletions src/utils/latinToIpa/latinToIpa.ts
Original file line number Diff line number Diff line change
@@ -1,55 +1,5 @@
import { transliterate } from '@interslavic/utils';

export function latinToIpa(text: string) {
return text.replace(/nads([eę])/g, 'nac$1')
.replace(/ı/g, 'i̯')
.replace(/e/g, 'ɛ')
.replace(/ě/g, 'ьɛ')
.replace(/ę/g, 'ьæ')
.replace(/ŕ/g, 'ьǝr')
.replace(/([ščžj])ь/g, '$1')
.replace(/y/g, 'ɪ')
.replace(/å/g, 'ɒ')
.replace(/o/g, 'ɔ')
.replace(/[ŕṙ]/g, 'ər')
.replace(/[ŀĺ]/g, 'əl')
.replace(/[ò’]/g, 'ə')
.replace(/ų/g, 'ʊ')
.replace(/c/g, 't͡s')
.replace(/č/g, 't͡ʃ')
.replace(/šć/g, 'ɕt͡ɕ')
.replace(/ć/g, 't͡ɕ')
.replace(/dz/g, 'd͡z')
.replace(//g, 'd͡ʒ')
.replace(/žđ/g, 'ʑd͡ʑ')
.replace(/đ/g, 'd͡ʑ')
.replace(/x/g, 'ks')
.replace(/h/g, 'x')
.replace(/š/g, 'ʃ')
.replace(/ž/g, 'ʒ')
.replace(//g, 'sʲtʲ')
.replace(/st́/g, 'sʲtʲ')
.replace(//g, 'zʲdʲ')
.replace(/sd́/g, 'sʲdʲ')
.replace(/ť/g, 'tʲ')
.replace(//g, 'tʲ')
.replace(//g, 'tʲ')
.replace(/ď/g, 'dʲ')
.replace(//g, 'dʲ')
.replace(//g, 'dʲ')
.replace(/ś/g, 'sʲ')
.replace(//g, 'sʲ')
.replace(/ź/g, 'zʲ')
.replace(//g, 'zʲ')
.replace(/ř/g, 'rʲ')
.replace(/r[ьj]/g, 'rʲ')
.replace(/ń/g, 'ɲ')
.replace(/n[ьj]/g, 'ɲ')
.replace(/ľ/g, 'ʎ')
.replace(/ĺ/g, 'ʎ')
.replace(/l[ьj]/g, 'ʎ')
.replace(/ь/g, 'j')
.replace(/l/g, 'ɫ')
.replace(/ɫ([ii̯e])/g, 'l$1')
.replace(/t͡sj/g, 't͡sʲ')
.replace(/d͡zj/g, 'd͡zʲ')
;
return transliterate(text, 'art-x-interslv-fonipa');
}

0 comments on commit 410f6dd

Please sign in to comment.