Commit 30f41aba by Robert Dewar Committed by Arnaud Charlet

g-speche.ads, [...]: Add special case to recognize misspelling initial letter o as a zero.

2006-10-31  Robert Dewar  <dewar@adacore.com>

	* g-speche.ads, g-speche.adb: Add special case to recognize misspelling
	initial letter o as a zero.

From-SVN: r118281
parent ad98c85e
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1998-2005 AdaCore -- -- Copyright (C) 1998-2006, AdaCore --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -39,8 +39,7 @@ package body GNAT.Spelling_Checker is ...@@ -39,8 +39,7 @@ package body GNAT.Spelling_Checker is
function Is_Bad_Spelling_Of function Is_Bad_Spelling_Of
(Found : String; (Found : String;
Expect : String) Expect : String) return Boolean
return Boolean
is is
FN : constant Natural := Found'Length; FN : constant Natural := Found'Length;
FF : constant Natural := Found'First; FF : constant Natural := Found'First;
...@@ -60,9 +59,14 @@ package body GNAT.Spelling_Checker is ...@@ -60,9 +59,14 @@ package body GNAT.Spelling_Checker is
elsif EN = 0 then elsif EN = 0 then
return False; return False;
-- If first character does not match, then definitely not misspelling -- If first character does not match, then we consider that this is
-- definitely not a misspelling. An exception is when we expect a
-- letter O and found a zero.
elsif Found (FF) /= Expect (EF) then elsif Found (FF) /= Expect (EF)
and then (Found (FF) /= '0'
or else (Expect (EF) /= 'o' and then Expect (EF) /= 'O'))
then
return False; return False;
-- Not a bad spelling if both strings are 1-2 characters long -- Not a bad spelling if both strings are 1-2 characters long
...@@ -149,7 +153,6 @@ package body GNAT.Spelling_Checker is ...@@ -149,7 +153,6 @@ package body GNAT.Spelling_Checker is
else else
return False; return False;
end if; end if;
end Is_Bad_Spelling_Of; end Is_Bad_Spelling_Of;
end GNAT.Spelling_Checker; end GNAT.Spelling_Checker;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1998-2005 AdaCore -- -- Copyright (C) 1998-2006, AdaCore --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -40,8 +40,7 @@ package GNAT.Spelling_Checker is ...@@ -40,8 +40,7 @@ package GNAT.Spelling_Checker is
function Is_Bad_Spelling_Of function Is_Bad_Spelling_Of
(Found : String; (Found : String;
Expect : String) Expect : String) return Boolean;
return Boolean;
-- Determines if the string Found is a plausible misspelling of the -- Determines if the string Found is a plausible misspelling of the
-- string Expect. Returns True for an exact match or a probably -- string Expect. Returns True for an exact match or a probably
-- misspelling, False if no near match is detected. This routine -- misspelling, False if no near match is detected. This routine
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment