set entity labels from get_labels()
555701
def _set_labels(self):
        
        data = self._load_response('labels')
        entities = data.get('entities') or []

        for ent in entities:
            label = self._get_entity_prop(entities[ent], 'labels')
            self.data['labels'][ent] = label
1235545
def set_label_elements(self, wanted_label_elements):
        
        if isinstance(wanted_label_elements, str):
            wanted_label_elements = [wanted_label_elements]

        # Figure out which desired label elements are missing
        missing_elements = [e for e in wanted_label_elements if getattr(self, e) is None]

        contained_elements = [e for e in ann_label_fields if getattr(self, e )is not None]

        if not contained_elements:
            raise Exception('No annotation labels contained in object')

        for e in missing_elements:
            self.convert_label_attribute(contained_elements[0], e)

        unwanted_label_elements = list(set(ann_label_fields)
                                       - set(wanted_label_elements))

        self.rm_attributes(unwanted_label_elements)

        return
1107148
def _set_label(label, mark, dim, **kwargs):
    
    if mark is None:
        mark = _context['last_mark']
    if mark is None:
        return {}
    fig = kwargs.get('figure', current_figure())
    scales = mark.scales
    scale_metadata = mark.scales_metadata.get(dim, {})
    scale = scales.get(dim, None)
    if scale is None:
        return
    dimension = scale_metadata.get('dimension', scales[dim])
    axis = _fetch_axis(fig, dimension, scales[dim])

    if axis is not None:
        _apply_properties(axis, {'label': label})
410195
def parse_labels(labels_str):
    
    if not _LABELS_RE.match(labels_str):
        return None
    labels = {}
    for kv in _KV_RE.finditer(labels_str):
        gd = kv.groupdict()
        key = unquote(gd['key'])
        if key in labels:
            logger.warning('Duplicate label key "%s"', key)
        labels[key] = unquote(gd['val'])
    return labels
591508
def label( self, node ):
        """"""
        result = []
        if node.get('type'):
            result.append( node['type'] )
        if node.get('name' ):
            result.append( node['name'] )
        elif node.get('value') is not None:
            result.append( unicode(node['value'])[:32])
        if 'module' in node and not node['module'] in result:
            result.append( ' in %s'%( node['module'] ))
        if node.get( 'size' ):
            result.append( '%s'%( mb( node['size'] )))
        if node.get( 'totsize' ):
            result.append( '(%s)'%( mb( node['totsize'] )))
        parent_count = len( node.get('parents',()))
        if parent_count > 1:
            result.append( '/%s refs'%( parent_count ))
        return " ".join(result)
637323
def labels(self, values):
        """"""
        if isinstance(values, dict):
            if self.__data is not None and len(self.__data) != len(values):
                raise ValueError(
                    'number of samples do not match the previously assigned data')
            elif set(self.keys) != set(list(values)):
                raise ValueError('sample ids do not match the previously assigned ids.')
            else:
                self.__labels = values
        else:
            raise ValueError('labels input must be a dictionary!')
221659
def tag_named_entities(self):
        
        if not self.is_tagged(LABEL):
            self.tag_labels()
        nes = []
        word_start = -1
        labels = self.labels + ['O'] # last is sentinel
        words = self.words
        label = 'O'
        for i, l in enumerate(labels):
            if l.startswith('B-') or l == 'O':
                if word_start != -1:
                    nes.append({START: words[word_start][START],
                                END: words[i-1][END],
                                LABEL: label})
                if l.startswith('B-'):
                    word_start = i
                    label = l[2:]
                else:
                    word_start = -1
        self[NAMED_ENTITIES] = nes
        return self
35052
public function setLabels($labels) 
	{
		if(is_array($labels)) {
			$this->labels = $labels;
			return $this;
		}
		
		$args = func_get_args();
		$this->labels[$args[0]] = $args[1];
		
		return $this;
	}
1010481
def set_label(self, label, lineno, local=False):
        
        ex_label, namespace = Memory.id_name(label)

        if ex_label in self.local_labels[-1].keys():
            result = self.local_labels[-1][ex_label]
            result.lineno = lineno
        else:
            result = self.local_labels[-1][ex_label] = Label(ex_label, lineno, namespace=NAMESPACE)

        if result.local == local:
            warning(lineno, "label '%s' already declared as LOCAL" % label)

        result.local = local

        return result
1212164
def labels(self, labels):
        
        allowed_values = ["raw data", "documentation", "visualization", "clean data", "script", "report"]
        if not set(labels).issubset(set(allowed_values)):
            raise ValueError(
                "Invalid values for `labels` [{0}], must be a subset of [{1}]"
                .format(", ".join(map(str, set(labels)-set(allowed_values))),
                        ", ".join(map(str, allowed_values)))
            )

        self._labels = labels
1305847
def get_labels(labels):
    """"""
    label_u = unique_labels(labels)
    label_u_line = [i + "_line" for i in label_u]
    return label_u, label_u_line
1223000
def from_labels(cls, labels, inputCol, outputCol=None, handleInvalid=None):
        
        sc = SparkContext._active_spark_context
        java_class = sc._gateway.jvm.java.lang.String
        jlabels = StringIndexerModel._new_java_array(labels, java_class)
        model = StringIndexerModel._create_from_java_class(
            "org.apache.spark.ml.feature.StringIndexerModel", jlabels)
        model.setInputCol(inputCol)
        if outputCol is not None:
            model.setOutputCol(outputCol)
        if handleInvalid is not None:
            model.setHandleInvalid(handleInvalid)
        return model
393886
def MultiReadClientLabels(self, client_ids):
    """"""
    res = {}
    for client_id in client_ids:
      res[client_id] = []
      owner_dict = self.labels.get(client_id, {})
      for owner, labels in iteritems(owner_dict):
        for l in labels:
          res[client_id].append(rdf_objects.ClientLabel(owner=owner, name=l))
      res[client_id].sort(key=lambda label: (label.owner, label.name))
    return res
1286344
def set_state_data(cls, entity, data):
        
        attr_names = get_domain_class_attribute_names(type(entity))
        nested_items = []
        for attr, new_attr_value in iteritems_(data):
            if not attr.entity_attr in attr_names:
                raise ValueError('Can not set attribute "%s" for entity '
                                 '"%s".' % (attr.entity_attr, entity))
            if '.' in attr.entity_attr:
                nested_items.append((attr, new_attr_value))
                continue
            else:
                setattr(entity, attr.entity_attr, new_attr_value)
        for attr, new_attr_value in nested_items:
            try:
                set_nested_attribute(entity, attr.entity_attr, new_attr_value)
            except AttributeError as exc:
                if not new_attr_value is None:
                    raise exc
861532
def set_value(self, labels, value):
        

        if labels:
            self._label_names_correct(labels)

        with mutex:
            self.values[labels] = value
740396
def get_label(self, queryset, query_data):
        
        if query_data.get('label', False):
            return query_data['label']

        try:
            return queryset.model.__name__
        except AttributeError:
            return query_data['queryset'].model.__name__
1246424
function labels (modelName, callback) {

    if (callback) {
        return get(modelName, true).getLabels(callback);
    }

    return get(modelName, true).getLabels();

}