Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which algorithm is being used in Android's spell checker?

I am doing some research on string matching algorithms. One of the most usable I came across is the one my cellphone uses (android 2.3.4 on SE xPeria neo v).

enter image description here

As seen in the screenshot, I pressed the characters jiw which are near the ones I wanted and it suggested correctly.

It seems like the algorithm is similar to levenstein distance (distance between my input and the dictionary). Somehow the near characters have some value in the string-matching.

Any idea about the algorithm being used?

like image 704
Odys Avatar asked Jun 16 '12 19:06

Odys


People also ask

What algorithm does spell check use?

Spell checkers can use approximate string matching algorithms such as Levenshtein distance to find correct spellings of misspelled words. An alternative type of spell checker uses solely statistical information, such as n-grams, to recognize errors instead of correctly-spelled words.

What is Android spell checker?

The Android platform offers a spelling checker framework that lets you implement and access spell checking in your application. The framework is one of the Text Service APIs offered by the Android platform.

How does Google spell checker work?

This spell check is used in Google Search. It sends the text you enter in your browser to Google for improved spelling suggestions. In some operating systems, you can update custom words in the spell check dictionary.

Do Androids have spell check?

Enable spell check, Android device: Go to Settings. Tap System > Languages & input > Advanced. ... Tap Spell checker.


2 Answers

I pulled the Android source code and looked for spell checking. I found this directory which seems to contain the sources you are looking for:

packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/

The file spellcheck/AndroidSpellCheckerService.java looks like the one doing all the heavy work, but Suggest.java also seems to be involved in some way.

like image 52
Emil Vikström Avatar answered Oct 09 '22 02:10

Emil Vikström


This excellent information retrieval book has a detailed section on Levenstein distance, including weighted variations. The weights could then be taken to be the distance between keys on your keypad.

like image 23
phs Avatar answered Oct 09 '22 02:10

phs