def matchremove_noun_endings(word):
    """Remove the noun and adverb word endings"""

    was_stemmed = False

    """common and proper noun and adjective word endings sorted by charlen, then alph"""
    noun_endings = ['arons', 'ains', 'aron', 'ment', 'ain', 'age', 'on', 'es', 'ée', 'ee', 'ie', 's']

    for ending in noun_endings:
        """ignore exceptions"""
        if word in exceptions:
            word = word
            was_stemmed = True
            break
        if word == ending:
            word = word
            was_stemmed = True
            break
        """removes noun endings"""
        if word.endswith(ending):
            word = re.sub(r'{0}$'.format(ending), '', word)
            was_stemmed = True
            break

    return word, was_stemmed
def matchremove_noun_endings ( word ) : was_stemmed = False """common and proper noun and adjective word endings sorted by charlen, then alph""" noun_endings = [ 'arons' , 'ains' , 'aron' , 'ment' , 'ain' , 'age' , 'on' , 'es' , 'ée' , 'ee' , 'ie' , 's' ] for ending in noun_endings : if word in exceptions : word = word was_stemmed = True break if word == ending : word = word was_stemmed = True break """removes noun endings""" if word . endswith ( ending ) : word = re . sub ( r'{0}$' . format ( ending ) , '' , word ) was_stemmed = True break return word , was_stemmed
Remove the noun and adverb word endings