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 → Conversion de Kanji avec Python, Mecab, API GoogleTranslitrate. Module pour lister la sortie MeCab en Python (mecab-python)
Recommended Posts