filter: Use the index print functions

This cuts out some code that doesn't need to be duplicated.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
Anna Schumaker 2013-10-06 22:10:36 -04:00 committed by Anna Schumaker
parent 629cbeb2e9
commit 37d4085d27
2 changed files with 3 additions and 31 deletions

View File

@ -48,37 +48,10 @@ std::string quotes [] = {
static const unsigned int num_quotes = sizeof(quotes) / sizeof(std::string);
void print_keys(Index &index)
{
std::set<std::string>::iterator it;
print("Found keys:");
for (it = index.keys_begin(); it != index.keys_end(); it++)
print(" %s", it->c_str());
print("\n");
}
void print_index(Index &index)
{
std::set<std::string>::iterator s_it;
std::set<unsigned int>::iterator u_it;
print("=== Printing index ===\n");
print_keys(index);
for (s_it = index.keys_begin(); s_it != index.keys_end(); s_it++) {
std::string key = *s_it;
print("index[%s] = {", key.c_str());
for (u_it = index[key].begin(); u_it != index[key].end(); u_it++) {
if (u_it != index[key].begin())
print(" ");
print("%d", *u_it);
}
print("}\n");
}
print("\n");
index.print_keys();
index.print();
}
void test_search(const std::string &text)

View File

@ -1,5 +1,4 @@
=== Printing index ===
Found keys: 1 2 a ab abo abou about abs abse absen absenc absence aby abys abyss al all alw alwa alway always am an and ap app appl appla applau applaud applauds ar are aro arou aroun around as ask at att atta attac attach attache attached b ba bac back bas basi basic basica basical basicall basically be bec beca becam became bee been bef befo befor before beh behe behea behead beheadi beheadin beheading bes best bo boa boar board br bri brin bring bu but by c ca can cas case cat cats ch cha chan chanc chance chances chang change che chee chees cheese co com come comes cor coro coron corona coronat coronati coronatio coronation cou coul could couldv couldve cour cours course cr cro crop crow crowb crowba crowbar crowd cru crue cruel cu cuc cucu cucum cucumb cucumbe cucumber cuz d da dar dark darkn darkne darknes darkness de dea dead deat death di div divi divid divide do don dont doz doze dozen dr dro drop dru drug e ed edi edib edibl edible ef eff effo effor effort el elf elfs em emp empl emplo employ er err erro error ev eve even f fa far farm farmi farmin farming fi fin fing finge finger fingers fo for fr fre fret fu fun fung fungi g gi giv give given go goo good gr gra grav gravi gravit gravity h ha hab habi habit har hard hav have he her here hero heroe heroes hi him his hu hug huge i if im in int inte inter intere interes interest interesti interestin interesting into is isn isnt it its j jo job k ki kil kill kills l la lay le lea lear learn learne learned leo leop leopa leopar leopard li lig ligh light lik like lim limi limit limits liv live livi livin living lo loo look lot m ma mak make man manu manur manure may me men mer mere merel merely mi mil mill milli millio million min minc mince mo mor more mov move moves mu muc much my myt myth myths n ni nic nice nin nine no not o of off on onc once one onl only op opp oppo oppos opposi opposit opposite ot oth othe other others ou out p pa pas pass passe passed paw pawn pawns pe peo peop peopl people per pers persu persua persuad persuadi persuadin persuading pl ple plea pleas please po pos poss possi possib possibl possible r re reb rebo reboo reboot rei rein reins reinst reinsta reinstal reinstall rem reme remem rememb remembe remember rep repu repub republ republi republic ro rol roll rolle rolled roo rook rooks ros rose rou roun round ru run s sa sam same san sane say sc sca scar scare scared scy scyt scyth scythe sh sha shak shake shal shall sho shor short shorts show si sim simp simpl simply six sl slo slow slowl slowly so sof soft softl softly som some sp spe spea speak st sta star start str stre stren streng strengt strength su sun sup supp suppo suppos suppose supposed sur sure t ta tae tal talk talke talked talki talkin talking tax taxe taxes te ten ter terr terri terrib terribl terribly th tha than that the them thems themse themsel themselv themselve themselves ther there they thi thin think thinki thinkin thinking thu thun thund thunde thunder ti tim time times to too tr tre tree trees tri trib triba tribal tru true trul truly trut truth tu tur turn u un unc unce uncer uncert uncerta uncertai uncertain uncertaint uncertainty uni unit unite united univ unive univer univers universe unt unto up us use v va val valu value ve ver very w wa was wasn wasnt wav wave we wea weak wer were wh wha what whe when whi whic which who whol whole whoo whoop whoops wi wil will wit with wo wor word words wort worth wu wuz y ye yer yes yo you your
Keys: 1 2 a ab abo abou about abs abse absen absenc absence aby abys abyss al all alw alwa alway always am an and ap app appl appla applau applaud applauds ar are aro arou aroun around as ask at att atta attac attach attache attached b ba bac back bas basi basic basica basical basicall basically be bec beca becam became bee been bef befo befor before beh behe behea behead beheadi beheadin beheading bes best bo boa boar board br bri brin bring bu but by c ca can cas case cat cats ch cha chan chanc chance chances chang change che chee chees cheese co com come comes cor coro coron corona coronat coronati coronatio coronation cou coul could couldv couldve cour cours course cr cro crop crow crowb crowba crowbar crowd cru crue cruel cu cuc cucu cucum cucumb cucumbe cucumber cuz d da dar dark darkn darkne darknes darkness de dea dead deat death di div divi divid divide do don dont doz doze dozen dr dro drop dru drug e ed edi edib edibl edible ef eff effo effor effort el elf elfs em emp empl emplo employ er err erro error ev eve even f fa far farm farmi farmin farming fi fin fing finge finger fingers fo for fr fre fret fu fun fung fungi g gi giv give given go goo good gr gra grav gravi gravit gravity h ha hab habi habit har hard hav have he her here hero heroe heroes hi him his hu hug huge i if im in int inte inter intere interes interest interesti interestin interesting into is isn isnt it its j jo job k ki kil kill kills l la lay le lea lear learn learne learned leo leop leopa leopar leopard li lig ligh light lik like lim limi limit limits liv live livi livin living lo loo look lot m ma mak make man manu manur manure may me men mer mere merel merely mi mil mill milli millio million min minc mince mo mor more mov move moves mu muc much my myt myth myths n ni nic nice nin nine no not o of off on onc once one onl only op opp oppo oppos opposi opposit opposite ot oth othe other others ou out p pa pas pass passe passed paw pawn pawns pe peo peop peopl people per pers persu persua persuad persuadi persuadin persuading pl ple plea pleas please po pos poss possi possib possibl possible r re reb rebo reboo reboot rei rein reins reinst reinsta reinstal reinstall rem reme remem rememb remembe remember rep repu repub republ republi republic ro rol roll rolle rolled roo rook rooks ros rose rou roun round ru run s sa sam same san sane say sc sca scar scare scared scy scyt scyth scythe sh sha shak shake shal shall sho shor short shorts show si sim simp simpl simply six sl slo slow slowl slowly so sof soft softl softly som some sp spe spea speak st sta star start str stre stren streng strengt strength su sun sup supp suppo suppos suppose supposed sur sure t ta tae tal talk talke talked talki talkin talking tax taxe taxes te ten ter terr terri terrib terribl terribly th tha than that the them thems themse themsel themselv themselve themselves ther there they thi thin think thinki thinkin thinking thu thun thund thunde thunder ti tim time times to too tr tre tree trees tri trib triba tribal tru true trul truly trut truth tu tur turn u un unc unce uncer uncert uncerta uncertai uncertain uncertaint uncertainty uni unit unite united univ unive univer univers universe unt unto up us use v va val valu value ve ver very w wa was wasn wasnt wav wave we wea weak wer were wh wha what whe when whi whic which who whol whole whoo whoop whoops wi wil will wit with wo wor word words wort worth wu wuz y ye yer yes yo you your
index[1] = {28}
index[2] = {28}
index[a] = {1 3 6 7 8 9 10 11 12 14 15 17 18 19 21 23 25 28 29 30 31 32 33}