this is an apple, I like apple ,do you like apple;
结果
 this 1次
 is 1交
 an 1
 apple 2
 like aplle 2次
 i 1

解决方案 »

  1.   

    // 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;
      

  2.   

    1.单词的出现次数不难,如果不考虑效率,使用Pos函数,每次截断,循环记数就可以了。2.连续单词出现,定为短语,这个难一点。需要好好考虑
      

  3.   

    to jinjazz(近身剪(N-P攻略)) :
    你好好看题目,短语是未知的,需要你去确定哪些是短语
      

  4.   

    关键是 短句是未知的 。并且取短语时要取最 长串,还要考虑除最长串外是否还有 能够短路句的串。
    如 一文章中出现在
    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 出现三次