Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NewsNounExtractor base_noun_dictionary argument 사용 시 오류 #130

Closed
hungry-wook opened this issue Feb 1, 2021 · 3 comments
Closed

Comments

@hungry-wook
Copy link
Collaborator

from soynlp.noun import NewsNounExtractor
noun_extractor = NewsNounExtractor(base_noun_dictionary=['단어1'])

위와 같이 코드 실행 시, 아래와 같은 오류가 발생합니다

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-49-3fb4645fbd51> in <module>
      1 from soynlp.noun import NewsNounExtractor
----> 2 noun_extractor = NewsNounExtractor(base_noun_dictionary=['단어1'])

~/anaconda3/lib/python3.8/site-packages/soynlp/noun/_noun_news.py in __init__(self, max_left_length, max_right_length, predictor_fnames, verbose, base_noun_dictionary)
     14         self.verbose = verbose
     15         self.r_scores = {}
---> 16         self.noun_dictionary = noun_dictionary if base_noun_dictionary else {}
     17 
     18         import os

NameError: name 'noun_dictionary' is not defined
@lovit
Copy link
Owner

lovit commented Feb 1, 2021

noun_dictionary

NewsNounExtractor 는 deprecated 할 예정입니다 ㅠㅜ

@lovit
Copy link
Owner

lovit commented Feb 1, 2021

용례를 보니, 아마도 사전에 정의된 명사를 이용하여 문장에서 명사만 추려내시려는 것으로 보입니다. 리팩 브랜치 (refactoring) 의 코드의 사용법을 추천드립니다.

from soynlp.tokenizer import NounMatchTokenizer

noun_scores = {'아이': 0.5, '아이오': 0.7, '아이오아이': 0.8, '오이': 0.7}
noun_tokenizer = NounMatchTokenizer(noun_scores)
sentence = '아이오아이의아이들은 오이오이를 좋아하는 아이들이오'
noun_tokenizer.tokenize(sentence)
['아이오아이', '아이', '오이오이', '아이']

@hungry-wook
Copy link
Collaborator Author

추가했으면 하는 기능 관련하여 이슈 생성하였습니다
#131

우선은 알려주신 방법을 활용하겠습니다. 감사합니다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants