OpenBD Wiki

From OpenBD
Jump to: navigation, search

Category:SpellCheckPlugin

The SpellCheckPlugin adds CFML functions within OpenBD that can pull in dictionary files and check the spelling of given text.

As an example of this functionality, the following code will load in an american dictionary from mozilla and perform a spell check on some text.

To begin with, let us see what dictionaries ship with the plugin as standard.

<cfset dictionaryList = SpellListDictionary()>
<cfdump var="#dictionaryList#">

You can easily add to the main dictionaries using any standard OpenOffice or Mozilla dictionary. Here is an example of loading it directly from Mozilla's website.

<cfif !SpellIsRegistered("Dictionary-US")>
  <cfset path="c:\">
  <cfset newFile="DictionaryUS.xpi">
	
  <cfhttp method="GET" file="#newFile#" path="#path#" url="http://downloads.mozdev.org/dictionaries/spell-en-US.xpi">

  <!--- register our new dictionary from the file --->
  <cfset SpellRegisterDictionary( "Dictionary-US", path & newFile )>

  <!--- safe to delete the dictionary file once it is loaded in (registered) --->
  <cfset FileDelete(path & newFile)>
</cfif>

Once a dictionary is loaded in we can go on to perform a spell check as shown below. Simply using some text to spell check and the dictionary name to check against.

<cfset spellText = "hello here is a test of speling colour with the US Dictionry">
<cfdump var="Performing Spell Check on: '#spellText#'">

<!--- perform the spell check specifying our text and dictionary to use --->
<cfset results = SpellCheck( spellText, "dictionary-us" )>

<!--- in this case lets simply output the resulting spelling mistakes found and suggestions for fixing them --->
<cfdump var="#results#">

function definitions and more to come...

What Dictionaries Are Available?

This plug-in can accept both OpenOffice(.zip) dictionary files and Mozilla(.xpi) dictionary files.

A variety of Mozilla dictionaries that can be used with this plugin are available from:

Download

You can download this from the main OpenBD website Official Download Site

Pages in category "SpellCheckPlugin"

The following 7 pages are in this category, out of 7 total.

S

S cont.

S cont.


Personal tools