Class NounService


  • public final class NounService
    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 a noun, in addition to having a whole nouns' dataset to power up the text generation at its maximum. It was chosen to be a Singleton 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> commonNouns()
      Getter.
      static java.lang.String getRandom()
      Gets a random noun based on a dataset.
      static boolean isNoun​(@NotNull java.lang.String word)
      Checks if a word is a noun.
      • Methods inherited from class java.lang.Object

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

      • commonNouns

        public static java.util.Set<java.lang.String> commonNouns()
        Getter.
        Returns:
        commonNouns HashSet.
      • isNoun

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

        public static java.lang.String getRandom()
        Gets a random noun based on a dataset.
        Returns:
        random noun.