Skip to content

Commit

Permalink
further refactor _create_document
Browse files Browse the repository at this point in the history
  • Loading branch information
osma committed Aug 9, 2019
1 parent 4acc731 commit 0678998
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions annif/corpus/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ def _create_document(self, text, uris, labels):
information. URIs for labels and vice versa are looked up from the
subject index, if available."""

if not uris and labels and self._subject_index:
uris = set((self._subject_index.labels_to_uris(labels)))
if not labels and uris and self._subject_index:
labels = set((self._subject_index.uris_to_labels(uris)))
if self._subject_index:
if not uris and labels:
uris = set((self._subject_index.labels_to_uris(labels)))
if not labels and uris:
labels = set((self._subject_index.uris_to_labels(uris)))

return Document(text=text, uris=uris, labels=labels)

Expand Down

0 comments on commit 0678998

Please sign in to comment.