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

Subtlex OOV #5

Open
OmerShubi opened this issue Jan 27, 2023 · 0 comments
Open

Subtlex OOV #5

OmerShubi opened this issue Jan 27, 2023 · 0 comments

Comments

@OmerShubi
Copy link
Collaborator

# TODO subtlex freq should be 'inf' if missing, not zero?
subtlex_freqs = []
for word in words:
tokens = tokenize(word, lang='en')
one_over_result = 0.0
try:
for token in tokens:
one_over_result += 1.0 / subtlex.loc[token, 'Frequency']
except KeyError:
subtlex_freq = 0
else:
subtlex_freq = 1.0 / one_over_result if one_over_result != 0 else 0
subtlex_freqs.append(subtlex_freq)
frequencies['subtlex_Frequency'] = subtlex_freqs

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

No branches or pull requests

1 participant