/** * Removes the postpunctuation characters from the current token. Copies * those postpunctuation characters to the class variable * 'postpunctuation'. */ private void removeTokenPostpunctuation() { if (token == null) { return; } final String tokenWord = token.getWord(); int tokenLength = tokenWord.length(); int position = tokenLength - 1; while (position > 0 && postpunctuationSymbols.indexOf((int) tokenWord .charAt(position)) != -1) { position--; } if (tokenLength - 1 != position) { // Copy postpunctuation from token token.setPostpunctuation(tokenWord.substring(position + 1)); // truncate token at postpunctuation token.setWord(tokenWord.substring(0, position + 1)); } else { token.setPostpunctuation(""); } }
/** * Removes the postpunctuation characters from the current token. Copies * those postpunctuation characters to the class variable * 'postpunctuation'. */ private void removeTokenPostpunctuation() { if (token == null) { return; } final String tokenWord = token.getWord(); int tokenLength = tokenWord.length(); int position = tokenLength - 1; while (position > 0 && postpunctuationSymbols.indexOf((int) tokenWord .charAt(position)) != -1) { position--; } if (tokenLength - 1 != position) { // Copy postpunctuation from token token.setPostpunctuation(tokenWord.substring(position + 1)); // truncate token at postpunctuation token.setWord(tokenWord.substring(0, position + 1)); } else { token.setPostpunctuation(""); } }