Boolean Search for Python Containers
Library to make simple boolean queries for python string containers (e.g. sets or lists). E.g. query built from expression 'Alice & Bob & ~John' can be applied to any container to check if it contains strings 'Alice' and 'Bob' and not contains 'John'.
Base example:
#!/usr/bin/env python
from termsquery import TermsQuery
query = TermsQuery('Alice & (Bob | "Unknown user")')
container1 = {'Alice', 'Unknown user'}
container2 = {'Bob'}
assert True == query(container1)
assert False == query(container2)
Library can be used to tag collection of documents: create query for each tag and apply that query for document words.
Simple tagging example:
#!/usr/bin/env python
from termsquery import TermsQuery
tags = {
'A-not-B' : TermsQuery('A & ~B'),
'X-and-Y' : TermsQuery('X & Y')
}
docs = [
'A is the first letter of ...',
'A and B letters, X and Y letters'
]
for doc in docs:
words = doc.split()
doc_tags = [name for (name, query) in tags.items() if query(words)]
print(doc, doc_tags)
Metadata
Release files for termsquery 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| termsquery-0.2.tar.gz | 3.9 kB | Without provenance | Details for termsquery-0.2.tar.gz |
Release files / termsquery-0.2.tar.gz
| Download URL | termsquery-0.2.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
598bd011d51cf293ee49b5c3049c5797e69b83650272e3579995065b302585f4
|
|
BLAKE2b-256 checksum How to use checksums |
63070d4395cd0ffa2312237cc0ffae654019cabf677d95bcc3021b96f15fb9a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for termsquery 0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.