konlpy icon indicating copy to clipboard operation
konlpy copied to clipboard

kkma.nouns() return NoneType

Open jingkunzler211 opened this issue 4 years ago • 2 comments

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.

image

image

image

jingkunzler211 avatar Jan 31 '21 23:01 jingkunzler211

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😊 image

coding-Benny avatar Sep 04 '21 03:09 coding-Benny

Hello @jingkunzler211, could you please confirm that solution provided by coding-Benny worked as intended? Thanks in advance.

combacsa avatar Jan 02 '22 17:01 combacsa