vi3k6i5 / flashtext

Extract Keywords from sentence or Replace keywords in sentences.
MIT License
5.59k stars 599 forks source link

Dealing with multiple (optional) tokens) #19

Open kootenpv opened 6 years ago

kootenpv commented 6 years ago

How do you recommend dealing with multiple (optional) tokens?

Let's say we want to extract abc or a subset of it; the regex would be:

(a)?(b)?(c)?

This will allow matching all combinations:

abc
ab
ac
bc
b
c
a

Is the best we can do having to add all combinations, including "" and then joining them?