def pr(sentence): import BeautySafe as BS list_res = sentence.getSentence('dict') #sentence = 'montru miajn kursojn de rusia dolaro' BS.FWrite('----'+BS.getTime()+'\n') sentence = '' for k, v in list_res.items(): sentence += v['word'] + ' ' BS.FWrite(' '+sentence+'\n\n') BS.safeResults(list_res, 'PostMorphA') print 'Ready! :)'
index, GN = _getPostMorphA(index, sentence) GrammarNazi.extend(GN) index += 1 # удаляем служебные части речи sentence.delByCharacteristic('POSpeech', 'preposition') pr(sentence) return sentence, GrammarNazi if __name__ == '__main__': from MorphologicalAnalysis import getMorphA import BeautySafe as BS #sentence = 'montru miajn kursojn de rusia dolaro' sentence = '' BS.FWrite('----'+BS.getTime()+'\n') list_res = getMorphA(sentence) BS.safeResults(list_res, 'MorphA') BS.safeUnknown(list_res) tree = getPostMorphA(list_res) BS.FWrite('\n '+sentence+'\n') sentence = '' for k, v in tree.items(): sentence += v['word'] + ' ' BS.FWrite(' '+sentence+'\n\n') BS.safeResults(tree, 'PostMorphA') print 'Ready! :)'