Artificial intelligent assistant

MeCabを用いたPythonの品詞抽出について MeCabPython `TypeError: in method 'Tagger_parse', argument 2 of type 'char const *'` * Python 3.7 * mecab-python-windows0.996.3 pycharm import sys import MeCab m = MeCab.Tagger("-Ochasen") datafile = open("\.txt", 'r', encoding='UTF-8') nouns = [ sentence.split('')[0] for sentence in m.parse(datafile).splitlines if "" in m.parse(datafile).split('')[4] ] print(nouns) datafile.close()

`datafile` `MeCab.Tagger` `parse()`




import sys
import MeCab

m = MeCab.Tagger("-Ochasen")
with open("test.txt", 'r', encoding='UTF-8') as f:
s = f.read()

parse_result = [l.split('\t') for l in m.parse(s).splitlines()][:-1]
nouns = [w[0] for w in parse_result if w[3].startswith('')]
print(nouns)

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy d88400ab308e356f740d9d63b656fbf3