summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/examples/java/bjc/inflexion/examples/IndefTester.java9
-rw-r--r--src/main/java/bjc/inflexion/EnglishUtils.java14
2 files changed, 18 insertions, 5 deletions
diff --git a/src/examples/java/bjc/inflexion/examples/IndefTester.java b/src/examples/java/bjc/inflexion/examples/IndefTester.java
index fd1929c..e22737c 100644
--- a/src/examples/java/bjc/inflexion/examples/IndefTester.java
+++ b/src/examples/java/bjc/inflexion/examples/IndefTester.java
@@ -4,7 +4,16 @@ import java.util.Scanner;
import bjc.inflexion.EnglishUtils;
+/**
+ * Test class for checking indefinite articles
+ * @author bjculkin
+ *
+ */
public class IndefTester {
+ /**
+ * Main method.
+ * @param args Unused CLI args.
+ */
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
diff --git a/src/main/java/bjc/inflexion/EnglishUtils.java b/src/main/java/bjc/inflexion/EnglishUtils.java
index 197b7cf..1a399be 100644
--- a/src/main/java/bjc/inflexion/EnglishUtils.java
+++ b/src/main/java/bjc/inflexion/EnglishUtils.java
@@ -74,7 +74,11 @@ public class EnglishUtils {
return "many";
}
-
+ /**
+ * Pick an indefinite article ('a' or 'an') for a phrase.
+ * @param phrase The phrase to pick an article for.
+ * @return The article to use for the phrase.
+ */
public static String pickIndefinite(String phrase) {
Pattern pattern;
Matcher matcher;
@@ -112,9 +116,9 @@ public class EnglishUtils {
if (lowercaseWord.length() == 1) {
if ("aedhilmnorsx".indexOf(lowercaseWord) >= 0) {
return "an";
- } else {
- return "a";
}
+
+ return "a";
}
// Capital words which should likely be preceded by 'an'
@@ -137,9 +141,9 @@ public class EnglishUtils {
} else if (word == word.toUpperCase()) {
if ("aedhilmnorsx".indexOf(lowercaseWord.substring(0, 1)) >= 0) {
return "an";
- } else {
- return "a";
}
+
+ return "a";
}
// Basic method of words that begin with a vowel being preceded by 'an'