Using WeSay from Other Applications
Recently, we were asked to make a way for a user of a translation program to make use of WeSay, without leaving the program they’ve been trained on. The native speaker-user will want to:
- See which words are missing from the dictionary, and add them along with a definition.
- Jump into the entry screen for a word in WeSay to do more advanced editing.
- Point to a word and see a list of similar words they might choose instead (thesaurus lookup).
A linguist working with the group will want to:
- Click on an unfamiliar word and see the full dictionary article for it.
If the language has any affixation, both users will need to be able to:
- See a list of entries, ordered by how similar their spellings are to the word be investigated.
- Find words based on their inflected/derived forms, not just by the citation form in the dictionary.
- Add variants to the word so that it is clear that this form is covered by the dictionary, and make it easier to lookup next time.
The first round of this work is now available for other application developers to use (the italicized bullet items above will come in some future version).
To help developers add these features to their programs, I’ve built a little sample application so they can see what’s possible and how to do it. Here’s a little crummy video showing it:
(*** Flash video not supported ***)
[kml_flashembed movie=”http://www.wesay.org/downloads/movies/dsDemo/dsDemo.swf” height=”464″ width=”512″ scale=”noborder”/]
A few technical details for developers
Currently, I’ve implemented support for .net applications to make use of these services. But support via any language, via xml-rpc, should be easy to add when needed. All .net applications need to do is get our Palaso library and use the DictionaryAccessor class. You currently need to tell it where on the user’s machine to find WeSay, and where the dictionary is that you’ll be accessing.
Here’s some code to show what it takes add this ability to a .net application:
Getting some HTML of matching entries to show in a WebBrowser control
DictionaryAccessor dictionary = new DictionaryAccessor("c:docsnoosupunoosupu.lift", "c:program fileswesaywesapp.exe"); string forms; string ids; dictionary.GetMatchingEntries(writingSystemIdForWords, "foobar", FindMethods.Exact, out ids, out forms); string html = dictionary.GetHtmlForEntries(ids);
Adding a new word
dictionary.AddEntry(writingSystemIdForWords, wordBox.Text, writingSystemIdForDefinitions,definitionBox.Text, writingSystemIdForWords, exampleBox.Text);
Ok, so you get the idea that this will be a very easy service to add to your .Net program.
A plug here for .Net 3’s WCF (Windows Communication Framework), which made implementing this a very nice experience.
This has now been re-written to use cross language, cross platform “XML-RPC”messaging. So programs written in non-.Net languages can now participate.