4

I'm Trying to create a custom iOS keyboard. I used the UILexicon class to provide a basic lexicon of words that requestSupplementaryLexiconWithCompletion: method provides.

But I want to add the Predictive Text to the keyboard as well.

I know that its not possible to create a database of words even if you try with full Effort.

So, I Believe that no one would have done it with their own keyboard. There must be a pre-Created Database of words and I know that.

Even if I find a Database of these words, I don't understand how to provide a Suggestion based on the Previous word.

Could any one Point me to a good and trusted Source that could provide me the results I want and give me a database of the Lexicons of English as well as Other Languages too.

Please even suggest the way to use the Database in the App.

All Responses would be very helpful.

Community
  • 1
  • 1
Casper
  • 152
  • 12

1 Answers1

5

You should check out the UITextChecker class for implementing advanced auto-correct. It allows predictive suggestions based on what the user is typing but is not context aware. That coupled with UILexicon would be a pretty decent basic autocorrect.

You should also check out this SO question

Community
  • 1
  • 1
donkey
  • 1,343
  • 13
  • 32
  • I tried the UITextChecker class for ***completionsForPartialWordRange:inString:language:*** method, Its mentioned that the objects in array it will return would be in sequence which should be used as they are. But the sequence is not appropriate. And Can you suggest something about the Suggestions that we can implement for the next word based on the previous? – Casper Nov 16 '14 at 08:15
  • Predictive text would have to be built by you as Apple offers no API for that. I thought the sequence was appropriate are you sure? – donkey Nov 16 '14 at 10:24
  • The sequence comes in alphabetical order, not in the order of commonly used words in the language. When I read the documentation of UITextChecker class I first Imagined the ***completionsForPartialWordRange:inString:language:*** method would return the sequence in commonly used to rarely used words. It isn't the Case though. – Casper Nov 17 '14 at 10:58
  • Do you know any sqlite databases, or any other APIs? I found [LexiconText](http://www.lexicontext.com) API but I thought its not too good for this job. – Casper Nov 17 '14 at 11:00
  • unfortunately I don't – donkey Nov 17 '14 at 15:28
  • I did just just that with a custom iOS keyboard. Using lexicon and UITextChecker class provides pretty the same functionality as the stock keyboard, except the context aware part. That will need to be custom logic, I did not add that in my keyboard, but using TextChecker picks up on what word the user is typing very quickly. – Jacob Boyd Jan 11 '17 at 18:10