konlpy
konlpy copied to clipboard
kkma.nouns() return NoneType
I'm doing a project and I want to create a word cloud based on tokenized word frequencies.
Here's my code and some screenshots. I don't understand why I can print nouns but its type is NoneType.
It looks like you're working on BTS - FAKE LOVE lyrics :)
By the way, I looked at your code and it seems to me that the reason why nouns
are printed, but the type is NoneType
is there is no return value from pprint()
.
So in the code nouns = pprint(kkma.nouns(text))
, pprint()
prints the result of extracting the noun and returns nothing to nouns
.
The result of pprint()
was truncated because it was long, but the result of print(nouns)
is probably None
.
To get the desired result, you need to modify it as follows:
- nouns = pprint(kkma.nouns(text))
+ nouns = kkma.nouns(text)
# optional, if you want to check whether the desired result is well
pprint(nouns)
Here is my screenshot😊
Hello @jingkunzler211, could you please confirm that solution provided by coding-Benny worked as intended? Thanks in advance.