Class AdjectiveService


  • public final class AdjectiveService
    extends java.lang.Object
    Provides methods to classify words. It is necessary because there's a need to check if a word is or not an adjective, in addition to having a whole adjectives' dataset to power up the text generation at its maximum. It was chosen to be static because there is no need to have another instance of this class in an application.
    Since:
    1.0 SNAPSHOT
    Author:
    Arthur Brenno
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Set<java.lang.String> commonAdjectives()
      Getter.
      static java.lang.String getRandom()
      Gets a random adjective from the adjective dataset.
      static boolean isAdjective​(@NotNull java.lang.String word)
      Checks if a word is an adjective.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • commonAdjectives

        public static java.util.Set<java.lang.String> commonAdjectives()
        Getter.
        Returns:
        the "commonAdjectives" instance variable (HashSet).
      • isAdjective

        public static boolean isAdjective​(@NotNull
                                          @NotNull java.lang.String word)
        Checks if a word is an adjective.
        Parameters:
        word - to be checked (will be converted to lower-case).
        Returns:
        true if it is an adjective, false if it's not.
      • getRandom

        public static java.lang.String getRandom()
        Gets a random adjective from the adjective dataset.
        Returns:
        the random adjective.