Package edu.odu.cs.cs350
Class Word
java.lang.Object
edu.odu.cs.cs350.Word
Represents a single word and its frequency count in a document.
Each
Word object stores the word itself and the number of times
it has appeared. This is useful for calculating term frequency (TF) and
other text analysis metrics.-
Constructor Details
-
Word
Constructs a new Word with an initial count of 1.- Parameters:
word- the string representation of the word
-
-
Method Details
-
getWord
Returns the string representation of this word.- Returns:
- the word as a string
-
getCount
public int getCount()Returns the current count of occurrences for this word.- Returns:
- the count of occurrences
-
incrementCount
public void incrementCount()Increments the count of occurrences for this word by 1.
-