Skip to content

Commit

Permalink
Batch model queries for faster for entity prior feature lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
andychisholm committed Apr 27, 2016
1 parent b28958a commit a366d15
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nel/features/probability.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ def __init__(self, entity_model_tag):
self.tag = entity_model_tag
self.em = disambiguation.EntityCounts(self.tag)

def compute_doc_state(self, doc):
candidates = set(c.id for chain in doc.chains for c in chain.candidates)
return dict(self.em.iter_counts(candidates))

def compute_raw(self, doc, chain, candidate, state):
return self.em.count(candidate.id) + 0.1
return state[candidate.id] + 0.1

@classmethod
def add_arguments(cls, p):
Expand Down

0 comments on commit a366d15

Please sign in to comment.