Skip to content

Instantly share code, notes, and snippets.

@NesrineSF
Created March 31, 2021 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NesrineSF/436e7b1395e0099a4ba45f469f96a5cd to your computer and use it in GitHub Desktop.
Save NesrineSF/436e7b1395e0099a4ba45f469f96a5cd to your computer and use it in GitHub Desktop.
concept_ID for each word "object" within the knowledge graph
#Concept_ID for object_noun
print (f'\t \033[1mConcept_ID for object when NOUN \033[0m \n')
#to print TOKEN, POS and ID (for the concept) in bold at the beginning of the output array:
print (f'\033[1m{"TOKEN":{20}} {"POS":{15}} {"ID":{6}}\033[0m')
#Syncon stands for "Concept" that we refer to with an ID
for token in output.tokens:
print (f'{object_noun[token.start:token.end]:{20}} {token.pos:{15}} {token.syncon:{6}} ')
#Concept_ID for object_verb
print (f'\t \033[1mConcept_ID for object when VERB \033[0m \n')
#to print TOKEN, POS and ID (for the concept) in bold at the beginning of the output array:
print (f'\033[1m{"TOKEN":{20}} {"POS":{15}} {"ID":{6}}\033[0m')
#Syncon stands for "Concept" that we refer to with an ID
for token in output_2.tokens:
print (f'{object_verb[token.start:token.end]:{20}} {token.pos:{15}} {token.syncon:{6}} ')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment