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

Error in wordsteam.py #31

Open
kyongsoolee opened this issue Jul 14, 2021 · 0 comments
Open

Error in wordsteam.py #31

kyongsoolee opened this issue Jul 14, 2021 · 0 comments

Comments

@kyongsoolee
Copy link

Dear, jalajthanaki

These days, I tried to study NLP using your book 'Python Natural Language Processing' in Korea.
I have some problem in Ch3, wordsteam.py.
I tried to solve it through internet searching such as stackoverflow for long time.
(Actually I am a beginner in Python and NLP)
But, I can't solve it. So, finally I think I need your help if you can.
When I run this code, wordsteam.py, I get this below result.
You know how can I fix it?


(base) C:\Users\kyong\NLP\Ch3>python wordsteam.py

Derivational Morphemes
happi
unkind

Inflectional Morphemes
dog
expect

Some examples
unexpect
disagr
disagre
agreement
quirki
histor
canon

Derivational Morphemes using polyglot library
Traceback (most recent call last):
File "wordsteam.py", line 56, in
polyglot_stem()
File "wordsteam.py", line 43, in polyglot_stem
print("{:<20}{}".format(w, w.morphemes))
File "C:\Users\kyong\anaconda3\lib\site-packages\polyglot\decorators.py", line 20, in get
value = obj.dict[self.func.name] = self.func(obj)
File "C:\Users\kyong\anaconda3\lib\site-packages\polyglot\text.py", line 269, in morphemes
words, score = self.morpheme_analyzer.viterbi_segment(self.string)
File "C:\Users\kyong\anaconda3\lib\site-packages\polyglot\decorators.py", line 20, in get
value = obj.dict[self.func.name] = self.func(obj)
File "C:\Users\kyong\anaconda3\lib\site-packages\polyglot\text.py", line 265, in morpheme_analyzer
return load_morfessor_model(lang=self.language)
File "C:\Users\kyong\anaconda3\lib\site-packages\polyglot\decorators.py", line 30, in memoizer
cache[key] = obj(*args, **kwargs)
File "C:\Users\kyong\anaconda3\lib\site-packages\polyglot\load.py", line 128, in load_morfessor_model
p = locate_resource(src_dir, lang)
File "C:\Users\kyong\anaconda3\lib\site-packages\polyglot\load.py", line 47, in locate_resource
if downloader.status(package_id) != downloader.INSTALLED:
File "C:\Users\kyong\anaconda3\lib\site-packages\polyglot\downloader.py", line 737, in status
info = self._info_or_id(info_or_id)
File "C:\Users\kyong\anaconda3\lib\site-packages\polyglot\downloader.py", line 507, in _info_or_id
return self.info(info_or_id)
File "C:\Users\kyong\anaconda3\lib\site-packages\polyglot\downloader.py", line 929, in info
self._update_index() # If package is not found, most probably we did not
File "C:\Users\kyong\anaconda3\lib\site-packages\polyglot\downloader.py", line 831, in _update_index
data = urlopen(index_url).read()
File "C:\Users\kyong\anaconda3\lib\urllib\request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\kyong\anaconda3\lib\urllib\request.py", line 531, in open
response = meth(req, response)
File "C:\Users\kyong\anaconda3\lib\urllib\request.py", line 640, in http_response
response = self.parent.error(
File "C:\Users\kyong\anaconda3\lib\urllib\request.py", line 563, in error
result = self._call_chain(*args)
File "C:\Users\kyong\anaconda3\lib\urllib\request.py", line 502, in _call_chain
result = func(*args)
File "C:\Users\kyong\anaconda3\lib\urllib\request.py", line 755, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "C:\Users\kyong\anaconda3\lib\urllib\request.py", line 531, in open
response = meth(req, response)
File "C:\Users\kyong\anaconda3\lib\urllib\request.py", line 640, in http_response
response = self.parent.error(
File "C:\Users\kyong\anaconda3\lib\urllib\request.py", line 569, in error
return self._call_chain(*args)
File "C:\Users\kyong\anaconda3\lib\urllib\request.py", line 502, in _call_chain
result = func(*args)
File "C:\Users\kyong\anaconda3\lib\urllib\request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden

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

1 participant