Those are for matching a single pattern against a text. The intended usage of Rabin-Karp is to match a set of patterns against a text, in a more efficient manner than running Boyer-Moore or KMP on each individual pattern. An algorithm with a similar use-case to Rabin-Karp is the Aho-Corasick algorithm, which is very simple to learn if you know KMP already - the preprocess of the set of patterns is just a generalization of the preprocess of the pattern in KMP.
Comments
Those are for matching a single pattern against a text. The intended usage of Rabin-Karp is to match a set of patterns against a text, in a more efficient manner than running Boyer-Moore or KMP on each individual pattern. An algorithm with a similar use-case to Rabin-Karp is the Aho-Corasick algorithm, which is very simple to learn if you know KMP already - the preprocess of the set of patterns is just a generalization of the preprocess of the pattern in KMP.