kwic
Class Phrase
java.lang.Object
|
+--kwic.Phrase
- public class Phrase
- extends Object
|
Method Summary |
protected String |
cleanUp(String s)
Filter the supplied String (which is the String of
a Phrase presumably) into a canonical form
for subsequent matching. |
boolean |
equals(Object o)
The behavior of this lab depends on how you view this method. |
Iterator |
getWords()
Provide the words of a phrase. |
int |
hashCode()
This method must also be properly defined, or else your HashSet
structure won't operate properly. |
String |
toString()
|
phrase
protected final String phrase
Phrase
public Phrase(String s)
getWords
public Iterator getWords()
- Provide the words of a phrase. Each word may have to be
cleaned up: punctuation removed, put into lower case
equals
public boolean equals(Object o)
- The behavior of this lab depends on how you view this method.
Are two phrases the same because they have the same words?
Or are they the same because they are string-equlivalent.
What song? Is that Bekcy?
What song is that, Becky?
The above phrases have the same words but are different strings.
- Overrides:
equals in class Object
hashCode
public int hashCode()
- This method must also be properly defined, or else your
HashSet
structure won't operate properly.
- Overrides:
hashCode in class Object
cleanUp
protected String cleanUp(String s)
- Filter the supplied
String (which is the String of
a Phrase presumably) into a canonical form
for subsequent matching.
The acutal filtering depends on what you consider to be
insignificant in terms of matching.
- If punctuation is
irrelevant, remove puncutation.
- If case does not matter, than convert to lower (or upper)
case.
toString
public String toString()
- Overrides:
toString in class Object