16 #ifndef THRILL_EXAMPLES_WORD_COUNT_WORD_COUNT_HEADER 17 #define THRILL_EXAMPLES_WORD_COUNT_WORD_COUNT_HEADER 26 namespace word_count {
34 template <
typename InputStack>
37 auto word_pairs = input.template FlatMap<WordCountPair>(
42 if (sv.
size() == 0)
return;
60 using HashWord = std::pair<size_t, std::string>;
73 template <
typename InputStack>
76 std::hash<std::string> string_hasher;
80 .template FlatMap<std::string>(
85 if (sv.
size() == 0)
return;
111 #endif // !THRILL_EXAMPLES_WORD_COUNT_WORD_COUNT_HEADER DIA is the interface between the user and the Thrill framework.
auto ReduceByKey(const KeyExtractor &key_extractor, const ReduceFunction &reduce_function, const ReduceConfig &reduce_config=ReduceConfig()) const
ReduceByKey is a DOp, which groups elements of the DIA with the key_extractor and reduces each key-bu...
std::pair< std::string, size_t > WordCountPair
auto WordCount(const DIA< std::string, InputStack > &input)
auto HashWordCountExample(const DIA< std::string, InputStack > &input)
std::pair< size_t, std::string > HashWord
size_t size() const noexcept
Returns the size of this StringView.
std::basic_string< char, std::char_traits< char >, Allocator< char > > string
string with Manager tracking
StringView is a reference to a part of a string, consisting of only a char pointer and a length...
std::string to_string() const
Returns the data of this StringView as a std::string.
static void split_view(char sep, const std::string &str, Functor &&callback, std::string::size_type limit=std::string::npos)
Split the given string at each separator character into distinct substrings, and call the given callb...
std::pair< HashWord, size_t > HashWordCount