Changeset 3794 for trunk/indexers/mg
- Timestamp:
- 2003-03-05T13:53:10+13:00 (21 years ago)
- Location:
- trunk/indexers/mg/java/org/greenstone/mg
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/indexers/mg/java/org/greenstone/mg/MGQueryResult.java
r3744 r3794 102 102 103 103 104 // public void addTerm(String term, int stem, long match, long freq) 105 public void addTerm(String term, String tag, int stem, 106 long match, long freq, String[] equivs) 104 public void addTerm(String term, int stem) 107 105 { 108 106 MGTermInfo ti = new MGTermInfo(); 109 107 ti.term_ = term; 110 ti.tag_ = tag;111 108 ti.stem_method_ = stem; 112 ti.match_docs_ = match; 113 ti.term_freq_ = freq; 114 if (equivs != null) { 115 for (int i = 0; i < equivs.length; i++) { 116 ti.equiv_terms_.add(equivs[i]); 109 terms_.add(ti); 110 System.out.println("(Java) Added term " + ti); 111 } 112 113 114 public void addEquivTerm(String term, String equivTerm, 115 long match, long freq) 116 { 117 // Find the term to add the equivalent to 118 MGTermInfo ti = null; 119 for (int i = (terms_.size() - 1); i >= 0; i--) { 120 ti = (MGTermInfo) terms_.elementAt(i); 121 // Found 122 if (ti.term_ == term) { 123 break; 117 124 } 118 125 } 119 System.out.println("(Java) Added term " + ti);120 126 121 terms_.add(ti); 127 if (ti == null) { 128 System.err.println("Internal error: No term exists to add to.\n"); 129 } 130 else { 131 ti.addEquivTerm(equivTerm, match, freq); 132 System.out.println("(Java) Added equivalent term " + equivTerm + ", match: " + match + ", freq: " + freq); 133 } 122 134 } 123 135 -
trunk/indexers/mg/java/org/greenstone/mg/MGTermInfo.java
r3744 r3794 33 33 public String term_ = null; 34 34 35 /** the tag - level or metadata - for which the query was done */36 public String tag_ = null;37 38 35 /** the stem and casefold method used 39 36 0 = none … … 42 39 3 = casefold and stem */ 43 40 public int stem_method_ = 0; 44 45 /** the number of documents containing this term46 (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 41 52 42 /** list of stemmed and casefolded equivalent terms - if stem_method_ is non-zero … … 61 51 62 52 53 public void addEquivTerm(String equivTerm, long match, long freq) 54 { 55 equiv_terms_.add(new MGEquivTermInfo(equivTerm, match, freq)); 56 } 57 58 63 59 /** output the class as a string */ 64 60 public String toString() 65 61 { 66 62 String result = "\"" + term_ + "\""; 67 result += " tag(" + tag_ + ")";68 63 result += " stem(" + stem_method_ + ")"; 69 result += " docs(" + match_docs_ + ")";70 result += " freq(" + term_freq_ + ")";71 72 64 result += " equiv terms("; 73 65 for (int i = 0; i < equiv_terms_.size(); i++) { 74 66 if (i > 0) result += ", "; 75 result += (String)equiv_terms_.elementAt(i);67 result += equiv_terms_.elementAt(i); 76 68 } 77 69 result += ")"; 78 79 70 return result; 80 71 }
Note:
See TracChangeset
for help on using the changeset viewer.