Package englishlanguage.services
Class PrepositionService
- java.lang.Object
-
- englishlanguage.services.PrepositionService
-
public final class PrepositionService 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 preposition, in addition to having a whole prepositions 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>
commonPrepositions()
Getter.static java.lang.String
getRandom()
Gets a random preposition from the commonPrepositions HashSet.static boolean
isPreposition(@NotNull java.lang.String word)
Checks if a word is a preposition.
-
-
-
Method Detail
-
commonPrepositions
public static java.util.Set<java.lang.String> commonPrepositions()
Getter.- Returns:
- the commonPrepositions instance variable (HashSet).
-
isPreposition
public static boolean isPreposition(@NotNull @NotNull java.lang.String word)
Checks if a word is a preposition.- Parameters:
word
- to be analyzed.- Returns:
- true if the word is a preposition found in a database, false if not.
-
getRandom
public static java.lang.String getRandom()
Gets a random preposition from the commonPrepositions HashSet.- Returns:
- a random preposition.
-
-