用于较短时间音频的评估，例如单词或者短句，评估一次性发布所有音频数据
426832
async function EvaluationOnce(client) {
    try {
        console.log("-----------一次性评估示例------------")
        let sessionId = uuid.v1();
        // 初始化评估
        let initReq = new models.InitOralProcessRequest();
        initReq.SessionId = sessionId;
        initReq.RefText = "bike";
        // 设置评估为一次性评估
        initReq.WorkMode = 1;
        initReq.EvalMode = 1;
        initReq.ScoreCoeff = 3.5;
        let initRsp = await InitOralProcess(client, initReq);
        console.log("初始化返回结果：")
        console.log(initRsp.to_json_string())

        let data = fs.readFileSync(AUDIO_FOR_ONCE)
        let base64Str = data.toString("base64")

        // 传输评估音频数据
        let transReq = new models.TransmitOralProcessRequest();
        transReq.SessionId = sessionId;
        transReq.VoiceFileType = 3;
        transReq.VoiceEncodeType = 3;
        transReq.SeqId = 1;
        transReq.IsEnd = 1;
        transReq.UserVoiceData = base64Str;
        let transRsp = await TransmitOralProcess(client, transReq)
        console.log("评估结果：")
        console.log(transRsp.to_json_string())

    } catch (err) {
        console.log("评估失败", err)
    } finally {
        console.log("-----------完成一次性评估------------\n\n")
    }
}
1167016
@Override
	protected ThriftConnection<T> getConnectionInternal(byte[] nodeID) throws ThriftConnectionPoolException {
		if (nodeID == null) {
			throw new NullPointerException();
		}
		if (this.pool.getThriftServerCount() == 0) {
			throw new ThriftConnectionPoolException("当前没有可用的服务器  无法获取连接");
		}

		List<ThriftConnectionPartition<T>> partitions = Collections.unmodifiableList(this.pool.partitions);
		ThriftConnectionPartition<T> thriftConnectionPartition = null;
		for (ThriftConnectionPartition<T> tempPartition : partitions) {
			ThriftServerInfo thriftServerInfo = tempPartition.getThriftServerInfo();
			if (Arrays.equals(thriftServerInfo.getServerID(), nodeID)) {
				thriftConnectionPartition = tempPartition;
				break;
			}
		}
		if (thriftConnectionPartition == null) {
			throw new ThriftConnectionPoolException("没有找到对应服务器节点：" + Arrays.toString(nodeID));
		}

		ThriftConnection<T> result = null;
		try {
			result = thriftConnectionPartition.poolFreeConnection(this.pool.connectionTimeoutInMs,
					TimeUnit.MILLISECONDS);
			if (result == null) {

				throw new ThriftConnectionPoolException("Timed out waiting for a free available connection.");
			}
		} catch (InterruptedException e) {
			throw new ThriftConnectionPoolException(e);
		}
		return result;
	}
1264017
private void buildNode(Node parent, List<String>[] sequence, int from, List<Node> leaf){
        //递归退出条件：二维数组遍历完毕
        if(from >= sequence.length){
            //记住叶子节点
            leaf.add(parent);
            return;
        }
        for(String item : sequence[from]){
            Node child = new Node(item, parent);
            buildNode(child, sequence, from+item.length(), leaf);
        }
    }
1236450
function (len, min, dataTypeName, chars) {
      // 疑是 id 字段
      if (utils.isLikeId(dataTypeName)) {
        return String(utils.getId());
      }
      // 对疑是 xxx time 或者 xxx date 的字段, 返回当前时间之前一个月内的随机时间
      if (utils.isLikeTime(dataTypeName) || utils.isLikeDate(dataTypeName)) {
        return String(Date.now() - this._getNum(2592000));
      }
      // 疑是 email 字段
      if (utils.isLikeEmail(dataTypeName)) {
        return this._getStr(9, 6) + '@' + this._getStr(5) + '.' + this._getStr(3, null, null, ALPHA_LOWER_CASE_CHARS);
      }
      // 疑是 url 字段
      if (utils.isLikeUrl(dataTypeName)) {
        return 'http://' + this._getStr(3, null, null, ALPHA_LOWER_CASE_CHARS) + '.' + this._getStr(5, 15, null, ALPHA_LOWER_CASE_CHARS) + '.' + this._getStr(2, 8, null, ALPHA_LOWER_CASE_CHARS);
      }
      len = len || 10;
      if (min != undefined) {
        len = this._getNum(len, min);
      }
      var i;
      var str = '';
      chars = chars || ALPHA_NUMERIC_CHARS;
      var charsCount = chars.length;
      for (i = 0; i < len; i++) {
        str += chars[Math.floor(Math.random() * charsCount)];
      }
      return str;
    }
389834
private List<Word>[] toWords(List<Node> leaf){
        List<Word>[] result = new ArrayList[leaf.size()];
        int i = 0;
        if(LOGGER.isDebugEnabled()) {
            LOGGER.debug("全切分结果：");
        }
        for(Node node : leaf){
            result[i++] = toWords(node);
            if(LOGGER.isDebugEnabled()) {
                LOGGER.debug("\t" + i + "：" + result[i - 1]);
            }
        }
        return result;
    }
487373
@Override
	public T get() {
		T result = reference.get();

		if (result == null) {
			result = init();
			if (false == reference.compareAndSet(null, result)) {
				// 其它线程已经创建好此对象
				result = reference.get();
			}
		}

		return result;
	}
324321
private void buildValuePartForBETWEEN(StringBuilder conditionStrBuilder, List<Object> paramValues) {
		// BETWEEN x AND y 的情况，两个参数
		if (isPlaceHolder()) {
			// 使用条件表达式占位符
			conditionStrBuilder.append(" ?");
			if(null != paramValues) {
				paramValues.add(this.value);
			}
		} else {
			// 直接使用条件值
			conditionStrBuilder.append(CharUtil.SPACE).append(this.value);
		}

		// 处理 AND y
		conditionStrBuilder.append(StrUtil.SPACE).append(LogicalOperator.AND.toString());
		if (isPlaceHolder()) {
			// 使用条件表达式占位符
			conditionStrBuilder.append(" ?");
			if(null != paramValues) {
				paramValues.add(this.secondValue);
			}
		} else {
			// 直接使用条件值
			conditionStrBuilder.append(CharUtil.SPACE).append(this.secondValue);
		}
	}
781374
public static List<String> split(String str, String separator, int limit, boolean isTrim, boolean ignoreEmpty, boolean ignoreCase){
		if(StrUtil.isEmpty(str)){
			return new ArrayList<String>(0);
		}
		if(limit == 1){
			return addToList(new ArrayList<String>(1), str, isTrim, ignoreEmpty);
		}
		
		if(StrUtil.isEmpty(separator)){//分隔符为空时按照空白符切分
			return split(str, limit);
		}else if(separator.length() == 1){//分隔符只有一个字符长度时按照单分隔符切分
			return split(str, separator.charAt(0), limit, isTrim, ignoreEmpty, ignoreCase);
		}
		
		final ArrayList<String> list = new ArrayList<>();
		int len = str.length();
		int separatorLen = separator.length();
		int start = 0;
		int i = 0;
		while(i < len){
			i = StrUtil.indexOf(str, separator, start, ignoreCase);
			if(i > -1){
				addToList(list, str.substring(start, i), isTrim, ignoreEmpty);
				start = i + separatorLen;
				
				//检查是否超出范围（最大允许limit-1个，剩下一个留给末尾字符串）
				if(limit > 0 && list.size() > limit-2){
					break;
				}
			}else{
				break;
			}
		}
		return addToList(list, str.substring(start, len), isTrim, ignoreEmpty);
	}
140156
protected ExqlUnit compileUnit() {

        // 在输入中查找  PREFIX 字符
        Matcher matcher = PATTERN_KEYWORD.matcher(pattern);

        // 输出的单元列表
        ArrayList<ExqlUnit> units = new ArrayList<ExqlUnit>();

        // 组装位置
        int fromIndex = 0;

        while ((position < length) && matcher.find(position)) {

            // 修改当前位置
            position = matcher.end();

            // 检查  :expr | $expr 形式的子句
            String expr = matcher.group(1);
            if (expr != null) {

                // 创建文本子句
                if (matcher.start() > fromIndex) {
                    units.add(new TextUnit(pattern.substring(fromIndex, matcher.start())));
                }

                // 创建  :expr | $expr 形式的子句
                if (expr.charAt(0) == '$') {

                    // 创建  $expr 形式的子句, 作为拼接处理
                    units.add(new JoinExprUnit(expr));
                } else {

                    // 创建  :expr 形式的子句
                    units.add(new ExprUnit(expr));
                }

                fromIndex = position;

                continue;
            }

            // 检查  {...}? 的语法
            String group = matcher.group(2);
            if (group != null) {

                // 创建文本子句
                if (matcher.start() > fromIndex) {
                    units.add(new TextUnit(pattern.substring(fromIndex, matcher.start())));
                }

                // 编译  {...} 内部的子句
                ExqlCompiler compiler = new ExqlCompiler(group);
                System.out.println("DELETE>>>group=" + group);
                ExqlUnit unit = compiler.compileUnit();

                // 创建   {...}? 形式的子句
                units.add(new OptionUnit(unit));

                fromIndex = position;

                continue;
            }

            // 检查  # 后面的关键字
            String keyword = matcher.group(3);

            // 处理  #(:expr) 形式的子句
            if (keyword == null) {

                // 获取括号内的内容
                expr = findBrace(BRACE_LEFT, BRACE_RIGHT);
                if (expr != null) {

                    // 创建文本子句
                    if (matcher.start() > fromIndex) {
                        units.add(new TextUnit(pattern.substring(fromIndex, matcher.start())));
                    }

                    // 创建  #(:expr) 形式的表达式
                    units.add(new ExprUnit(expr));

                    fromIndex = position;
                }
            }
            // 处理  ##(:expr) 形式的子句
            else if (keyword.equals(SHARP) || keyword.equals(JOIN)) {

                // 获取括号内的内容
                expr = findBrace(BRACE_LEFT, BRACE_RIGHT);
                if (expr != null) {

                    // 创建文本子句
                    if (matcher.start() > fromIndex) {
                        units.add(new TextUnit(pattern.substring(fromIndex, matcher.start())));
                    }

                    // 创建  ##(:expr) 形式的表达式
                    units.add(new JoinExprUnit(expr));

                    fromIndex = position;
                }
            }
            // 处理  #if(:expr) {...} #else {...} 形式的子句
            else if (keyword.equals(KEYWORD_IF)) {

                // 获取括号内的内容
                expr = findBrace(BRACE_LEFT, BRACE_RIGHT);
                if (expr != null) {

                    // 编译  {...} 单元
                    ExqlUnit unitIfTrue = compileBlock();
                    if (unitIfTrue != null) {

                        // 创建文本子句
                        if (matcher.start() > fromIndex) {
                            units.add(new TextUnit(pattern.substring(fromIndex, matcher.start())));
                        }

                        ExqlUnit unitIfFalse = null;

                        // 匹配  #else {...} 子句
                        if (match(SHARP_ELSE, position)) {

                            // 编译  {...} 单元
                            unitIfFalse = compileBlock();
                        }

                        // 创建  #if(:expr) {...} #else {...} 形式的子句
                        units.add(new ChoiceUnit(expr, unitIfTrue, unitIfFalse));

                        fromIndex = position;
                    }
                }
            }
            // 处理  #for(variant in :expr) {...} 形式的子句
            else if (keyword.equals(KEYWORD_FOR)) {

                // 获取括号内的内容
                expr = findBrace(BRACE_LEFT, BRACE_RIGHT);
                if (expr != null) {

                    // 编译  {...} 单元
                    ExqlUnit unit = compileBlock();
                    if (unit != null) {

                        // 创建文本子句
                        if (matcher.start() > fromIndex) {
                            units.add(new TextUnit(pattern.substring(fromIndex, matcher.start())));
                        }

                        // 循环变量名
                        String variant = null;

                        // 解析  variant in :expr 表达式
                        Matcher matcherIn = PATTERN_IN.matcher(expr);
                        if (matcherIn.matches()) {
                            variant = matcherIn.group(1);
                            expr = matcherIn.group(2);
                        }

                        // 创建  #for(variant in :expr) {...} 形式的子句
                        units.add(new ForEachUnit(expr, variant, unit));

                        fromIndex = position;
                    }
                }
            }
        }

        if (fromIndex < length) {
            // 写入 PREFIX 字符后的内容。
            units.add(new TextUnit(pattern.substring(fromIndex)));
        }

        if (units.size() > 1) {

            // 返回集合对象
            return new BunchUnit(units);

        } else if (!units.isEmpty()) {

            // 返回单个对象
            return units.get(0);

        } else {

            // 返回空对象
            return new EmptyUnit();
        }
    }
55534
@Override
    public List<Class<?>> scanByFilter(List<ClassFilter> excludeFilters,
                                       Object... args) throws ScannerException {
        LOGGER.debug("搜索扫描所有的类，过滤器为：{}，参数为：{}", excludeFilters, args);

        if (args == null || args.length == 0) {
            return Collections.emptyList();
        }

        for (Object arg : args) {
            if (!(arg instanceof String)) {
                LOGGER.debug("参数类型为：{}", args.getClass());
                throw new ScannerException("参数类型为：" + args.getClass());
            }
        }

        List<Class<?>> result = null;
        for (Object obj : args) {
            List<Class<?>> list = scanByFilter((String) obj, excludeFilters);
            if (result == null) {
                result = list;
            } else {
                result.addAll(list);
            }
        }
        return result;
    }
205757
function(input) {
      // 清理input数据、因为parsed数据最终会被缓存，
      // 我们要尽量让相同的选择器只对应一份parsed数据
      input = clean(input);
      // 先检查缓存中是否有数据
      if (parsed = this.cache.get(input)) return parsed;
      // 如果没有: 初始化参数
      var parsed = this.parsed = [
        [null]
      ];
      var remain = this.input = input;
      var TRUNK = this.TRUNK;
      var prevRemain;
        // 将remain进行this._process这里每匹配一个字符串都会进行一次reduce
      while (prevRemain != (remain = remain.replace(TRUNK, this._process.bind(this)))) {
        prevRemain = remain;
      }
      // 如果没有被解析完 证明选择器字符串有不能被解析的部分
      if (remain !== '') this.error(remain);
      // 返回数据并推入cache
      return this.cache.set(input, parsed);
    }
37364
private static void mergeContinueNumIntoOne(List<Vertex> linkedArray)
    {
        if (linkedArray.size() < 2)
            return;

        ListIterator<Vertex> listIterator = linkedArray.listIterator();
        Vertex next = listIterator.next();
        Vertex current = next;
        while (listIterator.hasNext())
        {
            next = listIterator.next();
//            System.out.println("current:" + current + " next:" + next);
            if ((TextUtility.isAllNum(current.realWord) || TextUtility.isAllChineseNum(current.realWord)) && (TextUtility.isAllNum(next.realWord) || TextUtility.isAllChineseNum(next.realWord)))
            {
                /////////// 这部分从逻辑上等同于current.realWord = current.realWord + next.realWord;
                // 但是current指针被几个路径共享，需要备份，不然修改了一处就修改了全局
                current = Vertex.newNumberInstance(current.realWord + next.realWord);
                listIterator.previous();
                listIterator.previous();
                listIterator.set(current);
                listIterator.next();
                listIterator.next();
                /////////// end 这部分
//                System.out.println("before:" + linkedArray);
                listIterator.remove();
//                System.out.println("after:" + linkedArray);
            }
            else
            {
                current = next;
            }
        }

//        logger.trace("数字识别后：" + Graph.parseResult(linkedArray));
    }
1300243
synchronized public void initSingle() {
		if (setting == null) {
			try {
				setting = new Setting(MONGO_CONFIG_PATH, true);
			} catch (Exception e) {
				// 在single模式下，可以没有配置文件。
			}
		}

		String group = StrUtil.EMPTY;
		if (null == this.serverAddress) {
			//存在唯一分组
			if (groups != null && groups.length == 1) {
				group = groups[0];
			}
			serverAddress = createServerAddress(group);
		}

		final MongoCredential credentail = createCredentail(group);
		try {
			if (null == credentail) {
				mongo = new MongoClient(serverAddress, buildMongoClientOptions(group));
			} else {
				mongo = new MongoClient(serverAddress, credentail, buildMongoClientOptions(group));
			}
		} catch (Exception e) {
			throw new DbRuntimeException(StrUtil.format("Init MongoDB pool with connection to [{}] error!", serverAddress), e);
		}

		log.info("Init MongoDB pool with connection to [{}]", serverAddress);
	}
558299
private synchronized void init(List<UrlPattern> urlPatterns) {
        LOGGER.info("开始初始化URL抽取规则");
        //构造抽取规则查找结构
        Map<String, List<UrlPattern>> newUrlPatterns = toMap(urlPatterns);
        if (!newUrlPatterns.isEmpty()) {
            Map<String, List<UrlPattern>> oldUrlPatterns = urlPatternMap;
            urlPatternMap = newUrlPatterns;
            //清空之前的抽取规则查找结构（如果有）
            if (oldUrlPatterns != null) {
                for (List<UrlPattern> list : oldUrlPatterns.values()) {
                    list.clear();
                }
                oldUrlPatterns.clear();
            }
        }
        LOGGER.info("完成初始化URL抽取规则");
    }
1093786
private static List<String> getColumnLabels(ResultSet result) throws SQLException {
        // 存放结果集中的列名
        List<String> listColumns = new ArrayList<String>();
        // 获取结果集元数据
        ResultSetMetaData rsmd = result.getMetaData();
        // 将字段名放入数组中
        for (int i = 0; i < rsmd.getColumnCount(); i++) {
            listColumns.add(rsmd.getColumnLabel(i + 1));
        }

        return listColumns;
    }
958624
private int[] loadTagCoven(BufferedReader br) throws Exception {

        int[] conver = new int[Config.TAG_NUM + Config.TAG_NUM * Config.TAG_NUM];

        String temp = br.readLine();// #qrk#4

        // TODO: 这个是个写死的过程,如果标签发生改变需要重新来写这里
        for (int i = 0; i < Config.TAG_NUM; i++) {
            char c = br.readLine().split(":")[1].charAt(0);
            switch (c) {
                case 'S':
                    conver[i] = Config.S;
                    break;
                case 'B':
                    conver[i] = Config.B;
                    break;
                case 'M':
                    conver[i] = Config.M;
                    break;
                case 'E':
                    conver[i] = Config.E;
                    break;
                default:
                    throw new Exception("err tag named " + c + " in model " + temp);
            }
        }

        for (int i = Config.TAG_NUM; i < conver.length; i++) {
            conver[i] = conver[(i - 4) / Config.TAG_NUM] * Config.TAG_NUM + conver[i % Config.TAG_NUM] + Config.TAG_NUM;
        }

        return conver;
    }
1260400
public static List<String> split(String str, int limit){
		if(StrUtil.isEmpty(str)){
			return new ArrayList<String>(0);
		}
		if(limit == 1){
			return addToList(new ArrayList<String>(1), str, true, true);
		}
		
		final ArrayList<String> list = new ArrayList<>();
		int len = str.length();
		int start = 0;//切分后每个部分的起始
		for(int i = 0; i < len; i++){
			if(CharUtil.isBlankChar(str.charAt(i))){
				addToList(list, str.substring(start, i), true, true);
				start = i+1;//i+1同时将start与i保持一致
				
				//检查是否超出范围（最大允许limit-1个，剩下一个留给末尾字符串）
				if(limit > 0 && list.size() > limit-2){
					break;
				}
			}
		}
		return addToList(list, str.substring(start, len), true, true);//收尾
	}