Created
April 23, 2019 15:44
-
-
Save isaacimholt/3c952742f3ef767d34694977ba930c6d to your computer and use it in GitHub Desktop.
Bies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _bies_word(str: word) -> str: | |
if len(word) == 1: | |
return 'S' | |
return 'B' + ''.join('I' for _ in word[1:-1]) + 'E' | |
def _bies_line(str: line) -> str: | |
return ''.join(_bies_word(w) for w in line.split()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment