[3744] | 1 | /*
|
---|
| 2 | * MGTermInfo.java
|
---|
| 3 | * Copyright (C) 2002 New Zealand Digital Library, http://www.nzdl.org
|
---|
| 4 | *
|
---|
| 5 | * This program is free software; you can redistribute it and/or modify
|
---|
| 6 | * it under the terms of the GNU General Public License as published by
|
---|
| 7 | * the Free Software Foundation; either version 2 of the License, or
|
---|
| 8 | * (at your option) any later version.
|
---|
| 9 | *
|
---|
| 10 | * This program is distributed in the hope that it will be useful,
|
---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 13 | * GNU General Public License for more details.
|
---|
| 14 | *
|
---|
| 15 | * You should have received a copy of the GNU General Public License
|
---|
| 16 | * along with this program; if not, write to the Free Software
|
---|
| 17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 18 | */
|
---|
| 19 | package org.greenstone.mg;
|
---|
| 20 |
|
---|
| 21 |
|
---|
| 22 | import java.util.Vector;
|
---|
| 23 |
|
---|
| 24 |
|
---|
| 25 | /** TermInfo 'struct' class for a search result from mg
|
---|
| 26 | * used by MGQueryResult
|
---|
| 27 | *
|
---|
| 28 | * @see MGQueryResult
|
---|
| 29 | */
|
---|
| 30 | public class MGTermInfo
|
---|
| 31 | {
|
---|
| 32 | /** the term itself */
|
---|
| 33 | public String term_ = null;
|
---|
| 34 |
|
---|
| 35 | /** the tag - level or metadata - for which the query was done */
|
---|
| 36 | public String tag_ = null;
|
---|
| 37 |
|
---|
| 38 | /** the stem and casefold method used
|
---|
| 39 | 0 = none
|
---|
| 40 | 1 = casefold only
|
---|
| 41 | 2 = stem only
|
---|
| 42 | 3 = casefold and stem */
|
---|
| 43 | public int stem_method_ = 0;
|
---|
| 44 |
|
---|
| 45 | /** the number of documents containing this term
|
---|
| 46 | (where document is defined by the tag data) */
|
---|
| 47 | public long match_docs_ = 0;
|
---|
| 48 |
|
---|
| 49 | /** overall term freq - word level */
|
---|
| 50 | public long term_freq_ = 0;
|
---|
| 51 |
|
---|
| 52 | /** list of stemmed and casefolded equivalent terms - if stem_method_ is non-zero
|
---|
| 53 | - Vector of Strings */
|
---|
| 54 | public Vector equiv_terms_ = null;
|
---|
| 55 |
|
---|
| 56 |
|
---|
| 57 | public MGTermInfo()
|
---|
| 58 | {
|
---|
| 59 | equiv_terms_ = new Vector();
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 | /** output the class as a string */
|
---|
| 64 | public String toString()
|
---|
| 65 | {
|
---|
| 66 | String result = "\"" + term_ + "\"";
|
---|
| 67 | result += " tag(" + tag_ + ")";
|
---|
| 68 | result += " stem(" + stem_method_ + ")";
|
---|
| 69 | result += " docs(" + match_docs_ + ")";
|
---|
| 70 | result += " freq(" + term_freq_ + ")";
|
---|
| 71 |
|
---|
| 72 | result += " equiv terms(";
|
---|
| 73 | for (int i = 0; i < equiv_terms_.size(); i++) {
|
---|
| 74 | if (i > 0) result += ", ";
|
---|
| 75 | result += (String) equiv_terms_.elementAt(i);
|
---|
| 76 | }
|
---|
| 77 | result += ")";
|
---|
| 78 |
|
---|
| 79 | return result;
|
---|
| 80 | }
|
---|
| 81 | }
|
---|