{ "info": { "author": "Danny McDonald", "author_email": "mcddjx@gmail.com", "bugtrack_url": null, "classifiers": [ "Topic :: Utilities" ], "description": "# depgrep\n\nDependency parse searching for CONLL-U DataFrames\n\n\n> Version 0.1.3\n\n> Note: this tool currently doesn't have tests, CI, etc. It is not yet advised to use this tool outside of the depgrep methods provided by the `buzz` library.\n\n## Installation\n\n```bash\npip install depgrep\n```\n\n## Usage\n\nThe tool is designed to work with corpora made from CONLL-U files and parsed into DataFrames by *buzz*. The best thing to do is use *buzz* to model corpora, and then use its *depgrep* method.\n\n```bash\npip install buzz\n```\n\nThen, in Python:\n\n```python\nfrom buzz import Corpus\ncorpus = Corpus('path/to/conll/files')\nquery = 'l\"have\"' # match the lemma \"have\"\n```\n\n## Syntax\n\ndepgrep searches work through a combination of *nodes* and *relations*, just like Tgrep2, on which this tool is based.\n\n### Nodes\n\nA node targets one token feature (word, lemma, POS, wordclass, dependency role, etc). It may be specified as a regular expression or a simple string match: `f/amod|nsubj/` will match tokens filling the *nsubj* or *amod* role; `l\"be\"` will match the lemma, *be*.\n\nThe first part of the node query chooses which token attribute is to be searched. It can be any of:\n\n```\nw : word\nl : lemma\np : part of speech tag\nx : wordclass / XPOS\nf : dependency role\ni : index in sentence\ns : sentence number\n```\n\nCase sensitivity is controlled by the case of the attribute you are searching: `p/VB/` is case-insensitive, and `P/VB/` is case sensitive. Therefore, the following query matches words ending in *ing*, *ING*, *Ing*, etc:\n\n```\nw/ing$/\n```\n\nFor case-insensitivity across the query, use the `case_sensitive=False` keyword argument.\n\n### Relations\n\nRelations specify the relationship between nodes. For example, we can use `f\"nsubj\" <- f\"ROOT\"` to locate nominal subjects governed by nodes in the role of *ROOT*. The thing you want to find is the leftmost node in the query. So, while the above query finds nominal subject tokens, you could use inverse relation, `f\"ROOT\" -> f\"nsubj\"` to return the ROOT tokens.\n\nAvailable relations:\n\n```\na = b : a and b are the same node\na & b : a and b are the same node (same as =)\n\na <- b : a is a dependent of b\na <<- b : a is a descendent of b, with any distance in between\na <-: b : a is the only dependent of b\na <-N b : a is descendent of b by N generations\n\na -> b : a is the governor of a\na ->> b : a is an ancestor of b, with any distance in between\na ->: b : a is the only governor of b (as is normal in many grammars)\na ->N b : a is ancestor of b by N generations\n\na + b : a is immediately to the left of b\na +N b : a is N places to the left of b\na <| b : a is left of b, with any distance in between\n\na - b : a is immediately to the right of b\na -N b : a is n places to the right of b\na |> b : a is right of b, with any distance in between\n\na $ b : a and b share a governor (i.e. are sisters)\n\na $> b : a is a sister of and to the right of b.\na $< b : a is a sister of and to the left of b.\n\n```\n\n### Negation\n\nAdd `!` before a relation to negate it: `f\"ROOT\" != x\"VERB\"` will find non-verbal ROOT nodes.\n\n### Brackets\n\nBrackets can be used to make more complex queries:\n\n```\nf\"amod\" = l/^[abc]/ <- (f/nsubj/ != x/NOUN/)\n```\n\nThe above translates to *match adjectival modifiers starting with a, b or c, which are governed by nominal subjects that are not nouns*\n\nNote that **without** brackets, each relation/node refers to the leftmost node. In the following, the plural noun must be the same node as the *nsubj*, not the *ROOT*:\n\n```\nf\"nsubj\" <- f\"ROOT\" = p\"NNS\"\n```\n\n### *Or* expressions\n\nYou can use the pipe (`|`) to create an *OR* expression.\n\n```\n# match all kinds of modifiers\nx\"ADJ\" | f\"amod\" | f\"appos\" | p/^JJ/\nx\"NOUN\" <- f\"ROOT\" | = p\"NNS\"\n```\n\n\nAbove, we match nouns that are either governed by *ROOT*, or are plural.\n\n### Wildcard\n\nYou can use `__` or `*` to stand in for any token. To match any token that is the governor of a verb, do:\n\n```\n__ -> x\"VERB\"\n```\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/interrogator/depgrep", "keywords": "linguistics nlp dependencies conll", "license": "", "maintainer": "", "maintainer_email": "", "name": "depgrep", "package_url": "https://pypi.org/project/depgrep/", "platform": "", "project_url": "https://pypi.org/project/depgrep/", "project_urls": { "Homepage": "https://github.com/interrogator/depgrep" }, "release_url": "https://pypi.org/project/depgrep/0.1.3/", "requires_dist": [ "pandas", "pyparsing", "nltk" ], "requires_python": ">=3.6", "summary": "Dependency parse searching", "version": "0.1.3" }, "last_serial": 5702164, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "3c2195cd484a4363669d471ca3ede654", "sha256": "109a2e83cdccb87a5edddc1b9ebeea7937fbf87b137148a8b82c54b4624813e0" }, "downloads": -1, "filename": "depgrep-0.0.1-py3.6.egg", "has_sig": false, "md5_digest": "3c2195cd484a4363669d471ca3ede654", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": ">=3.6", "size": 18991, "upload_time": "2019-06-11T15:34:41", "url": "https://files.pythonhosted.org/packages/e6/34/a6b35f5d3471cba686dd22cb844d66eae832ad4018c59a8feccb13a3e25f/depgrep-0.0.1-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "b8e2ebeaddf18de415af88f0cf070a05", "sha256": "028b929e02aaead3afbc439820907ae18aa9e0e04ea25d8ee78d26516e4fb43c" }, "downloads": -1, "filename": "depgrep-0.0.1.tar.gz", "has_sig": false, "md5_digest": "b8e2ebeaddf18de415af88f0cf070a05", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 9443, "upload_time": "2019-06-11T15:34:43", "url": "https://files.pythonhosted.org/packages/eb/65/4d8b5a30ef3c2f88bd1a23ba81a65172ecf97576b8f5a13ec63095528be7/depgrep-0.0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "1fa099cfd99045f2a93b8e4b01b4354e", "sha256": "7146761a3115cc9827a71beb5c3f29e4a022a0e58207ef0b913eb2c6ea669f04" }, "downloads": -1, "filename": "depgrep-0.1.1-py3.7.egg", "has_sig": false, "md5_digest": "1fa099cfd99045f2a93b8e4b01b4354e", "packagetype": "bdist_egg", "python_version": "3.7", "requires_python": ">=3.6", "size": 19001, "upload_time": "2019-08-09T12:00:19", "url": "https://files.pythonhosted.org/packages/cb/1c/96d5e9531ae55f4e9e98e1c0340114855c2ca3703e186f39881d9cf89bdf/depgrep-0.1.1-py3.7.egg" }, { "comment_text": "", "digests": { "md5": "61d572cc152a19196c0ac2c34c412a3f", "sha256": "b636063e8eb7773781521e13aa2c5a7c0f6801fca9a0fc443a508ef5bca522a1" }, "downloads": -1, "filename": "depgrep-0.1.1.tar.gz", "has_sig": false, "md5_digest": "61d572cc152a19196c0ac2c34c412a3f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 9447, "upload_time": "2019-08-09T12:00:21", "url": "https://files.pythonhosted.org/packages/72/d5/b7802011e987297122b5ef42c37b51fe29032996ed0f52d2fc5aac9a88dd/depgrep-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "70b4000fce564a21466c0cb970374c51", "sha256": "2ab47b5bb1eaf5704fb86fbf88aefd216200ea9e6b90b3fe765821e4cfb12b20" }, "downloads": -1, "filename": "depgrep-0.1.2-py3.7.egg", "has_sig": false, "md5_digest": "70b4000fce564a21466c0cb970374c51", "packagetype": "bdist_egg", "python_version": "3.7", "requires_python": ">=3.6", "size": 18955, "upload_time": "2019-08-09T18:59:45", "url": "https://files.pythonhosted.org/packages/0d/90/5aec95324a044f74595ca6777b497dab85eb00883ce1db9c5fb3af9e3d87/depgrep-0.1.2-py3.7.egg" }, { "comment_text": "", "digests": { "md5": "6f0f15da5c944af827f9dc752a851d51", "sha256": "a553e6b7446edfe350ce7c508c52e03988050f89006fe1b9427574818f0d9697" }, "downloads": -1, "filename": "depgrep-0.1.2.tar.gz", "has_sig": false, "md5_digest": "6f0f15da5c944af827f9dc752a851d51", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 9426, "upload_time": "2019-08-09T18:59:46", "url": "https://files.pythonhosted.org/packages/35/91/230c8efea8dba40f056200beaf98618864ec869d9535dd547a85701b3d5d/depgrep-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "0ebf54179beaebf6db75b15f9580657e", "sha256": "06d4f136ed8bdfa2e6264d0b1de7023d3a01afc7f930572413266825262bbaaf" }, "downloads": -1, "filename": "depgrep-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "0ebf54179beaebf6db75b15f9580657e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 10791, "upload_time": "2019-08-20T08:46:08", "url": "https://files.pythonhosted.org/packages/f1/89/36076afd0e1bb7adbe93991b91bccf244f11d2c37124fe04a69ec08c95e1/depgrep-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5faf625ad4410a9a32008457c403d2fa", "sha256": "dc0ca8e8be4f4645b8a9e3eec19e71092144a8da32aa8bd93d7874e21c480acf" }, "downloads": -1, "filename": "depgrep-0.1.3.tar.gz", "has_sig": false, "md5_digest": "5faf625ad4410a9a32008457c403d2fa", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 12564, "upload_time": "2019-08-20T08:46:10", "url": "https://files.pythonhosted.org/packages/87/48/85b55230d0a6e0f11b5843fcafdb899f96ed7e5f815425837bd11e681ec2/depgrep-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0ebf54179beaebf6db75b15f9580657e", "sha256": "06d4f136ed8bdfa2e6264d0b1de7023d3a01afc7f930572413266825262bbaaf" }, "downloads": -1, "filename": "depgrep-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "0ebf54179beaebf6db75b15f9580657e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 10791, "upload_time": "2019-08-20T08:46:08", "url": "https://files.pythonhosted.org/packages/f1/89/36076afd0e1bb7adbe93991b91bccf244f11d2c37124fe04a69ec08c95e1/depgrep-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5faf625ad4410a9a32008457c403d2fa", "sha256": "dc0ca8e8be4f4645b8a9e3eec19e71092144a8da32aa8bd93d7874e21c480acf" }, "downloads": -1, "filename": "depgrep-0.1.3.tar.gz", "has_sig": false, "md5_digest": "5faf625ad4410a9a32008457c403d2fa", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 12564, "upload_time": "2019-08-20T08:46:10", "url": "https://files.pythonhosted.org/packages/87/48/85b55230d0a6e0f11b5843fcafdb899f96ed7e5f815425837bd11e681ec2/depgrep-0.1.3.tar.gz" } ] }