(ds)
Args:
        ds (List[Tuple[str, str]])
Args:
        ds (List[Tuple[str, str]])
Args : ds ( List [ Tuple [ str str ]] )
def summarize_dataset(ds):
    """
    Args:
        ds (List[Tuple[str, str]])
    """
    n_obs = len(ds)
    print("# observations:", n_obs)
    pprint(ds[:3])
    min_text_len = min(len(text) for text, _ in ds)
    print("...")
    print("min text len:", min_text_len)
    try:
        mean_text_len = statistics.mean(len(text) for text, _ in ds)
        stdev_text_len = statistics.stdev(len(text) for text, _ in ds)
        print("mean text len: {:.1f} +/- {:.1f}".format(mean_text_len, stdev_text_len))
    except NameError:
        pass
    max_text_len = max(len(text) for text, _ in ds)
    print("max text len:", max_text_len)
    lang_counts = collections.Counter(lang for _, lang in ds)
    top_counts = ", ".join(
        "'{}': {}".format(lang, count) for lang, count in lang_counts.most_common(15)
    )
    bot_counts = ", ".join(
        "'{}': {}".format(lang, count)
        for lang, count in sorted(
            lang_counts.items(), key=operator.itemgetter(1), reverse=True
        )[-15:]
    )
    print("# languages:", len(lang_counts))
    print("{} ... {}".format(top_counts, bot_counts))
def summarize_dataset ( ds ) : n_obs = len ( ds ) print ( "# observations:" , n_obs ) pprint ( ds [ : 3 ] ) min_text_len = min ( len ( text ) for text , _ in ds ) print ( "..." ) print ( "min text len:" , min_text_len ) try : mean_text_len = statistics . mean ( len ( text ) for text , _ in ds ) stdev_text_len = statistics . stdev ( len ( text ) for text , _ in ds ) print ( "mean text len: {:.1f} +/- {:.1f}" . format ( mean_text_len , stdev_text_len ) ) except NameError : pass max_text_len = max ( len ( text ) for text , _ in ds ) print ( "max text len:" , max_text_len ) lang_counts = collections . Counter ( lang for _ , lang in ds ) top_counts = ", " . join ( "'{}': {}" . format ( lang , count ) for lang , count in lang_counts . most_common ( 15 ) ) bot_counts = ", " . join ( "'{}': {}" . format ( lang , count ) for lang , count in sorted ( lang_counts . items ( ) , key = operator . itemgetter ( 1 ) , reverse = True ) [ - 15 : ] ) print ( "# languages:" , len ( lang_counts ) ) print ( "{} ... {}" . format ( top_counts , bot_counts ) )