词与词之间的关联表数据

@return
327523
public static void initBigramTables() {
        try (BufferedReader reader = IOUtil.getReader(DicReader.getInputStream("bigramdict.dic"), "UTF-8")) {
            String temp = null;
            String[] strs = null;
            int freq = 0;
            while ((temp = reader.readLine()) != null) {
                if (StringUtil.isBlank(temp)) {
                    continue;
                }
                strs = temp.split("\t");
                freq = Integer.parseInt(strs[1]);
                strs = strs[0].split("@");
                AnsjItem fromItem = DATDictionary.getItem(strs[0]);

                AnsjItem toItem = DATDictionary.getItem(strs[1]);

                if (fromItem == AnsjItem.NULL && strs[0].contains("#")) {
                    fromItem = AnsjItem.BEGIN;
                }

                if (toItem == AnsjItem.NULL && strs[1].contains("#")) {
                    toItem = AnsjItem.END;
                }

                if (fromItem == AnsjItem.NULL || toItem == AnsjItem.NULL) {
                    continue;
                }

                if (fromItem.bigramEntryMap == null) {
                    fromItem.bigramEntryMap = new HashMap<Integer, Integer>();
                }

                fromItem.bigramEntryMap.put(toItem.getIndex(), freq);

            }
        } catch (NumberFormatException e) {
            LOG.warn("数字格式异常", e);
        } catch (UnsupportedEncodingException e) {
            LOG.warn("不支持的编码", e);
        } catch (IOException e) {
            LOG.warn("IO异常", e);
        }
    }
910284
public T get(Object key) {
		if (circle.isEmpty()) {
			return null;
		}
		int hash = hashFunc.hash(key);
		if (!circle.containsKey(hash)) {
			SortedMap<Integer, T> tailMap = circle.tailMap(hash);	//返回此映射的部分视图，其键大于等于 hash
			hash = tailMap.isEmpty() ? circle.firstKey() : tailMap.firstKey();
		}
		//正好命中
		return circle.get(hash);
	}
1351792
public java.util.List<Dimension> getDimensions() {
        if (dimensions == null) {
            dimensions = new com.amazonaws.internal.SdkInternalList<Dimension>();
        }
        return dimensions;
    }
381869
public static boolean isAllNum(String str)
    {
        if (str == null)
            return false;

        int i = 0;
        /** 判断开头是否是+-之类的符号 */
        if ("±+-＋－—".indexOf(str.charAt(0)) != -1)
            i++;
        /** 如果是全角的０１２３４５６７８９ 字符* */
        while (i < str.length() && "０１２３４５６７８９".indexOf(str.charAt(i)) != -1)
            i++;
        // Get middle delimiter such as .
        if (i > 0 && i < str.length())
        {
            char ch = str.charAt(i);
            if ("·∶:，,．.／/".indexOf(ch) != -1)
            {// 98．1％
                i++;
                while (i < str.length() && "０１２３４５６７８９".indexOf(str.charAt(i)) != -1)
                    i++;
            }
        }
        if (i >= str.length())
            return true;

        /** 如果是半角的0123456789字符* */
        while (i < str.length() && "0123456789".indexOf(str.charAt(i)) != -1)
            i++;
        // Get middle delimiter such as .
        if (i > 0 && i < str.length())
        {
            char ch = str.charAt(i);
            if (',' == ch || '.' == ch || '/' == ch  || ':' == ch || "∶·，．／".indexOf(ch) != -1)
            {// 98．1％
                i++;
                while (i < str.length() && "0123456789".indexOf(str.charAt(i)) != -1)
                    i++;
            }
        }

        if (i < str.length())
        {
            if ("百千万亿佰仟%％‰".indexOf(str.charAt(i)) != -1)
                i++;
        }
        if (i >= str.length())
            return true;

        return false;
    }
1257004
public String getSource() {
		if (source != null) {
			return source;
		}
		if (parentSequence != null) {
			return parentSequence.getSource();
		}
		return null;
	}
353108
public HashSparseVector getFeatures() {
		if (isFinalState())
			return null;
		
		IFeatureAlphabet features = factory.DefaultFeatureAlphabet();

		int rightFocus = leftFocus + 1;

		HashSparseVector vec = new HashSparseVector();

		// 设定上下文窗口大小
		int l = 2;
		int r = 2;
		for (int i = 0; i <= l; i++) {
			// 词性特征前缀
			String posFeature = "-" + new Integer(i).toString() + "/pos/";
			String lexFeature = "-" + new Integer(i).toString() + "/lex/";

			String lcLexFeature = "-" + new Integer(i).toString()
					+ "/ch-L-lex/";
			String lcPosFeature = "-" + new Integer(i).toString()
					+ "/ch-L-pos/";
			String rcLexFeature = "-" + new Integer(i).toString()
					+ "/ch-R-lex/";
			String rcPosFeature = "-" + new Integer(i).toString()
					+ "/ch-R-pos/";

			if (leftFocus - i < 0) {
				addFeature(features, vec,
						lexFeature + "START" + String.valueOf(i - leftFocus));
				addFeature(features, vec,
						posFeature + "START" + String.valueOf(i - leftFocus));
			} else {
				addFeature(
						features,
						vec,
						lexFeature
								+ instance.words[trees.get(leftFocus - i).id]);
				addFeature(features, vec, posFeature
						+ instance.tags[trees.get(leftFocus - i).id]);

				if (trees.get(leftFocus - i).leftChilds.size() != 0) {
					for (int j = 0; j < trees.get(leftFocus - i).leftChilds
							.size(); j++) {
						int leftChildIndex = trees.get(leftFocus - i).leftChilds
								.get(j).id;
						addFeature(features, vec, lcLexFeature
								+ instance.words[leftChildIndex]);
						addFeature(features, vec, lcPosFeature
								+ instance.tags[leftChildIndex]);
					}
				}

				if (trees.get(leftFocus - i).rightChilds.size() != 0) {
					for (int j = 0; j < trees.get(leftFocus - i).rightChilds
							.size(); j++) {
						int rightChildIndex = trees.get(leftFocus - i).rightChilds
								.get(j).id;
						addFeature(features, vec, rcLexFeature
								+ instance.words[rightChildIndex]);
						addFeature(features, vec, rcPosFeature
								+ instance.tags[rightChildIndex]);
					}
				}
			}
		}

		for (int i = 0; i <= r; i++) {
			String posFeature = "+" + new Integer(i).toString() + "/pos/";
			String lexFeature = "+" + new Integer(i).toString() + "/lex/";

			String lcLexFeature = "+" + new Integer(i).toString()
					+ "/ch-L-lex/";
			String lcPosFeature = "+" + new Integer(i).toString()
					+ "/ch-L-pos/";
			String rcLexFeature = "+" + new Integer(i).toString()
					+ "/ch-R-lex/";
			String rcPosFeature = "+" + new Integer(i).toString()
					+ "/ch-R-pos/";

			if (rightFocus + i >= trees.size()) {
				addFeature(
						features,
						vec,
						lexFeature
								+ "END"
								+ String.valueOf(rightFocus + i
										- trees.size() + 3));
				addFeature(
						features,
						vec,
						posFeature
								+ "END"
								+ String.valueOf(rightFocus + i
										- trees.size() + 3));
			} else {
				addFeature(
						features,
						vec,
						lexFeature
								+ instance.words[trees.get(rightFocus + i).id]);
				addFeature(features, vec, posFeature
						+ instance.tags[trees.get(rightFocus + i).id]);

				if (trees.get(rightFocus + i).leftChilds.size() != 0) {
					for (int j = 0; j < trees.get(rightFocus + i).leftChilds
							.size(); j++) {
						int leftChildIndex = trees.get(rightFocus + i).leftChilds
								.get(j).id;
						addFeature(features, vec, lcLexFeature
								+ instance.words[leftChildIndex]);
						addFeature(features, vec, lcPosFeature
								+ instance.tags[leftChildIndex]);
					}
				}

				if (trees.get(rightFocus + i).rightChilds.size() != 0) {
					for (int j = 0; j < trees.get(rightFocus + i).rightChilds
							.size(); j++) {
						int rightChildIndex = trees.get(rightFocus + i).rightChilds
								.get(j).id;
						addFeature(features, vec, rcLexFeature
								+ instance.words[rightChildIndex]);
						addFeature(features, vec, rcPosFeature
								+ instance.tags[rightChildIndex]);
					}
				}
			}
		}

		return vec;
	}
881114
public int getValueIndex() {

        int result = 0;
        Node previousSibling = getElement().getPreviousSibling();
        while (previousSibling != null) {
            result++;
            previousSibling = previousSibling.getPreviousSibling();
        }
        return result;
    }
819614
function() {
                // 获取现有颜色映射
                //     resource => color_index
                var colorMapping = this._getResourceColorIndexMapping();

                var resource, used, i;

                used = [];

                // 抽取已经使用的值到 used 数组
                for (resource in colorMapping) {
                    if (Object.prototype.hasOwnProperty.call(colorMapping, resource)) {
                        used.push(colorMapping[resource]);
                    }
                }

                // 枚举所有的可用值，如果还没被使用，返回
                for (i = 0; i < RESOURCE_COLOR_SERIES.length; i++) {
                    if (!~used.indexOf(i)) return i;
                }

                // 没有可用的颜色了
                return -1;
            }
935840
public function getScriptUrl()
    {
        if (!$this->scriptUrl) {
            $scriptName = 'index.php';
            if(false != $scriptUrl = $this->getServer('PHP_SELF')) {
                $scriptName = $this->getServer('SCRIPT_FILENAME');
                // 去掉 index.php之后的字符
                if (false !== ($pos = stripos($scriptUrl, basename($scriptName)))) {
                    $scriptUrl = substr($scriptUrl, 0, $pos + strlen(basename($scriptName)));
                }
                
                if($scriptName && $scriptName == $scriptUrl) {
                    $docRoot = $this->getServer('DOCUMENT_ROOT');
                    if($docRoot && strpos($scriptName, $docRoot) === 0) {
                        $scriptUrl = str_replace('\\','/', str_replace($docRoot, '', $scriptName));
                    } else {
                        $scriptUrl = '/'.basename($scriptName);
                    }
                } elseif ($scriptName && strlen($scriptName) < strlen($scriptUrl)) {
                    $scriptUrl = '/'.basename($scriptName);
                } else {
                    //$scriptUrl = $scriptUrl;
                }
            } else {
                $scriptUrl = '/'.basename($scriptName);
            }
            
            $this->scriptUrl = htmlentities($scriptUrl);
        }
        
        return $this->scriptUrl;
    }
1131104
public String consumeDigit() {
        int start = pos;

        if (queue.charAt(pos) == '-') {// 负数标记
            pos++;
        }
        while (!isEmpty() && Character.isDigit(queue.charAt(pos))) {
            pos++;
        }

        if (!isEmpty() && queue.charAt(pos) == '.' && remainingLength() >= 2
                && Character.isDigit(queue.charAt(pos + 1))) {// 小数点
            pos++;
            while (!isEmpty() && Character.isDigit(queue.charAt(pos))) {
                pos++;
            }
        }

        return queue.substring(start, pos);
    }
1282935
private List<From> findFrom(SQLTableSource from) {
        //zhongshu-comment class1.isAssignableFrom(class2) class2是不是class1的子类或者子接口
        //改成用instanceof 应该也行吧：from instanceof SQLExprTableSource
        boolean isSqlExprTable = from.getClass().isAssignableFrom(SQLExprTableSource.class);

        if (isSqlExprTable) {
            SQLExprTableSource fromExpr = (SQLExprTableSource) from;
            String[] split = fromExpr.getExpr().toString().split(",");

            ArrayList<From> fromList = new ArrayList<>();
            for (String source : split) {
                fromList.add(new From(source.trim(), fromExpr.getAlias()));
            }
            return fromList;
        }

        SQLJoinTableSource joinTableSource = ((SQLJoinTableSource) from);
        List<From> fromList = new ArrayList<>();
        fromList.addAll(findFrom(joinTableSource.getLeft()));
        fromList.addAll(findFrom(joinTableSource.getRight()));
        return fromList;
    }
632921
@Override
	public ThriftConnection<T> pollConnection() {
		ThriftConnection<T> result;
		if (pool.getThriftServerCount() == 0) {
			throw new IllegalStateException("当前无可用连接服务器");
		}
		int partition = (int) (Thread.currentThread().getId() % this.pool.thriftServerCount);

		ThriftConnectionPartition<T> thriftConnectionPartition = this.pool.partitions.get(partition);

		result = thriftConnectionPartition.poolFreeConnection();
		if (result == null) {
			for (int i = 0; i < this.pool.thriftServerCount; i++) {
				if (i == partition) {
					continue;
				}
				result = this.pool.partitions.get(i).poolFreeConnection();
				if (result != null) {
					thriftConnectionPartition = this.pool.partitions.get(i);
					break;
				}
			}
		}

		if (!thriftConnectionPartition.isUnableToCreateMoreTransactions()) {
			this.pool.maybeSignalForMoreConnections(thriftConnectionPartition);
		}
		return result;
	}
651393
public List<CandidateAnswer> getAllCandidateAnswer() {
        //按CandidateAnswer的分值排序
        Collections.sort(candidateAnswers);
        Collections.reverse(candidateAnswers);
        return candidateAnswers;
    }
1085503
public String[] getTypeArr() {
		List<String> list = new ArrayList<>();
		From index = null;
		for (int i = 0; i < from.size(); i++) {
			index = from.get(i);
			if (index.getType() != null && index.getType().trim().length() > 0) {
				list.add(index.getType());
			}
		}
		if (list.size() == 0) {
			return null;
		}

		return list.toArray(new String[list.size()]);
	}
1336955
private int fetch(State parent, List<Map.Entry<Integer, State>> siblings)
    {
        if (parent.isAcceptable())
        {
            State fakeNode = new State(-(parent.getDepth() + 1));  // 此节点是parent的子节点，同时具备parent的输出
            fakeNode.addEmit(parent.getLargestValueId());
            siblings.add(new AbstractMap.SimpleEntry<Integer, State>(0, fakeNode));
        }
        for (Map.Entry<Character, State> entry : parent.getSuccess().entrySet())
        {
            siblings.add(new AbstractMap.SimpleEntry<Integer, State>(entry.getKey() + 1, entry.getValue()));
        }
        return siblings.size();
    }
522107
public List<Long> fetchIncoming() { // TODO: replace with primitive specialization
        if (incoming == null || incoming.isEmpty()) {
            //return EMPTY_LONG_LIST;
            return Collections.emptyList(); // TODO: replace with primitive specialization
        }
        //TLongList result = incoming;
        List<Long> result = incoming;
        this.incoming = null;
        return result;
    }
772319
public String[] getValue() {
        if (this.requestMapping != null) {
            return this.requestMapping.value();
        }
        if (this.postMapping != null) {
            return this.postMapping.value();
        }
        if (this.putMapping != null) {
            return this.putMapping.value();
        }
        if (this.deleteMapping != null) {
            return this.deleteMapping.value();
        }
        if (this.getMapping != null) {
            return this.getMapping.value();
        }
        if (this.patchMapping!= null) {
            return this.patchMapping.value();
        }
        return null;
    }