Last active
March 31, 2021 15:26
-
-
Save NesrineSF/f04e5712c061d5d0b6c4041e0cc0b7c9 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
#POS of the first sentence | |
print (f'\t \033[1mOutput of the first sentence : \033[0m \n') | |
#to print TOKEN and POS in bold at the beginning of the output array: | |
print (f'\033[1m{"TOKEN":{20}} {"POS":{6}}\033[0m') | |
#to iterate over the tokens and assign a POS to each token for the first sentence | |
for token in output.tokens: | |
print (f'{object_noun[token.start:token.end]:{20}} {token.pos:{6}}') | |
#POS of the second sentence | |
print (f'\t \033[1mOutput of the second sentence : \033[0m \n') | |
#to print TOKEN and POS in bold at the beginning of the output array: | |
print (f'\033[1m{"TOKEN":{20}} {"POS":{6}}\033[0m') | |
#to iterate over the tokens and assign a POS to each token for the second sentence | |
for token in output_2.tokens: | |
print (f'{object_verb[token.start:token.end]:{20}} {token.pos:{6}}') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment