📄 adsapigr.pas
字号:
^M^J +
'<Less1000000000000Pad>=<Less1000Pad> <Less1000000000000Pad2>' + ^M^J +
'<Less1000000000000Pad>=<Less1000Pad> <Less1000000000000Pad2>' + ^M^J +
'<Less1000000000000Pad2>=billion "000000000"' + ^M^J +
'<Less1000000000000Pad2>=billion [opt] and <Less1000000000Pad>' + ^M^J +
'// Less than 1,000,000,000,000, not padded with zeros' + ^M^J +
'<Less1000000000000Not>=<Less100Not> <Less1000000000000Not2>' + ^M^J +
'<Less1000000000000Not>=<Less1000Not> <Less1000000000000Not2>' + ^M^J +
'<Less1000000000000Not2>=billion "000000000"' + ^M^J +
'<Less1000000000000Not2>=billion [opt] and <Less1000000000Pad>' + ^M^J +
'// Less than 1,000,000,000, padded with zeros' + ^M^J +
'<Less1000000000Pad>="000" <Less1000000Pad>' + ^M^J +
'<Less1000000000Pad>=million [opt] and "001" <Less1000000Pad>' + ^M^J +
'<Less1000000000Pad>=<Less1000Pad> <Less1000000000Pad2>' + ^M^J +
'<Less1000000000Pad2>=million "000000"' + ^M^J +
'<Less1000000000Pad2>=million [opt] and <Less1000000Pad>' + ^M^J +
'// Less than 1,000,000,000, not padded with zeros' + ^M^J +
'<Less1000000000Not>=<Less100Not> <Less1000000000Not2>' + ^M^J +
'<Less1000000000Not>=<Less1000Not> <Less1000000000Not2>' + ^M^J +
'<Less1000000000Not2>=million "000000"' + ^M^J +
'<Less1000000000Not2>=million [opt] and <Less1000000Pad>' + ^M^J +
'// Less than 1,000,000, padded with zeros' + ^M^J +
'<Less1000000Pad>="000" <Less1000Pad>' + ^M^J +
'<Less1000000Pad>=thousand [opt] and "001" <Less1000Pad>' + ^M^J +
'<Less1000000Pad>=<Less1000Pad> <Less1000000Pad2>' + ^M^J +
'<Less1000000Pad2>=thousand "000"' + ^M^J +
'<Less1000000Pad2>=thousand [opt] and <Less1000Pad>' + ^M^J +
'' + ^M^J +
'[<1_9>]' + ^M^J +
'<1_9>=1' + ^M^J +
'<1_9>=2' + ^M^J +
'<1_9>=3' + ^M^J +
'<1_9>=4' + ^M^J +
'<1_9>=5' + ^M^J +
'<1_9>=6' + ^M^J +
'<1_9>=7' + ^M^J +
'<1_9>=8' + ^M^J +
'<1_9>=9' + ^M^J +
'' + ^M^J +
'[<0_9>]' + ^M^J +
'<0_9>=zero "0"' + ^M^J +
'<0_9>=oh "0"' + ^M^J +
'<0_9>=<1_9>' + ^M^J +
'' + ^M^J +
'[<10_19>]' + ^M^J +
'<10_19>=10' + ^M^J +
'<10_19>=11' + ^M^J +
'<10_19>=12' + ^M^J +
'<10_19>=13' + ^M^J +
'<10_19>=14' + ^M^J +
'<10_19>=15' + ^M^J +
'<10_19>=16' + ^M^J +
'<10_19>=17' + ^M^J +
'<10_19>=18' + ^M^J +
'<10_19>=19' + ^M^J +
'' + ^M^J +
'[<20_99>]' + ^M^J +
'<20_99>=<20_31>' + ^M^J +
'<20_99>=<32_99>' + ^M^J +
'' + ^M^J +
'[<20_31>]' + ^M^J +
'<20_31>=20' + ^M^J +
'<20_31>=twenty "2" <1_9>' + ^M^J +
'<20_31>=30' + ^M^J +
'' + ^M^J +
'[<32_99>]' + ^M^J +
'<32_99>=thirty "3" <1_9>' + ^M^J +
'<32_99>=40' + ^M^J +
'<32_99>=forty "4" <1_9>' + ^M^J +
'<32_99>=50' + ^M^J +
'<32_99>=fifty "5" <1_9>' + ^M^J +
'<32_99>=60' + ^M^J +
'<32_99>=sixty "6" <1_9>' + ^M^J +
'<32_99>=70' + ^M^J +
'<32_99>=seventy "7" <1_9>' + ^M^J +
'<32_99>=80' + ^M^J +
'<32_99>=eighty "8" <1_9>' + ^M^J +
'<32_99>=90' + ^M^J +
'<32_99>=ninety "9" <1_9>' + ^M^J +
'' + ^M^J +
'[<DoubleDigit>]' + ^M^J +
'<DoubleDigit>=<20_99>' + ^M^J +
'<DoubleDigit>=<10_19>' + ^M^J +
'' + ^M^J +
'[<TripleDigit>]' + ^M^J +
'<TripleDigit>=hundred "1" <Less100Pad>' + ^M^J +
'<TripleDigit>=<1_9> <TripleDigit2>' + ^M^J +
'<TripleDigit2>=hundred [opt] and <Less100Pad>' + ^M^J +
'<TripleDigit2>=hundred "00"' + ^M^J +
'' + ^M^J +
'[<Less100Not>]' + ^M^J +
'// Less that 100, not padded with zeros' + ^M^J +
'<Less100Not>=<1_9>' + ^M^J +
'<Less100Not>=<DoubleDigit>' + ^M^J +
'<Less100Not>=zero "0"' + ^M^J +
'' + ^M^J +
'[<Less100Pad>]' + ^M^J +
'// Less that 100, padded with zeros' + ^M^J +
'<Less100Pad>="0" <1_9>' + ^M^J +
'<Less100Pad>=<DoubleDigit>' + ^M^J +
'<Less100Pad>=zero "00"' + ^M^J +
'' + ^M^J +
'[<Less1000Not>]' + ^M^J +
'// Less than 1000, not padded with zeros' + ^M^J +
'<Less1000Not>=<TripleDigit>' + ^M^J +
'' + ^M^J +
'[<Less1000Pad>]' + ^M^J +
'// Less than 1000, padded with zeros' + ^M^J +
'<Less1000Pad>="0" <Less100Pad>' + ^M^J +
'<Less1000Pad>=<TripleDigit>' + ^M^J +
'' + ^M^J +
'[<Less1000000Not>]' + ^M^J +
'// Less than 1,000,000, not padded with zeros' + ^M^J +
'<Less1000000Not>=<1_9> thousand "000"' + ^M^J +
'<Less1000000Not>=<1_9> thousand [opt] and <Less1000Pad>' + ^M^J +
'<Less1000000Not>=<DoubleDigit> <Less1000000Not2>' + ^M^J +
'<Less1000000Not>=<TripleDigit> <Less1000000Not2>' + ^M^J +
'<Less1000000Not2>=thousand "000"' + ^M^J +
'<Less1000000Not2>=thousand [opt] and <Less1000Pad>' + ^M^J;
ApdAskForYesNoGrammar : string =
'[<MyGrammar>]' + ^M^J +
'<MyGrammar>=(YesNoReply)' + ^M^J +
'' + ^M^J +
'[(YesNoReply)]' + ^M^J +
'-100=(YesReplies)' + ^M^J +
'-101=(NoReplies)' + ^M^J +
'' + ^M^J +
'[(YesReplies)]' + ^M^J +
'=yes' + ^M^J +
'=yup' + ^M^J +
'=go for it' + ^M^J +
'=yeah [opt] sure' + ^M^J +
'=do it' + ^M^J +
'=you betcha' + ^M^J +
'=sure' + ^M^J +
'=okay' + ^M^J +
'=yep' + ^M^J +
'=fer sure' + ^M^J +
'' + ^M^J +
'[(NoReplies)]' + ^M^J +
'=no' + ^M^J +
'=nope' + ^M^J +
'=nah' + ^M^J +
'=no way' + ^M^J +
'=stop' + ^M^J +
'=no thanks' + ^M^J +
'=no thank you' + ^M^J +
'=don''t do it' +^M^J +
'=naw' + ^M^J;
type
TApdSapiPhraseType = (ptConvert, ptDrop, ptConvertJoin);
TApdSapiParseTable = record
PhraseType : TApdSapiPhraseType;
InputPhrase : string;
OutputPhrase : string;
end;
const
ApdPhoneNumberEntries = 12;
ApdPhoneNumberConvert :
array [1..ApdPhoneNumberEntries] of TApdSapiParseTable =
((PhraseType : ptConvert; InputPhrase : 'twenty'; OutputPhrase : '2'),
(PhraseType : ptConvert; InputPhrase : 'thirty'; OutputPhrase : '3'),
(PhraseType : ptConvert; InputPhrase : 'forty'; OutputPhrase : '4'),
(PhraseType : ptConvert; InputPhrase : 'fifty'; OutputPhrase : '5'),
(PhraseType : ptConvert; InputPhrase : 'sixty'; OutputPhrase : '6'),
(PhraseType : ptConvert; InputPhrase : 'seventy'; OutputPhrase : '7'),
(PhraseType : ptConvert; InputPhrase : 'eighty'; OutputPhrase : '8'),
(PhraseType : ptConvert; InputPhrase : 'ninety'; OutputPhrase : '9'),
(PhraseType : ptConvert; InputPhrase : 'dash'; OutputPhrase : '-'),
(PhraseType : ptConvert; InputPhrase : 'slash'; OutputPhrase : '-'),
(PhraseType : ptConvert; InputPhrase : 'oh'; OutputPhrase : '0'),
(PhraseType : ptConvert; InputPhrase : 'zero'; OutputPhrase : '0'));
ApdNumericCvtEntries = 29;
ApdNumericCvt :
array [1..ApdNumericCvtEntries] of TApdSapiParseTable =
((PhraseType : ptConvertJoin; InputPhrase : 'twenty'; OutputPhrase : '2'),
(PhraseType : ptConvertJoin; InputPhrase : 'thirty'; OutputPhrase : '3'),
(PhraseType : ptConvertJoin; InputPhrase : 'forty'; OutputPhrase : '4'),
(PhraseType : ptConvertJoin; InputPhrase : 'fifty'; OutputPhrase : '5'),
(PhraseType : ptConvertJoin; InputPhrase : 'sixty'; OutputPhrase : '6'),
(PhraseType : ptConvertJoin; InputPhrase : 'seventy'; OutputPhrase : '7'),
(PhraseType : ptConvertJoin; InputPhrase : 'eighty'; OutputPhrase : '8'),
(PhraseType : ptConvertJoin; InputPhrase : 'ninety'; OutputPhrase : '9'),
(PhraseType : ptConvert; InputPhrase : 'oh'; OutputPhrase : '0'),
(PhraseType : ptConvert; InputPhrase : 'zero'; OutputPhrase : '0'),
(PhraseType : ptConvert; InputPhrase : 'first'; OutputPhrase : '1'),
(PhraseType : ptConvert; InputPhrase : 'second'; OutputPhrase : '2'),
(PhraseType : ptConvert; InputPhrase : 'third'; OutputPhrase : '3'),
(PhraseType : ptConvert; InputPhrase : 'fourth'; OutputPhrase : '4'),
(PhraseType : ptConvert; InputPhrase : 'fifth'; OutputPhrase : '5'),
(PhraseType : ptConvert; InputPhrase : 'sixth'; OutputPhrase : '6'),
(PhraseType : ptConvert; InputPhrase : 'seventh'; OutputPhrase : '7'),
(PhraseType : ptConvert; InputPhrase : 'eighth'; OutputPhrase : '8'),
(PhraseType : ptConvert; InputPhrase : 'ninth'; OutputPhrase : '9'),
(PhraseType : ptConvert; InputPhrase : 'tenth'; OutputPhrase : '10'),
(PhraseType : ptConvert; InputPhrase : 'eleventh';
OutputPhrase : '11'),
(PhraseType : ptConvert; InputPhrase : 'twelfth';
OutputPhrase : '12'),
(PhraseType : ptConvert; InputPhrase : 'thirteenth';
OutputPhrase : '13'),
(PhraseType : ptConvert; InputPhrase : 'fourteenth';
OutputPhrase : '14'),
(PhraseType : ptConvert; InputPhrase : 'fifteenth';
OutputPhrase : '15'),
(PhraseType : ptConvert; InputPhrase : 'sixteenth';
OutputPhrase : '16'),
(PhraseType : ptConvert; InputPhrase : 'seventeenth';
OutputPhrase : '17'),
(PhraseType : ptConvert; InputPhrase : 'eighteenth';
OutputPhrase : '18'),
(PhraseType : ptConvert; InputPhrase : 'nineteenth';
OutputPhrase : '19'));
type
TApdTimeWordType = (twtQuarter, twtHalf, twtMidnight, twtNoon, twtAfter,
twtBefore, twtPM, twtAM, twtUnknown);
TApdTimeWord = record
WordType : TApdTimeWordType;
TimeWord : string;
end;
const
ApdTimeWordCount = 19;
ApdTimeWordList : array [1..ApdTimeWordCount] of TApdTimeWord =
((WordType : twtQuarter; TimeWord : 'quarter'),
(WordType : twtHalf; TimeWord : 'half'),
(WordType : twtMidnight; TimeWord : 'midnight'),
(WordType : twtNoon; TimeWord : 'noon'),
(WordType : twtAfter; TimeWord : 'after'),
(WordType : twtAfter; TimeWord : 'past'),
(WordType : twtBefore; TimeWord : 'before'),
(WordType : twtBefore; TimeWord : 'to'),
(WordType : twtBefore; TimeWord : 'til'),
(WordType : twtPM; TimeWord : 'p.m.'),
(WordType : twtPM; TimeWord : 'p. m.'),
(WordType : twtPM; TimeWord : 'pm'),
(WordType : twtPM; TimeWord : 'evening'),
(WordType : twtPM; TimeWord : 'night'),
(WordType : twtPM; TimeWord : 'afternoon'),
(WordType : twtAM; TimeWord : 'a.m.'),
(WordType : twtAM; TimeWord : 'a. m.'),
(WordType : twtAM; TimeWord : 'am'),
(WordType : twtAM; TimeWord : 'morning'));
type
TApdDateWordType = (dwtMonth, dwtDay, dwtNext, dwtLast, dwtToday,
dwtTomorrow, dwtYesterday, dwtWeekOff, dwtMonthOff,
dwtYearOff, dwtUnknown);
TApdDateWord = record
WordType : TApdDateWordType;
DateWord : string;
Number : Integer;
end;
const
ApdDateWordCount = 27;
ApdDateWordList : array [1..ApdDateWordCount] of TApdDateWord =
((WordType : dwtMonth; DateWord : 'january'; Number : 1),
(WordType : dwtMonth; DateWord : 'february'; Number : 2),
(WordType : dwtMonth; DateWord : 'march'; Number : 3),
(WordType : dwtMonth; DateWord : 'april'; Number : 4),
(WordType : dwtMonth; DateWord : 'may'; Number : 5),
(WordType : dwtMonth; DateWord : 'june'; Number : 6),
(WordType : dwtMonth; DateWord : 'july'; Number : 7),
(WordType : dwtMonth; DateWord : 'august'; Number : 8),
(WordType : dwtMonth; DateWord : 'september'; Number : 9),
(WordType : dwtMonth; DateWord : 'october'; Number : 10),
(WordType : dwtMonth; DateWord : 'november'; Number : 11),
(WordType : dwtMonth; DateWord : 'december'; Number : 12),
(WordType : dwtDay; DateWord : 'monday'; Number : 1),
(WordType : dwtDay; DateWord : 'tuesday'; Number : 2),
(WordType : dwtDay; DateWord : 'wednesday'; Number : 3),
(WordType : dwtDay; DateWord : 'thursday'; Number : 4),
(WordType : dwtday; DateWord : 'friday'; Number : 5),
(WordType : dwtDay; DateWord : 'saturday'; Number : 6),
(WordType : dwtDay; DateWord : 'sunday'; Number : 7),
(WordType : dwtNext; DateWord : 'next'),
(WordType : dwtLast; DateWord : 'last'),
(WordType : dwtToday; DateWord : 'today'; Number : 0),
(WordType : dwtTomorrow; DateWord : 'tomorrow'; Number : 1),
(WordType : dwtYesterday; DateWord : 'yesterday'; Number : -1),
(WordType : dwtWeekOff; DateWord : 'week'; Number : 7),
(WordType : dwtMonthOff; DateWord : 'month'; Number : 31),
(WordType : dwtYearOff; DateWord : 'year'; Number : 365));
implementation
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -