import MeCab
def mecab_list(text):
tagger = MeCab.Tagger("-Ochasen")
tagger.parse('')
node = tagger.parseToNode(text)
word_class = []
while node:
word = node.surface
wclass = node.feature.split(',')
if wclass[0] != u'BOS/EOS':
if wclass[6] == None:
word_class.append((wclass[7]))
else:
word_class.append((wclass[7]))
node = node.next
mojiretsu=''.join(word_class)
return mojiretsu
Kanji → Katakana → Hiragana → Kanji conversion with Python, Mecab, GoogleTranslitrate API. Module to list MeCab output in Python (mecab-python)
Recommended Posts