Text Categorization confrontation sample generation

This article reproduce a text-based white-box algorithm, based on the paper "TEXTBUGGER: Generating Adversarial Text AgainstReal-world Applications"

First on the final results

No-3srcSentence:the protector you hear the name you think ah its a crappy hong kong movie guess what its not hong kong and yes it is crappy this amazingly stupid jackie chan film ruined by us yes us the americans im boiling with anger ooh i think ill jump out that window has chan as a new york cop hunting down a gang avenging the death of his buddy sounds unk its not dont waste your money renting it to prove he could make a better cop film chan made the amazing police story
No-3srcSentence:the protector you hear the name you think ah its a crappy hong kong movie guess what its not hong kong and yes it is crappy this amazingly funny jackie chan film ruined by us yes us the americans im boiling with anger ooh i think ill jump out that window has chan as a new york cop hunting down a gang avenging the death of his buddy sounds unk its not dont waste your money renting it to prove he could make a better cop film chan made the amazing police story
No-3label:negative--->positive
No-3probability:positive(0.05022594)-->positive(0.815222)
No-3mutate:type(stupid-->funny)

The first row is the original sentence
of the second line of the sample is generated against the
third row and respectively correspond to the original tag label against samples
fourth row transition probability, we can see the original sentence as the positive judgment probability of 0.05 against the sample is judged as positive probability 0.81
the fifth generation of this line shows what specific changes against the sample word, for example, this is the original sentence was changed to the stupid funny

Model and configuration: lstm, pytorch, details and source code to see my GitHub: https://github.com/Flynn-ML2019/Adversarial_Examples_Generate   seek the stars

 

Published 200 original articles · won praise 17 · views 30000 +

Guess you like

Origin blog.csdn.net/qq_36328915/article/details/104638875