Skip to content

Commit

Permalink
Merge pull request #300 from dkpro/bugfix/299-cassis-wont-find-tokens…
Browse files Browse the repository at this point in the history
…-when-doing-cas-select-TOP

#299 - cassis won't find tokens when doing cas.select(...TOP)
  • Loading branch information
reckart authored Feb 4, 2024
2 parents 3aa2856 + e7030a5 commit 19b096e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cassis/typesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ def create_type(self, name: str, supertypeName: str = "uima.tcas.Annotation", de
supertype = self.get_type(supertypeName)
new_type = Type(name=name, supertype=supertype, description=description, typesystem=self)

if supertypeName != TOP_TYPE_NAME:
if name != TOP_TYPE_NAME:
supertype._children[name] = new_type

for feature in supertype.all_features:
Expand Down
1 change: 1 addition & 0 deletions tests/test_cas.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def test_select(small_typesystem_xml, tokens, sentences):
assert list(cas.select("cassis.Sentence")) == sentences
assert list(cas.select(ts.get_type("cassis.Token"))) == tokens
assert list(cas.select(ts.get_type("cassis.Sentence"))) == sentences
assert set(cas.select(ts.get_type(TYPE_NAME_TOP))) == set(tokens) | set(sentences)


def test_select_also_returns_parent_instances(small_typesystem_xml, tokens, sentences):
Expand Down

0 comments on commit 19b096e

Please sign in to comment.