Skip to content

Instantly share code, notes, and snippets.

@sam-writer
Last active October 3, 2019 01:39
Show Gist options
  • Save sam-writer/a81af70fd3d983e3d6c44cc53b231759 to your computer and use it in GitHub Desktop.
Save sam-writer/a81af70fd3d983e3d6c44cc53b231759 to your computer and use it in GitHub Desktop.
fitbert-syntax
# example from "Targeted Syntactic Evaluation of Language Models"
# https://arxiv.org/abs/1808.09031
masked_string = "the author that the guard likes ***mask***"
options = ['laugh', 'laughs']
fb.rank_with_prob(masked_string, options)
# >>> (['laughs', 'laugh'], [4.14195717654553e-12, 3.3748110100755013e-13])
# example from "Assessing the Ability of LSTMs to Learn Syntax-Sensitive Dependencies"
# https://transacl.org/ojs/index.php/tacl/article/view/972
masked_string = "accusations of abusive sockpuppetry from a trusted source ***mask*** a serious chilling effect ."
options = ["have", "has"]
fb.rank_with_prob(masked_string, options)
# >>> (['have', 'has'], [0.8899502754211426, 0.004103286191821098])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment