How to search all words from input string in ios? -


say, have vocabulary (around 100000 words) , word ("inputstring"). so:

i need generate words "inputstring" "input", "string", "put", "strinpg" etc. , need check out them in vocabulary. algorithm that? because have idea with:

  1. recursive search possible combinations @ step 1
  2. using nspredicates filter them in vocabulary.

you're on right track nspredicate. , phase you're looking fault tolerant search , solved levenshtein distance. need make || combination queries in single queries.

let's assume have words in nsarray. need call method filteredarrayusingpredicate: on it, it's not super easy build predicate that.

so requirements are:

  1. search word can part of larger word
  2. user can misspelled word

first part pretty easy, need put contains predicate. second part should ?tring or s?ring or st?ing... , can build simple for. can experiment various number of ? signs , see matches criteria.


Comments