sense-bert icon indicating copy to clipboard operation
sense-bert copied to clipboard

Aligning tokens with supersenses?

Open victoryhb opened this issue 3 years ago • 3 comments

Thank you very much for sharing the code for your excellent paper. Pardon me for asking this newbie question: how to align the tokens in the input sentence with the supersenses outputted from the model? For example, the words in the sentence "I went to the store to buy some groceries." do not appear to be aligned with the following senses

['noun.person']
['verb.communication']
['verb.social']
['verb.communication']
['noun.artifact']
['noun.artifact']
['verb.communication']
['verb.cognition']
['noun.artifact']
['noun.artifact']
['adv.all']
['adv.all']

as printed using the following code:

for i, id_ in enumerate(input_ids[0]):
  print(sensebert_model.tokenizer.convert_ids_to_senses([np.argmax(supersense_logits[0][i])]))

Could you please provide some example code for how to do this properly? Thanks a lot in advance!

victoryhb avatar Oct 16 '20 17:10 victoryhb