Skip to content

Commit

Permalink
Merge pull request #795 from HRNPH/dev
Browse files Browse the repository at this point in the history
adding tonemark removal to fix mattra checking
  • Loading branch information
wannaphong committed May 1, 2023
2 parents 52ff97e + 38c0b1c commit 7321c36
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pythainlp/khavee/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from typing import List, Union
from pythainlp.tokenize import subword_tokenize
from pythainlp.util import sound_syllable

from pythainlp.util import remove_tonemark
class KhaveeVerifier:
def __init__(self):
"""
Expand Down Expand Up @@ -215,6 +215,7 @@ def check_marttra(self, word: str) -> str:
if word[-1] == 'ร' and word[-2] in ['ต','ท'] :
word = word[:-1]
word = self.handle_karun_sound_silence(word)
word = remove_tonemark(word)
if 'ำ' in word or ('ํ' in word and 'า' in word) or 'ไ' in word or 'ใ' in word:
return 'กา'
elif word[-1] in ['า','ะ','ิ','ี','ุ','ู','อ'] or ('ี' in word and 'ย' in word[-1]) or ('ื' in word and 'อ' in word[-1]):
Expand Down

0 comments on commit 7321c36

Please sign in to comment.