@Test public void testGetLengthInDomWord() { final EsvXmlEnhancer esvXmlEnhancer = new EsvXmlEnhancer(null, null, null); assertEquals(7, esvXmlEnhancer.getLengthInDomWord("the dog", "the dog")); assertEquals(8, esvXmlEnhancer.getLengthInDomWord("the, dog", "the dog")); assertEquals(6, esvXmlEnhancer.getLengthInDomWord("wife's", "wife s")); assertEquals(26, esvXmlEnhancer.getLengthInDomWord( "you, that you have brought, on me and my kingdom a great sin as she tells you for", "you that you have brought")); }
int getLengthInDomWord(final String textContent, final String taggedText) { int baseLength = taggedText.length(); int nonAlpha = 0; char previousChar = 'a'; for (int ii = 0; ii < baseLength + nonAlpha; ii++) { final char c = textContent.charAt(ii); if (!Character.isLetterOrDigit(c)) { if (c == ' ') { if (previousChar == ' ') { nonAlpha++; } } else { if (ii + 1 < textContent.length() && !Character.isLetterOrDigit(textContent.charAt(ii + 1))) { nonAlpha++; } } } previousChar = c; } return baseLength + nonAlpha; }
EsvXmlEnhancer { int getLengthInDomWord(final String textContent, final String taggedText) { int baseLength = taggedText.length(); int nonAlpha = 0; char previousChar = 'a'; for (int ii = 0; ii < baseLength + nonAlpha; ii++) { final char c = textContent.charAt(ii); if (!Character.isLetterOrDigit(c)) { if (c == ' ') { if (previousChar == ' ') { nonAlpha++; } } else { if (ii + 1 < textContent.length() && !Character.isLetterOrDigit(textContent.charAt(ii + 1))) { nonAlpha++; } } } previousChar = c; } return baseLength + nonAlpha; } }
EsvXmlEnhancer { int getLengthInDomWord(final String textContent, final String taggedText) { int baseLength = taggedText.length(); int nonAlpha = 0; char previousChar = 'a'; for (int ii = 0; ii < baseLength + nonAlpha; ii++) { final char c = textContent.charAt(ii); if (!Character.isLetterOrDigit(c)) { if (c == ' ') { if (previousChar == ' ') { nonAlpha++; } } else { if (ii + 1 < textContent.length() && !Character.isLetterOrDigit(textContent.charAt(ii + 1))) { nonAlpha++; } } } previousChar = c; } return baseLength + nonAlpha; } EsvXmlEnhancer(final File tagging, final File esvText, File outputPath); }
EsvXmlEnhancer { int getLengthInDomWord(final String textContent, final String taggedText) { int baseLength = taggedText.length(); int nonAlpha = 0; char previousChar = 'a'; for (int ii = 0; ii < baseLength + nonAlpha; ii++) { final char c = textContent.charAt(ii); if (!Character.isLetterOrDigit(c)) { if (c == ' ') { if (previousChar == ' ') { nonAlpha++; } } else { if (ii + 1 < textContent.length() && !Character.isLetterOrDigit(textContent.charAt(ii + 1))) { nonAlpha++; } } } previousChar = c; } return baseLength + nonAlpha; } EsvXmlEnhancer(final File tagging, final File esvText, File outputPath); static void main(final String[] args); }
EsvXmlEnhancer { int getLengthInDomWord(final String textContent, final String taggedText) { int baseLength = taggedText.length(); int nonAlpha = 0; char previousChar = 'a'; for (int ii = 0; ii < baseLength + nonAlpha; ii++) { final char c = textContent.charAt(ii); if (!Character.isLetterOrDigit(c)) { if (c == ' ') { if (previousChar == ' ') { nonAlpha++; } } else { if (ii + 1 < textContent.length() && !Character.isLetterOrDigit(textContent.charAt(ii + 1))) { nonAlpha++; } } } previousChar = c; } return baseLength + nonAlpha; } EsvXmlEnhancer(final File tagging, final File esvText, File outputPath); static void main(final String[] args);  }