def test_entity_type(): tok_per = Token(entity_type=EntityType.PER) tok_foo = Token(entity_type=EntityType.CUSTOM_TYPE, custom_entity_type='foo') assert get_entity_type(tok_per) == 'PER' assert get_entity_type(tok_foo) == 'foo'
def is_loc(token): netype = None if token.entity_type != 3 and token.entity_type != 4: netype = sc.get_entity_type(token) if netype == 'LOC': return True else: return False
def streamcorpus_is_loc(token): netype = None if token.entity_type != 3 and token.entity_type != 4: netype = sc.get_entity_type(token) if netype == "LOC": return True else: return False