type
CodeRec =
record
Normal : WideChar; // the normal unaccented form of a character
Lower : WideChar; // the Unicode for the lower case version with diacritic
Upper : WideChar; // the Unicode for the upper case version with diacritic
end;
const
NumRomanceCodes = 23;
RomanceCodes : array[0..NumRomanceCodes-1] of CodeRec = (
(Normal : 'a'; Lower : #$00E0; Upper : #$00C0),
(Normal : 'a'; Lower : #$00E1; Upper : #$00C1),
(Normal : 'a'; Lower : #$00E2; Upper : #$00C2),
(Normal : 'a'; Lower : #$00E4; Upper : #$00C4),
(Normal : 'a'; Lower : #$00E5; Upper : #$00C5),
(Normal : 'c'; Lower : #$00E7; Upper : #$00C7),
(Normal : 'e'; Lower : #$00E8; Upper : #$00C8),
(Normal : 'e'; Lower : #$00E9; Upper : #$00C9),
(Normal : 'e'; Lower : #$00EA; Upper : #$00CA),
(Normal : 'e'; Lower : #$00EB; Upper : #$00CB),
(Normal : 'i'; Lower : #$00EC; Upper : #$00CC),
(Normal : 'i'; Lower : #$00ED; Upper : #$00CD),
(Normal : 'i'; Lower : #$00EE; Upper : #$00CE),
(Normal : 'i'; Lower : #$00EF; Upper : #$00CF),
(Normal : 'n'; Lower : #$00F1; Upper : #$00D1),
(Normal : 'o'; Lower : #$00F2; Upper : #$00D2),
(Normal : 'o'; Lower : #$00F3; Upper : #$00D3),
(Normal : 'o'; Lower : #$00F4; Upper : #$00D4),
(Normal : 'o'; Lower : #$00F6; Upper : #$00D6),
(Normal : 'u'; Lower : #$00F9; Upper : #$00D9),
(Normal : 'u'; Lower : #$00FA; Upper : #$00DA),
(Normal : 'u'; Lower : #$00FB; Upper : #$00DB),
(Normal : 'u'; Lower : #$00FC; Upper : #$00DC)
);
var
I, J, Jlo, Jhi : Integer
Recognized : Boolean;
for I := 1 to Length(InpWord) do begin
TestWord := iUnicode.ToLower(InpWord);
Recognized := False;
Jlo := 0; // Low(RomanceCodes);
Jhi := NumRomanceCodes-1; // High(RomanceCodes);
for J := Jlo to Jhi do begin
if TestWord[I] = RomanceCodes[J].Normal then begin
TestWord[I] := RomanceCodes[J].Lower;
iLook := LookUp( ForwardDictFile, TestWord );
if iLook <> nil then begin
Recognized := True;
break;
end
else begin
TestWord[I] := RomanceCodes[J].Normal;
end;
end;
end;
if Recognized then break;
end;
This is the table of characters and the associated
code.
It looks very straightforward to me, but maybe there's
something I am missing.