- Notice (Please be sure to read) -
The cpi00 is an implementation of "the compressed permuterm index" described in a following paper,

Paolo Ferragina and Rossano Venturini,
"The compressed permuterm index", ACM Transactions on Algorithms 7(1): 10 (2010).

Notice this code includes the idea in a following patent owenered by Yahoo!,
http://www.google.com/patents/US20090063465

So, this is only admitted for non-profit purpose, never use for commercial use.
-

- Note -
The cpi00 is currently not stable version, and APIs would be changed!
-

- Commands for compiling -
$ ./waf configure
$ ./waf build
-

- Sample program -
I prepared a sample program, called cpi00.
Here, assume there is a keyword list named "keyword.txt" as below.

...
keyword1
keyword2
keyword3
...

Create an index (keyword.idx) for your keyword list (keyword.txt).
$ ./build/src/cpi00 -k keyword.txt -i keyword.idx

Display all key list registered in the index (keyword.idx) in ascending order.
$ ./build/src/cpi00 -i keyword.idx -s

If you want to search SubstringSearch("keyword"), enter the following command.
$ ./build/src/cpi00 -i keyword.idx
mode > ss
query > keyword
...
result1
result2
result3
...
#hit = number of hits.

To run substring search, enter "ss" in mode selection like this example.
Other search modes are also executable by entering following options.
“mb” (Membership), “rk” (Rank), “sl” (Select), “pf” (PrefixSearch),
“sf” (SuffixSearch), “ps” (PrefixSuffixSearch).
-

- Usage of APIs -
I simply explain the usage of APIs with an example of a following code.
*************************************************************************
...
#include "CompPermIdx.hpp"
...
// Prepare keyword list in std::string types. 
// The list may not be sorted.
vector<string> keys;
keys.push_back("hop");
keys.push_back("hope");
keys.push_back("hit");
keys.push_back("hat");
 
// Create index.
CompPermIdx cpi1;
cpi1.Build(keys);
 
// Delete the original keyword list if you don't need it.
vector<string>().swap(keys);
 
// Write the index as "test.idx".
fstream ofs("test.idx");
cpi1.Write(ofs);
 
// Initialize the index structures.
cpi1.Clear();
 
// Read the index from "test.idx".
CompPermIdx cpi2;
fstream ifs("test.idx");
cpi2.Read(ifs);
 
// Search your query for the index.
string query1 = "ho";
string query2 = "e";
vector<string> p_ret, ps_ret; // An array for storing searching results.
cpi2.PrefixSearch(query1, ret); // Prefix search.
cpi2.PrefixSuffixSearch(query1, query2, ps_ret); // PrefixSuffix search.
...
************************************************************************

See src/CompPermIdx.hpp for more details.
-