On 01/26/2012 04:41 PM, Vivien wrote:
>>> * Suggestions API
>>> That's just another name for the spellcheck API.
>>> This is well described by the thread at
>>>
http://groups.google.com/group/mozilla.dev.webapi/browse_thread/thread/22d2747a81af066a/927e58625c6b4741?q=spellchecking&lnk=ol&
>>>
>> IIRC, the only issue that still applies with that API is that spellcheck
>> and suggestions are clearly not the same thing: suggestions should
>> propose words based on what and how I typed something while spellcheck
>> should assume I might have mispelled the word and will try to propose a
>> correction. Implementing suggestions like spellcheck would be a mistake.
>> That issue was raised by Justin Lebar in the thread you mentioned but no
>> one replied IIRC.
>
> I have no strong opinions on that so 2 APIs works for me.
We had a talk with Vivien today and he agrees that the Spellcheck API
will not solve what he wants to do. Basically, suggestions in a virtual
keyboard has nothing to do with spellchecking.
For example, try to press to type "Wz" on an Android virtual keyboard.
The first result I have on my phone is "Ex" because W is close to E and
z is close to x. This has nothing to do with spellchecking.
The conclusion of our discussion is that the logic of suggestion should
be part of the virtual keyboard application because the keys disposition
is required, the exact position of touch might be needed and the input
method too (pressing keys VS drawing lines for example).
Then, the only missing part is having the list of available words. The
keyboard can access to some information in the phone (like Contacts
name) but should mostly have access to the dictionary which is currently
not doable. Thus, we should add an API for that.
Basically, this API should allow the developers to:
- add an entry in the personal dictionnary;
- remove an entry from the personal dictionnary;
- read entries in the dictionnary;
- be informed when the dictionnary changes;
- knows if a word is part of the personal dictionnary.
A quick draft of the API gives us:
interface DictionaryNavigator {
Dictionary getDictionary(in DOMString lang);
};
interface Navigator implements DictionaryNavigator;
interface Dictionary {
// request.result = whether the word has been adedd.
DOMRequest add(in DOMString word);
// request.result = whether the word has been removed.
DOMRequest remove(in DOMString word);
// request.result = DOMString[] with all words from the dictionary.
DOMRequest read();
// request.result = DOMString[] with all words from the personal
dictionary.
DOMRequest readPersonal();
// 'change' event can be sent to the Dictionnary object.
// It is using DictionaryChange interface.
Function onchange;
};
[Constructor(DOMString type, optional DictionaryEventInit dicEventInitDict)]
interface DictionaryChange : Event {
readonly attribute DOMString entry;
readonly attribute DOMString operation;
// type can be "added" or "removed".
}
dictionary DictionaryEventInit : EventInit {
DOMString entry;
DOMString operation;
};
Cheers,
--
Mounir