A vocabulary listing available (and activated) categories.
553678
def getAnalysisCategories(self):
        
        bsc = getToolByName(self, 'bika_setup_catalog')
        cats = bsc(portal_type='AnalysisCategory', is_active=True)
        items = [(o.UID, o.Title) for o in cats]
        o = self.getCategory()
        if o and o.UID() not in [i[0] for i in items]:
            items.append((o.UID(), o.Title()))
        items.sort(lambda x, y: cmp(x[1], y[1]))
        return DisplayList(list(items))
836712
def category(self, categories):
        
        if isinstance(categories, list):
            for c in categories:
                self.add_category(c)
        else:
            self.add_category(categories)
482352
def p_word_list(p):
    ''''''
    parserobj = p.context
    if len(p) == 2:
        p[0] = [_expandword(parserobj, p.slice[1])]
    else:
        p[0] = p[1]
        p[0].append(_expandword(parserobj, p.slice[2]))
1263692
def classify(doc, cutoff = 0.30, &block)
      scored_categories(doc, cutoff, &block).last.first
    end
424250
def _build_label_filter(category, *args, **kwargs):
    """"""
    terms = list(args)
    for key, value in six.iteritems(kwargs):
        if value is None:
            continue

        suffix = None
        if key.endswith(
            ("_prefix", "_suffix", "_greater", "_greaterequal", "_less", "_lessequal")
        ):
            key, suffix = key.rsplit("_", 1)

        if category == "resource" and key == "resource_type":
            key = "resource.type"
        else:
            key = ".".join((category, "label", key))

        if suffix == "prefix":
            term = '{key} = starts_with("{value}")'
        elif suffix == "suffix":
            term = '{key} = ends_with("{value}")'
        elif suffix == "greater":
            term = "{key} > {value}"
        elif suffix == "greaterequal":
            term = "{key} >= {value}"
        elif suffix == "less":
            term = "{key} < {value}"
        elif suffix == "lessequal":
            term = "{key} <= {value}"
        else:
            term = '{key} = "{value}"'

        terms.append(term.format(key=key, value=value))

    return " AND ".join(sorted(terms))
920554
def on_lstCategories_itemSelectionChanged(self):
        
        self.clear_further_steps()
        # Set widgets
        purpose = self.selected_purpose()
        # Exit if no selection
        if not purpose:
            return
        # Set description label
        self.lblDescribeCategory.setText(purpose["description"])
        self.lblIconCategory.setPixmap(QPixmap(
            resources_path('img', 'wizard', 'keyword-category-%s.svg'
                           % (purpose['key'] or 'notset'))))
        # Enable the next button
        self.parent.pbnNext.setEnabled(True)
420051
def classify(self, text=u''):
        
        result = self.calculate(doc_terms=self.tokenize(text))
        #return (result['calc_id'], result)
        return (result['calc_id'], self.karbasa(result))
1065724
public final ImmutableList<TaxonomyTerm> categories() {
      ImmutableList<TaxonomyTerm> categories = taxonomyTerms.get(CATEGORY_TAXONOMY);
      return categories != null ? categories : ImmutableList.of();
   }
1199384
def getAnalysisCategories(self):
        
        bsc = api.get_tool("bika_setup_catalog")
        cats = []
        for st in bsc(portal_type="AnalysisCategory",
                      is_active=True,
                      sort_on="sortable_title"):
            cats.append((st.UID, st.Title))
        return DisplayList(cats)
1148493
public function index()
    {
        $this->loadModel('Taxonomy.Vocabularies');
        $vocabularies = $this->Vocabularies
            ->find()
            ->order(['ordering' => 'ASC'])
            ->all();

        $this->title(__d('taxonomy', 'Vocabularies'));
        $this->set(compact('vocabularies'));
        $this->Breadcrumb
            ->push('/admin/system/structure')
            ->push(__d('taxonomy', 'Taxonomy'), '/admin/taxonomy/manage')
            ->push(__d('taxonomy', 'Vocabularies'), '#');
    }
894235
def list_supported_categories():
  
  categories = get_supported_categories(api)
  category_names = [category.name for category in categories]
  print ("Supported account categories by name: {0}".format(
    COMMA_WITH_SPACE.join(map(str, category_names))))
1254062
def output_list(self, category):
        """"""
        print('{} users:'.format(category))
        for user in getattr(self.sub, category):
            print('  {}'.format(user))
497450
def get_reviewable_topics(self, lang):
        """"""
        return [topic['title']
                for topic in self.user_data.language_data[lang]['skills']
                if topic['learned'] and topic['strength'] < 1.0]
1009605
def build_vocab(nested_list):
    
    # Build vocabulary
    word_counts = Counter(itertools.chain(*nested_list))

    # Mapping from index to label
    vocabulary_inv = [x[0] for x in word_counts.most_common()]

    # Mapping from label to index
    vocabulary = {x: i for i, x in enumerate(vocabulary_inv)}
    return vocabulary, vocabulary_inv
548098
def do_list(lookup, term):
    """"""

    space = lookup.keys()
    matches = fnmatch.filter(space, term)

    return [(m, translate(lookup, m)) for m in matches]
1232159
function setVocabIds(index, pkg, callback) {
	if(!pkg.tags) return callback();

	if( index == pkg.tags.length ) {
		callback();
	} else {
		getVocabId(pkg.tags[index].vocabulary_id, function(id) {
			pkg.tags[index].vocabulary_id = id;
			index++;
			setVocabIds(index, pkg, callback);
		});
	}
}
1083531
def get_entry_tags(self, categories):
        
        tags = []
        for category in categories:
            domain = category.attrib.get('domain', 'category')
            if 'tag' in domain and category.attrib.get('nicename'):
                tags.append(category.attrib.get('nicename'))
        return tags