'Stem a Romanian word and return the stemmed form.
:param word: The word that is stemmed.
:type word: str or unicode
:return: The stemmed form.
:rtype: unicode'

def stem(self, word):

    word = word.lower()
    if (word in self.stopwords):
        return word
    step1_success = False
    step2_success = False
    for i in range(1, (len(word) - 1)):
        if ((word[(i - 1)] in self.__vowels) and (word[(i + 1)] in self.__vowels)):
            if (word[i] == u'u'):
                word = u''.join((word[:i], u'U', word[(i + 1):]))
            elif (word[i] == u'i'):
                word = u''.join((word[:i], u'I', word[(i + 1):]))
    (r1, r2) = self._r1r2_standard(word, self.__vowels)
    rv = self._rv_standard(word, self.__vowels)
    for suffix in self.__step0_suffixes:
        if word.endswith(suffix):
            if (suffix in r1):
                if (suffix in (u'ul', u'ului')):
                    word = word[:(- len(suffix))]
                    if (suffix in rv):
                        rv = rv[:(- len(suffix))]
                    else:
                        rv = u''
                elif ((suffix == u'aua') or (suffix == u'atei') or ((suffix == u'ile') and (word[(-5):(-3)] != u'ab'))):
                    word = word[:(-2)]
                elif (suffix in (u'ea', u'ele', u'elor')):
                    word = suffix_replace(word, suffix, u'e')
                    if (suffix in rv):
                        rv = suffix_replace(rv, suffix, u'e')
                    else:
                        rv = u''
                elif (suffix in (u'ii', u'iua', u'iei', u'iile', u'iilor', u'ilor')):
                    word = suffix_replace(word, suffix, u'i')
                    if (suffix in rv):
                        rv = suffix_replace(rv, suffix, u'i')
                    else:
                        rv = u''
                elif (suffix in (u'a\u0163ie', u'a\u0163ia')):
                    word = word[:(-1)]
            break
    while True:
        replacement_done = False
        for suffix in self.__step1_suffixes:
            if word.endswith(suffix):
                if (suffix in r1):
                    step1_success = True
                    replacement_done = True
                    if (suffix in (u'abilitate', u'abilitati', u'abilit\u0103i', u'abilit\u0103\u0163i')):
                        word = suffix_replace(word, suffix, u'abil')
                    elif (suffix == u'ibilitate'):
                        word = word[:(-5)]
                    elif (suffix in (u'ivitate', u'ivitati', u'ivit\u0103i', u'ivit\u0103\u0163i')):
                        word = suffix_replace(word, suffix, u'iv')
                    elif (suffix in (u'icitate', u'icitati', u'icit\u0103i', u'icit\u0103\u0163i', u'icator', u'icatori', u'iciv', u'iciva', u'icive', u'icivi', u'iciv\u0103', u'ical', u'icala', u'icale', u'icali', u'ical\u0103')):
                        word = suffix_replace(word, suffix, u'ic')
                    elif (suffix in (u'ativ', u'ativa', u'ative', u'ativi', u'ativ\u0103', u'a\u0163iune', u'atoare', u'ator', u'atori', u'\u0103toare', u'\u0103tor', u'\u0103tori')):
                        word = suffix_replace(word, suffix, u'at')
                        if (suffix in r2):
                            r2 = suffix_replace(r2, suffix, u'at')
                    elif (suffix in (u'itiv', u'itiva', u'itive', u'itivi', u'itiv\u0103', u'i\u0163iune', u'itoare', u'itor', u'itori')):
                        word = suffix_replace(word, suffix, u'it')
                        if (suffix in r2):
                            r2 = suffix_replace(r2, suffix, u'it')
                else:
                    step1_success = False
                break
        if (not replacement_done):
            break
    for suffix in self.__step2_suffixes:
        if word.endswith(suffix):
            if (suffix in r2):
                step2_success = True
                if (suffix in (u'iune', u'iuni')):
                    if (word[(-5)] == u'\u0163'):
                        word = u''.join((word[:(-5)], u't'))
                elif (suffix in (u'ism', u'isme', u'ist', u'ista', u'iste', u'isti', u'ist\u0103', u'i\u015fti')):
                    word = suffix_replace(word, suffix, u'ist')
                else:
                    word = word[:(- len(suffix))]
            break
    if ((not step1_success) and (not step2_success)):
        for suffix in self.__step3_suffixes:
            if word.endswith(suffix):
                if (suffix in rv):
                    if (suffix in (u'seser\u0103\u0163i', u'seser\u0103m', u'ser\u0103\u0163i', u'sese\u015fi', u'seser\u0103', u'ser\u0103m', u'sesem', u'se\u015fi', u'ser\u0103', u'sese', u'a\u0163i', u'e\u0163i', u'i\u0163i', u'\xe2\u0163i', u'sei', u'\u0103m', u'em', u'im', u'\xe2m', u'se')):
                        word = word[:(- len(suffix))]
                        rv = rv[:(- len(suffix))]
                    elif ((not rv.startswith(suffix)) and (rv[(rv.index(suffix) - 1)] not in u'aeio\u0103\xe2\xee')):
                        word = word[:(- len(suffix))]
                    break
    for suffix in (u'ie', u'a', u'e', u'i', u'\u0103'):
        if word.endswith(suffix):
            if (suffix in rv):
                word = word[:(- len(suffix))]
            break
    word = word.replace(u'I', u'i').replace(u'U', u'u')
    return word
