
com.cfdev.activspell2.SpellChecker - Object Reference
Properties
|
Property |
Method |
Type |
State |
Description |
|
clx |
init |
text (path) |
REQUIRED |
Compressed Lexicon File, path to the file in the lex directory with the extension .clx. |
|
tlx |
init |
text (path) |
REQUIRED |
Text Lexicon File, path to the file in the lex directory with the extension .tlx. |
|
userdict |
init addWord |
text (path) |
REQUIRED |
User Dictionary File, path to the file which will contain a user defined dictionary. |
|
searchdepth |
setSearchDepth |
integer |
1 to 100 |
An integer specifing the search depth, this attribute has significant impact on the spell checkers response time. Default value is 50, high values conduct a more in depth search. |
|
englishphonetic |
setEnglishPhoneticComparator |
boolean |
default:false |
Should be set to true if you are using the English language. This option will use an English Phonetic Comparator for searches. This comparator searches by phonetics, which often produces better results, and a few tests show that it has a higher return time. |
|
charlimit |
getCharLimit setCharLimit |
integer |
none |
Gets or sets the maximum number of characters allowed. If the limit is exceeded, an error message is returned. |
|
format |
checkSpelling |
text |
javascript or wddx |
Returns either a set of Java Script arrays of mispelled words, or output in WDDX XML Format. Default is JavaScript |
| suggestions | setNumSuggestions | integer | 1 to 100 | Sets the maximum number of suggestions that the spell checker will return. Default is 14. |
|
striphtml |
checkSpelling |
boolean |
default: true |
Removes all tags from the words input attribute. It will also remove anything inside <script>javascript</script> or <style>css</style> tags. |
| METHOD | DESCRIPTION |
| init(String userdic, String tlx, String clx) | Initializes the object, tells it what files represent the dictionary. |
| checkSpelling(String text, String format, boolean stripHTML) | Checks the spelling and returns the results in a format specified by format parameter. Valid values for format are javascript and wddx, see here for details. |
| addWord(String tlx, String word) | Adds a word to a text lexicon dictionary. |
| getCharLimit() | Returns the character limit as an integer. |
| setCharLimit(int charlimit) | Sets the character limit for the spelling session. |
| addLexicon(String tlx, String clx) | Adds a dictionary to the spelling session. |
An example instantiating a SpellChecker object:
'A file to hold commonly used variables. Found in the spellchecker directory
<!--#include file="global.inc"-->
<%
Set jsoutput = ""
Set spellChecker = Server.CreateObject("com.cfdev.activspell2.SpellChecker")
spellChecker.init cfdev_userdict, cfdev_tlx, cfdev_clx
'Add an additional lexicon to the spelling session using this method
'This allows support for multilingual spelling sessions and language extensions
'spellChecker.addLexicon Application("cfdev_tlx2"), Application("cfdev_clx2")
spellChecker.setEnglishPhoneticComparator(cfdev_englishphonetic)
spellChecker.setSearchDepth(cfdev_searchdepth)
spellChecker.setNumSuggestions(cfdev_suggestions)
jsoutput = spellChecker.checkSpelling(Request.Form("spellCheckContent") , "javascript", cfdev_striphtml)
%>
Most properties are stored in application variables or in an include file as with the default front-end, but could also be combined with session variables, for instance to create a unique user dictionary for each user in an application where the user dictionary exists as a file named as indicated.
See addword.asp, spell.asp and suggest.asp for example object useage in the supplied front-end.