取得人名补充

@param term
@return
188056
public static boolean foreign(Term term) {
		String name = term.getName();

		boolean contains = FOREIGNSET.contains(name);
		if (contains) {
			return contains;
		}

		if (!term.getNatureStr().startsWith("nr")) {
			return false;
		}

		for (int i = 0; i < name.length(); i++) {
			if (!FOREIGNSET.contains(String.valueOf(name.charAt(i)))) {
				return false;
			}
		}
		return true ;
	}
481887
public boolean filter(Term term) {

        if (!stop.isEmpty() && (stop.contains(term.getName()))) {
            return true;
        }

        if (!natureStop.isEmpty() && (natureStop.contains(term.natrue().natureStr))) {
            return true;
        }

        if (!regexList.isEmpty()) {
            for (Pattern stopwordPattern : regexList) {
                if (stopwordPattern.matcher(term.getName()).matches()) {
                    return true;
                }
            }
        }

        return false;
    }
790215
@Override
  public List<String> getSynonyms(String word, Language lang) {
    return getSynonyms(word, getLocale(lang));
  }
58780
public Term getTerm(String name) {
        for (Term term : this.terms) {
            if (name.equals(term.getName())) {
                return term;
            }
        }
        return null;
    }
96061
public Term merage(Term to) {
        this.name = this.name + to.getName();
        if (StringUtil.isNotBlank(this.realName) && StringUtil.isNotBlank(to.getRealName())) {
            this.realName = this.realName + to.getRealName();
        }
        this.setTo(to.to);
        return this;
    }
572309
public static String getCamelName(String name) {
        if (StringUtils.isBlank(name)) {
            return null;
        }
        name = name.toLowerCase();
        //去掉前面的_
        while (name.startsWith("_")) {
            name = name.substring(1);
        }
        //去掉后面的_
        while (name.endsWith("_")) {
            name = name.substring(0, name.length() - 1);
        }

        StringBuilder sb = new StringBuilder();

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

            char c = name.charAt(i);

            if (c == '_') {
                i++;
                sb.append(Character.toUpperCase(name.charAt(i)));
                continue;
            }
            sb.append(c);
        }

        return sb.toString();
    }
907960
public static Term create(String term) {
        Term res = createStringCache.get(term);

        if (res == null) {
            if (term != null && term.length() >= 2 &&
                term.charAt(0) == '{' && term.charAt(term.length() - 1) == '}') {
                term = EscapeUtils.escape(term.substring(1, term.length() - 1));
            }

            long[] value = checkStringIndex(term);
            if (value[1] < 0L) {
                res = (Term) StringProperty.getInstance(term);
            } else {
                res = (Term) create(value[0]);
            }
            createStringCache.put(term, res);
        }

        // no clone/copy needed for cached result
        return res;
	}
1119879
public static int getTwoWordFreq(Term from, Term to) {
        if (from.item().bigramEntryMap == null) {
            return 0;
        }
        Integer freq = from.item().bigramEntryMap.get(to.item().getIndex());
        if (freq == null) {
            return 0;
        } else {
            return freq;
        }
    }
1288184
protected Query getTermQueryFilter(String field, String term) {

        return getMultiTermQueryFilter(field, term, Collections.singletonList(term));
    }
86683
public static void nameAmbiguity(Term[] terms, Forest... forests) {
        Term from = null;
        Term term = null;
        Term next = null;
        for (int i = 0; i < terms.length - 1; i++) {
            term = terms[i];
            if (term != null && term.termNatures() == TermNatures.NR && term.getName().length() == 2) {
                next = terms[i + 2];
                if (next.termNatures().personAttr.split > 0) {
                    term.setName(term.getName() + next.getName().charAt(0));
                    terms[i + 2] = null;

                    String name = next.getName().substring(1);
                    terms[i + 3] = new Term(name, next.getOffe() + 1,
                                    new NatureRecognition(forests).getTermNatures(name));
                    TermUtil.termLink(term, terms[i + 3]);
                    TermUtil.termLink(terms[i + 3], next.to());
                }
            }
        }

        // 外国人名修正
        for (int i = 0; i < terms.length; i++) {
            term = terms[i];
            if (term != null && term.getName().length() == 1 && i > 0
                            && WordAlert.CharCover(term.getName().charAt(0)) == '·') {
                from = term.from();
                next = term.to();

                if (from.natrue().natureStr.startsWith("nr") && next.natrue().natureStr.startsWith("nr")) {
                    from.setName(from.getName() + term.getName() + next.getName());
                    TermUtil.termLink(from, next.to());
                    terms[i] = null;
                    terms[i + 1] = null;
                }
            }
        }

    }
275376
public String getMap(String word){
		if(nameMap==null||!nameMap.containsKey(word))
			return word;
		else
			return nameMap.get(word);
	}
1158423
public static CoreDictionary.Attribute guessAttribute(Term term)
    {
        CoreDictionary.Attribute attribute = CoreDictionary.get(term.word);
        if (attribute == null)
        {
            attribute = CustomDictionary.get(term.word);
        }
        if (attribute == null)
        {
            if (term.nature != null)
            {
                if (Nature.nx == term.nature)
                    attribute = new CoreDictionary.Attribute(Nature.nx);
                else if (Nature.m == term.nature)
                    attribute = CoreDictionary.get(CoreDictionary.M_WORD_ID);
            }
            else if (term.word.trim().length() == 0)
                attribute = new CoreDictionary.Attribute(Nature.x);
            else attribute = new CoreDictionary.Attribute(Nature.nz);
        }
        else term.nature = attribute.nature[0];
        return attribute;
    }
1200816
@Override
    public boolean containsTerm(Term t) {
        List<Term> terms = getTerms();
        for (int i = 0; i < terms.size(); i++) {
            Term t2 = terms.get(i);
            if (t2.equals(t))
                return true;
        }
        return false;
    }
1024285
public String getName() {
        switch (type) {
            case Element.SUBJECT:
                return ElementTags.SUBJECT;
            case Element.KEYWORDS:
                return ElementTags.KEYWORDS;
            case Element.AUTHOR:
                return ElementTags.AUTHOR;
            case Element.TITLE:
                return ElementTags.TITLE;
            case Element.PRODUCER:
                return ElementTags.PRODUCER;
            case Element.CREATIONDATE:
                return ElementTags.CREATIONDATE;
                default:
                    return ElementTags.UNKNOWN;
        }
    }
1109629
private boolean _validate(Token token, Term term) {

		if (token == null) {
			return true;
		}

		Set<String> terms = token.getTerms();
		if ((!terms.contains(Token.ALL)) && !terms.contains(term.getName()) && !(terms.contains(":" + term.getNatureStr()))) {
			return true;
		}

		boolean flag = token.getRegexs().size() != 0;

		for (String regex : token.getRegexs()) {
			if (term.getName().matches(regex)) {
				flag = false;
				break;
			}
		}

		return flag;
	}
1360573
@Override
    public String[] tag(List<String> wordList)
    {
        String[] termArray = new String[wordList.size()];
        wordList.toArray(termArray);
        return tag(termArray);
    }
79617
private String computeMorse(BytesRef term) {
    StringBuilder stringBuilder = new StringBuilder();
    int i = term.offset + prefixOffset;
    for (; i < term.length; i++) {
      if (ALPHABET_MORSE.containsKey(term.bytes[i])) {
        stringBuilder.append(ALPHABET_MORSE.get(term.bytes[i]) + " ");
      } else if(term.bytes[i]!=0x00){
        return null;
      } else {
        break;
      }
    }
    return stringBuilder.toString();
  }