Skip to content

Commit

Permalink
Merge pull request #998 from VesnaT/onto_fix
Browse files Browse the repository at this point in the history
[FIX] Ontology: Fix 'remove word' bug
  • Loading branch information
PrimozGodec authored Aug 21, 2023
2 parents c899e1c + eef1b12 commit 743a1b1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions orangecontrib/text/widgets/owontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,17 @@ def _model_to_tree(
) -> Union[Dict, OntoType]:
tree = {}
for i in range(item.rowCount()):
tree[item.child(i).text()] = \
_model_to_tree(item.child(i), selection, with_selection)
if item.child(i) is not None:
tree[item.child(i).text()] = \
_model_to_tree(item.child(i), selection, with_selection)
return (tree, item.index() in selection) if with_selection else tree


def _model_to_words(item: QStandardItem) -> List:
words = [item.text()] if item.text() else []
for i in range(item.rowCount()):
words.extend(_model_to_words(item.child(i)))
if item.child(i) is not None:
words.extend(_model_to_words(item.child(i)))
return words


Expand Down

0 comments on commit 743a1b1

Please sign in to comment.