nltk / nltk/nltk_data

hmm_treebank_pos_tagger doesn't load

Open
#4 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.8k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

In [7]: _POS_TAGGER = 'taggers/hmm_treebank_pos_tagger/treebank.tagger.pickle.gz'

In [8]: pickle.load(nltk.data.find(_POS_TAGGER).open())
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-8-3e64e4dab40b> in <module>()
----> 1 pickle.load(nltk.data.find(_POS_TAGGER).open())

/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.pyc in load(file)
   1376 
   1377 def load(file):
-> 1378     return Unpickler(file).load()
   1379 
   1380 def loads(str):

/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.pyc in load(self)
    856             while 1:
    857                 key = read(1)
--> 858                 dispatch[key](self)
    859         except _Stop, stopinst:
    860             return stopinst.value

/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.pyc in load_reduce(self)
   1131         args = stack.pop()
   1132         func = stack[-1]
-> 1133         value = func(*args)
   1134         stack[-1] = value
   1135     dispatch[REDUCE] = load_reduce

/Users/kmike/envs/nltk/lib/python2.7/copy_reg.pyc in _reconstructor(cls, base, state)
     46 def _reconstructor(cls, base, state):
     47     if base is object:
---> 48         obj = object.__new__(cls)
     49     else:
     50         obj = base.__new__(cls, state)

TypeError: object.__new__(ConditionalProbDist) is not safe, use collections.defaultdict.__new__()

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure while loading taggers/hmm_treebank_pos_tagger/treebank.tagger.pickle.gz with nltk.data.find and pickle.load. Trace the tagger resource's loading and serialization compatibility, then verify that the resource loads without the reported TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.