List of usage examples for org.apache.commons.lang StringUtils isAllUpperCase
public static boolean isAllUpperCase(String str)
Checks if the String contains only uppercase characters.
From source file:de.tu.darmstadt.lt.ner.feature.extractor.CamelCaseFeatureExtractor.java
@Override public List<Feature> apply(Feature feature) { Object featureValue = feature.getValue(); if (featureValue == null) { return Collections.singletonList(new Feature("CapsFeature", "CapsFeature_null")); }/*w ww. j a v a2 s.c o m*/ String value = featureValue.toString(); if (value == null || value.length() == 0) { return Collections.singletonList(new Feature("CapsFeature", "CapsFeature_null")); } if (StringUtils.isAllUpperCase(value)) { return Collections .singletonList(new Feature("CapsFeature", StringUtils.capitalize(value.toLowerCase()))); } else { return Collections.singletonList(new Feature("CapsFeature", value)); } }
From source file:fr.upmc.qvcs.scanner.service.resolver.name.BasicNameResolver.java
@Override public String resolve(String name) { String oldName = name;//from w ww .j av a 2 s . c om //5.1 case name = name.replace("5.1", ""); for (String s : SPLIT_CHAR) name = name.replace(s, " "); StringTokenizer tokenizer = new StringTokenizer(name); StringBuilder builder = new StringBuilder(); while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken().trim(); if (isForbiddenToken(token)) continue; if (StringUtils.isAllUpperCase(token)) continue; builder.append(token.toLowerCase()).append(" "); } LOGGER.info("The name " + oldName + " had been resolved has " + name); return builder.toString(); }
From source file:com.apexxs.neonblack.detection.LocationInspector.java
private DetectedLocation checkForBigramType1(DetectedLocation loc) { String countryCode;//from w ww.ja v a2 s . c om String stateCode; if (loc.hints == null) { String[] tokens = loc.name.split(" "); if (tokens.length > 1) { String possBigram = tokens[tokens.length - 1]; if ((possBigram.length() == 2 || possBigram.length() == 3) && StringUtils.isAllUpperCase(possBigram)) { countryCode = isItACountry(possBigram); stateCode = isItAState(possBigram); if (!StringUtils.isEmpty(countryCode) && !StringUtils.isEmpty(stateCode)) { loc.hints = new ArrayList<>(); loc.hints.add("(countryCode:" + countryCode + " OR " + "admin1:" + stateCode + ")"); } else if (!StringUtils.isEmpty(countryCode)) { loc.hints = new ArrayList<>(); loc.hints.add("countryCode:" + countryCode); } else if (!StringUtils.isEmpty(stateCode)) { loc.hints = new ArrayList<>(); loc.hints.add("admin1:" + stateCode); } } if (loc.hints != null) { loc.name = loc.name.replace(possBigram, "").trim(); } } } return loc; }
From source file:com.apexxs.neonblack.detection.LocationInspector.java
private DetectedLocation checkForBigramType2(DetectedLocation loc, String text) { if (loc.hints == null) { String countryCode;//from w w w. ja v a 2s.c om String stateCode; for (Integer stop : loc.stopPos) { if (text.length() >= stop + 5) { String subString = text.substring(stop, stop + 5); subString = subString.replaceAll("\\p{Punct}", "").trim(); String[] tokens = subString.split(" "); String possBigram = tokens[0]; if ((possBigram.length() == 2 || possBigram.length() == 3) && StringUtils.isAllUpperCase(possBigram)) { countryCode = isItACountry(possBigram); stateCode = isItAState(possBigram); if (!StringUtils.isEmpty(countryCode) && !StringUtils.isEmpty(stateCode)) { loc.hints = new ArrayList<>(); loc.hints.add("(countryCode:" + countryCode + " OR " + "admin1:" + stateCode + ")"); //return loc; } else if (!StringUtils.isEmpty(countryCode)) { loc.hints = new ArrayList<>(); loc.hints.add("countryCode:" + countryCode); } else if (!StringUtils.isEmpty(stateCode)) { loc.hints = new ArrayList<>(); loc.hints.add("admin1:" + stateCode); } } } } } return loc; }
From source file:ips1ap101.lib.base.util.StrUtils.java
public static boolean isMixedCase(String string) { return !StringUtils.isAllLowerCase(string) && !StringUtils.isAllUpperCase(string); }
From source file:ips1ap101.lib.base.util.StrUtils.java
public static boolean isNotMixedCase(String string) { return StringUtils.isAllLowerCase(string) || StringUtils.isAllUpperCase(string); }
From source file:ar.com.fluxit.jqa.bce.bcel.BCERepositoryImpl.java
protected String getParameterPaths(Method method, Type parentType, String paramsSignature) { String result = ""; // TODO improve String temp;/*from ww w.ja va 2 s. co m*/ while (paramsSignature != (temp = paramsSignature.replaceAll("<[^>|<]*>", ""))) { paramsSignature = temp; } String[] paramsSignatureSplit = paramsSignature.split(";"); int i = 1; for (String paramSignature : paramsSignatureSplit) { boolean array; if (paramSignature.startsWith("[")) { array = true; paramSignature = paramSignature.substring(1); } else { array = false; } if (paramSignature.startsWith("T")) { result += String.format("[.//FormalParameter[%d]/Type[./ReferenceType/*[@Image='%s']]]", i, paramSignature.substring(1)); } else if (paramSignature.startsWith("L")) { BcelJavaType argumentType = BcelJavaType.create(paramSignature.substring(1)); result += getParameterPath(i, argumentType, array); } else if (paramSignature.startsWith("ZL")) { BcelJavaType argumentType = BcelJavaType.create(paramSignature.substring(2)); result += getParameterPath(i, argumentType, array); } else if (!(paramSignature.length() == 1 && StringUtils.isAllUpperCase(paramSignature))) { throw new IllegalStateException("Unssuported param signature " + paramSignature + " of method " + method + " on type" + parentType.getName()); } i++; } return result; }
From source file:adalid.commons.util.StrUtils.java
public static boolean isNotMixedCase(String string) { string = StringUtils.trimToEmpty(string); if (string.isEmpty()) { return true; }/*from ww w .jav a 2s. c om*/ string = string.replaceAll("[^a-zA-Z]", ""); if (string.isEmpty()) { return true; } return StringUtils.isAllLowerCase(string) || StringUtils.isAllUpperCase(string); }
From source file:org.apdplat.superword.rule.TextAnalysis.java
/** * ?/*from w ww. j a v a 2 s . c o m*/ * @param sentence * @param debug ??? * @return */ public static List<String> seg(String sentence, boolean debug) { List<String> data = new ArrayList<>(); //?? String[] words = sentence.trim().split("[^a-zA-Z]"); StringBuilder log = new StringBuilder(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("??:" + sentence); } for (String word : words) { if (StringUtils.isBlank(word)) { continue; } List<String> list = new ArrayList<String>(); //?6??? if (word.length() < 6 || StringUtils.isAllUpperCase(word)) { word = word.toLowerCase(); } //??? int last = 0; for (int i = 1; i < word.length(); i++) { if (Character.isUpperCase(word.charAt(i)) && Character.isLowerCase(word.charAt(i - 1))) { list.add(word.substring(last, i)); last = i; } } if (last < word.length()) { list.add(word.substring(last, word.length())); } list.stream().map(w -> w.toLowerCase()).forEach(w -> { if (w.length() < 2) { return; } w = irregularity(w); if (StringUtils.isNotBlank(w)) { data.add(w); if (LOGGER.isDebugEnabled()) { log.append(w).append(" "); } } }); } LOGGER.debug("?" + log); return data; }
From source file:org.apdplat.superword.tools.PrefixSuffixOptimizer.java
/** * ?????// w w w . ja va 2 s . com * * @param element */ public static void replace(Element element) { String oldText = element.text(); StringBuilder newText = new StringBuilder(); System.out.println("oldText: " + oldText); String[] items = oldText.trim().replace(".", ",").split(","); for (String item : items) { item = item.trim(); if (!StringUtils.isAlpha(item)) { newText.append(item).append(", "); continue; } if (StringUtils.isAllUpperCase(item)) { newText.append("<strong><a target=\"_blank\" href=\"http://www.iciba.com/").append(item) .append("\">").append(item).append("</a></strong>").append(", "); } else { newText.append("<a target=\"_blank\" href=\"http://www.iciba.com/").append(item).append("\">") .append(item).append("</a>").append(", "); } WORDS.add(item.toLowerCase()); } if (newText.length() > 2) { String text = newText.substring(0, newText.length() - 2); System.out.println("newText: " + text); element.html(text); } }