设置词典, 参数指定是否同时设置分词词典
@param dict 词典
960133
public void setDictionary(Dictionary dict, boolean isSetSegDict)   {
		removeDictionary(isSetSegDict);
		if(cws != null && isSetSegDict)
			cws.setDictionary(dict);
		dictPipe = null;
		dictPipe = new DictPOSLabel(dict, labels);
		oldfeaturePipe = featurePipe;
		featurePipe = new SeriesPipes(new Pipe[] { dictPipe, featurePipe });
		LinearViterbi dv = new ConstraintViterbi(
				(LinearViterbi) getClassifier().getInferencer(),labels.size());
		getClassifier().setInferencer(dv);
	}
600620
def empty(key, dict):
    
    if key in dict.keys():
        if dict[key]:
            return False
    return True
172121
def _handle_key_value(t_dict, key, value):
    
    if key in t_dict:
        val = t_dict[key]
        if isinstance(val, str):
            val = [val]
        val.append(value)
        return val
    return value
344261
def _dict_set(self, key, val):
        '''
        
        '''
        if key != None and self.stringify_keys:
            key = str(key)
        db = self._keyed_db[self.split_func(key)]
        db._dict_set(key, val)
924656
def dotopdict(self, dict_):
        
        mlookup = {'get':'GET', 'post':'POST'}
        def rearrange(path, method_dict, method):
            oid = method_dict['operationId']
            self._paths[oid] = path
            method_dict['nickname'] = oid
            method_dict['method'] = mlookup[method]

        paths = dict_['paths']
        for path, path_dict in paths.items():
            if self.path_prefix and self.path_prefix not in path:
                continue
            path_dict['operations'] = []
            for method, method_dict in sorted(path_dict.items()):
                if method == 'operations':
                    continue
                rearrange(path, method_dict, method)
                #print(self.operation(method_dict))
                path_dict['operations'].append(method_dict)
            path_dict['path'] = path

        def setp(v, lenp=len(self.path_prefix)):
            v['path'] = v['path'][lenp:]
            return v

        dict_['apis'] = []
        for tag_dict in dict_['tags']:
            path = '/' + tag_dict['name']
            d = {'path':path,
                 'description':tag_dict['description'],
                 'class_json':{
                     'docstring':tag_dict['description'],
                     'resourcePath':path,
                     'apis':[setp(v) for k, v in paths.items()
                             if k.startswith(self.path_prefix + path)]},
            }
            dict_['apis'].append(d)

        # make sure this is run first so we don't get key errors
        self._swagger(dict_['swagger'])
        self._info(dict_['info'])
        self._definitions(dict_['definitions'])

        return dict_
1082234
def _from_dict_dict(cls, dic):
        
        return cls({_convert_id(i): v for i, v in dic.items()})
885132
def group_dict(items, keyfunc):
    
    result = collections.defaultdict(list)
    for i in items:
        key = keyfunc(i)
        result[key].append(i)
    return result
232507
def binds(val, **kwargs):  # pylint: disable=unused-argument
    '''
    
    '''
    if not isinstance(val, dict):
        if not isinstance(val, list):
            try:
                val = helpers.split(val)
            except AttributeError:
                raise SaltInvocationError(
                    '\'{0}\' is not a dictionary or list of bind '
                    'definitions'.format(val)
                )
    return val
519021
def _nary_dict_update(dicts, **kwargs):
    
    copy = kwargs['copy']
    res = dicts[0].copy() if copy else dicts[0]
    if len(dicts) == 1:
        return res

    # decide what strategy to use when updating a dictionary
    # with the values from another: {(non)recursive} x {(non)overwriting}
    deep = kwargs['deep']
    overwrite = kwargs['overwrite']
    if deep:
        dict_update = curry(_recursive_dict_update, overwrite=overwrite)
    else:
        if overwrite:
            dict_update = res.__class__.update
        else:
            def dict_update(dict_, other):
                for k, v in iteritems(other):
                    dict_.setdefault(k, v)

    for d in dicts[1:]:
        dict_update(res, d)
    return res
300706
def dict_load(self, ns_dict):
        
        for prefix, uri in ns_dict.items():
            self.bind(prefix, uri, override=False, calc=False)
        self.__make_dicts__
622707
def set_dict(self, incomming):
        
        for key, val in incomming.items():
            if val and key in self._property_names:
                setattr(self, key, val)
466538
function DictionaryItem(key, value) {
    this.key = ko.observable(key);
	this.options = [];
    if(value instanceof Array){
		this.options = value;
		value = value[0];
    }
    this.value = (typeof(value)==='function')? value : ko.observable(value);
}
61544
def bind(self, **kwargs):
        '''
        
        '''
        d = dict(self.__dict__)
        for k in d.keys():
            if k[0] == '_':
                del d[k]
            elif k.startswith('obj_'):
                d[k] = d[k].bind(**kwargs)
        d.update(kwargs)
        return self.__class__(**d)
264182
def key_from_dict(**kwargs):
    
    out = []
    stack = [kwargs]
    while stack:
        obj = stack.pop()
        if isinstance(obj, dict):
            stack.extend(sorted(obj.items()))
        elif isinstance(obj, (list, tuple)):
            stack.extend(obj)
        else:
            out.append(str(obj))
    return ''.join(out)
989182
def delete_items_from_dict(d, to_delete):
    
    if not isinstance(to_delete, list):
        to_delete = [to_delete]
    if isinstance(d, dict):
        for single_to_delete in set(to_delete):
            if single_to_delete in d.values():
                for k, v in d.copy().items():
                    if v == single_to_delete:
                        del d[k]
        for k, v in d.items():
            delete_items_from_dict(v, to_delete)
    elif isinstance(d, list):
        for i in d:
            delete_items_from_dict(i, to_delete)
    return remove_none(d)
888426
def _from_dict(cls, _dict):
        """"""
        args = {}
        if 'key' in _dict:
            args['key'] = _dict.get('key')
        if 'matching_results' in _dict:
            args['matching_results'] = _dict.get('matching_results')
        if 'aggregations' in _dict:
            args['aggregations'] = [
                QueryAggregation._from_dict(x)
                for x in (_dict.get('aggregations'))
            ]
        return cls(**args)
122453
def purge_dict(idict):
    
    odict = {}
    for key, val in idict.items():
        if is_null(val):
            continue
        odict[key] = val
    return odict