(
    page,
    min_content_len=500,
    snippet_len=(150, 500),
    min_text_frac=0.9,
    exclude_en=False,
    max_n=10,
)
return snippets
Args:
        page (:class:`wikipedia.WikipediaPage`)
        min_content_len (int)
        snippet_len (Tuple[int, int])
        min_text_frac (float)
        exclude_en (bool)
        max_n (int)

    Returns:
        List[str]
Args:
        page (:class:`wikipedia.WikipediaPage`)
        min_content_len (int)
        snippet_len (Tuple[int, int])
        min_text_frac (float)
        exclude_en (bool)
        max_n (int)
Args : page ( : class : wikipedia . WikipediaPage ) min_content_len ( int ) snippet_len ( Tuple [ int int ] ) min_text_frac ( float ) exclude_en ( bool ) max_n ( int )
def extract_snippets_from_page(
    page,
    min_content_len=500,
    snippet_len=(150, 500),
    min_text_frac=0.9,
    exclude_en=False,
    max_n=10,
):
    """
    Args:
        page (:class:`wikipedia.WikipediaPage`)
        min_content_len (int)
        snippet_len (Tuple[int, int])
        min_text_frac (float)
        exclude_en (bool)
        max_n (int)

    Returns:
        List[str]
    """
    logging.debug("... extracting snippets from page %s", page.title)
    snippets = []
    content = page.content
    if len(content) < min_content_len:
        logging.debug("...... content too short: %s < %s", len(content), min_content_len)
        return snippets
    for section in re_sections.split(content):
        if len(snippets) >= max_n:
            break
        for snippet in re_breaking_whitespace.split(section.strip()):
            if len(snippets) >= max_n:
                break
            snippet = re_whitespace.sub(" ", snippet).strip()
            snippet = re_citation.sub("", snippet)
            if is_good_snippet(snippet, snippet_len, min_text_frac, exclude_en):
                snippets.append(snippet)
    logging.debug("... extracted %s snippets from page %s", len(snippets), page.title)
    return snippets
def extract_snippets_from_page ( page , min_content_len = 500 , snippet_len = ( 150 , 500 ) , min_text_frac = 0.9 , exclude_en = False , max_n = 10 , ) : logging . debug ( "... extracting snippets from page %s" , page . title ) snippets = [ ] content = page . content if len ( content ) < min_content_len : logging . debug ( "...... content too short: %s < %s" , len ( content ) , min_content_len ) return snippets for section in re_sections . split ( content ) : if len ( snippets ) >= max_n : break for snippet in re_breaking_whitespace . split ( section . strip ( ) ) : if len ( snippets ) >= max_n : break snippet = re_whitespace . sub ( " " , snippet ) . strip ( ) snippet = re_citation . sub ( "" , snippet ) if is_good_snippet ( snippet , snippet_len , min_text_frac , exclude_en ) : snippets . append ( snippet ) logging . debug ( "... extracted %s snippets from page %s" , len ( snippets ) , page . title ) return snippets