WojciechMula / pyahocorasick

Python module (C extension and plain python) implementing Aho-Corasick algorithm
BSD 3-Clause "New" or "Revised" License
927 stars 122 forks source link

Support to select longest available match without overlap #127

Closed giriannamalai closed 2 years ago

giriannamalai commented 4 years ago

We need support for longest match without overlapping.

Ex: Keyword 1: python Keyword 2: Python programming

After running iteration over the following sentence: I love python programming.

Result should be "Python programming". Not both "Python and Python Programming"

pombredanne commented 2 years ago

This is a feature in the latest 1.4.2 ... See https://pyahocorasick.readthedocs.io/en/latest/#iter-long-string-start-end Thanks!