Skip to content

Commit

Permalink
consistency: rename key to item
Browse files Browse the repository at this point in the history
  • Loading branch information
piskvorky committed Jun 23, 2017
1 parent 6a98f86 commit c601cbf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions gensim/models/fast_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def __init__(self, doc2items=iter_gram1):
self.doc2items = doc2items
self.hash2cnt = Counter() # TODO replace by some GIL-free low-level struct

def hash(self, key):
return hash(key)
def hash(self, item):
return hash(item)

def update(self, documents):
"""
Expand All @@ -72,9 +72,9 @@ def prune_vocab(self):
# Or use a fixed-size data structure to start with (hyperloglog?)
raise NotImplementedError

def get(self, key, default=None):
"""Return the item frequency of `key` (or `default` if key not present)."""
return self.hash2cnt.get(self.hash(key), default)
def get(self, item, default=None):
"""Return the item frequency of `item` (or `default` if item not present)."""
return self.hash2cnt.get(self.hash(item), default)

def merge(self, other):
"""
Expand Down

0 comments on commit c601cbf

Please sign in to comment.