NaNoGenMo / 2021

National Novel Generation Month, 2021 edition.
45 stars 8 forks source link

adversarial prose #53

Open l-blissett opened 2 years ago

l-blissett commented 2 years ago

I will attempt to manipulate a particular given (german or english) political prose (of course > 50k words) in such a way that it will be misinterpreted by common NLP prediction models ... < mixing adversarial attack methods (paraphrasing attack + language plays (combinatorics / permutations / simple tiny errors & misspellings - i dont know yet)

l-blissett commented 2 years ago

My 50k novel - step by step < work in progress

Technical Desription

“Literal Untargeted Adversarial Black Box Attack”

Steps
  1. Reading Gertrude Steins »Poetry & Grammar (1935)
  2. interpret it and try to formalize it in creating simple grammatical rules
  3. Taking the message "No Justice No Peace" from anonymous Anarchist agency, who hacked the website of the German police agency in December 2019, see: the hambi blog.
  4. POS-tag it the oulipotique way, in Python with SpaCy
  5. And manipulate the Text step by step:
    1. prepositions are usually wrong
    2. articles are delicate and varied items
    3. adjectives are not interesting
    4. nouns are not interesting
    5. verbs are in motion
    6. & adverbs moves with them
    7. pronomia are moving in a very large space of possibility
    8. names do not
    9. upper and lower case spelling is fun to play with
    10. question marks are uninteresting
    11. exclamation marks and inverted commas are unnecessary and ugly
    12. commas are useless
    13. the dot leads the text to its own life
  6. After each step < Analyse it with the opinion mining technique "sentiment analysis" (with TextBlob)
    Goal

    Try to trick the machine literary so that the subjective information in an expression is inverted in their classification. In short: Opinions, emotions or attitudes towards a topic or a person or whatever, which are usually interpreted by the machine as negative or bad will be "misinterpreted" as positive.

    Example (Step 5.viii.)

    salute_string= """No Justice No Peace
    We are the rebellion against an authoritarian society, against isolation and competition. We are the rebellion for another social and cultural reality. In the wake of global liberation attempts, the time was ripe for a decisive struggle that would no longer accept the pseudo-natural legitimacy of the system and seriously wanted to overcome it. We are looking for change for the liberation struggle, for a new way in which we can connect with others.
    As democratic state is maintaining the population in a constant state of survival without starvation and widespread sicknesses, in the same way the riotcops units are using the maximum of repression without direct execution. Their presence is to impose control, their actions to re-establish order. The war is chemical and the weapons they are allowed to use are not lethal. In every way they are the frame of stability, designing the inner borders of metropolis, tracing routes and dead ends for the demonstrations. They are occupying grounds, defining the danger zones which have to be surrounded. They are used against social uprisings, against the migrants inside the camps, to secure the destruction of natural places.
    We think that the tendencies of attack are the most vital part of anarchy, as direct action is the constitutive part of the fight for freedom, liberation and eco-defense. We think that it’s important to combine and multiply our struggle with comrades around the globe, because everywhere that anarchists are fighting, we can become a more dangerous and subversive threat against power when we internationalise and break down the borders between us. This is the reason that the States and corporations across the world are becoming afraid of anarchy again in the 21st Century, because we are the only real opposition to power’s domination and they do not want us to grow and link up with each other to conspire.
    The insurrection of 2008 in Greece was one of the most powerful in the contemporary world. It showed an the amount of power and creativity which can be brought against the state mechanisms and how weak and small they looked those days. The murder of the anarchist Grigoropoulos from the Greek police will always be present in our memory and through our actions. Even though, we are to mark that this assassination, and the insurrection it brought within the society and the all left political spectrum was mainly because he was a 15 years old white Greek student (meanwhile they try to hide his political identity). From our sight, we are seeing the state‘s murders in various subjects, in a daily base along with the imprisonment and domination over the ground. That is why our struggles are violent and constant. Our insurrectionary acts do not depend on social legitimisation. Society is an abstract concept, more likely it refers to what is visible and approved to exist. Our struggles are connected to our experiences. We do not fight to save the people, we fight to survive and give solidarity to those who resist with the target to stimulate more individuals and collectives to join this sincere anarchist struggle.
    Our tactics can easily be adopted in any metropolis of the InterState fortress. Every preparing action, every conversation, every aspect of our plan, can get us one step forward from our enemy giving us the advantage to surprise him. Let’s create an insurrectional movement without borders that will be able to spread anarchistic ideas and practices.
    We send a burning signal and we join the call for a Black December announced by the comrades in Chile by communicating with this action and our words with the insurgents around the world. In fighting memory of all friends, comrades and unknown killed or imprisoned by the state.
    We will never forget the comrades, we want to especially remember those who decided to give everything in the struggle and died in it. Our memory and our full respect for those whose names we can not name because we do not know them.
    The future belongs to those who struggle for liberation. Solidarity with people facing repression near and far! Let’s light up the nights and days We are Autonomen, We are Ungovernable, We are Action, We do not forget our comrades,
    Salute, anonymous Anarchist agency"""
    from textblob import TextBlob
    from textblob.sentiments import NaiveBayesAnalyzer
    blob = TextBlob(salute_string, analyzer=NaiveBayesAnalyzer())
    blob.sentiment

    Sentiment(classification='pos', p_pos=1.0, p_neg=4.4526365268591785e-27)

    
    import spacy
    spacy_obj = spacy.load('en_core_web_sm')
    salute_spacy = spacy_obj(salute_string)
    salspac = salute_string

for i in reversed(salute_spacy.ents): start = i.start_char end = start + len(i.text) salspac = salspac[:start] + '-' + salspac[end:] print(salspac)

No Justice No Peace
We are the rebellion against an authoritarian society, against isolation and competition. We are the rebellion for another social and cultural reality. In the wake of global liberation attempts, the time was ripe for a decisive struggle that would no longer accept the pseudo-natural legitimacy of the system and seriously wanted to overcome it. We are looking for change for the liberation struggle, for a new way in which we can connect with others.
As democratic state is maintaining the population in a constant state of survival without starvation and widespread sicknesses, in the same way the riotcops units are using the maximum of repression without direct execution. Their presence is to impose control, their actions to re-establish order. The war is chemical and the weapons they are allowed to use are not lethal. In every way they are the frame of stability, designing the inner borders of metropolis, tracing routes and dead ends for the demonstrations. They are occupying grounds, defining the danger zones which have to be surrounded. They are used against social uprisings, against the migrants inside the camps, to secure the destruction of natural places.
We think that the tendencies of attack are the most vital part of anarchy, as direct action is the constitutive part of the fight for freedom, liberation and eco-defense. We think that it’s important to combine and multiply our struggle with comrades around the globe, because everywhere that anarchists are fighting, we can become a more dangerous and subversive threat against power when we internationalise and break down the borders between us. This is the reason that the - and corporations across the world are becoming afraid of anarchy again in -, because we are the only real opposition to power’s domination and they do not want us to grow and link up with each other to conspire.
The insurrection of - in - was one of the most powerful in the contemporary world. It showed an the amount of power and creativity which can be brought against the state mechanisms and how weak and small they looked those days. The murder of the anarchist - from the - police will always be present in our memory and through our actions. Even though, we are to mark that this assassination, and the insurrection it brought within the society and the all left political spectrum was mainly because he was a - white - student (meanwhile they try to hide his political identity). From our sight, we are seeing the state‘s murders in various subjects, in a - base along with the imprisonment and domination over the ground. That is why our struggles are violent and constant. Our insurrectionary acts do not depend on social legitimisation. Society is an abstract concept, more likely it refers to what is visible and approved to exist. Our struggles are connected to our experiences. We do not fight to save the people, we fight to survive and give solidarity to those who resist with the target to stimulate more individuals and collectives to join this sincere anarchist struggle.
Our tactics can easily be adopted in any metropolis of the - fortress. Every preparing action, every conversation, every aspect of our plan, can get us - step forward from our enemy giving us the advantage to surprise him. Let- create an insurrectional movement without borders that will be able to spread anarchistic ideas and practices.
We send a burning signal and we join the call for a - announced by the comrades in - by communicating with this action and our words with the insurgents around the world. In fighting memory of all friends, comrades and unknown killed or imprisoned by the state.
We will never forget the comrades, we want to especially remember those who decided to give everything in the struggle and died in it. Our memory and our full respect for those whose names we can not name because we do not know them.
The future belongs to those who struggle for liberation. - with people facing repression near and far! Let’s light up - We are Autonomen, We are -, We are Action, We do not forget our comrades,
Salute, anonymous - agency
```python
blob = TextBlob(salspac, analyzer=NaiveBayesAnalyzer())
blob.sentiment

Sentiment(classification='pos', p_pos=1.0, p_neg=1.9907938776738466e-24)

l-blissett commented 2 years ago

ADM - Anarchistic Decision Making

...with a little help from Gertrude Stein

finally, I had to change the input file, but worked strictly according to the Gertrude Stein constraints... see codes in repo: https://github.com/l-blissett/adm & output file merged into one pdf here: NLP-on-Anarchism.pdf