Binary search on a sorted dictionary text file?
I was wondering if anyone knows of a project/library that can quickly search a dictionary file without loading the entire thing in memory.
I am about to implement my own, but this information could save me quite a bit of time. I will use a binary search on a pre-sorted flat text file. It will be very similar to this:
http://search.cpan.org/~jfreeman/File-SortedSeek/lib/File/SortedSeek.pm
This will be 开发者_如何学Pythonfor a 'fast-typing' game on the iPhone, where I check a user entered word against a dictionary for validity. So speed and memory are major concerns of mine.
Any recommendations / advice / thoughts? Thanks!
why not import your text file into a sqlite .db file and use sql to validate the words?
精彩评论