def add_morph(orig, new): orig_poem = u'' for a, b in orig: orig_poem = orig_poem+' '+unicode(a) orig_poem = orig_poem.strip() new_words = u'' for l in new: for elem in l: el = unicode(elem[0]) new_words = new_words+' '+el new_words = new_words.strip() ana_orig = morpha_fi.analyse_morphologically(orig_poem) ana_new = morpha_fi.analyse_morphologically(new_words) orig_wa = morpha_fi.words_with_analyses(ana_orig) new_wa = morpha_fi.words_with_analyses(ana_new) mor = morphology(orig, orig_wa, new, new_wa) #TO BE FIXED: return (mor, [])
def pos_tag(text): analysis = morpha_fi.analyse_morphologically(text) result = morpha_fi.pos_tag(analysis) return result