I want to use the twint tool in Python to search for tweets containing all possible spellings of the word Ethiopia including exaggerations, such as ETHIOOOPIAAAA and ethiopiaaaa. So far I have tried to create a search term that is the string f"e{eth}a"
where eth
is a string of random length between 0-18 chars starting with e, ending with a and has a random order of characters in the middle, of which the characters are limited to e,t,h,i,o,p,a.
I have tried to use this:
import random
eth_chars = "ethiopa"
eth = ""
for i in range(0,18):
eth += random.choice(eth_chars)
search_term = f"e{eth}a"
This does not work since it assigns one generated string to search_term
and searches for that single term instead, but I want to search for all possible strings of any length 0-18 char. that follow this rule:
e-(random order of e,t,h,i,o,p,a)-a
Also, I need to make the queries case insensitive. I tried to add the .casefold()
string method to the search query when configuring twint like this 'config.Search = search_term.casefold()', assuming this would simply read the string and ignore the case. I am not sure this will work.
Any assistance will be appreciated.