我现在有个ACCESS数据库,里面有个子段存的是文章,因为数据很多,所以我想先找出里面关键词,然后根据关键词判断哪条数据是我想要的数据,然后打开,阅读。请问如何实现关键词提取。有什么好的方法,思路,或者有源码分析更好。不胜感激。

解决方案 »

  1.   

    文章文本很长哦的
    用stringlist,把全部文章load进来
    然后find函数参数用关键字找出你想要的文章。
      

  2.   

    有一种算法叫状态机,就是你想要的,搜一下就行了。 在 Delphi算法与结构 这本书上!Function TCountWord.ExtractWords(const S: string): TStringDynArray;
    type
      TStates = (ScanNormal,ScanQuoted,ScanPunctuation);
    const
      WordDelim = ' !<>[](){},./?;~:-+=*@#$%^&"12345567890';
    var
      State: TStates;
      Inx: integer;
      Ch: Char;
      CurWord: string;  procedure AddToList(Const aWord: string);
      var
        aLen: integer;
      begin
        aLen := Length(Result);
        SetLength(Result,aLen+1);
        Result[aLen] := lowerCase(aWord);
      end;
    begin
      SetLength(Result,0);
      State := ScanNormal;
      CurWord :='';
      //读入串中所有字符
      for Inx := 1 to Length(S) do
      begin
          //获取下一个字符
          Ch := S[Inx];
          //对于状分情况处理
          case State of
              ScanNormal:
              begin
                  if Pos(Ch,WordDelim)<>0 then
                  begin
                      if (CurWord<>'') then
                      begin
                          AddToList(CurWord);
                          CurWord := '';
                      end;
                      state := ScanPunctuation;
                  end else
                  begin
                      CurWord := CurWord+Ch;
                  end;
              end;
              ScanQuoted:
              begin
                  CurWord := CurWord+Ch;
                  State := ScanNormal;
              end;
              ScanPunctuation:
              begin
                  if Pos(Ch,WordDelim) = 0 then
                  begin
                      CurWord := Ch;
                      State := ScanNormal;
                  end;
              end;      end;
      end;
      if CurWord<>'' then
        AddToList(CurWord);
    end;
      

  3.   

    模糊检索直接
    like SQL语句不行吗?