<?xml version="1.0" encoding="UTF-8"?> <spellcheck> <word text="misspelled word w/ diacritics removed"> <suggestion>suggestion 1</suggestion> <suggestion>suggestion 2</suggestion> </word> <word text="misspelled word w/ diacritics removed"> <suggestion>suggestion 1</suggestion> <suggestion>suggestion 2</suggestion> <suggestion>suggestion 3</suggestion> </word> <word text="correctly spelled word"></word> <errors> <error>error 1</error> <error>error 2</error> </errors> </spellcheck>
<Context path="/vwebv" className="org.apache.catalina.core.StandardContext" cachingAllowed="true" charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true" crossContext="false" debug="0" displayName="Voyager WebVoyage" docBase="/m1/voyager/{xxxdb}/tomcat/vwebv/context/vwebv" mapperClass="org.apache.catalina.core.StandardContextMapper" privileged="false" reloadable="false" swallowOutput="false" useNaming="true" wrapperClass="org.apache.catalina.core.StandardWrapper"> <Logger className="org.apache.catalina.logger.FileLogger" verbosity="0" directory="logs" prefix="vwebv." suffix=".log" timestamp="true" /> <!-- uncomment the following to limit access to connections from this machine only --> <!--<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127.0.0.1"/> --> </Context> <Context path="/spellcheck" className="org.apache.catalina.core.StandardContext" cachingAllowed="true" charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true" crossContext="false" debug="0" displayName="Voyager WebVoyage Spellcheck" docBase="/m1/voyager/{xxxdb}/tomcat/vwebv/spellcheck" mapperClass="org.apache.catalina.core.StandardContextMapper" privileged="false" reloadable="false" swallowOutput="false" useNaming="true" wrapperClass="org.apache.catalina.core.StandardWrapper"> <Logger className="org.apache.catalina.logger.FileLogger" verbosity="0" directory="logs" prefix="spell." suffix=".log" timestamp="true" /> <!-- uncomment the following to limit access to connections from this machine only --> <!--<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127.0.0.1"/> --> </Context>
<Context path="/vwebv" className="org.apache.catalina.core.StandardContext" cachingAllowed="true" charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true" crossContext="false" displayName="Voyager WebVoyage" docBase="/m1/voyager/xxxdb/tomcat/vwebv/context/vwebv" privileged="true" reloadable="false" swallowOutput="false" useNaming="true" wrapperClass="org.apache.catalina.core.StandardWrapper"> <!-- uncomment the following to limit access to connections from this machine only --> <!--<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127.0.0.1"/> --> </Context> <Context path="/spellcheck" className="org.apache.catalina.core.StandardContext" cachingAllowed="true" charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true" crossContext="false" displayName="Voyager WebVoyage Spellcheck" docBase="/m1/voyager/xxxdb/tomcat/vwebv/spellcheck" privileged="true" reloadable="false" swallowOutput="false" useNaming="true" wrapperClass="org.apache.catalina.core.StandardWrapper"> <!-- uncomment the following to limit access to connections from this machine only --> <!--<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127.0.0.1"/> --> </Context>
Alias /vwebv/ui/ "/m1/voyager/xxxdb/tomcat/vwebv/context/vwebv/ui/"
Alias /spellcheck/ "/m1/voyager/xxxdb/tomcat/vwebv/spellcheck/"
JkMount /vwebv/vwe* ajp13_lb_xxxdb_vwebv
JkMount /spellcheck* ajp13_lb_xxxdb_vwebv
dictionary.english=/m1/voyager/{xxxdb}/tomcat/vwebv/spellcheck/WEB-INF/english.0
<?xml version="1.0" encoding="UTF-8"?> <spellcheck> <word text="captian"> <suggestion>caption</suggestion> <suggestion>captain</suggestion> </word> </spellcheck>The test must be working before continuing!
Example URL parameter: searchArg=pikle+captian
Example URL parameter: dict=cats
Example URL parameter: reload=true
When tomcat is first started, the dictionary is loaded by a user call to
http://your.library.domain/spellcheck/spellcheck?searchArg=captian
Because no dictionary is specified, the default english dictionary was used.
I then add Supercalifragilisticexpialidocious to the english dictionary. A search for supercalifragilsticexpialidocious (missing an i) will return no results until I call the servlet with reload=true
http://your.library.domain/spellcheck/spellcheck?searchArg=supercalifragilsticexpialidocious&reload=true
Now I would like to check the spelling of trés, which I'm quite sure is French for very. To do this, I ask for a new dictionary with dict=french&reload=true like so:
http://your.library.domain/spellcheck/spellcheck?searchArg=trés&dict=french&reload=true
assuming I have dictionary.french=/path/to/a/french_dictionary.0 in my spellcheck.properties file.
<pageMsg errorCode="searchResults.noHits">Search resulted in no hits.
<span id='spellcheck_message'></span> <span id="close_box" onclick="hide_spelling()">X</span> <script type='text/javascript'>spellcheck();</script></pageMsg>
<script type="text/javascript" src="{$jscript-loc}ajaxUtils.js"/>
<xsl:variable name="searchPages"
select="'page.searchBasic page.searchAdvanced page.searchSubject page.searchAuthor' "/>
<xsl:if test="contains($searchPages,/page:page/@nameId)">
<script type="text/javascript" src="{$jscript-loc}spellcheck.js"/>
</xsl:if>
<p class="{$messageClass}" id="{$messageClass}">
p.noHitsError { background:#FFFF90 none repeat scroll 0%; border:1px solid red; color:#FF0000; font-weight:bold; padding:5px; text-align:center; width:300px; position:relative; } #close_box {position:absolute;right:1px;top:1px;border:1px solid red;cursor:pointer;}
<pageMsg errorCode="searchResults.noHits">Search resulted in no hits.<span id='spellcheck_message'></span>
<span id="close_box" onclick="hide_spelling()">X</span>
<script type='text/javascript'>spellcheck();</script></pageMsg>
<p class="{$messageClass}" id="{$messageClass}">
p.noHitsError { background:#FFFF90 none repeat scroll 0%; border:1px solid red; color:#FF0000; font-size:1em; font-weight:bold; padding:5px; text-align:center; width:300px; position:relative; } #close_box {position:absolute;right:1px;top:1px;border:1px solid red;cursor:pointer;}
Ignore everything below and rush right over to Michael Doran's site to get a nice tool for creating custom dictionaries.
The Authors and Subjects in your OPAC don't always show up in the English dictionary.
For that matter, many other languages don't always show up in the English dictionary. It is, in fact, quite rare. ;-)
So I've written a couple of tools that will allow you to add lists of words to a dictionary that can be used for checking spelling.
What we did was to pull the authors' names and the subjects from our Voyager database and add them to the english dictionary to create one very large dictionary. I'll describe what we did, then you can work out your own customized dictionary from there...
SELECT DISTINCT utf8to16([DISPLAY_HEADING]) AS heading, BIB_INDEX.INDEX_CODE FROM BIB_INDEX WHERE ((BIB_INDEX.INDEX_CODE) Like "6*") ORDER BY utf8to16([DISPLAY_HEADING]);
Well, that's all well and good, but do we really want to have to open the English dictionary, then the author dictionary, then the subject dictionary in order to check the spelling for a keyword search? Of course not! So I wrote another program that will combine the dictionaries together, remove the duplicates, and sort the results. (Also located in the programs directory of the download file.)
Questions and comments can be sent to Jim Robinson at Tarrant County College.