This is a Python module that parses Spintax. Spintax also known as spinning syntax is often used then text is “spun”, all this means is that the code can create many sentences or paragraphs that are all worded differently however all mean the same thing.
"{Hey|Hello|Hi} {this|here} is {an example of|how to use} Spintax{.|!|}"
The above example Spintax can return 36 possibilities however this number grows exponentially as more spintax is used.
This code was originally made so the bots I code can respond with automated responses that are unique, I found that by doing this people tended to interact with the bot more. I also noticed that by displaying the same information different ways to people who had trouble understanding English (as it was not their native language) were more likely to understand the meaning of the sentence.
There are many applications of Spintax from generating memorable passwords and usernames to making automated responses seem less robotic. Spintax is useful for chat bots or for video game dialog so that responses seem more natural, this module can be extremely useful with Amazon Alexa skills (apps for Alexa) or other voice automation so that communication with the device seems less robotic.
This module is simple to use;
import spintax
string = r"{Hey|Hello|Hi} {this|here} is {an example of|how to use} Spintax{.|!|}"
print(spintax.spin(string))
Just input the string into the parse function and it will return the spun text, unlike other Spintax parsers this parser is allows for both nested spintax (spintax within spintax) and the abilerty to escape the syntax characters for example;
spintax.spin(r"\{example|shown|here}")
>> '{example|shown|here}'
To download this module either download a copy from Github and install manually or use pip,
pip install spintax
Language: Python
Tagged: Spintax, Spintax parser, Text Spinning