Class Word

java.lang.Object
edu.odu.cs.cs350.Word

public class Word extends Object
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

      public Word(String word)
      Constructs a new Word with an initial count of 1.
      Parameters:
      word - the string representation of the word
  • Method Details

    • getWord

      public String 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.