I want to know, Are these algorithms开发者_Python百科 implemented in Objective-C Libraries for text search?
- Knutt-Morri-Pratt
- Boyer-Moore
- finite automata
Looking at the source for CFStringFindWithOptionsAndLocale in CFString.c, it seems like it only implements naive search. Depending on how huge the text is, you might actually get away with this.
Regardless, if your passage is sufficiently huge, Boyer-Moore and KMP are still linear time (albeit with a smaller constant factor), you might want to look at implementing a simple disk based full text index. I've done it for a client's project and it really isn't as hard as it sounds.
精彩评论