implement AhoCorasick by using inverted index