I have a german Artemis and I really wonder about the words that are available in the input dictionary. A lot of very common words are missing but a lot of strange and rarely used words are available. Where did Microsoft take these words from? Did they prefer long words as to maximize the time you save by using the dictionary?
The german dictionary contains "anregung" but not "anruf" or "anrufen", "instanz" but not "installation", "sterblichkeit" but not "sterben". Words like "mögen", "möchte" and "Michael" are missing, instead there is "Hügellandschaft".
I know how to add words but I guess there is no way to put a completely alternative dictionary!?
WMSpellChecker
I have been programming for Windows Mobile for a few months by now, mainly using Basic4ppc which is an excellent developing-software, at a low cost, for producing great Windows Mobile-applications (but also Desktop-applications). Basic4ppc is based upon the .Net Framework.
One of the strenght of Basic4ppc is that it has great support and not only from the developer but also from other users who are supplying Basic4ppc with a lot of extra featues through external libraries. I got interested in writing a library myself and this is how the WMSpellChecker-library was born. However, from the very beginning, my idea was that the library should be compatible not only with Basic4ppc but also with Windows Mobile-applications developed in Visual Studio and SharpDevelop using VB.NET and C#.
I have seen commercial solutions for spellchecking but since I wanted to learn writing a library, I thought this would be a nice thing to give "for free" to fellow developers.
Well, let me get back to the WMSpellChecker-library:
Basically, a spell checker customarily consists of two parts:
1) A set of routines for scanning text and extracting words, and
2) An algorithm for comparing the extracted words against a known list of correctly spelled words (i.e., the dictionary).
However, what mentioned above is only a "half" spell checker since these days spell checkers also suggest replacements/corrections for misspelled words (among other things such as synonyms and grammar-hints). Said suggestions can be proposed by a spellchecking-engine based upon various techniques:
- phonetic algorithms such as "Soundex" among others.
- word lists containing common misspelled words and letters commonly inverted
- functions called "Near Miss Strategy" and introduced by one of the first spell-checkers on the market, namely Ispell for UNIX and with its roots dating back to 1971.
- algorithms like "edit distance" which measures the amount of difference between two sequences. A famous one is the "Levenshtein distance".
- and other techniques
The "techniques" mentioned above have all been implemented in the library.
I am aware of the fact that (at least) WM6 already offers spelling-suggestions and a spell checker if PocketWord (Office) has been installed but still I liked this idea so I decided to make a library. In any case, as far as I know, only the dictionary corresponding to the language of WM6 is being installed so if you want to spell check words in other languages you cannot do so.
The way it works.....
First of all, apart from referencing the library itself, you need to add two objects to your application, namely DICTIONARY and COMPUTEDETECTION.
Then you need to load the dictionary-files by using "LoadDict". Currently they consist of four separate files. However, I may change this in a future release. The dictionary-files must be located in the application-directory although you can create sub-folders. This first release only supports English and the dictionaries distributed with the library must not be tempered with. Next release will bring support for other languages and will also include a separate program for handling dictionaries.
Once the dictionaries have been loaded, you can start the spellchecking by calling the library using "ComputeDetection" which passes on your textbox-control to the library. In case there are words that are not present in the dictionary, then a set of suggestions will be returned to the calling application and at the same time the word which was not found will be shown in the textbox in capital-letters. The suggestions produced by the library can be obtained using "ReturnSuggestions" which returns a string-array.
Once you have shown the suggestions returned by the library, you can let your user in your application decide what to do i.e.
-"IgnoreWord" - ignoring the wrong word
-"AddWord" - adding an own word to replace the wrong word
-"ReplaceWord" - replacing the wrong word with a word from the suggestions
At this point, you tell the library to continue spellchecking by using "ContinueDetection". You should also verify if spellchecking has been terminated by using "IsSpellingFinished".
At any time, you can interrupt spellchecking by using "UnloadDict". This will be useful in a future release of the library so you can unload an English dictionary and to replace it with, for instance, a French dictionary without exiting your own application. However, before unloading the dictionary, you should verify if a dictionary has already been loaded or not by using "IsDictionaryLoaded".
In the help-file, you can find more important information as to the methods/properties available. Please also check out the two sample-projects present in the attachment where the source-code has been fully commented. One is using a classic spellchecking-interface and the other one is using context-menus.
Other comments....
This first release has some limitations, such as support only for English and the need for a textbox-control. However, I will add other features in the future, for instance:
-support for other languages
-dictionary-tools (for creating dictionaries) - will be an external program
-possibility to add a user-dictionary
-possibility to limit amount of suggestions produced by the library (by using a "ranking-system")
-no further need for a textbox-control in your application. Your application will be able to pass on to the library only the word(s) you wish to spellcheck and the library will only return the suggestion(s). In this way, the spellchecker-library will not "interfere" with your application and you can use whichever control you prefer although you as a developer has to take care of the words to be passed on the library for verification.
-spellchecking "on the fly"
-extended error-handling
A few notes regarding dictionaries....
The English dictionary supplied with the library is composed of nearly 70'000 words. Dictionaries to be used with the library must be sorted and each word in the dictionary must use LF = chr(10) as line-endings. In addition, the dictionary should be saved as UTF-8.
From the dictionary, a KeyMap is created using either a Soundex - or a DoubleMetaphone-algorithm. In this moment, the KeyMap is being furnished with the library and loaded as an external file but future releases might create it on the fly (or at least an option to do so). With next release, I will add a utility, to be run from the Desktop, which will let you create your own dictionary and corresponding KeyMap which are compatible with WMSpellChecker.
Unlike English and Scandinavian ones, dictionaries for German and Latin languages such as Spanish, Italian and French will probably be rather large. This is due to the fact that German, Italian and other similar languages use a lot of suffixes, for instance when creating verbs. In order to overcome this, certain famous spellcheckers such as ASpell, ISpell, HunSpell (used by OpenOffice) have implemented dictionaries which mostly contain only the base-form of words/verbs. However, they use a supplementary file called "affix" which contains a lot of grammar-rules and this file together with the simplified dictionary overcomes the problem of large dictionaries. However, I believe this system is probably rather memory- and performance-hungry and might not be the best solution for Windows Mobile and PPC. However, maybe in the future I will look into this.
Another negative side-effect of using a too large dictionary is that said dictionary may include more obscure words which will increase the risk that the spelling-engine will "miss" real-word errors. For instance, the word wether illustrates this. The word is, arguably, so obscure that any occurrence of wether in a passage is more likely to be a misspelling of weather or whether than a genuine occurrence of wether, so that a spellchecker that did not have the word in its dictionary would do better than one that did.
Conclusion....
The library can be used with projects developed with Basic4ppc (PPC and Desktop) but should also work with projects created in Visual Studio and SharpDevelop (using VB.NET and C#). The library has been compiled targeting Framework Version 2.0.
Library-version: 1.0
Helpfile-version: 1.0
As mentioned before, this is my first serious library. Please check it out and let me know how well it integrates in your applications.
Please also give me feedback, suggestions for improvements, missing features, bug-reports etc.
The idea is to add spelling-support for other languages as well and here I might need some help from end-users. I will let you know.
UPDATE - 17/08/2009: I will in the next days release an updated version with support for other languages as well (starting with French, German, Swedish and Spanish).
Enjoy!
Rgds,
Tilleke
Reserved for future use
Hopefully this evening or by the latest tomorrow, I will upload a new release of the spellchecking-library :
1) which will permit you to pass on a word to verify to the library and the library will return the suggestions without "interfering" with your application. In this way, there is no further need for a textbox-control in your application and you can apply spellchecking to other controls as well (such as the Webbrowser-control).
2) if I find the time, I will add other languages as well in above release otherwise this will follow in the next release.
By the way, has anyone tested it yet? If yes, does it work? Any problems? Please let me know.
rgds,
tilleke
tilleke,
Thanks for this. Looks great, especially the foriegn language capability. I would like to add Thai and Lao to the libraries.
Thanks.
Hmm..I'd love to be able to add support for Thai and Lao but I foresee a few problems:
1) in order to do so, I would need word lists (dictionaries) in those languages and which would be free to use/distribute. If you have any, please let me know. I tried to google for some but I couldn't find any.
2) I couldn't locate an emulator supporting Thai or Lao which I would need to work with Thai-fonts. I guess there must be some kind of support for UniCode:
ก ข ฃ ค ฅ ฆ ง จ ฉ ช ซ ฌ ญ ฎ ฏ ฐ
ฑ ฒ ณ ด ต ถ ท ธ น บ ป ผ ฝ พ ฟ ภ
ม ย ร ฤ ฤๅ ล ฦ ฦๅ ว ศ ษ ส ห ฬ อ ฮ
Click to expand...
Click to collapse
In any case, if one found a dictionary then maybe the font problem could be resolved in one way or another
3) I don't know if the "techniques" mentioned by me in my first post, can be applied to the languages of Thai and Lao...
nagbenjy said:
tilleke,
Thanks for this. Looks great, especially the foriegn language capability. I would like to add Thai and Lao to the libraries.
Thanks.
Click to expand...
Click to collapse
For Thai there are a couple of SIPs available - Thaiwince and Thai-G. I don't have the links handy, but a search on Google will find them.
I don't use either of them. What I did was copy tahoma and tahomabd from the WINDOWS\FONTS folder on the desktop. Opened them in font creator and added the Thai and Lao fonts. I then copied the new fonts to the phone WINDOWS directory overwriting the existing fonts. I use Resco Keyboard Pro to enter Thai and Lao text.
I can post the fonts and the Lao Language skin if you want them. I will aso find some word lists. BUT after thinking more about your methodology in your first post, I don't think it will work. Thai and Lao only have spaces at the end of phrases and sentences, not between words.
Thanks.
Interesting. In any case, I found a worlist for Thai If you send me by PM your e-mail address, then I can send it to you and you can let me know if it is any good.
Out of curiosity: How do you write in Thai the following sentences?
"Today the sun is shining. I think I will go to the beach with my friends. Do you want to come with me?"
nagbenjy said:
Thai and Lao only have spaces at the end of phrases and sentences, not between words.
Thanks.
Click to expand...
Click to collapse
BTW, do you know if Thai-SIPS (Thaiwince and Thai-G) or keyboards such as the one mentioned by you, Resco Keyboard Pro, insert the Unicode Character 'ZERO WIDTH SPACE' (U+200B) between words. If it does, then one could simplify the spell-checking.
See this page for further information:
http://blogamundo.net/dev/2006/12/28/the-zero-width-space/
Originally Posted by nagbenjy
Thai and Lao only have spaces at the end of phrases and sentences, not between words.
Thanks.
Click to expand...
Click to collapse
I am still looking into the the ZERO WIDTH SPACE and will reply later.
In reply to:
"Today the sun is shining. I think I will go to the beach with my friends. Do you want to come with me?"
Depends on where you live, hot climate or cold climate. For cold climate where the sun hardly shines:
"วันนี้มีแสงแดด ผมคิดว่าจะไปชายหาดกับเพื่อน คุณอยากไปด้วยไหม"
Rough transcription, no breaks separating words, no punctuation:
"wanneemiisaengdaed phomkidwajapaichaaihaadkapphuon khunyaakpaiduaymai"
breaks separating words:
"วัน นี้ มี แสง แดด ผม คิด ว่า จะ ไป ชาย หาด กับ เพื่อน. คุณ อยาก ไป ด้วย ไหม?"
wan nee mii saeng daed. phom kid wa ja pai chaaihaad kap phuon. khun yaak pai duay mai?
Hot climate:
"วันนี้แดดจ้า ผมคิดว่าจะไปชายหาดกับเพื่อน คุณอยากไปด้วยไหม"
Rough transcription, no breaks separating words, no punctuation
wanneedaedjaa phomkidwajapaichaaihaadkapphuon khunyaakpaiduaymai
breaks separating words:
วัน นี้ มี แสง แดด ผม คิด ว่า จะ ไป ชาย หาด กับ เพื่อน. คุณ อยาก ไป ด้วย ไหม?
wan nee mii daed jaa. phom kid wa ja pai chaaihaad kap phuon. khun yaak pai duay mai?
Thanks for the link, interesting
NAG
Update - 17/08/2009: - I will in the next days release an updated version with support for other languages as well (starting with French, German, Swedish and Spanish).
In this regard, I need some help with verifying that the suggested replacements generated by the spellchecking-engine are accurate and reasonable. I need to verify Spanish, French and German so if (any) above languages is (are) your mother-tongue(s) or if you know them very well, please send me a PM and I will send you an application that can be run on a normal PC-desktop (Windows).
Ahh this is your home ...
Funny that you're working on a spell checker as myself I've been looking for a replacement to phatspell for a long time and then gave up. You could find my threads http://forum.xda-developers.com/showthread.php?t=350563.
....
Hal_rr:
this project (library) is more intended for fellow developers who wish to add spellchecking to their applications. For end-users, there is not much use of this library since it's not a standalone program.
For the time being, this project is on hold (although it has evolved a lot compared to the features described in my first post/introduction). However if a developer is interested in an updated version, just let me know.
Who knows, I might one day write a small texteditor with spellchecking support, just for the fun of it.
Hi!
I've copied this post from another forum user, but I cannot seem to find a solution. Anyone know how to solve this? See below...
Big thanks!
Co
------
I have a problem with the spelling correction build within ICS. I’ll try and explain as good as possible.
Device: Samsung Galaxy Nexus
Android: Stock, unrooted, 4.0.2
My system setting is set to English while my keyboard/input language is set to Dutch. I prefer it this way since it’s much easier to look up problems and answers with English as a system language then Dutch (should a problem arise, the chances someone has asked it somewhere online in English are ‘a bit’ larger). However most of my texts are to Dutch friends, so the input language is Dutch. So far, so good.
If I mistype a word, the auto-correct does correct the word to a Dutch word. If I type words correctly, the auto-correct does nothing (and rightfully so). However, here’s my problem. The correct word remains correct, however ICS feels the need to underline it in red, showing it’s wrong. Touching the ‘wrong’ word gives suggestions for correct words, all of them in English.
Is there anyone who knows how to have the system language and the input language be two different languages, yet not have the spellcheck use the system-language?
I hope I’ve explained it clearly, such things are always more clear in your own head then when you type them out!
(If this has previously been discussed, my apologies, I couldn't find it)
Hi,
I still coming back to this topic when dealing with different version of LOS system. I hope that someone will help me clear out some doubts regarding AOSP Keyboard.
1. Dictionary with predicted words are just wrong at least for PL and CS languages. There are some weird words which seems okay, but there is a space between last two letters of a the word. I have to manually delete this word or create my own user dictionary.
Is there a way to replace or edit those dictionaries for predicting words?
2. There is something wrong at least in LOS 17.1 with spellcheck. IT only checks words for the the language set for the system interface what is a bit useless. I would like to have done for the language I've chosen in the keyboard settings
Thanks,