diff options
Diffstat (limited to 'src/examples/java/bjc')
| -rw-r--r-- | src/examples/java/bjc/inflexion/examples/IndefTester.java | 7 | ||||
| -rw-r--r-- | src/examples/java/bjc/inflexion/examples/InflexionTester.java | 34 |
2 files changed, 24 insertions, 17 deletions
diff --git a/src/examples/java/bjc/inflexion/examples/IndefTester.java b/src/examples/java/bjc/inflexion/examples/IndefTester.java index e22737c..6172eca 100644 --- a/src/examples/java/bjc/inflexion/examples/IndefTester.java +++ b/src/examples/java/bjc/inflexion/examples/IndefTester.java @@ -6,13 +6,16 @@ import bjc.inflexion.EnglishUtils; /** * Test class for checking indefinite articles + * * @author bjculkin * */ public class IndefTester { /** * Main method. - * @param args Unused CLI args. + * + * @param args + * Unused CLI args. */ public static void main(String[] args) { Scanner scn = new Scanner(System.in); @@ -20,7 +23,7 @@ public class IndefTester { System.out.print("Enter word: "); String word = scn.nextLine().trim(); - while(!word.equals("")) { + while (!word.equals("")) { System.out.printf("\t%s %s\n", EnglishUtils.pickIndefinite(word), word); System.out.print("Enter word: "); diff --git a/src/examples/java/bjc/inflexion/examples/InflexionTester.java b/src/examples/java/bjc/inflexion/examples/InflexionTester.java index 0595cfa..bf0452c 100644 --- a/src/examples/java/bjc/inflexion/examples/InflexionTester.java +++ b/src/examples/java/bjc/inflexion/examples/InflexionTester.java @@ -44,11 +44,12 @@ public class InflexionTester { * Main method. * * @param args - * Unused CLI args. + * Unused CLI args. */ public static void main(final String[] args) { final Prepositions prepositionDB = new Prepositions(); - try (InputStream strim = InflectionML.class.getResourceAsStream("/prepositions.txt")) { + try (InputStream strim + = InflectionML.class.getResourceAsStream("/prepositions.txt")) { prepositionDB.loadFromStream(strim); } catch (IOException ioex) { ioex.printStackTrace(); @@ -88,7 +89,8 @@ public class InflexionTester { try (InputStream compressedStream = new FileInputStream(fname)) { final InputStream stream = new BZip2CompressorInputStream(compressedStream); - final BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); + final BufferedReader reader + = new BufferedReader(new InputStreamReader(stream)); /* * Pattern find word name @@ -106,7 +108,7 @@ public class InflexionTester { * Pattern to find noun definition */ final Pattern enNounPattern = Pattern - .compile("\\{\\{en-noun([a-z0-9\\|\\-\\[\\]\\?\\!=]*)\\}\\}"); + .compile("\\{\\{en-noun([a-z0-9\\|\\-\\[\\]\\?\\!=]*)\\}\\}"); final Pattern wordPattern = Pattern.compile("([a-zA-Z\\-]+)"); @@ -227,13 +229,13 @@ public class InflexionTester { } if (basicWord) { - System.out.println("basic word: " + word + " got: " - + calculatedPlural + ", but expected " - + enNounMatcher.group(1)); + System.out.println( + "basic word: " + word + " got: " + calculatedPlural + + ", but expected " + enNounMatcher.group(1)); basicWrong++; } else if (!uncountable) { System.out.println(word + " got: " + calculatedPlural - + ", but expected " + enNounMatcher.group(1)); + + ", but expected " + enNounMatcher.group(1)); } } } @@ -243,18 +245,20 @@ public class InflexionTester { compressedStream.close(); final float correct = (count - wrong) * 100 / (float) count; - final float basicCorrect = (basicCount - basicWrong) * 100 / (float) basicCount; + final float basicCorrect + = (basicCount - basicWrong) * 100 / (float) basicCount; final float wrongNoPluralPercent = wrongNoPlural * 100 / (float) count; final int justPlainWrong = wrong - wrongNoPlural; final float justPlainWrongPercent = justPlainWrong * 100 / (float) count; - System.out.println("Words checked: " + count + " (" + basicCount + " basic words)"); - System.out.println("Correct: " + correct + "% (" + basicCorrect + "% basic words)"); + System.out.println( + "Words checked: " + count + " (" + basicCount + " basic words)"); + System.out.println( + "Correct: " + correct + "% (" + basicCorrect + "% basic words)"); System.out.println("Errors: "); System.out.println(" No plural form specified: " + wrongNoPlural + " (" - + wrongNoPluralPercent + "%)"); - System.out.println(" Incorrect answer: " + justPlainWrong + " (" + - justPlainWrongPercent - + "%)"); + + wrongNoPluralPercent + "%)"); + System.out.println(" Incorrect answer: " + justPlainWrong + " (" + + justPlainWrongPercent + "%)"); } catch (final FileNotFoundException fnfex) { fnfex.printStackTrace(); } catch (final IOException ioex) { |
