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

Add lower bound wilson score for bernoulli parameter #22

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

c-martinez
Copy link
Contributor

Alternative way of converting counts to probabilities (as suggested by #13 ).

In the following example, entities like: Chiliometrum, Magnum opus, Litus, Occidens, Septentrio, etc, are assigned 1.0 probability when using 'simple' count conversion, but get different probabilities when using 'wilson' method.

import re
from semanticizest import Semanticizer

sem = Semanticizer('la.model', score='wilson', wilson_confidence=0.95)

text = """Area 389.434 km² Naxos est maxima Cycladum insula. Insulae orientali sunt litora ardua, in occidentem versus loca planiora patent, a septentrionibus ad meridiem montes granitici insulam transeunt, qui usque ad 1000 metra surgunt; quorum summa cacumina sunt Mons Iovis et Coronus."""
toks = re.findall('\w+', text)

for cand in sem.all_candidates(toks):
   print cand

However, it is significantly slower.

@@ -4,6 +4,9 @@

import six

from math import sqrt
from scipy.stats import norm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should add scipy to requirements.txt.

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

Successfully merging this pull request may close these issues.

2 participants