[2491] | 1 | /**********************************************************************
|
---|
| 2 | *
|
---|
[7371] | 3 | * phindaction.h --
|
---|
[2491] | 4 | *
|
---|
| 5 | * Copyright 2001 Gordon W. Paynter
|
---|
| 6 | * Copyright 2001 The New Zealand Digital Library Project
|
---|
| 7 | *
|
---|
| 8 | * A component of the Greenstone digital library software
|
---|
| 9 | * from the New Zealand Digital Library Project at the
|
---|
| 10 | * University of Waikato, New Zealand.
|
---|
| 11 | *
|
---|
| 12 | * This program is free software; you can redistribute it and/or modify
|
---|
| 13 | * it under the terms of the GNU General Public License as published by
|
---|
| 14 | * the Free Software Foundation; either version 2 of the License, or
|
---|
| 15 | * (at your option) any later version.
|
---|
| 16 | *
|
---|
| 17 | * This program is distributed in the hope that it will be useful,
|
---|
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 20 | * GNU General Public License for more details.
|
---|
| 21 | *
|
---|
| 22 | * You should have received a copy of the GNU General Public License
|
---|
| 23 | * along with this program; if not, write to the Free Software
|
---|
| 24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 25 | *
|
---|
| 26 | *********************************************************************/
|
---|
| 27 |
|
---|
[7371] | 28 | #include "gsdl_modules_cfg.h"
|
---|
| 29 | #ifdef GSDL_USE_PHIND_ACTION
|
---|
| 30 |
|
---|
[2491] | 31 | #ifndef PHINDACTION_H
|
---|
| 32 | #define PHINDACTION_H
|
---|
| 33 |
|
---|
| 34 | #include "action.h"
|
---|
| 35 |
|
---|
| 36 | // Include MGPP functionality.
|
---|
| 37 | #include <TextGet.h>
|
---|
| 38 | #include <MGQuery.h>
|
---|
| 39 | #include <Terms.h>
|
---|
| 40 | #include <messages.h>
|
---|
| 41 | #include <GSDLQueryParser.h>
|
---|
| 42 |
|
---|
| 43 | class phindaction : public action {
|
---|
| 44 |
|
---|
| 45 | protected:
|
---|
| 46 |
|
---|
[7734] | 47 | bool find_phrase_number_from_word(const text_t &basepath,
|
---|
[2491] | 48 | const text_t &query,
|
---|
| 49 | DocNumArray &result);
|
---|
| 50 |
|
---|
[7734] | 51 | bool get_phrase_all_data(TextData &textdata, unsigned long phrase,
|
---|
[2491] | 52 | text_t &word, unsigned long &tf, unsigned long &ef,
|
---|
| 53 | unsigned long &lf, unsigned long &df,
|
---|
| 54 | vector <unsigned long> &el,
|
---|
| 55 | vector <unsigned long> &linkdest,
|
---|
| 56 | vector <UCArray> &linktype,
|
---|
| 57 | vector <unsigned long> &docnum,
|
---|
| 58 | vector <unsigned long> &docfrq);
|
---|
| 59 |
|
---|
[7734] | 60 | bool print_thesaurus_links(const text_t &collection, bool XMLmode,
|
---|
[2491] | 61 | TextData &textdata, vector <unsigned long> &linkdest,
|
---|
| 62 | vector <UCArray> &linktype, unsigned long first,
|
---|
| 63 | unsigned long last, displayclass &disp,
|
---|
| 64 | outconvertclass &outconvert, ostream &textout);
|
---|
| 65 |
|
---|
[7734] | 66 | bool get_phrase_freq_data(TextData &textdata, unsigned long phrase,
|
---|
[2491] | 67 | UCArray &word, unsigned long &tf,
|
---|
| 68 | unsigned long &ef, unsigned long &df);
|
---|
| 69 |
|
---|
| 70 | void print_expansions(const text_t &collection, bool XMLmode,
|
---|
| 71 | const text_t &body, TextData &textdata,
|
---|
| 72 | const vector <unsigned long> &elist,
|
---|
| 73 | unsigned long first, unsigned long last,
|
---|
| 74 | displayclass &disp, outconvertclass &outconvert,
|
---|
| 75 | ostream &textout);
|
---|
| 76 |
|
---|
| 77 | void split_phrase(const UCArray &word, const UCArray &body,
|
---|
| 78 | UCArray &prefix, UCArray &suffix);
|
---|
| 79 |
|
---|
| 80 | bool phrase_match(const UCArray &text, UCArray::const_iterator &here,
|
---|
| 81 | UCArray::const_iterator end);
|
---|
| 82 |
|
---|
[7734] | 83 | bool print_documents(bool XMLmode, const text_t &basepath,
|
---|
[2491] | 84 | const text_t &collection,
|
---|
| 85 | const vector <unsigned long> &docNums,
|
---|
| 86 | const vector <unsigned long> &docFreq,
|
---|
| 87 | unsigned long first, unsigned long last,
|
---|
| 88 | displayclass &disp, outconvertclass &outconvert,
|
---|
| 89 | ostream &textout);
|
---|
| 90 |
|
---|
[7734] | 91 | bool get_document_all_data(TextData &docdata, unsigned long docNum,
|
---|
[2491] | 92 | UCArray &title, UCArray &hash);
|
---|
| 93 |
|
---|
| 94 | void toUCArray(const text_t &in, UCArray &out);
|
---|
[28899] | 95 | void fromUCArray(const UCArray &arrin, text_t &txtout);
|
---|
[2491] | 96 |
|
---|
[2502] | 97 | void output_error (const text_t &message, ostream &textout,
|
---|
| 98 | outconvertclass &outconvert,
|
---|
| 99 | displayclass & disp, ostream &logout,
|
---|
| 100 | bool XMLmode);
|
---|
[2491] | 101 |
|
---|
[2502] | 102 |
|
---|
[2491] | 103 | public:
|
---|
| 104 | phindaction ();
|
---|
| 105 | virtual ~phindaction ();
|
---|
| 106 |
|
---|
| 107 | text_t get_action_name () {return "phind";}
|
---|
| 108 |
|
---|
| 109 | void get_cgihead_info (cgiargsclass &args, recptprotolistclass *protos,
|
---|
| 110 | response_t &response,text_t &response_data,
|
---|
| 111 | ostream &logout);
|
---|
| 112 |
|
---|
| 113 | bool do_action (cgiargsclass &args, recptprotolistclass *protos,
|
---|
| 114 | browsermapclass *browsers, displayclass &disp,
|
---|
| 115 | outconvertclass &outconvert, ostream &textout,
|
---|
| 116 | ostream &logout);
|
---|
| 117 |
|
---|
| 118 |
|
---|
| 119 | };
|
---|
| 120 |
|
---|
[7371] | 121 | #endif //!PHINDACTION_H
|
---|
| 122 | #endif //GSDL_USE_PHIND_ACTION
|
---|
[7734] | 123 |
|
---|