• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to load a dictionary file into a de la briandais tree?  RSS feed

 
Michael Boyd
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basically, I have a dictionary file that I have to load into a de la briandais tree so I can search for anagrams in it. I have the anagram part worked out, but loading the thing is giving me fits. Any suggestions?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch. Please take a look at our display name policy and edit your display name to follow the policy. "speedphreeek" is (a) obviously fictitious, and only one word. Thanks.
For your question, there are several parts.
Do you know how to read lines from a file?
Can you figure out how to parse one line in the file?
Can you insert the info from a single line into your tree?
We need a bit more infomation to help you.
 
Michael Boyd
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since this is the first time I've had to do something like this, I'm not quite sure on how to read/insert lines to/from file, or on how to parse a line in the file. I do have a an algorithm for inserting into dlB trees, but that's about it.
Sorry about the name thing, btw.
 
Jeff Langr
author
Ranch Hand
Posts: 799
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

- The StringTokenizer class will suffice for most simple line parsing.
Good luck,
Jeff
[ January 25, 2004: Message edited by: Jeff Langr ]
[ February 10, 2004: Message edited by: Jeff Langr ]
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
StringBuffer? Were you thinking of StringTokenier, Jeff? That would make sense. Michael, how you parse each line will depend the file format. But StringTokenizer is often a good option for this.
 
Michael Boyd
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The file format is a simple .txt file with one word per line of text. If you have anything to add now that i finally remembered to say that, i'd be happy to hear it.
Thanks guys
 
Jeff Langr
author
Ranch Hand
Posts: 799
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jim Yingst:
StringBuffer? Were you thinking of StringTokenier, Jeff?

Oops. Mental block. I fixed the original--thanks for pointing it out. I was thinking of StringTokenizer, though, not StringTokenier. ;-)
-Jeff-
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!