I have a boolean expression as a string like: "Hello, world/earth , how" and so on where / is OR and , is AND
I want to compare a string with this boolean expression and return True if the string contains "Hello" AND ("world" OR "earth") AND "how"
How should I do this?
You could build a graph (python-graph) if you now something about finite automata, where every word is a node and every node points to the next possible words. In your example “Hello” would point to “world” and “earth”, these would point to “how”. It should be easy to go through your graph then.