Reputation: 12085
I need to replace words with other words from a dictionary. The dictionary contains around ~1500 key-value-pairs (all NSStrings containing a word which should get replaced by another word). The dictionary is build up dynamically. Using a database looks like an over heap to me, but storing all the words in a dictionary doesn't feel good too. (They may be stored for a longer time and in rare cases also get stored too disk too.)
What would be the right solution in this case on an iOS application?
Upvotes: 2
Views: 223
Reputation: 162712
1500 key-value pairs that are word -> word?
That isn't large. That is pretty tiny, actually.
Just stick 'em in an NSDictionary and write it to storage as a plist.
Make sure access to said dictionary is isolated behind a class's interface such that any future need for expansion that might cause a size explosion can be done entirely behind said interface without impacting clients.
Upvotes: 5