org.eclipse.jdt.internal.ui.text.spelling.engine

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Eclipse » jdt » org.eclipse.jdt.internal.ui.text.spelling.engine 
org.eclipse.jdt.internal.ui.text.spelling.engine
Package-level Javadoc Provides the core functionality for spell-checking documents

Package Specification

This package provides the interfaces for the notions of dictionary, edit distance, phonetic hash, spell event and spell-check iterator. For most of these interfaces a default implementation for english languages is provided. These implementations can be reused in custom dictionaries or spell-check iterators, or replaced by more specialized algorithms for a particular group of languages.

Spell Check Engine

The central point to access the spell-checker functionality is the interface ISpellCheckEngine. Implementations of this interface provide support for life-cycle management, registering and unregistering dictionaries, changing the locale of the engine and creating a spell-checker for a specific language.

The following steps are needed to obtain a spell-checker for a specific language:

  • Create an instance of ISpellCheckEngine. In this package, no default implementation is provided, since the management of the dictionary registering and loading is application dependent. Usually, instances of ISpellCheckEngine are implemented as singletons.
  • Create the appropriate dictionaries that should be used during the spell-check process. All dictionaries that can be registered with ISpellCheckEngine must implement the interface ISpellCheckDictionary. For this interface, an abstract implementation is provided in the class AbstractSpellDictionary. Depending on the language of the words contained in this dictionary, custom algorithms for the phonetic hash (IPhoneticHashProvider) and the edit distance (IPhoneticDistanceAlgorithm) should be implemented and registered with the dictionary.
  • Instances of spell-checkers can now be created by calling createSpellChecker(Locale), where the locale denotes the language that the spell-checker should use while executing.
When requesting a new spell-checker with a different locale via createSpellChecker(Locale), the spell-checker is reconfigured with the new dictionaries. More concretely, the old dictionary is unregistered and a new one registered for the desired locale is associated with the spell-checker. If no such dictionary is available, no spell-checker is returned and the locale of the engine is reset to its default locale.

Dictionaries

Dictionaries are the data structures to hold word lists for a particular language. All implementations of dictionaries must implement the interface ISpellDictionary. It provides support for life-cycle management as well as the facility to query words from the list, add words to the list and get correction proposals for incorrectly spelt words.

This package provides a default implementation of a dictionary (AbstractSpellDictionary) that uses algorithms convenient for english languages.
Every dictionary needs two kinds of algorithms to be plugged in:

  • An edit distance algorithm: Edit distance algorithms implement the interface IPhoneticDistanceAlgorithm. The algorithm is used to determine the similarity between two words. This package provides a default implementation for languages using the latin alphabet (DefaultPhoneticDistanceAlgorithm). The default algorithm uses the Levenshtein text edit distance.
  • A hash algorithm: Phonetic hash providers implement the interface IPhoneticHashProvider. The purpose of phonetic hashes is to have a representation of words which allows comparing it to other, similar words. This package provides a default implementation which is convenient for slavic and english languages. It uses the double metaphone algorithm by published Lawrence Philips.
By plugging in custom implementations of one or both of these algorithms the abstract implementation AbstractSpellDictionary can be customized to specified languages and alphabets.

Spell Check Iterators

Instances of ISpellChecker are usually language-, locale- and medium independent implementations and therefore need an input provider. The interface ISpellCheckIterator serves this purpose by abstracting the tokenizing of text media to a simple iteration. The actual spell-check process is launched by calling ISpellChecker#execute(ISpellCheckIterator). This method uses the indicated spell-check iterator to determine the words that are to be spell-checked. This package provides no default implementation of a spell-check iterator.

Event Handling

To communicate the results of a spell-check pass, spell-checkers fire spell events that inform listeners about the status of a particular word being spell-checked. Instances that are interested in receiving spell events must implement the interface ISpellEventListener and register with the spell-checker before the spell-check process starts.

A spell event contains the following information:

  • The word being spell-checked
  • The begin index of the current word in the text medium
  • The end index in the text medium
  • A flag whether this word was found in one of the registered dictionaries
  • A flag that indicates whether this word starts a new sentence
  • The set of proposals if the word was not correctly spelt. This information is lazily computed.
Spell event listeners are free to handle the events in any way. However, listeners are not allowed to block during the event handling unless the spell-checking process happens in another thread.
Java Source File NameTypeComment
AbstractSpellDictionary.javaClass Partial implementation of a spell dictionary.
DefaultPhoneticDistanceAlgorithm.javaClass Default phonetic distance algorithm for English words.
DefaultPhoneticHashProvider.javaClass Default phonetic hash provider for english languages.
DefaultSpellChecker.javaClass Default spell checker for standard text.
IPhoneticDistanceAlgorithm.javaInterface Interface of algorithms to compute the phonetic distance between two words.
IPhoneticHashProvider.javaInterface Interface of hashers to compute the phonetic hash for a word.
ISpellCheckEngine.javaInterface Interface for a spell check engine.
ISpellChecker.javaInterface Interface for spell checkers.
ISpellCheckIterator.javaInterface Interface for iterators used for spell checking.
ISpellDictionary.javaInterface Interface of dictionaries to use for spell checking.
ISpellEvent.javaInterface Event fired by spell checkers.
ISpellEventListener.javaInterface Interface for spell event listeners.
LocaleSensitiveSpellDictionary.javaClass Platform wide read-only locale sensitive dictionary for spell checking.
PersistentSpellDictionary.javaClass Persistent modifiable word-list based dictionary.
RankedWordProposal.javaClass Ranked word proposal for quick fix and content assist.
SpellEvent.javaClass Spell event fired for words detected by a spell check iterator.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.