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

update phenopy api #43

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion txt2hpo/nlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ def similarity_term_to_context(term, context, model):
:return: float
"""
def remove_out_of_vocab(tokens):
return [x for x in tokens if x in model.key_to_index]
try:
# gensim 3.8
return [x for x in tokens if x in model.vocab]
except AttributeError:
# gensim 4.0
return [x for x in tokens if x in model.wv.key_to_index]

hpo_term = hpo_network.nodes[term]
hpo_term_definition = hpo_term['name']
Expand Down
2 changes: 1 addition & 1 deletion txt2hpo/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import math
from phenopy.config import config as phenopy_config
from phenopy import generate_annotated_hpo_network
from phenopy.build_hpo import generate_annotated_hpo_network

import sys
import subprocess
Expand Down