Hi, Here is a Basic example:
Dim aLocale As New com.sun.star.lang.Locale Dim emptyArgs(0) As New com.sun.star.beans.PropertyValue aLocale.Language = "en" aLocale.Country = "US" aLocale.Variant = "" Dim vSpeller As Variant vSpeller = createUnoService("com.sun.star.linguistic2.SpellChecker") hasXMLAPI = "<?xml?>" query = "<?xml?><query type='analyze'><word>mice</word></query>" if (vSpeller.isValid(hasXMLAPI, aLocale, emptyArgs())) then vReturn = vSpeller.spell(query, aLocale, emptyArgs()) if (not IsNull(vReturn)) then if (vReturn.getAlternativesCount() > 0) then s = vReturn.getAlternatives() MsgBox "Result: " & s(0) end if end if end if The result of the analysis of the word "mice" is "<code><a> st:mouse ts:Ns</a></code>" (stem: mouse, affix:Ns, POS information (po: fields) is missing from the recent en-US dictionary, but you can add this and arbitrary fields to the morphological description). It seems, dictionary variant may be good for the development (adding a Variant string to the Locale parameter of the isValid/spell, OpenOffice.org doesn't use the base en-US dictionary). By the way, next version of the (language-neutral) Lightproof grammar checker extension will use Hunspell for morphological analysis, too. Regard, László 2009/9/25 William Colen <william.co...@gmail.com>: > Thank you, László > > I'll try that! I was wondering how I'll access my dictionary. Maybe I'll > have to add it as a dictionary extension with a special locale (using a > special Variant)? > I'll have to use my own dictionary for now and figure out how to stay > compatible with the official dictionary for that language. Latter I would > try to merge the official dictionary (without morph annotation) with mine. > > Thanks, > William > > > On Fri, Sep 25, 2009 at 12:00 PM, Németh László <nem...@openoffice.org>wrote: > >> Hello, >> >> In fact, you can use the XML API of Hunspell over the isValid() and >> spell() methods of XSpellChecker UNO interface. It is already used by >> the thesaurus component for stemming and morphological generation (see >> http://qa.openoffice.org/issues/show_bug.cgi?id=19563). >> >> From the Hunspell manual (hunspell.3): >> >> XML API >> The spell() [isValid() of XSpellChecker] function returns >> non-zero for the "<?xml?>" input >> indicating the XML API support. >> >> The suggest() [spell() of XSpellChecker] function stems, >> analyzes and generates the forms of the >> input word, if it was added by one of the following "SPELLML" >> syntaxes: >> >> <?xml?> >> <query type="analyze"> >> <word>dogs</word> >> </query> >> >> <?xml?> >> <query type="stem"> >> <word>dogs</word> >> </query> >> >> <?xml?> >> <query type="generate"> >> <word>dog</word> >> <word>cats</word> >> </query> >> >> <?xml?> >> <query type="generate"> >> <word>dog</word> >> <code><a>is:pl</a><a>is:poss</a></code> >> </query> >> >> The outputs of the type="stem" query and the stem() library >> function >> are the same. The output of the type="analyze" query is a >> string >> contained a <code><a>result1</a><a>result2</a>...</code> element. >> This >> element can be used in the second syntax of the type="generate" >> query. >> ....... >> >> Regards, >> László >> >> >> >> 2009/9/25 Thomas Lange - Sun Germany - ham02 - Hamburg < >> thomas.la...@sun.com>: >> > >> > Hi, >> > >> > William Colen wrote: >> >> Let me detail what I need: >> >> I have access to a Hunspell dictionary for pt-PT with morphological >> >> annotation. I'd like to access that morphological data to write a new >> >> Proofreader (grammar checker). >> >> That would be easier if I could access the OOo Hunspell wrapper. >> >> If that is not possible, I'll try to use FSA like LT did. >> >> >> >> Thanks, >> >> William >> >> >> > >> > Can't be done. There is no UNO API for that. >> > >> > Thomas >> > >> > >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: dev-unsubscr...@lingucomponent.openoffice.org >> > For additional commands, e-mail: dev-h...@lingucomponent.openoffice.org >> > >> > >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscr...@lingucomponent.openoffice.org >> For additional commands, e-mail: dev-h...@lingucomponent.openoffice.org >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lingucomponent.openoffice.org For additional commands, e-mail: dev-h...@lingucomponent.openoffice.org