Such as a database or
StringGrid or dbGrid inside, there is such a set of data
Then, the original sentence such as:
Shenzhen is very good, is doing very well
Match shenzhen, and then find the corresponding prompt,
Ask for advice,
Or, the original sentence: there is a cat
Will find its corresponding trigger match for kittens, tips,
CodePudding user response:
If thesaurus entry is not much, controlled, within the string word find can directly to theUSES System. SysUtils, System. Math, Vcl. Grids;
The function TFrom1. FindHint (const S: string) : string;
Var
I, j, k: integer;
Word: string;
The begin
For I:=1 to Length (S) do
For j:=I to Min (I + 4, Length (S)) do
The begin
Word:=Copy (S, I, j - I + 1);
For: k=0 to StringGrid1. Do the RowCount - 1
If Pos (word, StringGrid1 Cols [0] [k]) & gt; 0 then
The begin
Result:=StringGrid1 Cols [1] [k].
exit;
The end;
The end;
The end;