Packagecom.adobe.linguistics.spelling
Classpublic class SpellChecker
InheritanceSpellChecker Inheritance Object
Implements com.adobe.linguistics.spelling.ISpellChecker

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 10

The spelling engine.

This class implements the ISpellChecker interface. This class performs spell-checking and generates suggestion lists for misspelled words. This class does not include any user-interface elements. Use this class if you want to offer control over how all upper case words are handled or words with numbers are handled, as this level of control is not offered by the SpellUI class. However, please keep in mind that if you use this class, you will need to write your own UI.

This class is based on the Hunspell algorithm and works with Hunspell/MySpell dictionaries and corresponding language rules files.

Currently, we support a subset of Hunspell rules(options).

The future of this class is to align as much as possible with existing Hunspell solution both for the algorithms and the content.

In this version, users can also directly load Open-Office dictionaries to HunspellDictionary class and initialize a SpellChecker instance with this HunspellDictionary object. When using this class, the language of use is implied by the dictionary supplied. Please make sure you load the appropriate dictionary based on the language the user selects to input.

Note: In the current implementation, only one main dictionary can be used at a time. In addition, in this version, suggestions for misspelled words do not include words from the user dictionary.



Public Properties
 PropertyDefined By
  ignoreWordWithAllUpperCase : Boolean
This property controls if words in all upper case should be considered as properly spelled or not.
SpellChecker
  ignoreWordWithNumber : Boolean
This property controls if words with numbers, such as windows95, should be considered as properly spelled.
SpellChecker
Public Methods
 MethodDefined By
  
SpellChecker(spellingDictionary:ISpellingDictionary)
Constructs a new SpellChecker object that performs language sensitive spell checking.
SpellChecker
  
addUserDictionary(userDictionary:UserDictionary):Boolean
Add a user dictionary to the SpellChecker.
SpellChecker
  
checkWord(word:String):Boolean
Spellchecks a word.
SpellChecker
  
getSuggestions(word:String):Array
Gets suggestions for a misspelled word.
SpellChecker
  
removeUserDictionary(userDictionary:UserDictionary):Boolean
Remove a user dictionary from the SpellChecker.
SpellChecker
Property Detail
ignoreWordWithAllUpperCaseproperty
ignoreWordWithAllUpperCase:Boolean

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 10

This property controls if words in all upper case should be considered as properly spelled or not.

ignoreWordWithAllUpperCase Description
falseDefault

Words with all characters in upper case are checked against the dictionary for proper spelling.

Example: if ignoreWordWithAllUpperCase = false, "MISPEL" will be checked for proper spelling.

true 

Any words with all characters in upper case are always considered as properly spelled, no matter whether the word is in the dictionary or not.

Example: if ignoreWordWithAllUpperCase = true, "MISPEL" will be considered as properly spelled.


Implementation
    public function get ignoreWordWithAllUpperCase():Boolean
    public function set ignoreWordWithAllUpperCase(value:Boolean):void
ignoreWordWithNumberproperty 
ignoreWordWithNumber:Boolean

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 10

This property controls if words with numbers, such as windows95, should be considered as properly spelled.

ignoreWordWithNumber Description
falseDefault

Any words containing digits are checked for proper spelling.

Example: If ignoreWordWithNumber = false, "mispel99" will be checked for proper spelling.

true 

Words containing digits are always ignored/skipped regardless of the dictionary.

Example: If ignoreWordWithNumber = true, "mispel99" will be considered as properly spelled.


Implementation
    public function get ignoreWordWithNumber():Boolean
    public function set ignoreWordWithNumber(value:Boolean):void
Constructor Detail
SpellChecker()Constructor
public function SpellChecker(spellingDictionary:ISpellingDictionary)

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 10

Constructs a new SpellChecker object that performs language sensitive spell checking.

Parameters
spellingDictionary:ISpellingDictionary — A ISpellingDictionary interface to be used by this SpellChecker. For example, you can pass a HunspellDictonary object which already implemented the ISpellingDictionary interface to this constructor.
Method Detail
addUserDictionary()method
public function addUserDictionary(userDictionary:UserDictionary):Boolean

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 10

Add a user dictionary to the SpellChecker.

Parameters

userDictionary:UserDictionary — A UserDictionary object to be added to this SpellChecker.

Returns
Booleantrue if the operation is successful. false if the operation failed.
checkWord()method 
public function checkWord(word:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 10

Spellchecks a word.

Parameters

word:String — A string containing a word.

Notes:

  • Please be aware that it is the caller's responsibility to break down sentences into words that can be handled by this method. For example, this method does not support punctuation marks such as comma, colon, quotes, etc. Punctuation marks should be stripped out from the word prior to calling this method. If a word contains white spaces (such as a regular space or non-breaking space), the word will be considered as misspelled.

Returns
Booleantrue if the word is properly spelled. false if the word is misspelled.
getSuggestions()method 
public function getSuggestions(word:String):Array

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 10

Gets suggestions for a misspelled word.

Parameters

word:String — A string containing a misspelled word.

Returns
Array — A list of suggestions.

Up to ten suggestions may be returned.

removeUserDictionary()method 
public function removeUserDictionary(userDictionary:UserDictionary):Boolean

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 10

Remove a user dictionary from the SpellChecker.

Parameters

userDictionary:UserDictionary — A UserDictionary object to be removed from this SpellChecker.

Returns
Booleantrue if the operation is successful. false if the operation failed.