+ 6

!! Challenge : inventing words !!

Write a code able to create a word everytime you run it. The word can have random length from 2 to 10 characters, but with higher probability to be of average length (gaussian curve centered on 6). The word must be readable (english-like) and you have to create some basic rules to make it happen ... Enjoy !

27th Sep 2017, 9:46 PM
Cépagrave
Cépagrave - avatar
10 Réponses
+ 9
https://code.sololearn.com/cIODQMQL0eo8/#cs My code for random string, but how to do it that the word be readable?
28th Sep 2017, 3:54 PM
Vukan
Vukan - avatar
+ 6
https://code.sololearn.com/cyMlzqEw56pz/?ref=app If I got that 6 part correct...
27th Sep 2017, 11:17 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
You can't get an english like word though. Because there is no Python english dictionary
27th Sep 2017, 11:18 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
Tough to get that 6....
27th Sep 2017, 11:14 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
@Gordie Amazing job ! Thank you so much ! I changed the feeding text with some french short story (maupassant) and it does work also, producing french-like words ! Here it is : https://code.sololearn.com/c6Nrl7hvqRfl/#rb The only sad thing about it : I don't know Ruby, I am a beginner and only learned Python basics on sololearn so far.
28th Sep 2017, 7:31 AM
Cépagrave
Cépagrave - avatar
+ 3
@Vengat Thanks for your code. There is no need for an english dictionnary, maybe my explanation was not clear enough : The goal is to produce unexisting words, but words that can be pronounced with the english style. For example : - "gptyiuoffr" is not really something you can pronounce it does not look like an english word - "wonep, parly, witock, atilened" are words produced with Gordie's code. If they exist I don't know them, but they look like english and they can be pronounced easily with the english pronunciation rules ! A simple idea could be to make a rule unabling the generator to write more than two consecutive vowels, and the same for consonants The method you used to give a bigger probability to 6 letters words is very simple and could be closer to a gaussian curve if you would write something like : [2,3,3,4,4,4,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,8,8,8,9,9,10] Keep on coding !
28th Sep 2017, 7:54 AM
Cépagrave
Cépagrave - avatar
28th Sep 2017, 8:34 AM
Ekansh
+ 3
@Bykah Nice ! Thanks. I don't know Css, but I got the idea. one first simple step to make it more readable would be to allow only 2 consecutive vowels or consonants. Then, there is the Markov method, as Gordie showed us in his ruby code. This method sets a probability for each letter to follow a first letter. The probabilities are taken from an existing text.
28th Sep 2017, 11:33 PM
Cépagrave
Cépagrave - avatar