Corpus Query Langauge Subset
Parse Corpus Query Language into a list of queries in JSON format.
Installation
pip install cqls
Usage
>>> import cqls
>>> cql = '''
... "我" [pos="V."]+
... '''
>>> cqls.parse(cql, default_attr="word", max_quant=5)
[
[{'match': {'word': ['我']}, 'not_match': {}}, {'match': {'pos': ['V.']}, 'not_match': {}}],
[{'match': {'word': ['我']}, 'not_match': {}}, {'match': {'pos': ['V.']}, 'not_match': {}}, {'match': {'pos': ['V.']}, 'not_match': {}}],
[{'match': {'word': ['我']}, 'not_match': {}}, {'match': {'pos': ['V.']}, 'not_match': {}}, {'match': {'pos': ['V.']}, 'not_match': {}}, {'match': {'pos': ['V.']}, 'not_match': {}}],
[{'match': {'word': ['我']}, 'not_match': {}}, {'match': {'pos': ['V.']}, 'not_match': {}}, {'match': {'pos': ['V.']}, 'not_match': {}}, {'match': {'pos': ['V.']}, 'not_match': {}}, {'match': {'pos': ['V.']}, 'not_match': {}}],
[{'match': {'word': ['我']}, 'not_match': {}}, {'match': {'pos': ['V.']}, 'not_match': {}}, {'match': {'pos': ['V.']}, 'not_match': {}}, {'match': {'pos': ['V.']}, 'not_match': {}}, {'match': {'pos': ['V.']}, 'not_match': {}}, {'match': {'pos': ['V.']}, 'not_match': {}}]
]
Supported CQL features
- token:
[],"我",[word="我"],[word!="我" & pos="N.*"] - token-level quantifier:
+,*,?,{n,m} - grouping:
("a" "b"? "c"){1,2} - label:
lab1:[word="我" & pos="N.*"] lab2:("a" "b")
Release files for cqls 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cqls-0.1.6.tar.gz | 6.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cqls-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.5 kB
Release files / cqls-0.1.6.tar.gz
| Download URL | cqls-0.1.6.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a6ee7e716667d15617496b9741c813f634b5de5d99690ddddef293b3e4b6805c
|
|
BLAKE2b-256 checksum How to use checksums |
ab3a4142550895dd0d3efd98dbbd45927e63f9bd29b7fc599b6d2659dd22c91c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
|
Release files / cqls-0.1.6-py3-none-any.whl
| Download URL | cqls-0.1.6-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
36048e5f49e6925bd8b963f85b95c87f8b3fb80abaf87075c2a0e87af70dc7a0
|
|
BLAKE2b-256 checksum How to use checksums |
95d3b17939552b400f65b97fac9e786dfcc8fcf50130ef251ba3c732feb25a55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
|