Check if my string is a reel word

Hello,


Sorry in advance if my english is not so good.


I make a word game and i need to check if the word tapped from users is a real word or not.


I have a file that containt a lot of french word and i tried to read line by line but this is too lang and that use 100% of processor.

I looked to "UIReferenceLibraryViewController.dictionaryHasDefinitionForTerm" but the response is almost ever "true" and it's not only french word


So i need to compare a string with a french dictionary to check if the word is real.


Someone can help me ?

Thanks

If you have a list of valid words already, you could put them in a table in SQLite and put a FTS (full text search) index on it. That's a fast way to search large data sets. If you search "ios sqlite fts4" you should find lots of relevant discussion.


BTW, your question is not a question about how to use the developer forums. I would suggest moving it to a more relevant subforum.

iOS includes sqlite and CoreData.

Either of those technologies can be used to build an indexed collection of words.

You're right. FTS would be overkill for this. A plain index would work fine.

How many words does your file contain? or How large is the file in bytes?

If the number of words is less than a few tens of thousands, you can hold it in memory (use Set or NSSet).

It consumes some amount of memory, but not so big as having a decompressed large image data.

Thank you all for your answers. I will try your proposition tomorrow

I think we were typing at the same time. 🙂


Now that you've mentioned it, full text support is probably worth considering for a word-based game. I mean, doesn't every word game probably eventually needs a "Give me the list of words I can make by adding to this string" function?


But a simple indexed string field in a table is a good start. 😀

Check if my string is a reel word
 
 
Q