One of the requirements for the twitter client we are developing for the community is a spellcheck component. What are some of the spellcheck components/systems you have us
I use the TRichView component as my "text editor" in my Delphi application.
It supports many spellcheckers that work with Delphi. You may want to compare the ones that it supports:
http://www.trichview.com/features/spellcheck.html
I've been using Addict and have been pretty happy with it. I've used it mainly in conjunction with WPTools for mail merge & emailing.
Addict Component Suite is the most complete one for Delphi, but it's not free.
But I think you are looking for freeware for your twitter utility, I have used LS Speller for free project and worked fine with me, it's based on ISpell, so you can update it with newer dictories.
But there's no D2009 update yet, and seems it's not actively developed.
Another option to use the MS Word built in dictionary.
In the blog comments Ken just suggested LS Spell which uses the ISpell dictionaries. It is for Delphi 5, 6 and 7, so as long as it doesn't make explicit use of other string types might work fine.
If you can guarantee that your client always has MS Word installed, I'd suggest MS Word's built in spellchecker too with OLE automation.
Windows comes with a spell checker API (Windows 8).
TWindow8SpellChecker = class(TCustomSpellChecker)
private
FSpellChecker: ISpellChecker;
public
constructor Create(LanguageTag: UnicodeString='en-US');
procedure Check(const text: UnicodeString; const Errors: TList); override; //gives a list of TSpellingError objects
function Suggest(const word: UnicodeString; const Suggestions: TStrings): Boolean; override;
end;
With implementation:
constructor TWindow8SpellChecker.Create(LanguageTag: UnicodeString='en-US');
var
factory: ISpellCheckerFactory;
begin
inherited Create;
factory := CoSpellCheckerFactory.Create;
OleCheck(factory.CreateSpellChecker(LanguageTag, {out}FSpellChecker));
end;
procedure TWindow8SpellChecker.Check(const text: UnicodeString; const Errors: TList);
var
enumErrors: IEnumSpellingError;
error: ISpellingError;
spellingError: TSpellingError;
begin
if text = '' then
Exit;
OleCheck(FSpellChecker.Check(text, {out}enumErrors));
while (enumErrors.Next({out}error) = S_OK) do
begin
spellingError := TSpellingError.Create(
error.StartIndex,
error.Length,
error.CorrectiveAction,
error.Replacement);
Errors.Add(spellingError);
end;
end;
function TWindow8SpellChecker.Suggest(const word: UnicodeString; const Suggestions: TStrings): Boolean;
var
hr: HRESULT;
enumSuggestions: IEnumString;
ws: PWideChar;
fetched: LongInt;
begin
if (word = '') then
begin
Result := False;
Exit;
end;
hr := FSpellChecker.Suggest(word, {out}enumSuggestions);
OleCheck(hr);
Result := (hr = S_OK); //returns S_FALSE if the word is spelled correctly
ws := '';
while enumSuggestions.Next(1, {out}ws, {out}@fetched) = S_OK do
begin
if fetched < 1 then
Continue;
Suggestions.Add(ws);
CoTaskMemFree(ws);
end;
end;
The TSpellingError object is a trivial wrapper around four values:
TSpellingError = class(TObject)
protected
FStartIndex: ULONG;
FLength: ULONG;
FCorrectiveAction: CORRECTIVE_ACTION;
FReplacement: UnicodeString;
public
constructor Create(StartIndex, Length: ULONG; CorrectiveAction: CORRECTIVE_ACTION; Replacement: UnicodeString);
property StartIndex: ULONG read FStartIndex;
property Length: ULONG read FLength;
property CorrectiveAction: CORRECTIVE_ACTION read FCorrectiveAction;
property Replacement: UnicodeString read FReplacement;
end;