Example #1
0
File: lex.py Project: joyrexus/ldp
class IrregularForm(object):
    '''Use for normalizing irregular word forms.'''

    def __init__(self):
        verb_file = WORDS_DIR + "/irregular/verb.txt"
        noun_file = WORDS_DIR + "/irregular/noun.txt"
        self.words = WordList(verb_file, noun_file)

    def normalize(self, word):
        '''
        Return normalized word form if present, otherwise return 
        original form.

        '''
        return self.words.get(word, word)