From 2f6a7807f7180fb467e3d06f2af4263a45759c28 Mon Sep 17 00:00:00 2001 From: Ben Culkin Date: Mon, 13 Apr 2020 18:44:24 -0400 Subject: Cleanup pass Pass to do some cleanups --- src/main/java/bjc/inflexion/InflectionML.java | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'src/main/java/bjc/inflexion/InflectionML.java') diff --git a/src/main/java/bjc/inflexion/InflectionML.java b/src/main/java/bjc/inflexion/InflectionML.java index e92e171..34b534a 100644 --- a/src/main/java/bjc/inflexion/InflectionML.java +++ b/src/main/java/bjc/inflexion/InflectionML.java @@ -33,9 +33,9 @@ import bjc.inflexion.nouns.Prepositions; /* * @TODO 10/11/17 Ben Culkin :InflectionML - * + * * Complete the implementation of this from the documentation for Lingua::EN:Inflexion. - * + * * ADDENDA 10/25/18 * Everything that doesn't require doing verbs is done. */ @@ -49,7 +49,8 @@ public class InflectionML { private static final List ESUB_OPT = Arrays.asList("a", "s", "w"); /* The regex that marks an inflection form. */ - private static Pattern FORM_MARKER = Pattern.compile("<(?[#N])(?[^:]*):(?[^>]*)>"); + private static Pattern FORM_MARKER + = Pattern.compile("<(?[#N])(?[^:]*):(?[^>]*)>"); private static Pattern AN_MARKER = Pattern.compile("\\{an(\\d+)\\}"); @@ -59,7 +60,8 @@ public class InflectionML { /* Load DBs from files. */ static { 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(); @@ -77,7 +79,7 @@ public class InflectionML { * Apply inflection to marked forms in the string. * * @param form - * The string to inflect. + * The string to inflect. * * @return The inflected string. */ @@ -164,9 +166,8 @@ public class InflectionML { switch (command) { case "#": /* - * @NOTE These should maybe be moved into their - * own function. This will also allow the use of - * custom inflection forms. + * @NOTE These should maybe be moved into their own function. This will + * also allow the use of custom inflection forms. */ try { if (optionSet.contains("e")) { @@ -238,7 +239,8 @@ public class InflectionML { rep = NumberUtils.toOrdinal(curCount, numOpts.get('o'), false); } else { - rep = NumberUtils.toOrdinal(curCount, numOpts.get('o'), false); + rep = NumberUtils.toOrdinal(curCount, numOpts.get('o'), + false); } if (curCount < numOpts.get('o')) { @@ -249,7 +251,8 @@ public class InflectionML { } if (optionSet.contains("f") && shouldOverride) { - rep = NumberUtils.summarizeNumber(curCount, numOpts.get('f') != 0); + rep = NumberUtils.summarizeNumber(curCount, + numOpts.get('f') != 0); } numOpts.put('o', Integer.MAX_VALUE); @@ -258,8 +261,8 @@ public class InflectionML { formMatcher.appendReplacement(formBuffer, rep); } catch (final NumberFormatException nfex) { - throw new InflectionException("Count setter must take a number as a parameter", - nfex); + throw new InflectionException( + "Count setter must take a number as a parameter", nfex); } break; case "N": -- cgit v1.2.3