25-02-2010, 07:51 PM
[COLOR="RoyalBlue"]الحمد الله, انتهيت من نسخة اخري.
- يعمل البرنامج لاستخلاص كلمات من مجموعة احرف غير مرتبة:
مثال: لديك هذه المجموعة من الحروف "ract"’, يمكن للبرنامج ان يستخرج بعض الكلمات من القاموس مثل:arc-art-car -rat-tar-cart.[/COLOR]
- شكراً لكن من ساعدني علي اتمام هذا البرنامج.
تم بحمد الله.
- يعمل البرنامج لاستخلاص كلمات من مجموعة احرف غير مرتبة:
مثال: لديك هذه المجموعة من الحروف "ract"’, يمكن للبرنامج ان يستخرج بعض الكلمات من القاموس مثل:arc-art-car -rat-tar-cart.[/COLOR]
PHP كود :
procedure LoadDictonary(Path : string);
var F : TextFile;
i : Integer;
begin
i := 0;
AssignFile(F,Path);
Reset(F);
While Not Eof(F) do begin
Readln(F,DictonaryArray[i]);
Inc(i);
end;
CloseFile(F);
Form1.Label1.Caption := 'Dictonary Loaded.';
Form1.Label1.Font.Color := clGreen;
end;
Function GeneratePossibleWords(RandedWord : string) : TStringList;
var MRand, DictonaryWord : string;
i, j, LC, RandedIndex : Integer;
MemoTemp : TStringList;
begin
MRand := RandedWord;
MemoTemp := TStringList.Create;
LC := 0;
for j := 0 to Length(DictonaryArray) - 1 do begin
DictonaryWord := DictonaryArray[j];
RandedWord := MRand;
for i := 1 to Length(DictonaryWord) do begin
RandedIndex := Pos(DictonaryWord[i],RandedWord);
If RandedIndex <> 0 then
begin
Inc(LC);
Delete(RandedWord,RandedIndex,1);
If (Length(DictonaryArray[j]) = LC) And (LC > 2) then // LC > 2 means that it will allow 3 lettted-Words only (prevent prepostions)
begin
MemoTemp.Add(DictonaryArray[j]);
Break;
end;
end
else
Break;
end;
LC := 0;
end;
Result := MemoTemp;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.Lines := GeneratePossibleWords(Edit1.Text);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
LoadDictonary('dictionary(1).txt');
end;
- شكراً لكن من ساعدني علي اتمام هذا البرنامج.
تم بحمد الله.