Пример #1
0
 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
Пример #2
0
    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
Пример #3
0
    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
Пример #4
0
 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
Пример #5
0
 def _procedeImpl(self, wordTokens, followingAux, wordObj, prevPair,
                  prevWord, nextWord):
     #print("TransformedStem", self.head)
     curStr = wordTokens.current()
     if korutils.isKor(curStr):
         head = ''.join([wordTokens.head(wordTokens.curidx), self.head])
         tail = wordTokens.tail(wordTokens.curidx + 1)
         return sm.Pair(wordTokens.text, head, tail, self.score).addtags(
             self.getTag(prevPair)).addpos(self.pos)
     return None
Пример #6
0
 def _procedeImpl(self, wordTokens, followingAux, wordObj, prevPair,
                  prevWord, nextWord):
     curStr = wordTokens.current()
     #print("TransformedAux", curStr)
     if korutils.isKor(curStr):
         head = ''.join([wordTokens.head(wordTokens.curidx), self.head])
         tail = ''.join([self.tail, wordTokens.tail(wordTokens.curidx + 1)])
         #print("TransformedAux2 head=", head, ", tail=", tail)
         return sm.Pair(wordTokens.text, head, tail,
                        self.score).addtags(self.getTag(prevPair))
     return None
Пример #7
0
    def _procedeImpl(self, wordTokens, followingAux, wordObj, prevPair,
                     prevWord, nextWord):
        curStr = wordTokens.current()
        prevStr = wordTokens.peekPrev()

        if korutils.isKor(curStr):
            prevStr = korutils.addJongsung(prevStr, self.headJongsung)
            head = ''.join([wordTokens.head(wordTokens.curidx - 1), prevStr])
            tail = ''.join([self.tail, wordTokens.tail(wordTokens.curidx + 1)])
            return sm.Pair(wordTokens.text, head, tail,
                           self.score).addtags(self.getTag(prevPair))
        return None
Пример #8
0
    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
Пример #9
0
 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