Slide 41
Slide 41 text
n 元⽂章の[BLANK]部分に対して、否定的な⽂章を⽣成してみた。
1. # the base sentence
2. text = "It's sunny today, so we'll play outside."
3. b_text = "It's sunny today, so we [BLANK] outside.”
4. pj = Polyjuice(model_path="uw-hai/polyjuice", is_cuda=True)
5. perturbations = pj.perturb(
6. orig_sent=text, #オリジナル⽂章
7. blanked_sent=b_text, #ブランク付き⽂章
8. ctrl_code=“negation”, #制御ルール
9. perplex_thred=5, #⽣成⽂章の質の閾値
10. num_perturbations=3, #⽣成⽂の返り値の最⼤数
11. )
12.print(perturbations)
[Out]: ["It's sunny today, so we don't need to play outside.", "It's sunny today, so we don't have to go outside."]
やってみた
41