TAbon = class(TObject)
private
- { Private \90é\8c¾ }
- Froot : String;
- Flistpath : String;
- FNGwordpath : String;
- Ftokens : array of array of string;
- FAbonRes : TIndiviAbonList;
- FAbonString : String;
+ { Private \90é\8c¾ }
+ Froot : String;
+ Flistpath : String;
+ FNGwordpath : String;
+ Ftokens : array of array of string;
+ FAbonRes : TIndiviAbonList;
+ FAbonString : String;
+ FpAbons : PChar;
+ FpAbone : PChar;
FDeleterlo : Boolean; //&rlo;\82ð\8dí\82é\82© //\92Ç\89Á&lro;\82à\8dí\82é
- FReplaceul :Boolean ; //<ul>\83^\83O\82ð<br>\83^\83O\82É\92u\8a·\82·\82é\82©
- FReverse : Boolean ; //NG\83\8f\81[\83h\82Å\82Ì\82 \82Ú\81`\82ñ\82Ì\8c\8b\89Ê\82ð\94½\93]\82³\82¹\82é\82©
- FAbonPopupRes : Boolean; //\83\8c\83X\83|\83b\83v\83A\83b\83v\82Ì\8e\9e\82É\82 \82Ú\81[\82ñ\82·\82é\82©
+ FReplaceul :Boolean ; //<ul>\83^\83O\82ð<br>\83^\83O\82É\92u\8a·\82·\82é\82©
+ FReverse : Boolean ; //NG\83\8f\81[\83h\82Å\82Ì\82 \82Ú\81`\82ñ\82Ì\8c\8b\89Ê\82ð\94½\93]\82³\82¹\82é\82©
+ FAbonPopupRes : Boolean; //\83\8c\83X\83|\83b\83v\83A\83b\83v\82Ì\8e\9e\82É\82 \82Ú\81[\82ñ\82·\82é\82©
FNGwordFileIndex : Integer; //\8c»\8dÝ\93Ç\82Ý\8d\9e\82ñ\82Å\82éNG\83\8f\81[\83h\82ªlist\82Ì\89½\8ds\96Ú\82©
- FNGwordname : String; //\8c»\8dÝ\93Ç\82Ý\8d\9e\82ñ\82Å\82éNG\83\8f\81[\83h\82Ì\95\\8e¦\96¼
- FIndividualFileName : String; //\8cÂ\95Ê\82 \82Ú\81`\82ñ\82Ì\83t\83@\83C\83\8b\96¼
- FReturnNGwordLineNum : Boolean; //NG\83\8f\81[\83h\82Ì\8ds\90\94\82ð\95Ô\82·\81B
- FSetNGResAnchor : Boolean; //NG\82É\8aY\93\96\82µ\82½\82Æ\82«\82É\96{\95¶\82É\82»\82Ì\83\8c\83X\82Ö\82Ì\83\8c\83X\83A\83\93\83J\81[\82ð\82Â\82¯\82é\82©\82Ç\82¤\82©
- FDeleteSyria: Boolean; //\83V\83\8a\83A\8cê\83u\83\89\83N\83\89\91Î\8dô\81i܀~ݏ\81j
- FIgnoreKana: Boolean; //\91S\8ap\94¼\8ap\82Ð\82ç\82ª\82È\83J\83^\83J\83i\82Ì\88á\82¢\82ð\96³\8e\8b\82·\82é\82©
- procedure SetTokens(index: integer ; argline:String);
- function Getlistpath() : String;
- procedure Setlistpath(const Value : String);
- function LoadListFile(path :String;listStringList : TStringList) : Boolean;
- function ReadNGwordslist(line : Integer) : Boolean;
- function LoadFromSetResNumFile(SetResNumFile : String) : Boolean;
+ FNGwordname : String; //\8c»\8dÝ\93Ç\82Ý\8d\9e\82ñ\82Å\82éNG\83\8f\81[\83h\82Ì\95\\8e¦\96¼
+ FIndividualFileName : String; //\8cÂ\95Ê\82 \82Ú\81`\82ñ\82Ì\83t\83@\83C\83\8b\96¼
+ FReturnNGwordLineNum : Boolean; //NG\83\8f\81[\83h\82Ì\8ds\90\94\82ð\95Ô\82·\81B
+ FSetNGResAnchor : Boolean; //NG\82É\8aY\93\96\82µ\82½\82Æ\82«\82É\96{\95¶\82É\82»\82Ì\83\8c\83X\82Ö\82Ì\83\8c\83X\83A\83\93\83J\81[\82ð\82Â\82¯\82é\82©\82Ç\82¤\82©
+ FDeleteSyria: Boolean; //\83V\83\8a\83A\8cê\83u\83\89\83N\83\89\91Î\8dô\81i܀~ݏ\81j
+ FIgnoreKana: Boolean; //\91S\8ap\94¼\8ap\82Ð\82ç\82ª\82È\83J\83^\83J\83i\82Ì\88á\82¢\82ð\96³\8e\8b\82·\82é\82©
+ procedure SetTokens(index: integer ; argline:String);
+ function Getlistpath() : String;
+ procedure Setlistpath(const Value : String);
+ function LoadListFile(path :String;listStringList : TStringList) : Boolean;
+ function ReadNGwordslist(line : Integer) : Boolean;
+ function LoadFromSetResNumFile(SetResNumFile : String) : Boolean;
public
- { Public \90é\8c¾ }
- constructor Create; // \83R\83\93\83X\83g\83\89\83N\83^
- destructor Destroy; override; // \83f\83X\83g\83\89\83N\83^
- property Deleterlo: Boolean read FDeleterlo write FDeleterlo default false;
- property Replaceul: Boolean read FReplaceul write FReplaceul default false;
- property Reverse: Boolean read FReverse write FReverse default false;
+ { Public \90é\8c¾ }
+ constructor Create; // \83R\83\93\83X\83g\83\89\83N\83^
+ destructor Destroy; override; // \83f\83X\83g\83\89\83N\83^
+ property Deleterlo: Boolean read FDeleterlo write FDeleterlo default false;
+ property Replaceul: Boolean read FReplaceul write FReplaceul default false;
+ property Reverse: Boolean read FReverse write FReverse default false;
property AbonString : String read FAbonString write FAbonString;
- property AbonPopupRes : Boolean read FAbonPopupRes write FAbonPopupRes default false;
- property listpath : String read Getlistpath write Setlistpath;
- property NGwordFileIndex : Integer read FNGwordFileIndex write FNGwordFileIndex default 0;
- property NGwordname : String read FNGwordname write FNGwordname;
+ property AbonPopupRes : Boolean read FAbonPopupRes write FAbonPopupRes default false;
+ property listpath : String read Getlistpath write Setlistpath;
+ property NGwordFileIndex : Integer read FNGwordFileIndex write FNGwordFileIndex default 0;
+ property NGwordname : String read FNGwordname write FNGwordname;
property ReturnNGwordLineNum : Boolean read FReturnNGwordLineNum write FReturnNGwordLineNum default false;
- property SetNGResAnchor : Boolean read FSetNGResAnchor write FSetNGResAnchor default false;
+ property SetNGResAnchor : Boolean read FSetNGResAnchor write FSetNGResAnchor default false;
property DeleteSyria : Boolean read FDeleteSyria write FDeleteSyria default false;
property IgnoreKana: Boolean read FIgnoreKana write FIgnoreKana default false;
- procedure Setroot(root :String);
- function Getroot() : String;
-
- function Getfullpath(argpath : String) : String;
- procedure SetNGwordpath(path :String);
- function GetNGwordpath() : String;
- function LoadFromNGwordFile(path :String) : Boolean;
- function ReLoadFromNGwordFile() : Boolean;
- procedure LoadFromStringList( bufstl : TStringList );
- function CheckAbonPopupRes(line : String) :Boolean;
+ procedure Setroot(root :String);
+ function Getroot() : String;
+
+ function Getfullpath(argpath : String) : String;
+ procedure SetNGwordpath(path :String);
+ function GetNGwordpath() : String;
+ function LoadFromNGwordFile(path :String) : Boolean;
+ function ReLoadFromNGwordFile() : Boolean;
+ procedure LoadFromStringList( bufstl : TStringList );
+ function CheckAbonPopupRes(line : String) :Boolean;
function FindNGwords(const line : String; var NGwordsLineNum : Integer; var Invisible : Boolean) : Boolean;//1\83\89\83C\83\93\82¸\82Â\97p\81B
//\82 \82Ú\81`\82ñ\8f\88\97\9d(NG\83\8f\81[\83h\82Å\82Ì\83t\83B\83\8b\83^\83\8a\83\93\83O)
procedure Execute(var ThreadStrings : TStringList); overload;
function GoBack() : Boolean; //List\82Ì\88ê\82Â\91O\82ÌNG\83\8f\81[\83h\83t\83@\83C\83\8b\82ð\93Ç\82Ý\8d\9e\82Þ
//--
function TreatSyria(AString: string): string;
+ //--
+ function AddToken(AString: string; Invisible: Boolean): Boolean;
end;
var
Abon1 :TAbon;
// \8f\89\8aú\89»
FAbonString := ' <> <> <> <><>';
FAbonRes := TIndiviAbonList.Create;
+ FpAbons := PChar(FAbonString);
+ FpAbone := FpAbons + Length(FAbonString);
end;
pos : Integer;
buftoken : String;
begin
- pos := 0;
bufstl := TStringList.Create;
try
if Length(argline) > 0 then begin
buftoken := Copy(argline,1,pos-1);
Delete(argline,1,pos);
if Length(buftoken) > 0 then begin
- bufstl.Append(buftoken);
+ // >> \82Å\8en\82Ü\82é\83g\81[\83N\83\93\82Í\83R\83\81\83\93\83g\88µ\82¢\82Å\96³\8e\8b\82·\82é
+ if AnsiPos('>>', buftoken) <> 1 then begin
+ bufstl.Append(buftoken);
+ end;
end else if ( bufstl.Count = 0 ) then begin
bufstl.Append('');
end;
pos := AnsiPos(#9,argline);
end;
if Length(argline) > 0 then begin
- bufstl.Append(argline);
+ // >> \82Å\8en\82Ü\82é\83g\81[\83N\83\93\82Í\83R\83\81\83\93\83g\88µ\82¢\82Å\96³\8e\8b\82·\82é
+ if AnsiPos('>>', argline) <> 1 then begin
+ bufstl.Append(argline);
+ end;
end;
ret := bufstl.Count;
SetLength(Ftokens[index],ret);
bufline : String;
start : Integer;
target : String;
- pos : Integer;
+ pos : PChar;
+ pts, pte : PChar;
+ trgLen : Integer;
begin
hit := false;
- if AnsiPos(FAbonString,line) <> 1 then begin
+ if AnsiStrPosEx(PChar(line), PChar(line)+Length(line), FpAbons, FpAbone) = nil then begin
//\91S\94¼\8ap\82Ð\82ç\83J\83i\96³\8e\8b\82·\82é\82©
if IgnoreKana then
target := ZenToHan(line)
else
target := line;
+
+ trgLen := Length(target);
+
for lines := 0 to High(Ftokens) do begin
+ if Length(Ftokens[lines]) = 0 then begin
+ Continue;
+ end;
hit := true;
bufline := target;
+ pts := PChar(bufline);
+ pte := pts + trgLen;
+
if Ftokens[lines][0] <> '' then begin
Invisible := false;
start := 0;
end;
for cells := start to High(Ftokens[lines]) do begin
- pos := AnsiPos(Ftokens[lines][cells],bufline);
- if pos = 0 then begin
+ pos := AnsiStrPosEx(pts, pte,
+ PChar(Ftokens[lines][cells]), PChar(Ftokens[lines][cells]) + Length(Ftokens[lines][cells]));
+ if pos = nil then begin
hit := false;
break;
end else begin
- Delete(bufline, pos, Length(Ftokens[lines][cells]));
+ Delete(bufline, pos - pte + 1, Length(Ftokens[lines][cells]));
+ pts := PChar(bufline);
+ pte := pts + Length(bufline);
end;
end;
if hit = true then begin
Dec(ps);
//\83V\83\8a\83A\8cê\83u\83\89\83N\83\89\82Ì\82Å\82È\82¢
- if (icode <1792) or (icode > 1871) then
- Result := Result + Copy(AString, 1, ps - PChar(AString) + 1);
+ if ( icode < 1758) or
+ ((icode > 1871) and (icode < 1958)) or
+ (icode > 1968) then begin
+ Result := Result + Copy(AString, 1, ps - PChar(AString) + 1);
+ end;
Delete(AString, 1, ps - PChar(AString) + 1);
end else begin
Result := Result + AString;
end;
+// NG\83\8f\81[\83h\83t\83@\83C\83\8b\82É\92Ç\89Á \92Ç\89Á\82³\82ê\82½\8fê\8d\87\81ATrue\82ª\82©\82¦\82é
+function TAbon.AddToken(AString: string; Invisible: Boolean): Boolean;
+var
+ bufStringList : TStringList;
+ ngword: String;
+begin
+ Result := False;
+ if FileExists(GetNGwordpath) then begin
+ bufStringList := TStringList.Create;
+ try
+ bufStringList.LoadFromFile(GetNGwordpath);
+ if (Invisible) then begin
+ ngword := #9 + AString;
+ end else begin
+ ngword := AString;
+ end;
+ if (bufStringList.IndexOf(ngword) = -1) then begin
+ bufStringList.Add(ngword);
+ bufStringList.SaveToFile(GetNGwordpath);
+ Result := True;
+ end;
+ finally
+ bufStringList.Free;
+ end;
+ end;
+end;
end.