Skip to content

Instantly share code, notes, and snippets.

@bigimot
Created September 26, 2012 17:03
Show Gist options
  • Save bigimot/226ccff91fadafee1652 to your computer and use it in GitHub Desktop.
Save bigimot/226ccff91fadafee1652 to your computer and use it in GitHub Desktop.
loose_match = ["bot", "software"]
exact_match = ["auto"]
ignore_negative = ["no"]
text = "no auto software, no bot. the best way to find auto bots."
# Would like to ignore negative context, so scan for 'bot' & 'software' will return
# 'software', 'bot' from the 1st line, and 'bot' from the second line.
# Then check if ignore_negative words appear in the same sentance, and ignore if they are.
# so checking first line (caught 'software' and 'bot'), "no" appears, and both words should be ignored.
# checking second line (caught 'bot' and 'auto'), no ignore_negative words appear, and should catch this word.
# so final result of the scan will be 'bot'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment