-
October 6th, 2012, 06:15 PM
#1
Word Generator
Alright, so pretty much, I'm looking for a word generator, to be more specific (if not too confusing) a random generator that's not random... If that made sense to you...
Pretty much, it will either 1. Generate a bunch of Pre-English words for example "pie" "fire truck" "shoelace" "head set" "exit" "compute" etc, and then it will say them in a list form (so it doesn't repeat itself) ONLY after the user enters something for example if I said factory, it would tell me "pie" then I said bowling ball it would tell me "fire truck" and so on, but it will never reach the end of the list because it will keep generating Pre-English words and putting it in this listing form...
Or 2, it will give me a English word every time the user enters something, for example: Fan, then it would give me a random word in English (off the top of my head) stop sign... Then I say for example, backpack, then it would tell me doorknob (you get the point, as you say words, it will also say words) and yeah, it will keep telling you random words, the problem with this format is, is there a way to save it? So that it wont end up repeating itself, and at some point wont say doorknob again?
*A lot of info of what I'm trying to do above...*
Long story short... I'm looking for a "random word generator" that doesn't just generate random letters into a "word" like tgwe (<- that's not a English word) it will actually generate an actual English word by random, every time the user enters a word.
-
October 7th, 2012, 03:53 AM
#2
Re: Word Generator
Originally Posted by Dibbie
a random generator that's not random...
You could generate character sequences at random and then determine whether they constitute proper English words. But that strategy is meaningless. First, it would be inefficient because you would generate lots of non-sensical words for every proper one. And second, to determine whether a random word is proper you need a dictionary and since it already holds all proper words you're looking for you can as well skip the guessing game and use the dictionary words straight away.
So you start with a dictionary of proper English words. You shuffle it into random order (a standard O(N) algorithm). Then you pick words from the randomized dictionary one by one (from the front or from the back) and move them to a list of used up words.
Last edited by nuzzle; October 7th, 2012 at 12:23 PM.
-
October 7th, 2012, 12:42 PM
#3
Re: Word Generator
Originally Posted by nuzzle
since it already holds all proper words you're looking for you can as well skip the guessing game and use the dictionary words straight away.
So you start with a dictionary of proper English words.
OK, so if Java already has this English Dictionary already, how do I "Access" it?
And for starting with a dictionary of proper words, would I have to literally make 1000000000 words up, like:
String 1;
1 = apple
String 2;
2 = bionic
etc?
Or how would I make this "Dictionary"?
-
October 7th, 2012, 01:03 PM
#4
Re: Word Generator
OK, so if Java already has this English Dictionary already, how do I "Access" it?
No Java doesn't come with a dictionary of words and nuzzle didn't say it did. He said you would need one.
And for starting with a dictionary of proper words, would I have to literally make 1000000000 words up
You can if you want, personally I'd search the web and download a list of English words. As for needing 1000000000 words - how long is this game supposed to be running for and when you say you don't want any repeats do you mean in the current session/game or ever?
Edit: BTW there aren't 1000000000 words in the English language. The oxford dictionary estimates there are probably around 250000 distinct English words excluding words which are technical, regional etc.
Last edited by keang; October 7th, 2012 at 01:08 PM.
-
October 7th, 2012, 04:22 PM
#5
Re: Word Generator
Originally Posted by Dibbie
Or how would I make this "Dictionary"?
Well, it's always a good idea to learn how to walk before you run. Start with 100 words and then if your game becomes a smash hit you can always increase the number of words in the next version.
Last edited by nuzzle; October 7th, 2012 at 04:28 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|