Summarize long text
765881
public function summarize( $text, $word_count = null )
	{
		$data =  $this->post_call('/gensim/summarize', ['text' => $text, 'word_count' => $word_count ] );
		
		return ( !empty($data['summarize']) ) ? $data['summarize'] : null;
	}
355133
def text_to_data(self, text, elt, ps):
        '''
        '''
        if text is None:
            return None
        m = Duration.lex_pattern.match(text)
        if m is None:
            raise EvaluateException('Illegal duration', ps.Backtrace(elt))
        d = m.groupdict()
        if d['T'] and (d['h'] is None and d['m'] is None and d['s'] is None):
            raise EvaluateException('Duration has T without time')
        try:
            retval = _dict_to_tuple(d)
        except ValueError, e:
            raise EvaluateException(str(e))
    
        if self.pyclass is not None:
            return self.pyclass(retval)
        return retval
665091
def nsummary(self,prn=None, lfilter=None):
        """"""
        for i, p in enumerate(self.res):
            if lfilter is not None:
                if not lfilter(p):
                    continue
            print(conf.color_theme.id(i,fmt="%04i"), end = " ")
            if prn is None:
                print(self._elt2sum(p))
            else:
                print(prn(p))
420196
def summarize_url(url, num_sentences=4, fmt='default'):
    '''
    '''

    title, meta, full_text = goose_extractor(url)

    if not full_text:
        raise ArticleExtractionFail("Couldn't extract: {}".format(url))

    its = _intertext_score(full_text)
    tss = _title_similarity_score(full_text,title)

    if _eval_meta_as_summary(meta):
        summ = meta
        if tss[0][2].lower() in summ.lower():
            its, tss = _remove_title_from_tuples(its, tss)
        elif summ.lower() in tss[0][2].lower():
            summ = tss[0][2]
            its, tss = _remove_title_from_tuples(its, tss)
    else:
        summ = tss[0][2]
        its, tss = _remove_title_from_tuples(its, tss)

    scores = [score[2] for score in _aggregrate_scores(its, tss, num_sentences)]
    formatted = Formatter(scores, fmt).frmt()
    return summ, formatted
1091832
def get_long_description():
    

    description = []
    with open("README.rst") as file:
        for line in file:
            if ".. code:: python" in line and len(description) >= 2:
                blockLine = description[-2]
                if re.search(r":$", blockLine) and not re.search(r"::$", blockLine):
                    description[-2] = "::".join(blockLine.rsplit(":", 1))
                continue

            description.append(line)
    return "".join(description)
295781
def get_long_description():
    
    import codecs 
    with codecs.open('README.rst', encoding='UTF-8') as f:
        readme = [line for line in f if not line.startswith('.. contents::')]
        return ''.join(readme)
529024
def wrap(text, width, *args, **kwargs):
    

    return sum([textwrap.wrap(line, width, *args, **kwargs)
                if line else [''] for line in text.splitlines()], [])
1057759
def str_summaryline(self):
        """"""
        return "{N} GOs, {M} genes described by {X} of {Y} sections {NM}".format(
            N=len(self.go2nt), M=len(self.gene2gos),
            X=len(self.sec2chr), Y=len(self.datobj.sec2chr), NM=self.name)
189880
function summarize(value, counts) {
  const min = counts.min;
  const max = counts.max;
  const num = counts.values.length;
  if (value < min) {
    // do nothing
  } else if (value >= max) {
    counts.values[num - 1] += 1;
  } else {
    const index = Math.floor((value - min) / counts.delta);
    counts.values[index] += 1;
  }
}
48870
def format_summary(self):
        """"""
        chunks = [chunk.format_chunk_summary()
                  for chunk in self._progress_chunks]
        return "/".join(chunks)
648654
def summarize(self, file: Optional[TextIO] = None) -> None:
        """"""
        print(self.summary_str(), file=file)
1321090
def get_summary(content):
  """"""
  soup = BeautifulSoup(content, "html.parser")
  summary = soup.find_all(attrs={
      'class': re.compile(r".*\bsummary-content\b.*")})

  if summary[0].p.string is None:
    return summary[0].p.p.getText()
  return summary[0].p.getText()
79514
def pretty_description(description, wrap_at=None, indent=0):
    
    if wrap_at is None or wrap_at < 0:
        width = console_width(default=79)
        if wrap_at is None:
            wrap_at = width
        else:
            wrap_at += width

    indent = ' ' * indent
    text_wrapper = textwrap.TextWrapper(
        width=wrap_at, replace_whitespace=False,
        initial_indent=indent, subsequent_indent=indent)
    new_desc = []
    for line in description.split('\n'):
        new_desc.append(line.replace('\n', '').strip())
    while not new_desc[0]:
        del new_desc[0]
    while not new_desc[-1]:
        del new_desc[-1]
    separators = [i for i, l in enumerate(new_desc) if not l]
    paragraphs = []
    if separators:
        start, end = 0, separators[0]
        paragraphs.append(new_desc[start:end])
        for i in range(len(separators) - 1):
            start = end + 1
            end = separators[i + 1]
            paragraphs.append(new_desc[start:end])
        paragraphs.append(new_desc[end + 1:])
        return '\n\n'.join(text_wrapper.fill(' '.join(p)) for p in paragraphs)
    return text_wrapper.fill(' '.join(new_desc))
890999
def _info_long(self) -> Optional[str]:
        """"""
        try:
            return str(
                html.unescape(self.journey.InfoTextList.InfoText.get("textL")).replace(
                    "<br />", "\n"
                )
            )
        except AttributeError:
            return None
238012
def long_description():
    """"""
    # use re.compile() for flags support in Python 2.6
    pattern = re.compile(r'\n^\.\. start-badges.*^\.\. end-badges\n',
                         flags=re.M | re.S)
    return pattern.sub('', read('README.rst'))
388464
def pad(lines, delim):
	
	"""
	Populates text into chunks. If the delim was & then
	['12 & 344', '344 & 8', '8 & 88'] would be stored in chunks as
	[['12', '344', '8'], ['344', '8', '88']]
	"""
	chunks = []
	for i in range(len(lines)):
		line = lines[i]
		sections = line.split(delim)
		for j in range(len(sections)):
			if len(chunks) <= j:
				chunks.append([])
			chunks[j].append(sections[j])

	"""
	Calculates & Stores the max length of chunks
	"""
	max_lengths = []
	for i in range(len(chunks)):
		_max = max([len(j) for j in chunks[i]])
		max_lengths.append(_max)

	"""
	Pads the children of chunks according to the chunk's max length" \
	"""
	for i in range(len(chunks)):
		for j in range(len(chunks[i])):
			chunks[i][j] += (max_lengths[i] - len(chunks[i][j])) * ' '
	new_lines = ['' for i in range(len(lines))]

	for i in range(len(chunks)):
		for j in range(len(chunks[i])):
			new_lines[j] += chunks[i][j]
	return new_lines
1277394
def _get_summary(self, text, **kwargs):
        

        card = cards.extract_card(text, kwargs, self.search_path)
        return flask.Markup((card.description or '').strip())