Closed Bug 129704 Opened 23 years ago Closed 2 years ago

SpellChecker API Redesign

Categories

(Core :: Spelling checker, task, P3)

task

Tracking

()

RESOLVED INACTIVE

People

(Reporter: kinmoz, Unassigned)

References

Details

This bug is intended for tracking and discussing issues related to a possible 
rewrite of Mozilla's Spellchecker interfaces.

I'll be updating this bug with some of my ideas to start off the discussion. I 
know that David Einstein (Deinst@world.std.com) has some ideas too.
Status: NEW → ASSIGNED
Priority: -- → P3
Target Milestone: --- → mozilla1.1
I've been thinking I should've implemented things at 2 different levels so that 
plugging in different spellcheckers would be easier.

At the lowest level, I think there should be a spellchecker interface that knows 
nothing about document structure, selection etc. The aim of this interface is to 
be as simple as possible and allow people to write glue code to their favorite 
spellchecker in under a day's time. This interface would be pretty basic and 
provide methods that allow us to query the dictionaries/languages it supported 
(so we could pass that back to the UI) and allow us to select which ones we 
wanted to use to check words. It would also have a checkWord or lookup method 
that just takes a word (string), the language used in the word's surrounding 
context, and perhaps the charset used in the word. This method would then give 
you back a bool telling you if the dictionaries used thought the word was 
misspelled, and something that allowed us to iterate over the replacement 
suggestions for the word.

At a higher level (spellchecker driver), we would have some interface that knew 
how to operate on DOM nodes ... but the interface itself would take a set of DOM 
ranges, similar to what the new find code uses, which would tell it the bounds 
in which it can operate and where to start/end it's checking. This would allow 
us do things like check the entire document, check specific portions of the 
document, or just what's inside the current selection. Note that this 
implementation would also be able to do checking inside mozilla text widgets 
since it also uses DOM nodes internally.

This higher level interface, would know nothing about selection or the document 
structure either. I'd really like to push that back on the app using this 
"driver". The implementation of this interface would be responsible for 
iterating over the nodes in the "check range" breaking the text into words based 
on the current language of the block and calling the low level interface to 
check the words. If it ran across a word that the low-level interface thought 
was misspelled and perhaps had some suggestions, it would then return a DOM 
range back to the app that represented the location of the word as well as the 
suggested info. The app would then use whatever means it had to select and even 
replace the word. Note that the app could use the new Find/Replace interfaces to 
implement the spellcheckers "change all words" feature.

Note that this driver level implementation could also be given a list of 
low-level spellcheckers to call when checking a word. (Use multiple 
spellcheckers)

We could also have this driver level maintain the user dictionary so that we 
have one list for all the spellcheckers.

We also need to think about a filtering mechanism that will allow us to skip 
over content that is not visible, for example text nodes that between <script> 
tags, etc.
See spellchecker.mozdev.org

I had made a mozISpellchecking engine interface that somewhat implements a low
level interface to a spell checker.  I have not paid as much attention to it as
I could have, but it pretty much does all that I want it to.  I probably want to
add a property setting function so that mozilla can turn on and off special
features of spell checkers.  I think that this will be necessary for system
spellcheckers, like those provided by OSX or KDE and probably others (does XP or
.net provide a system spellchecker?), and I think that it is crucial that we
support these.

I agree with the higher level interface, and was kind of thinking along the
lines of the new nsFind.  I also think that this makes it much easier to skip
unwanted text such as javascript, quoted mail, or signatures.  

The personal dictionary is somewhat tricky in the face of multiple languages, as
the system wide personal dictionary may be monolingual, and a multilingual user
may want to use a mozilla PD for some languages, and the system PD for others.


Blocks: 119232
Blocks: 16409
Blocks: 23421
Target Milestone: mozilla1.1alpha → Future
taking
Assignee: kin → rods
Status: ASSIGNED → NEW
Target Milestone: Future → mozilla1.2beta
Target Milestone: mozilla1.2beta → mozilla1.3alpha
reassigning
Assignee: rods → kin
Target Milestone: mozilla1.3alpha → mozilla1.3beta
Depends on: 180346
Target Milestone: mozilla1.3beta → mozilla1.5alpha
Target Milestone: mozilla1.5alpha → mozilla1.5beta
Assignee: kinmoz → nobody
Component: Editor: Core → Spelling checker
QA Contact: sujay → core.spelling-checker
Target Milestone: mozilla1.5beta → ---
According to this file
http://www.mozilla.org/quality/browser/front-end/testcases/composer/composer-spellcheck.html
there should be a clickable Help (button or link?) which would open an "About
the Edit Dictionary Box". Are there any plans to implement help, documentation
of some sort regarding Spell Checking?

For now, I'll make bug 256260 dependent of this bug. You may redirect bug 256260
to Documentation and Mozilla Developer (to update that composer-spellcheck.html
file) if there are no plans to implement a Help Button or Documentation of some
sort.
Blocks: 256260
This bug is about the code interfaces, not the user interface
No longer blocks: 256260
(In reply to comment #0)
> This bug is intended for tracking and discussing issues related to a possible 
> rewrite of Mozilla's Spellchecker interfaces.
> 
> I'll be updating this bug with some of my ideas to start off the discussion. I 
> know that David Einstein (Deinst@world.std.com) has some ideas too.

Hi, not shore if this is the right place for this request. I am not good at
spelling so I would love a "nearest" field in the Mozilla spell cheacker that I
can scroll through. Keep up the great work BTW! ~Mozfan.
Is this bug still relevant or should be be closed?  
(In reply to comment #9)
> Is this bug still relevant

Very much so.
Blocks: 346461
Depends on: 413950
No longer depends on: 413950
Summary: SpellChecker Interface Redesign → SpellChecker API Redesign

I guess this is not relevant anymore, but please reopen if it is.

Status: NEW → RESOLVED
Type: defect → task
Closed: 2 years ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.