Created
December 14, 2021 00:56
-
-
Save timrprobocom/9a49bb88b3762e82375ed4f14b328e84 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import re | |
data = [ | |
'atr.i', | |
'atr i', | |
'ok', | |
'test', | |
'ro bn.', | |
'ro bn', | |
'talk 1', | |
'talk n' | |
] | |
clean = [re.sub('[ .,-]','',d) for d in data] | |
unique = list(set(clean)) | |
for d,c in zip(data,clean): | |
idx = unique.index(c) | |
print( f"{d:10} {c:10} {idx:3}" ) | |
# Output: | |
# | |
# atr.i atri 5 | |
# atr i atri 5 | |
# ok ok 1 | |
# test test 4 | |
# ro bn. robn 2 | |
# ro bn robn 2 | |
# talk 1 talk1 3 | |
# talk n talkn 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment