Created
July 7, 2021 18:57
-
-
Save aadps/5f70cdd727620aff9a883eda18d432e1 to your computer and use it in GitHub Desktop.
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
with open("/mnt/dev/lexicon.txt", "r") as file1, open("/mnt/dev/l.txt", "w") as file2: | |
for line in file1: | |
items = line.split("\t") | |
if items[3].startswith("nn"): | |
items[3] = "1" | |
elif items[3].startswith("vv"): | |
items[3] = "2" | |
elif items[3].startswith("jj"): | |
items[3] = "3" | |
elif items[3].startswith("rr"): | |
items[3] = "4" | |
else: | |
items[3] = "5" | |
new = "\t".join(items)+"\n" | |
file2.write(new) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment