Skip to content

Commit

Permalink
Change default tags to empty list. Use open() to open pickle files.
Browse files Browse the repository at this point in the history
  • Loading branch information
rsgoncalves committed Nov 16, 2023
1 parent c39a408 commit 8b5cdd0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
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

0 comments on commit 8b5cdd0

Please sign in to comment.