bert icon indicating copy to clipboard operation
bert copied to clipboard

how to get the probability of a missing word in a sentence

Open ARozental opened this issue 8 years ago • 1 comments

How can I directly get the probability of a missing word in a sentence?

Specifically my sentence is "we <missing_word> chocolate" and I need to get the likelihood ratio between "we love chocolate" and "we hate chocolate".

Also, thank you so much for this code.

ARozental avatar Nov 12 '18 07:11 ARozental

This is what the masked LM does, so you can just look at the run_pretraining.py code to see how it computes the masked LM log probabilities and just use that. It will only work for single WordPieces though.

jacobdevlin-google avatar Nov 12 '18 17:11 jacobdevlin-google