// Thus we may stay with an empty list in order to use the ones
// form the property set.
PropertyValue[] aEmptyProps = new PropertyValue[0];
// use american english as language
Locale aLocale = new Locale("en","US","");
// another list of property values to used in function calls below.
// Only properties with values different from the (default) values
// in the LinguProperties property set need to be supllied.
PropertyValue[] aProps = new PropertyValue[1];
aProps[0] = new PropertyValue();
aProps[0].Name = "IsGermanPreReform";
aProps[0].Value = new Boolean( true );
GetSpell();
if (mxSpell != null)
{
// test with correct word
String aWord = "horseback";
boolean bIsCorrect = mxSpell.isValid( aWord, aLocale, aEmptyProps );
System.out.println( aWord + ": " + bIsCorrect );
// test with incorrect word
aWord = "course";
bIsCorrect = mxSpell.isValid( aWord, aLocale , aEmptyProps );
System.out.println( aWord + ": " + bIsCorrect );
aWord = "house";
XSpellAlternatives xAlt = mxSpell.spell( aWord, aLocale, aEmptyProps );
if (xAlt == null)
System.out.println( aWord + " is correct." );
else
{
System.out.println( aWord + " is not correct. A list of proposals follows." );
String[] aAlternatives = xAlt.getAlternatives();
if (aAlternatives.length == 0)
System.out.println( "no proposal found." );
else
{
for (int i = 0; i < aAlternatives.length; ++i)
System.out.println( aAlternatives[i] );
}
}
}
GetHyph();
if (mxHyph != null)
{
// maximum number of characters to remain before the hyphen
// character in the resulting word of the hyphenation
short nMaxLeading = 6;
XHyphenatedWord xHyphWord = mxHyph.hyphenate( "waterfall",
aLocale, nMaxLeading ,
aEmptyProps );
if (xHyphWord == null)
System.out.println( "no valid hyphenation position found" );
else
{
System.out.println( "valid hyphenation pos found at "
+ xHyphWord.getHyphenationPos()
+ " in " + xHyphWord.getWord() );
System.out.println( "hyphenation char will be after char "
+ xHyphWord.getHyphenPos()
+ " in " + xHyphWord.getHyphenatedWord() );
}
//! Note: 'aProps' needs to have set 'IsGermanPreReform' to true!
xHyphWord = mxHyph.queryAlternativeSpelling( "Schiffahrt",
new Locale("de","DE",""), (short)4, aProps );
if (xHyphWord == null)
System.out.println( "no alternative spelling found at specified position." );
else
{
if (xHyphWord.isAlternativeSpelling())