@Test public void testEqualsIgnorePunctuationAndCase() { final EsvXmlEnhancer esvXmlEnhancer = new EsvXmlEnhancer(null, null, null); assertTrue(esvXmlEnhancer.equalsIngorePunctuationAndCase("the dog", "the dog")); assertTrue(esvXmlEnhancer.equalsIngorePunctuationAndCase("the,dog", "the dog")); assertTrue(esvXmlEnhancer.equalsIngorePunctuationAndCase("the dog", "the' dog")); assertTrue(esvXmlEnhancer.equalsIngorePunctuationAndCase("the Dog", "tHe dog")); assertFalse(esvXmlEnhancer.equalsIngorePunctuationAndCase("the Dog", "thedog")); assertFalse(esvXmlEnhancer.equalsIngorePunctuationAndCase("the,Dog", "thedog")); assertFalse(esvXmlEnhancer.equalsIngorePunctuationAndCase("the Dog ", "thedog ")); assertFalse(esvXmlEnhancer.equalsIngorePunctuationAndCase("the Dog a", "the Dog i")); assertTrue(esvXmlEnhancer.equalsIngorePunctuationAndCase("you do", "you, do")); }
boolean equalsIngorePunctuationAndCase(final String taggedText, final String domText) { int nonAlpha = 0; for (int ii = 0; ii < taggedText.length(); ii++) { final char c1 = taggedText.charAt(ii); final char c2 = domText.charAt(ii + nonAlpha); if (Character.isLetterOrDigit(c1) && Character.toLowerCase(c1) != Character.toLowerCase(c2)) { return false; } if (!Character.isLetterOrDigit(c2) && c2 != ' ' && ii + 1 < domText.length() && domText.charAt(ii + 1) == ' ') { nonAlpha++; } } return true; }
EsvXmlEnhancer { boolean equalsIngorePunctuationAndCase(final String taggedText, final String domText) { int nonAlpha = 0; for (int ii = 0; ii < taggedText.length(); ii++) { final char c1 = taggedText.charAt(ii); final char c2 = domText.charAt(ii + nonAlpha); if (Character.isLetterOrDigit(c1) && Character.toLowerCase(c1) != Character.toLowerCase(c2)) { return false; } if (!Character.isLetterOrDigit(c2) && c2 != ' ' && ii + 1 < domText.length() && domText.charAt(ii + 1) == ' ') { nonAlpha++; } } return true; } }
EsvXmlEnhancer { boolean equalsIngorePunctuationAndCase(final String taggedText, final String domText) { int nonAlpha = 0; for (int ii = 0; ii < taggedText.length(); ii++) { final char c1 = taggedText.charAt(ii); final char c2 = domText.charAt(ii + nonAlpha); if (Character.isLetterOrDigit(c1) && Character.toLowerCase(c1) != Character.toLowerCase(c2)) { return false; } if (!Character.isLetterOrDigit(c2) && c2 != ' ' && ii + 1 < domText.length() && domText.charAt(ii + 1) == ' ') { nonAlpha++; } } return true; } EsvXmlEnhancer(final File tagging, final File esvText, File outputPath); }
EsvXmlEnhancer { boolean equalsIngorePunctuationAndCase(final String taggedText, final String domText) { int nonAlpha = 0; for (int ii = 0; ii < taggedText.length(); ii++) { final char c1 = taggedText.charAt(ii); final char c2 = domText.charAt(ii + nonAlpha); if (Character.isLetterOrDigit(c1) && Character.toLowerCase(c1) != Character.toLowerCase(c2)) { return false; } if (!Character.isLetterOrDigit(c2) && c2 != ' ' && ii + 1 < domText.length() && domText.charAt(ii + 1) == ' ') { nonAlpha++; } } return true; } EsvXmlEnhancer(final File tagging, final File esvText, File outputPath); static void main(final String[] args); }
EsvXmlEnhancer { boolean equalsIngorePunctuationAndCase(final String taggedText, final String domText) { int nonAlpha = 0; for (int ii = 0; ii < taggedText.length(); ii++) { final char c1 = taggedText.charAt(ii); final char c2 = domText.charAt(ii + nonAlpha); if (Character.isLetterOrDigit(c1) && Character.toLowerCase(c1) != Character.toLowerCase(c2)) { return false; } if (!Character.isLetterOrDigit(c2) && c2 != ' ' && ii + 1 < domText.length() && domText.charAt(ii + 1) == ' ') { nonAlpha++; } } return true; } EsvXmlEnhancer(final File tagging, final File esvText, File outputPath); static void main(final String[] args);  }