是否全是中国数字
@param word
@return
326948
public static boolean isAllChineseNum(String word)
    {// 百分之五点六的人早上八点十八分起床

        String chineseNum = "零○一二两三四五六七八九十廿百千万亿壹贰叁肆伍陆柒捌玖拾佰仟∶·．／点";//
        String prefix = "几数上第";
        String surfix = "几多余来成倍";
        boolean round = false;

        if (word == null)
            return false;

        char[] temp = word.toCharArray();
        for (int i = 0; i < temp.length; i++)
        {
            if (word.startsWith("分之", i))// 百分之五
            {
                i += 1;
                continue;
            }
            char tchar = temp[i];
            if (i == 0 && prefix.indexOf(tchar) != -1)
            {
                round = true;
            }
            else if (i == temp.length-1 && !round && surfix.indexOf(tchar) != -1)
            {
                round = true;
            }
            else if (chineseNum.indexOf(tchar) == -1)
                return false;
        }
        return true;
    }
280028
public static int getFrequency(String word)
    {
        CoreDictionary.Attribute attribute = getAttribute(word);
        if (attribute == null) return 0;
        return attribute.totalFrequency;
    }
1282137
public float cohesion(String word) {

        if (word.length() == 0) {
            return Integer.MIN_VALUE;
        }

        List<Element> elements = Config.wordAlert(word);

        for (int i = 0; i < elements.size(); i++) {
            computeTagScore(elements, i);
        }

        float value = elements.get(0).tagScore[1];

        int len = elements.size() - 1;

        for (int i = 1; i < len; i++) {
            value += elements.get(i).tagScore[2];
        }

        value += elements.get(len).tagScore[3];

        if (value < 0) {
            return 1;
        } else {
            value += 1;
        }

        return value;
    }
916494
private final int getIndexFor(String word) {
	Integer index = termToIndex.get(word);
	if (index == null) {	 
	    synchronized(this) {
		// recheck to see if the term was added while blocking
		index = termToIndex.get(word);
		// if another thread has not already added this word while the
		// current thread was blocking waiting on the lock, then add it.
		if (index == null) {
		    int i = wordIndexCounter++;
                    // Add a new counter for this term.  Because the
                    // wordIndexCounter starts at zero, so the next index will
                    // be the last index in the termCounts list.
                    termCounts.add(new AtomicInteger(0));
		    termToIndex.put(word, i);
		    return i; // avoid the auto-boxing to assign i to index
		}
	    }
	}
	return index;
    }
361439
@Override
    public Acceptance lookup(Word<? extends I> word) {
        State s = getState(word);
        if (s == null) {
            return Acceptance.DONT_KNOW;
        }
        return s.getAcceptance();
    }
895790
public static void parseNature(Term term) {
        if (!Nature.NW.equals(term.natrue())) {
            return;
        }

        String name = term.getName();

        if (name.length() <= 3) {
            return;
        }

        // 是否是外国人名
        if (ForeignPersonRecognition.isFName(name)) {
            term.setNature(NatureLibrary.getNature("nrf"));
            return;
        }

        List<Term> subTerm = term.getSubTerm();

        // 判断是否是机构名
        term.setSubTerm(subTerm);
        Term first = subTerm.get(0);
        Term last = subTerm.get(subTerm.size() - 1);
        int[] is = companyMap.get(first.getName());
        int all = 0;

        is = companyMap.get(last.getName());
        if (is != null) {
            all += is[1];
        }

        if (all > 1000) {
            term.setNature(NatureLibrary.getNature("nt"));
            return;
        }
    }
972198
private boolean isNotCompound(String word) throws IOException {
    List<String> probablyCorrectWords = new ArrayList<>();
    List<String> testedTokens = new ArrayList<>(2);
    for (int i = 2; i < word.length(); i++) {
      // chop from left to right
      final String first = word.substring(0, i);
      final String second = word.substring(i, word.length());
      if (prefixes.contains(first.toLowerCase(conversionLocale))
              && !isMisspelled(speller1, second)
              && second.length() > first.length()) { // but not for short words such as "premoc"
        // ignore this match, it's fine
        probablyCorrectWords.add(word); // FIXME: some strange words are being accepted, like prekupa
      } else {
        testedTokens.clear();
        testedTokens.add(first);
        testedTokens.add(second);
        List<AnalyzedTokenReadings> taggedToks =
                language.getTagger().tag(testedTokens);
        if (taggedToks.size() == 2
                // "białozielony", trzynastobitowy
                && (taggedToks.get(0).hasPosTag("adja")
                || (taggedToks.get(0).hasPosTag("num:comp")
                   && !taggedToks.get(0).hasPosTag("adv")))
                && taggedToks.get(1).hasPartialPosTag("adj:")) {
          probablyCorrectWords.add(word);
        }
      }
    }
    if (!probablyCorrectWords.isEmpty()) {
      addIgnoreTokens(probablyCorrectWords);
      return false;
    }
    return true;
  }
206385
int searchVocab(String word)
    {
        if (word == null) return -1;
        Integer pos = vocabIndexMap.get(word);
        return pos == null ? -1 : pos.intValue();
    }
399467
public static void remove(String key, String word) {

        SmartForest<List<String>> synonyms = get(key);

        SmartForest<List<String>> branch = synonyms.getBranch(word);

        if (branch == null || branch.getStatus() < 2) {
            return;
        }

        List<String> params = branch.getParam();

        synonyms.remove(word);
        branch.setParam(null);
        params.remove(word);

        if (params.size() == 1) { //如果是1 个也删除
            synonyms.remove(params.get(0));
            params.remove(0);
        } else {
            params.remove(word);
        }
    }
155990
public static Map<String, String> extractBrownFeat(String word) {
        if (!BROWN_CLUSTER.containsKey(word)) {
            return new HashMap<>();
        }

        String clusterId = BROWN_CLUSTER.get(word);

        return Arrays.stream(BROWN_PREFIX).mapToObj(p -> {
            int end = Math.min(p, clusterId.length());
            return new AbstractMap.SimpleEntry<>("brown_" + p, clusterId.substring(0, end));
        }).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));

    }
320741
public static boolean isReservedWord(String word) {
		return !StrUtils.isEmpty(word) && RESERVED_WORDS.containsKey(word.toUpperCase());
	}
523840
public static int getCharCount(String charSet, String word)
    {
        int nCount = 0;

        if (word != null)
        {
            String temp = word + " ";
            for (int i = 0; i < word.length(); i++)
            {
                String s = temp.substring(i, i + 1);
                if (charSet.indexOf(s) != -1)
                    nCount++;
            }
        }

        return nCount;
    }
525040
public boolean match(String word) {
        int flags = 0;
        if (ignoreCase) {
            flags = flags | Pattern.CASE_INSENSITIVE;
        }
        return Pattern.compile(pattern, flags).matcher(word).find();
    }
88498
protected Map<String, Float> toFastSearchMap(List<Word> words){
        Map<String, Float> weights = new ConcurrentHashMap<>();
        if(words == null){
            return weights;
        }
        words.parallelStream().forEach(word -> {
            if(word.getWeight() != null) {
                weights.put(word.getText(), word.getWeight());
            }else{
                LOGGER.error("词没有权重信息："+word.getText());
            }
        });
        return weights;
    }
1286828
public static TermNatures guessNature(String word) {
		String nature = null;
		SmartForest<String[]> smartForest = SUFFIX_FOREST;
		int len = 0;
		for (int i = word.length() - 1; i >= 0; i--) {
			smartForest = smartForest.get(word.charAt(i));
			if (smartForest == null) {
				break;
			}
			len++;
			if (smartForest.getStatus() == 2) {
				nature = smartForest.getParam()[0];
			} else if (smartForest.getStatus() == 3) {
				nature = smartForest.getParam()[0];
				break;
			}
		}

		if ("nt".equals(nature) && (len > 1 || word.length() > 3)) {
			return TermNatures.NT;
		} else if ("ns".equals(nature)) {
			return TermNatures.NS;
		} else if (word.length() < 5) {
			Result parse = ToAnalysis.parse(word);
			for (Term term : parse.getTerms()) {
				if ("nr".equals(term.getNatureStr())) {
					return TermNatures.NR;
				}
			}
		} else if (DATDictionary.foreign(word)) {
			return TermNatures.NRF;
		}

		return TermNatures.NW;
	}
1169337
public String[] getTags(String word) {
    if (caseSensitive) {
      return (String[]) dictionary.get(word);
    }
    else {
      //System.err.println(java.util.Arrays.asList((String[]) dictionary.get(word.toLowerCase())));
      return (String[]) dictionary.get(word.toLowerCase());
    }
  }
176458
public static List<Element> wordAlert(String word) {

		char[] chars = WordAlert.alertStr(word);

		List<Element> list = new ArrayList<Element>();

		StringBuilder tempSb = new StringBuilder();

		int status = 0; // 1 num 2 english

		Element element = null;

		for (int i = 0; i < chars.length; i++) {

			if (chars[i] >= '0' && chars[i] <= '9') {
				if (status == 2) {
					element = new Element(Config.getNum(tempSb.toString()));
					element.len = tempSb.length();
					list.add(element);
					tempSb = new StringBuilder();
				}
				tempSb.append(chars[i]);
				status = 1;
			} else if (chars[i] >= 'A' && chars[i] <= 'z') {
				if (status == 1) {
					element = new Element(Config.getEn(tempSb.toString()));
					element.len = tempSb.length();
					list.add(element);
					tempSb = new StringBuilder();
				}
				tempSb.append(chars[i]);
				status = 2;
			} else {
				if (status == 1) {
					element = new Element(Config.getNum(tempSb.toString()));
					element.len = tempSb.length();
					list.add(element);
				} else if (status == 2) {
					element = new Element(Config.getEn(tempSb.toString()));
					element.len = tempSb.length();
					list.add(element);
				}
				tempSb = new StringBuilder();
				list.add(new Element(chars[i]));
				status = 0;
			}

		}

		if (tempSb.length() > 0) {
			if (status == 1) {
				element = new Element(Config.getNum(tempSb.toString()));
				element.len = tempSb.length();
				list.add(element);
			} else if (status == 2) {
				element = new Element(Config.getEn(tempSb.toString()));
				element.len = tempSb.length();
				list.add(element);
			} else {
				LOG.error("err! status :"+status);
			}
		}

		return list;
	}