cnx-query-grammar-0.2.2
توضیحات
Connexions project search query parsing library.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | cnx-query-grammar-0.2.2 |
| نام | cnx-query-grammar |
| نسخه کتابخانه | 0.2.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Connexions team |
| ایمیل نویسنده | info@cnx.org |
| آدرس صفحه اصلی | https://github.com/connexions/cnx-query-grammar |
| آدرس اینترنتی | https://pypi.org/project/cnx-query-grammar/ |
| مجوز | AGPL, See also LICENSE.txt |
cnx-query-grammar
=================
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
نحوه نصب
نصب پکیج whl cnx-query-grammar-0.2.2:
pip install cnx-query-grammar-0.2.2.whl
نصب پکیج tar.gz cnx-query-grammar-0.2.2:
pip install cnx-query-grammar-0.2.2.tar.gz