A parser for an often-used subset of Corpus Query Language
Project description
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")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cqls-0.1.6.tar.gz
(6.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
cqls-0.1.6-py3-none-any.whl
(8.0 kB
view details)
File details
Details for the file cqls-0.1.6.tar.gz.
File metadata
- Download URL: cqls-0.1.6.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6ee7e716667d15617496b9741c813f634b5de5d99690ddddef293b3e4b6805c
|
|
| MD5 |
4b8622d6ebfa786e0da62fc3c4f52a8c
|
|
| BLAKE2b-256 |
ab3a4142550895dd0d3efd98dbbd45927e63f9bd29b7fc599b6d2659dd22c91c
|
File details
Details for the file cqls-0.1.6-py3-none-any.whl.
File metadata
- Download URL: cqls-0.1.6-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36048e5f49e6925bd8b963f85b95c87f8b3fb80abaf87075c2a0e87af70dc7a0
|
|
| MD5 |
a0f107d455e8a7b54a8ce1cdae17c95a
|
|
| BLAKE2b-256 |
95d3b17939552b400f65b97fac9e786dfcc8fcf50130ef251ba3c732feb25a55
|