List of utility methods to do String Tokenize
String[] | getTokens(String string, String tokenSeparator) Tokenizes the given string with the given separator string. List<Integer> tokenEndIndices = new ArrayList<Integer>(); int fromIndex = 0; while ((fromIndex = string.indexOf(tokenSeparator, fromIndex)) != -1) { tokenEndIndices.add(fromIndex++); if ((tokenEndIndices.isEmpty()) || (string.length() > tokenEndIndices.get(tokenEndIndices.size() - 1) + 1)) tokenEndIndices.add(string.length()); fromIndex = -tokenSeparator.length(); ... |
List | getTokens(String value) get Tokens return Arrays.asList(value.replaceAll("[^a-zA-Z0-9]", " ").split("[\\s@&.?$+-]+")); |
Vector | getTokens(String vbt) get Tokens String t = removeFillers(vbt); Vector v = new Vector(); StringTokenizer st = new StringTokenizer(t, " "); int knt = 0; String retstr = ""; while (st.hasMoreTokens()) { String val = st.nextToken(); val = val.toLowerCase(); ... |
List | getTokenTypes(CommonTree tree) get Token Types tokenTypes = new ArrayList<>(); generateTokenTypes(tree); return tokenTypes; |
Integer | getUnitType(String typeToken) Returns the corresponding unit type constant for the given "type token" string. for (Iterator i = mUnitTypeMap.keySet().iterator(); i.hasNext();) { String key = (String) i.next(); if (typeToken.equals(key)) { return (Integer) mUnitTypeMap.get(key); throw new IllegalArgumentException("Type " + typeToken + " is not a known device type"); |
java.util.List | hasSuffix(String _token) Checks for suffix. java.util.List<String> list = new java.util.ArrayList<String>(); if (_token.contains(".") == true) { String[] tokenArray = _token.split("\\."); list.add(tokenArray[0]); list.add(tokenArray[1]); return list; |
boolean | isPOSTag(String token) Very simple way of testing whether something is a part of speech tag. if (posTagSet == null) { initializePOSTagSet(); return posTagSet.contains(token); |
boolean | isStringFunction(String token) is String Function return stringFunctions.contains(token);
|
boolean | isToken(String sentence, String searchWord) is Token StringTokenizer sentenceToken = new StringTokenizer(sentence, " .;:"); while (sentenceToken.hasMoreTokens()) { if (sentenceToken.nextToken().equals(searchWord)) return true; return false; |
int | maxTokenLength(String s) max Token Length if (s == null) return 0; int max = 0; StringTokenizer st = new StringTokenizer(s); while (st.hasMoreTokens()) { int tokenLength = st.nextToken().length(); if (tokenLength > max) max = tokenLength; ... |