Skip to content

Commit

Permalink
Merge pull request #44 from ccb-hms/development
Browse files Browse the repository at this point in the history
Fixes bugs with adding tags
  • Loading branch information
paynejason authored Dec 6, 2023
2 parents 58ab290 + f95db93 commit ea7b970
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,20 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: show python path
run: |
python -c "import sys; print('\n'.join(sys.path))"
PYTHONPATH
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -r requirements.txt
pip install flake8 pytest
- name: Check package location
run: |
pip show pandas
- name: Install text2term
run: |
pip install -e .
- name: Lint with flake8
run: |
Expand Down
2 changes: 1 addition & 1 deletion text2term/config.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "4.1.0"
VERSION = "4.1.1"
2 changes: 1 addition & 1 deletion text2term/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def _blocklist_term(processed_terms, term, blocklist, blocklist_char, tagged=Fal
return False


def _update_tagged_term(processed_terms, term, new_term, tags=()):
def _update_tagged_term(processed_terms, term, new_term, tags=[]):
term.update_term(new_term)
term.add_tags(tags)
processed_terms.append(term)
Expand Down
5 changes: 3 additions & 2 deletions text2term/t2t.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@ def _load_ontology(ontology, iris, exclude_deprecated, use_cache=False, term_typ
if use_cache:
pickle_file = os.path.join("cache", ontology, ontology + "-term-details.pickle")
LOGGER.info(f"Loading cached ontology from: {pickle_file}")
onto_terms_unfiltered = pickle.load(open(pickle_file, "rb"))
onto_terms = filter_terms(onto_terms_unfiltered, iris, exclude_deprecated, term_type)
with open(pickle_file, "rb") as cached_ontology_pickle:
onto_terms_unfiltered = pickle.load(cached_ontology_pickle)
onto_terms = filter_terms(onto_terms_unfiltered, iris, exclude_deprecated, term_type)
else:
term_collector = OntologyTermCollector(ontology_iri=ontology)
onto_terms = term_collector.get_ontology_terms(base_iris=iris, exclude_deprecated=exclude_deprecated,
Expand Down
2 changes: 1 addition & 1 deletion text2term/tagged_term.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __repr__(self):
return f"<TaggedTerm term:{self.term} tags:{self.tags} original_term:{self.original_term}"

def add_tags(self, new_tags):
self.tags = list(self.tags) + new_tags
self.tags = list(self.tags) + list(new_tags)

def update_term(self, term):
self.term = term
Expand Down

0 comments on commit ea7b970

Please sign in to comment.