MCPcopy Create free account
hub / github.com/baidu/bigflow / count_words

Function count_words

bigflow_python/python/bigflow/example/word_cnt.py:40–59  ·  view source on GitHub ↗

将输入PCollection的每个元素(文本文件的每一行)切分成单词,统计每个单词个数,返回 内容为(word, count)的PCollection Args: lines (PCollection): 通过读取文本文件构造的PCollection Returns: PCollection: 表示统计结果的PCollection >>> _p = _pipeline.parallelize("to be or not to be") >>> print _p.apply(count_words).get()

(lines)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers

nothing calls this directly

Calls 6

flattenMethod · 0.80
apply_valuesMethod · 0.80
group_by_keyMethod · 0.80
mapMethod · 0.45
flat_mapMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected