def accept(self, wordTokens, worm, prevWord, nextWord, headObj, tags): curStr = wordTokens.current() if korutils.isKor(curStr): first, vowel, final = korutils.decompose(curStr) return final in self.jongsungs else: return False
def accept(self, wordTokens, worm, prevWord, nextWord, headObj, tags): prevStr = wordTokens.peekPrev() if korutils.isKor(prevStr): first, vowel, final = korutils.decompose(prevStr) #print("*****", wordTokens.text, wordTokens.current(), final, len(final), len(final) == 0) return vowel in korutils.NEGATIVE_VOWEL else: return False
def accept(self, wordTokens, worm, prevWord, nextWord, headObj, tags): prevStr = wordTokens.peekPrev() if korutils.isKor(prevStr): first, vowel, final = korutils.decompose(prevStr) #print("*****", wordTokens.text, wordTokens.current(), final, len(final), len(final) == 0) return len(final) == 0 or final in self.jongsungs else: return True
def accept(self, wordTokens, worm, prevWord, nextWord, headObj, tags): prevStr = wordTokens.peekPrev() if korutils.isKor(prevStr): first, vowel, final = korutils.decompose(prevStr) if (len(self.jongsungs) > 0): return final in self.jongsungs else: return len(final) > 0 else: return True
def _procedeImpl(self, wordTokens, followingAux, wordObj, prevPair, prevWord, nextWord): curStr = wordTokens.current() if korutils.isKor(curStr): first, vowel, final = korutils.decompose(curStr) if final in self.jongsungs: removed = korutils.removeJongsung(curStr) head = ''.join([wordTokens.head(wordTokens.curidx), removed]) tail = ''.join([final, wordTokens.tail(wordTokens.curidx + 1)]) return sm.Pair(wordTokens.text, head, tail, self.score).addtags(self.getTag(prevPair)) return None
def _procedeImpl(self, wordTokens, followingAux, wordObj, prevPair, prevWord, nextWord): prevStr = wordTokens.peekPrev() #print("#### NextJongsungAux ** ", prevStr) if korutils.isKor(prevStr): first, vowel, final = korutils.decompose(prevStr) #print("***NextJongsungAux **", prevStr, final , final in self.jongsungs) if final in self.jongsungs: removed = korutils.removeJongsung(prevStr) head = ''.join( [wordTokens.head(wordTokens.curidx - 1), removed]) tail = ''.join([final, wordTokens.tail()]) return sm.Pair(wordTokens.text, head, tail, self.score).addtags(self.getTag(prevPair)) return None