Returns the number of documents the specified term appears in.
427527
def get_document_frequency(self, term):
        
        if term not in self._terms:
            raise IndexError(TERM_DOES_NOT_EXIST)
        else:
            return len(self._terms[term])
177484
def _get_num_of_documents(self):
        '''
        
        '''
        parser = etree.XMLParser(target=XMLElementCountTarget('document'))
        # When iterated over, 'results' will contain the output from
        # target parser's close() method
        num_of_documents = etree.parse(self.urml_file, parser)
        self._num_of_documents = num_of_documents
        return num_of_documents
1368936
def count(self):
        
        params = self.dump()
        params['limit'] = 0
        params['count'] = 1
        content = self._do_request(params)
        return content['count']
930065
public Long getCount(String type, Map<String, ?> terms) {
		if (terms == null) {
			return 0L;
		}
		MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
		LinkedList<String> list = new LinkedList<>();
		for (Map.Entry<String, ? extends Object> term : terms.entrySet()) {
			String key = term.getKey();
			Object value = term.getValue();
			if (value != null) {
				list.add(key.concat(Config.SEPARATOR).concat(value.toString()));
			}
		}
		if (!terms.isEmpty()) {
			params.put("terms", list);
		}
		params.putSingle(Config._TYPE, type);
		params.putSingle("count", "true");
		Pager pager = new Pager();
		getItems(find("terms", params), pager);
		return pager.getCount();
	}
270988
def count_documents(self, filter={},  *args, **kwargs):
        
        result = self.collection.count_documents(filter, *args, **kwargs)
        return result
941235
def ngrams(self, with_counts=False):
        
        query = "SELECT "
        for i in reversed(range(self.cardinality)):
            if i != 0:
                query += "word_{0}, ".format(i)
            elif i == 0:
                query += "word"

        if with_counts:
            query += ", count"

        query += " FROM _{0}_gram;".format(self.cardinality)

        result = self.execute_sql(query)
        for row in result:
            yield tuple(row)
869366
def count(self):
        
        # Save the existing rows and start parameters to see how many results were actually expected
        _rows = self._solr_params.get('rows', None)
        _start = self._solr_params.get('start', 0)
        if not self._solr_cache:
            # Get the count for everything
            self.set_params(rows=0)
            self._exec_query()
        number = self._solr_cache.get('num_found', -1)

        # If start value is bigger or equal than solr results' count, should return 0
        # If there are 10 results, but if start value is specified as 30, should return 0.
        if _start >= number:
            return 0
        else:
            # If 'start' is specified, then this many results from the start will not be accessible.
            number -= _start
            # If 'rows' is NOT specified, then all results are accessible
            # (minus the ones skipped with 'start')
            if _rows is None:
                return number
            # If 'rows' is specified, then this many results at most will be accessible. If we have
            # more than this many results found, then we can say that this many results are
            # accessible. If there are less results found than rows, then we can't give more
            # than found results.
            return number if number < _rows else _rows
1345905
def aggregate_count(keyname):
    
    def inner(docs):
        return sum(doc[keyname] for doc in docs)

    return keyname, inner
960494
def get_documents(self, term):
        
        if term not in self._terms:
            raise IndexError(TERM_DOES_NOT_EXIST)
        else:
            return self._terms[term]
713960
def count(self, **query_dict):
        """"""
        param_dict = query_dict.copy()
        param_dict['count'] = 0
        resp_dict = self._get_query(**param_dict)
        return resp_dict['response']['numFound']
153677
public function count(): int
    {
        $collection = $this->documentManager->getCollection($this->documentClass);

        return $collection->count($this->query);
    }
1288008
def count(self, filter, **kwargs):
        
        return mongo_count(self._collection, filter=filter, **kwargs)
1220318
def get_term_frequency(self, term, document, normalized=False):
        
        if document not in self._documents:
            raise IndexError(DOCUMENT_DOES_NOT_EXIST)

        if term not in self._terms:
            raise IndexError(TERM_DOES_NOT_EXIST)

        result = self._terms[term].get(document, 0)
        if normalized:
            result /= self.get_document_length(document)

        return float(result)
952112
def get_num_words(text):
    
    try:
        word_regexp_pattern = re.compile(r"[a-zA-Záéíóúñ]+")
        num_words = re.findall(word_regexp_pattern, text)
        return len(num_words)
    except TypeError:
        return 0
1119879
public static int getTwoWordFreq(Term from, Term to) {
        if (from.item().bigramEntryMap == null) {
            return 0;
        }
        Integer freq = from.item().bigramEntryMap.get(to.item().getIndex());
        if (freq == null) {
            return 0;
        } else {
            return freq;
        }
    }
1273293
def pages_count(self):
        ''''''
        if not self.limit or self.count<self.limit:
            return 1
        if self.count % self.limit <= self.orphans:
            return self.count // self.limit
        return int(math.ceil(float(self.count)/self.limit))
67782
def plain_inverse_document_frequency(term, numerator = 0, denominator = 0)
      log((documents.size + numerator) / (@model.document_count(term).to_f + denominator))
    end