// SubStr: ' is' or 'is ', 就可以查找单词了 function GetCount(const SubStr, Source: String): Integer; var FIndex: Integer; begin Result := 0; FIndex := PosEx(SubStr, Source); while FIndex > 0 do // while begin Inc(Result); FIndex := PosEx(SubStr, Source, FIndex + 1); end; end;
to jinjazz(近身剪(N-P攻略)) : 你好好看题目,短语是未知的,需要你去确定哪些是短语
关键是 短句是未知的 。并且取短语时要取最 长串,还要考虑除最长串外是否还有 能够短路句的串。 如 一文章中出现在 I like this apple ,this is an apple this is an red apple I like this book// I like this 应为一个短句 I like 不是短句 如果 文中又出现 I like read book 则 I like 也是短句 因为 I like this 出现二次 I like 出现三次
function GetCount(const SubStr, Source: String): Integer;
var
FIndex: Integer;
begin
Result := 0; FIndex := PosEx(SubStr, Source);
while FIndex > 0 do // while
begin
Inc(Result);
FIndex := PosEx(SubStr, Source, FIndex + 1);
end;
end;
你好好看题目,短语是未知的,需要你去确定哪些是短语
如 一文章中出现在
I like this apple ,this is an apple this is an red apple
I like this book//
I like this 应为一个短句
I like 不是短句
如果 文中又出现 I like read book
则 I like 也是短句
因为 I like this 出现二次
I like 出现三次