I have a chatterbot program which uses a dictionary file to remember words and their meanings. My quesstion is, what is the best way to organize such a file in a machine readable format?
How to index a dictionary file
BlitzPlus Forums/BlitzPlus Programming/How to index a dictionary file Well if you have two giant text lists, one for words and one for meanings, you could make a two dimensional array, then use the number of the word/definition to reference the other part.
Or learn Python and use the built in dictionary sequence ;)
Or learn Python and use the built in dictionary sequence ;)
Hmm... That might work. But what I really need is a way to find out which words the progam doesn't know.
simply see if it's the same as any that it already knows, and if not then it doesn't know it.
Yeah, but how do I do that?
EDIT: Okay, I misunderstood the question at first, here's a real answer.
To read it easily and quickly, maybe record byte offsets at the beginning of the file for the first word of every letter (you may want to organize them alphabetically in the file) then from that letter have offsets for the second letter, then possibly the third letter, then check the words under that offset to see if any of them match. And what you may do to reduce file size is with the bite offset for example if the word was ARKANSAS and you had it under byte offset 43 under A and 28 under AR and 3 under ARK, instead of then writing the string ARKANSAS just put ANSAS, since you already have determined the first three letters by the location in the file based on the offsets.
Hopefully that was comprehensible.
To read it easily and quickly, maybe record byte offsets at the beginning of the file for the first word of every letter (you may want to organize them alphabetically in the file) then from that letter have offsets for the second letter, then possibly the third letter, then check the words under that offset to see if any of them match. And what you may do to reduce file size is with the bite offset for example if the word was ARKANSAS and you had it under byte offset 43 under A and 28 under AR and 3 under ARK, instead of then writing the string ARKANSAS just put ANSAS, since you already have determined the first three letters by the location in the file based on the offsets.
Hopefully that was comprehensible.