summaryrefslogtreecommitdiff
path: root/examples/booleansearchparser.py
Commit message (Collapse)AuthorAgeFilesLines
* Add Py2 compat code at submitter's request; add non-Western test case; more ↵Paul McGuire2019-08-181-98/+109
| | | | helpful message when tests fail; exit with exit code to include with package tests; trim trailing whitespace
* Boolean Search query parser: allows to perform searches with the common ↵xecgr2019-08-131-0/+394
boolean search syntax against a text (#21) * Add files via upload Boolean Search query parser, based on searchparser, that allows to perform searches with the common boolean search syntax against a text (western + non-western alphabets) SAMPLE USAGE: from booleansearchparser import BooleanSearchParser bsp = BooleanSearchParser() text = u"wildcards at the begining of a search term " exprs= [ u"*cards and term", #True u"wild* and term", #True u"not terms", #True u"terms or begin", #False ] for expr in exprs: print bsp.match(text,expr) #non-western samples text = u"안녕하세요, 당신은 어떠세요?" exprs= [ u"*신은 and 어떠세요", #True u"not 당신은", #False u"당신 or 당", #False ] for expr in exprs: print bsp.match(text,expr) * from __future__ import print_function and changing this over to be Python 2/3 compatible * ptmcg conversation issues