1

基本的に2つの質問があります。
1. mysql のように全文ブール検索を行う C++ ライブラリはありますか。たとえば、
私が持っているとしましょう:

string text = "this is my phrase keywords test with boolean query."; 
string booleanQuery = "\"my phrase\" boolean -test -\"keywords test\" OR ";
       booleanQuery += "\"boolean search\" -mysql -sql -java -php"b
//where quotes ("") contain phrases, (-) is NOT keyword and OR is logical OR.

最初の答えが「いいえ」の場合は、次のようになります。
2. テキスト内の語句を検索することはできますか。例えば、

string text =//same as previous
string keyword = "\"my phrase\"";
//here what's the best way to search for my phrase in the text?

4

3 に答える 3

1

2番目のポイントについて:stringクラスにはメソッドがあります。http://www.cppreference.com/wiki/string/findfindを参照してください。

于 2010-07-15T16:45:08.407 に答える
1

TR1 には正規表現クラスがあります (から派生Boost::regex)。上記で使用したものとはまったく異なりますが、かなり近いです。Boost::phoenix同様のBoost::Spirit機能も提供しますが、最初の試行では、Boost/TR1 正規表現クラスがおそらくより適切な選択です。

于 2010-07-15T16:50:59.453 に答える
0

確かにあります。Spirit を試してみてください。

http://boost-spirit.com/home/

于 2010-07-15T16:54:25.350 に答える