I want to generate x number of variants of an address, but with a list of predefined symbols.
adress = "RUE JEAN ARGENTIN"
a_variants = ["À","Á","Â","Ä","Ã","Å"]
e_variants = ["É","È","Ê","Ë"]
i_variants = ["Ì","Í","Î","Ï"]
u_variants = ["Ù","Ú","Û","Ü"]
r_variants = ["Ŕ","Ŗ"]
o_variants = ["Ò","Ó","Ô","Ö","Õ"]
s_variants = ["Ś","Š","Ş"]
n_variants = ["Ń","Ň"]
d_variants = ["D","Đ"]
Example of output
# RUE JEAN ARGENTINS
# ŔUE JEAN ARGENTINS
# ŖUE JEAN ARGENTINS
# RÙE JEAN ARGENTINS
# RÚE JEAN ARGENTINS
# RÛE JEAN ARGENTINS
# RÙE JEAN ARGENTINS
# RÜE JEAN ARGENTINS
# ....
# ŖUE JEAN ARGENTÌNS
# ....
# ....
# ŖÛÉ JÉÀŇ ÀŖGÈNTÏŇŞ
# ....
I don't especially want a code answer in python or anything, but mostly an algorithmic idea to achieve this. Or even a mathematical calculation to find the number of possible variations.
Thank you very much
It should be something like:
Rhas3versions (r_variants+ originalR)Uhas5versions (u_variants+ originalU) etc.and you have to multipicate all values
If you count repeated chars in text then you can reduce it to
But in code I will use first method:
Result:
EDIT:
You can substract
1to skip original version"RUE JEAN ARGENTIN"EDIT:
If you use shorter text and smaller number of variation then you can easly generate all version on paper (or display on screen) and count them - and check if calculation is correct.
For example for
RNit gives 8 variation (9 versions - original)You can use
itertools.product()to generate all versionsResult: