-- © Copyright 2000 by John Halleck. All Rights Reserved.
-- Definitions to deal with contractions.
package body Braille.Contractions is
function To_Print (Given : Cell; Found : Context) return String is
begin
if Given = Empty then
return " ";
end if;
if Found = Numeric then
case Given is
when A => return "1";
when B => return "2";
when C => return "3";
when D => return "4";
when E => return "5";
when F => return "6";
when G => return "7";
when H => return "8";
when I => return "9";
when J => return "0";
when others => null;
end case;
elsif Found = Whole_Word then
case Given is
when A => return "a";
when B => return "but";
when C => return "can";
when D => return "do";
when E => return "every";
when F => return "from";
when G => return "go";
when H => return "have";
when I => return "i";
when J => return "just";
when K => return "knowledge";
when L => return "like";
when M => return "more";
when N => return "not";
when O => return "o";
when P => return "people";
when Q => return "quite";
when R => return "rather";
when S => return "so";
when T => return "that";
when U => return "us";
when V => return "very";
when W => return "will";
when X => return "it";
when Y => return "you";
when Z => return "as";
when C_Ch => return "child";
when C_Sh => return "shall";
when C_Th => return "this";
when C_Wh => return "which";
when C_Ou => return "out";
when C_En => return "enough";
when C_St => return "still";
-- Several are missing here.
when others => null;
end case;
elsif Found = Initial then
null;
elsif Found = Final then
null;
elsif Found = Initial_5 then
case Given is
when D => return "day";
when E => return "ever";
when F => return "father";
when H => return "here";
when K => return "know";
when L => return "lord";
when M => return "mother";
when N => return "name";
when O => return "one";
when P => return "part";
when Q => return "question";
when R => return "right";
when S => return "some";
when T => return "time";
when U => return "under";
when W => return "work";
when Y => return "young";
when F_The => return "there";
when C_Ch => return "character";
when C_Th => return "through";
when C_Wh => return "where";
when C_Ou => return "ought";
when others => null;
end case;
elsif Found = Initial_45 then
case Given is
when U => return "upon";
when W => return "word";
when F_The => return "these";
when C_Th => return "those";
when C_Wh => return "whose";
when others => null;
end case;
elsif Found = Initial_456 then
case Given is
when C => return "cannot";
when H => return "had";
when M => return "many";
when S => return "sprit";
when W => return "world";
when F_The => return "their";
when others => null;
end case;
elsif Found = Final_46 then
case Given is
when D => return "ound";
when E => return "ance";
when N => return "sion";
when S => return "less";
when T => return "ount";
when others => null;
end case;
elsif Found = Final_56 then
case Given is
when E => return "ence";
when G => return "ong";
when L => return "ful";
when N => return "tion";
when S => return "ness";
when T => return "ment";
when Y => return "itty";
when others => null;
end case;
elsif Found = Final_6 then
case Given is
when N => return "ation";
when Y => return "ally";
when others => null;
end case;
end if;
-- If the special cases didn't work, try the default.
case Given is
when A => return "a";
when B => return "b";
when C => return "c";
when D => return "d";
when E => return "e";
when F => return "f";
when G => return "g";
when H => return "h";
when I => return "i";
when J => return "j";
when K => return "k";
when L => return "l";
when M => return "m";
when N => return "n";
when O => return "o";
when P => return "p";
when Q => return "q";
when R => return "r";
when S => return "s";
when T => return "t";
when U => return "u";
when V => return "v";
when W => return "w";
when X => return "x";
when Y => return "y";
when Z => return "z";
when F_And => return "and";
when F_For => return "for";
when F_Of => return "of";
when F_The => return "the";
when F_With => return "with";
when C_Ch => return "ch";
when C_Gh => return "gh";
when C_Sh => return "sh";
when C_Th => return "th";
when C_Wh => return "wh";
when C_Ed => return "ed";
when C_Er => return "er";
when C_Ou => return "ou";
when C_Ow => return "ow";
when C_En => return "en";
when C_In => return "in";
when C_St => return "st";
when C_Ar => return "ar";
when C_Ing => return "ing";
when Number => return "#";
when Period => return ".";
when Question => return "?";
when Exclamation => return "!";
when Comma => return ",";
when Semicolon => return ";";
when Colon => return ":";
when Apostrophe => return "'";
when Double_Quote => return """";
when Parenthesis => return "()";
when Letter => return "[letter]";
when Dash => return "_";
when Capital => return "^";
when Accent => return "'";
when Italic => return "[Italic]";
when others => null;
end case;
return "";
end To_Print;
end Braille.Contractions;
This page is http://www.cc.utah.edu/~nahaj/ada/braille/braille-contractions.adb.html
© Copyright 2000 by John Halleck, All Rights Reserved.
This snapshot was last modified on August 24th, 2000