Connexions project search query parsing library.
Project description
The Connections project query grammar parsing library.
Install
Use setup.py to install cnx-query-grammar:
$ python setup.py install
This creates a script called query_parser.
Usage
>>> from cnxquerygrammar.query_parser import grammar, DictFormater >>> node_tree = grammar.parse('Some text') >>> DictFormater().visit(node_tree) [('text', 'Some'), ('text', 'text')] >>> node_tree = grammar.parse('"A phrase"') >>> DictFormater().visit(node_tree) [('text', 'A phrase')] >>> node_tree = grammar.parse('author:"John Smith" type:book') >>> DictFormater().visit(node_tree) [('author', 'John Smith'), ('type', 'book')] >>> node_tree = grammar.parse('author:"John Smith" type:book title:" A Title With Spaces"') >>> DictFormater().visit(node_tree) [('author', 'John Smith'), ('type', 'book'), ('title', 'A Title With Spaces')]
Test
To run the tests:
$ python -m unittest discover
License
This software is subject to the provisions of the GNU Affero General Public License Version 3.0 (AGPL). See license.txt for details. Copyright (c) 2013 Rice University
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file cnx-query-grammar-0.2.2.zip
.
File metadata
- Download URL: cnx-query-grammar-0.2.2.zip
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61e72fd41558a1738cadc5cd795cc63b649b3eeb13a49c26b5a95f2b2fac98ab |
|
MD5 | 91b5b94aa998122f4641ff6c80621491 |
|
BLAKE2b-256 | b0d51db0be9c0837057fc8b3aa11ec8701afcb55d827a205ffa0ddd4cf019dea |
File details
Details for the file cnx-query-grammar-0.2.2.tar.gz
.
File metadata
- Download URL: cnx-query-grammar-0.2.2.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0c790a445b4116b6de6b028b6966a6e958d1d2cb73dc88aa5b4aaddfb13adba |
|
MD5 | cc3dda75fec753ea6f7fc6d37792d15f |
|
BLAKE2b-256 | 4ea56afdf20910777509e8a7c3494ac0f5fa4c1f59d3a0f9e56c76df68a79398 |
File details
Details for the file cnx-query-grammar-0.2.2.tar.bz2
.
File metadata
- Download URL: cnx-query-grammar-0.2.2.tar.bz2
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55cba16e697face73a1507b48721db8ea367be9f462503e78d7b7c9cbadb4b2c |
|
MD5 | dced3d1af8f86ec435958d58a1390b6b |
|
BLAKE2b-256 | df03d79c8ec9430a98e84e1f9963ae3ff03b446542865a86dd248c049f85ee44 |
File details
Details for the file cnx_query_grammar-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: cnx_query_grammar-0.2.2-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37af62033099205a994459b903a7d96a9f28e8a18f6a3515e61bcf6272790b62 |
|
MD5 | 93e844d47d07418aae77615a0d4f8ae6 |
|
BLAKE2b-256 | a97295611868010df6ea020cd4c7fa498171fdfc8d490ae769b31da99887a6b7 |
File details
Details for the file cnx_query_grammar-0.2.2-py2-none-any.whl
.
File metadata
- Download URL: cnx_query_grammar-0.2.2-py2-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 735db8a2ec65cbe01470c760a5cfbfb12d6f6093af9135ea1021d34fe003ebf5 |
|
MD5 | 08d3ac199f8b196ba13b302e42a8bb6b |
|
BLAKE2b-256 | 1f876b61380fdff10cb088f920e84106b6e9b74b6bfec78a501c46fd06ae6508 |