{ "info": { "author": "Antoine Rose", "author_email": "antoine_rose@hotmail.fr", "bugtrack_url": null, "classifiers": [], "description": "# bible-ref-py\n\n\nbible-ref-py is a Python 2 and Python 3 compatible package and regular\nexpression library for validating, extracting and normalizing biblical\nreferences from texts.\n\nbible-ref-py is built by [Beatitud developers](https://github.com/beatitud/), on top of python-scriptures library, initially implemented by \n[David Davis](http://www.davisd.com/projects/python-scriptures/) (Copyright (c) 2010-2015).\n\n\nTypical usage is as follows:\n````python\nfrom scriptures.text import Text\nstring = \"Le service est le billet \u00e0 pr\u00e9senter \u00e0 l\u2019entr\u00e9e des noces \u00e9ternelles. Ce qui reste de la vie au seuil de l\u2019\u00e9ternit\u00e9, ce n\u2019est pas ce que nous avons gagn\u00e9, mais ce que nous avons donn\u00e9 (cf. Mt 6, 19-21 ; 1Co 13, 8)\"\ntext = Text(string, language='fr', canon='catholic')\ntext.extract_refs(guess=True)\n# [, ]\n````\n\nRange validation is performed automatically and invalid references are not\nextracted.\n````python\nfrom scriptures.reference import Reference\nReference(book='Rom', chapter=2, verse=30).is_valid()\n# False\nReference(book='Rom', chapter=3, verse=23).is_valid()\n# True\n````\n\nSingle verse number references can be guessed, according to three rules:\n- If there is a complete reference in the same sentence, before, we suppose the single verse refers to the same books and chapters than this complete reference\n- Else, if there is a complete reference in the same paragraph, before, we suppose the single verse refers to the same books and chapters than this complete reference\n- Else, if there is a complete reference in the text, in the previous paragraphs, we suppose the single verse refers to those books and chapters\n\n\n````python\nfrom scriptures.text import Text\nstring = \"Les disciples \u00ab sortirent \u00e0 la rencontre de l\u2019\u00e9poux \u00bb (Mt 25, 1). Puis : \u00ab Voici l\u2019\u00e9poux, sortez \u00e0 sa rencontre ! \u00bb (v. 6).\" \ntext = Text(string, language='fr', canon='catholic')\ntext.extract_refs(guess=True)\n# [, ]\n````\n\nInstallation\n============\n\nTo install, simply run the script with the install command:\n````shell\n$ pip install beatitud-scriptures\n````\n\nOr just put the scriptures package somewhere on the Python path.\n\n\nAPI\n===\n\nReturn Values\n-------------\n\nWhen a \"scripture reference\" is returned, it is always an object with five attributes\nconsisting of:\n- book\n- chapter\n- verse\n- end_chapter\n- end_verse\n\n```python\nfrom scriptures.reference import Reference\nref = Reference(book='Rom', chapter=2, verse=30)\nprint(ref.book)\n# Romans\nprint(ref.chapter)\n# 2\n```\n\n\nRegular Expressions\n-------------------\n\nThere are two compiled regular expression patterns exposed by this package.\n\n### book_re\n\n\nMatch a valid abbreviation or book name.\n\nExamples:\n````python\nfrom scriptures.canons import get_canon\nimport re\ncanon = get_canon(name=\"catholic\")\nre.findall(canon.book_re, 'Matt test Ecclesiastes and 2 peter')\n# ['Matt', 'Ecclesiastes', '2 peter'] \n````\n\n\n### scripture_re\n\nMatch a scripture reference pattern from a valid abbreviation or book name.\n\nExamples:\n````python\nfrom scriptures.text import Text\nimport re\ntxt = Text(\"\", language=\"en\", canon=\"catholic\")\nre.findall(txt.scripture_re, 'Matt 3 & Acts 1:2-3 Rev 2:1-3:2')\n# [('Matt', '3', '', '', ''), ('Acts', '1', '2', '', '3'),\n# ('Rev', '2', '1', '3', '2')]\n````\n\n\nCanons\n================\n\nThis library currently provides the following canons:\n* catholic - scriptures.canons.catholic.Canon\n* protestant - scriptures.canons.protestant.Canon\n* deuterocanon - scriptures.canons.deutercanon.Canon\n* kjv1611 - scriptures.canons.kjv1611.Canon\n\nUsage\n-----\n\nTo use the additional texts, simply instantiate the text object and use the api\nfunctions and regular expressions on the new instance.\n\nExample\n\n````python\nfrom scriptures.canons.catholic import Canon\ncc = Canon(language='en')\nprint(cc.books)\n# {'gn': {\n# 'en': ('Genesis', 'Gen', 'Gen(?:esis)?'),\n# 'fr': ('Gen\u00e8se', 'Gn', 'Gen(?:\u00e8se)?'),\n# 'chapters':\n# [31, 25, 24, 26, 32, 22, 24, 22, 29, 32, 32, 20, 18, 24, 21, 16, 27, 33, 38, 18, 34, 24, 20, 67, 34, 35,\n# 46, 22, 35, 43, 55, 32, 20, 31, 29, 43, 36, 30, 23, 23, 57, 38, 34, 34, 28, 34, 31, 22, 33, 26]\n# },\n# ...}\n````\n\n\nCustom Canons\n============\n\nThe library makes makes extending the library through custom texts\ntrivial through additional modules. Please consider contributing your text\nmodules to this project by creating canons under scriptures/canons/ and submitting\na pull request.\n\n\nCreating a New Canon\n-------------------\n\nTo create a new Canon,\n\n1) Create a class that inherits from scriptures.base.CanonBase\n2) Implement the \"books\" dictionary\n3) Instantiate your new canon and use it\n\n\nTest Suite\n==========\n\nUnit tests are provided to verify chapter and verse style normalization, output\nformatting, and book names and abbreviations.\n\nTo run the test suite, cwd to just outside of the scriptures package and:\n```\n$ python -m unittest discover\n```\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/beatitud/bible-ref-py/", "keywords": "bible,ref,parser,catholic,protestant", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "beatitud-scriptures", "package_url": "https://pypi.org/project/beatitud-scriptures/", "platform": "", "project_url": "https://pypi.org/project/beatitud-scriptures/", "project_urls": { "Homepage": "https://github.com/beatitud/bible-ref-py/" }, "release_url": "https://pypi.org/project/beatitud-scriptures/4.0.0/", "requires_dist": null, "requires_python": "", "summary": "bible-ref-py is a python library built on top of python-scriptures library, implemented by David Davis (Copyright (c) 2010-2015). It is a Python package and regular expression library for validating, extracting, and normalizing biblical references from text.", "version": "4.0.0" }, "last_serial": 4642272, "releases": { "4.0.0": [ { "comment_text": "", "digests": { "md5": "f102bc4f2e3399808c8d78e387653429", "sha256": "42c6a7d4962e5586af916814b02111a4221f98dcb5de617638b52279d5f89f3a" }, "downloads": -1, "filename": "beatitud_scriptures-4.0.0-py2-none-any.whl", "has_sig": false, "md5_digest": "f102bc4f2e3399808c8d78e387653429", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 39124, "upload_time": "2018-12-28T20:18:49", "url": "https://files.pythonhosted.org/packages/ae/fd/cc9784cf530b7de893911750bdcd122b3809e238bb2093dfff1dba088263/beatitud_scriptures-4.0.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c5a11bd62f34bdf6a07d1f725372b7c4", "sha256": "f37391bb4e9448f0dd0874466c7648bcb1574b4eb3299d6744d64a6eb38776b7" }, "downloads": -1, "filename": "beatitud_scriptures-4.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "c5a11bd62f34bdf6a07d1f725372b7c4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 39124, "upload_time": "2018-12-28T20:18:52", "url": "https://files.pythonhosted.org/packages/2f/1f/ea1114fdeeecc63a0a2b9281911402c70e06a6ae99e2dff3a1a6aa2def97/beatitud_scriptures-4.0.0-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f102bc4f2e3399808c8d78e387653429", "sha256": "42c6a7d4962e5586af916814b02111a4221f98dcb5de617638b52279d5f89f3a" }, "downloads": -1, "filename": "beatitud_scriptures-4.0.0-py2-none-any.whl", "has_sig": false, "md5_digest": "f102bc4f2e3399808c8d78e387653429", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 39124, "upload_time": "2018-12-28T20:18:49", "url": "https://files.pythonhosted.org/packages/ae/fd/cc9784cf530b7de893911750bdcd122b3809e238bb2093dfff1dba088263/beatitud_scriptures-4.0.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c5a11bd62f34bdf6a07d1f725372b7c4", "sha256": "f37391bb4e9448f0dd0874466c7648bcb1574b4eb3299d6744d64a6eb38776b7" }, "downloads": -1, "filename": "beatitud_scriptures-4.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "c5a11bd62f34bdf6a07d1f725372b7c4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 39124, "upload_time": "2018-12-28T20:18:52", "url": "https://files.pythonhosted.org/packages/2f/1f/ea1114fdeeecc63a0a2b9281911402c70e06a6ae99e2dff3a1a6aa2def97/beatitud_scriptures-4.0.0-py3-none-any.whl" } ] }