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
cnx-query-grammar-0.2.1.zip
(7.7 kB
view details)
File details
Details for the file cnx-query-grammar-0.2.1.zip
.
File metadata
- Download URL: cnx-query-grammar-0.2.1.zip
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33a7af8a365d168609b9e7c1621b651fe6923094ea1716dd60992d35b1f6fa2c |
|
MD5 | bf4f6c846370868499c79824b7580466 |
|
BLAKE2b-256 | 451730105984127dedbbeb24be0a0cbf30a3e724ffd9a56f6d48ac80e6815997 |
Provenance
File details
Details for the file cnx-query-grammar-0.2.1.tar.gz
.
File metadata
- Download URL: cnx-query-grammar-0.2.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b81e59a9e6c31e8ef59fc1fe6183d3f6b82eb59ee731f9413244bb3423c83cf |
|
MD5 | 9ff4c06c6b5c1e0765f5f0b6bd5a573c |
|
BLAKE2b-256 | 187b8b6e93ced8ae9b40096830b1c567b758ebef85308e629b30bf4ec4892a24 |
Provenance
File details
Details for the file cnx-query-grammar-0.2.1.tar.bz2
.
File metadata
- Download URL: cnx-query-grammar-0.2.1.tar.bz2
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95c08d58407121407dd8a8e57d1035896e262b273abbd4ecbe409c813d522dd6 |
|
MD5 | e5baf05c70444eb260c6ee7810131ec4 |
|
BLAKE2b-256 | 12cf40704bfff1223a130a68d17c81d01854644ec49bc01f759f0794c347fce4 |