[79668b]: / tests / helpers.py

Download this file

16 lines (9 with data), 367 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
import docdeid as dd
def link_tokens(tokens: list[dd.Token]):
for token, next_token in zip(tokens, tokens[1:]):
token.set_next_token(next_token)
next_token.set_previous_token(token)
return tokens
def linked_tokens(tokens: list[str]) -> list[dd.Token]:
tokens = [dd.Token(x, 0, len(x)) for x in tokens]
return link_tokens(tokens)