How can I get ordered, duplicate vowel based maximum possible variations of words/strings? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I get ordered, duplicate vowel based maximum possible variations of words/strings?

For example: Maalaviiy-> Malaviiy, Maalaviy, Malaviy Maahaarathii-> mahaarathii, maaharathii, maahaarathi, maharathii, maaharathi, mahaarathi

11th Oct 2018, 8:25 AM
Satyam Dwivedi
Satyam Dwivedi - avatar
7 Answers
+ 2
Satyam Dwivedi, I sketched code on python. This way based on recursive construction of all possible variations with repetitions from 2 to N where N is identical vowel sequences amount (with length > 1). For example, word "Maahaarathii" corresponds to this variations from 2 (0, 1) to 3 (aa, aa, ii): 000, 001, 010, 011, 100, 101, 110, 111. 0 means that we do not change the corresponding vowel sequence, 1 means shorten to one vowel 000 => Maahaarathii, 111 => Maharathi, 010 => Maaharathii etc. Total 2^N combinations. https://code.sololearn.com/c4cundENvp95/?ref=app
11th Oct 2018, 11:24 AM
Daniel Holmes
Daniel Holmes - avatar
+ 3
I don't get it.
11th Oct 2018, 8:56 AM
Anna
Anna - avatar
+ 2
Daniel Holmes How does 'Maalaviiy' become 'Malviiy' and why does the same pattern not apply to 'Maahaarathi'? The second example doesn't "lose" any vowels 🤔
11th Oct 2018, 10:06 AM
Anna
Anna - avatar
0
Anna, i think that autor just missed one letter. Not Malviiy, Malaviiy. And autor considered not all cases.
11th Oct 2018, 10:19 AM
Daniel Holmes
Daniel Holmes - avatar
0
I don't know Russian, but спасибо I guess
11th Oct 2018, 10:52 AM
Anna
Anna - avatar
0
Daniel Holmes you pointed out correctly, I missed 'a' in all Maalaviiy examples which I have corrected now. Thankyou so much for your interest guys In case you didn't notice, the common pattern between all these examples is the deletion of the consecutive duplicate vowel at a time to form the maximum possible combinations of the string and the rest of the string remains the same. Single characters remain intact, the change occurs only in the consecutive duplicate characters. Other example can be such as: raam-> ram paapii-> papii, paapi, papi maanushiikaa-> manushiikaa, maanushikaa, maanushiika, manushikaa, maanushika, manushiika
11th Oct 2018, 4:54 PM
Satyam Dwivedi
Satyam Dwivedi - avatar
0
Daniel Holmes It's working perfectly dear. Thankyou so much. Can you please modify it so that it may take a .csv file with one string in each line as an input and output the variations separated by a tab next to each string in form of a .csv file. Thanks
11th Oct 2018, 4:59 PM
Satyam Dwivedi
Satyam Dwivedi - avatar