Issue 750 in nltk: Deletion of FreqDist element does not reset cache

1 view
Skip to first unread message

nl...@googlecode.com

unread,
Apr 7, 2014, 7:06:48 AM4/7/14
to nltk-...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 750 by Twinc...@gmail.com: Deletion of FreqDist element does not
reset cache
http://code.google.com/p/nltk/issues/detail?id=750

What version of NLTK are you using? 2.0.4
What steps will reproduce the problem? included

What is the expected output?
len 2
valid-gram1
valid-gram2

What do you see instead?
len 2
some-gram1
some-gram2
...
valid-gram1
...
valid-gram2
...
some-gramN

Analisys:
AbstractCollocationFinder.apply_freq_filter() use del operator to delete
filtered ngrams from FreqDist, but FreqDist does not update cache after
this deletion.

My advice:
FreqDist class should contain __delitem__ method with next code:
def __delitem__(self, sample):
dict.__delitem__(self, sample)
self._reset_caches()


Attachments:
freqdist_delitem.py 381 bytes

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages