{ "info": { "author": "Antonin Delpeuch", "author_email": "antonin@delpeuch.eu", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Scientific/Engineering :: Information Analysis" ], "description": "pynif\n=====\n\nThe `NLP Interchange Format\n(NIF) `__ is an\nRDF/OWL-based format that aims to achieve interoperability between\nNatural Language Processing (NLP) tools, language resources and\nannotations. It offers a standard representation of annotated texts for\ntasks such as `Named Entity\nRecognition `__\nor `Entity Linking `__. It\nis used by `GERBIL `__ to run\nreproducible evaluations of annotators.\n\nThis Python library can be used to serialize and deserialized annotated\ncorpora in NIF.\n\nDocumentation\n-------------\n\n`NIF Documentation `__\n\nSupported NIF versions\n----------------------\n\nNIF 2.1, serialized in `any of the formats supported by\nrdflib `__\n\nOverview\n--------\n\nThis library is revolves around three core classes: \\* a ``NIFContext``\nis a document (a string); \\* a ``NIFPhrase`` is the annotation of a\nsnippet of text (usually a phrase) in a document; \\* a ``NIFCollection``\nis a set of documents, which constitutes a collection. In NIF, each of\nthese objects is identified by a URI, and their attributes and relations\nare encoded by RDF triples between these URIs. This library abstracts\naway the encoding by letting you manipulate collections, contexts and\nphrases as plain Python objects.\n\nQuickstart\n-----------\n\n0) Import and create a collection\n\n.. code:: python\n\n from pynif import NIFCollection\n\n collection = NIFCollection(uri=\"http://freme-project.eu\")\n\n\n1) Create a context\n\n.. code:: python\n\n context = collection.add_context(\n uri=\"http://freme-project.eu/doc32\",\n mention=\"Diego Maradona is from Argentina.\")\n\n2) Create entries for the entities\n\n.. code:: python\n\n context.add_phrase(\n beginIndex=0,\n endIndex=14,\n taClassRef=['http://dbpedia.org/ontology/SportsManager', 'http://dbpedia.org/ontology/Person', 'http://nerd.eurecom.fr/ontology#Person'],\n score=0.9869992701528016,\n annotator='http://freme-project.eu/tools/freme-ner',\n taIdentRef='http://dbpedia.org/resource/Diego_Maradona',\n taMsClassRef='http://dbpedia.org/ontology/SoccerManager')\n\n context.add_phrase(\n beginIndex=23,\n endIndex=32,\n taClassRef=['http://dbpedia.org/ontology/PopulatedPlace', 'http://nerd.eurecom.fr/ontology#Location',\n 'http://dbpedia.org/ontology/Place'],\n score=0.9804963628413852,\n annotator='http://freme-project.eu/tools/freme-ner',\n taMsClassRef='http://dbpedia.org/resource/Argentina')\n\n3) Finally, get the output with the format that you need\n\n.. code:: python\n\n generated_nif = collection.dumps(format='turtle')\n print(generated_nif)\n\nYou will obtain the NIF representation as a string:\n\n.. code:: turtle\n\n a nif:ContextCollection ;\n nif:hasContext ;\n ns1:conformsTo .\n\n a nif:Context,\n nif:OffsetBasedString ;\n nif:beginIndex \"0\"^^xsd:nonNegativeInteger ;\n nif:endIndex \"33\"^^xsd:nonNegativeInteger ;\n nif:isString \"Diego Maradona is from Argentina.\" .\n\n a nif:OffsetBasedString,\n nif:Phrase ;\n nif:anchorOf \"Diego Maradona\" ;\n nif:beginIndex \"0\"^^xsd:nonNegativeInteger ;\n nif:endIndex \"14\"^^xsd:nonNegativeInteger ;\n nif:referenceContext ;\n nif:taMsClassRef ;\n itsrdf:taAnnotatorsRef ;\n itsrdf:taClassRef ,\n ,\n ;\n itsrdf:taConfidence 9.869993e-01 ;\n itsrdf:taIdentRef .\n\n a nif:OffsetBasedString,\n nif:Phrase ;\n nif:anchorOf \"Argentina\" ;\n nif:beginIndex \"23\"^^xsd:nonNegativeInteger ;\n nif:endIndex \"32\"^^xsd:nonNegativeInteger ;\n nif:referenceContext ;\n nif:taMsClassRef ;\n itsrdf:taAnnotatorsRef ;\n itsrdf:taClassRef ,\n ,\n ;\n itsrdf:taConfidence 9.804964e-01 .\n\n4) You can then parse it back:\n\n.. code:: python\n\n parsed_collection = NIFCollection.loads(generated_nif, format='turtle')\n\n for context in parsed_collection.contexts:\n for phrase in context.phrases:\n print(phrase)\n\nIssues\n------\n\nIf you have any problems with or questions about this library, please\ncontact us through a `GitHub\nissue `__.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/wetneb/pynif", "keywords": "NIF-Lib NIF NLP formats NER RDF", "license": "Apache v2.0", "maintainer": "", "maintainer_email": "", "name": "pynif", "package_url": "https://pypi.org/project/pynif/", "platform": "", "project_url": "https://pypi.org/project/pynif/", "project_urls": { "Homepage": "https://github.com/wetneb/pynif" }, "release_url": "https://pypi.org/project/pynif/0.1.4/", "requires_dist": [ "rdflib", "check-manifest ; extra == 'dev'", "pytest-cov ; extra == 'test'", "pytest ; extra == 'test'" ], "requires_python": "", "summary": "A small Python library for the NLP Interchange Format (NIF)", "version": "0.1.4" }, "last_serial": 4777939, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "b5dbffb1a8c5ae0cf5570d031b3ed239", "sha256": "ebeba4f80e6eb3699c3292fabfb7a0cd86f054c3117ec1c519e3b5c458cc2650" }, "downloads": -1, "filename": "pynif-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b5dbffb1a8c5ae0cf5570d031b3ed239", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 16245, "upload_time": "2019-01-22T16:27:38", "url": "https://files.pythonhosted.org/packages/3f/75/4c225b0cfa7a24415f02bb5ebe41a609eb406588d09bdfe835e5e1c71179/pynif-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "817462b9b0719cc767e5ebcce2d7101e", "sha256": "0ef1a29bac67794c4cabadec7edda39bbdecbefb414cf07881c8bed6f05de249" }, "downloads": -1, "filename": "pynif-0.1.1.tar.gz", "has_sig": false, "md5_digest": "817462b9b0719cc767e5ebcce2d7101e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13707, "upload_time": "2019-01-22T16:27:40", "url": "https://files.pythonhosted.org/packages/6d/1a/f2024be25536f54773a2a6f86cc286b2ef2913b498a14840e7f9e1ecfa9c/pynif-0.1.1.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "9139a6b3348a1afc00ed0d439769e630", "sha256": "4c0043b69211a31a8d470c956ba63d59765167f333c942175846a084a638fa4d" }, "downloads": -1, "filename": "pynif-0.1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9139a6b3348a1afc00ed0d439769e630", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 16389, "upload_time": "2019-02-04T14:08:53", "url": "https://files.pythonhosted.org/packages/1f/96/d567170e642db400f46fa944073218479dfc26f442e4a63b8edf9b2d5d81/pynif-0.1.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9a6933636793f60727ca021d1d3a445d", "sha256": "cd7eb988a5ab5c74172172193247a510cb3cc67b8e335d24eac0c96fa99d402a" }, "downloads": -1, "filename": "pynif-0.1.3.tar.gz", "has_sig": false, "md5_digest": "9a6933636793f60727ca021d1d3a445d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15467, "upload_time": "2019-02-04T14:08:55", "url": "https://files.pythonhosted.org/packages/6a/36/e8dcf1f99178fd5e9da62f2a592acb4b074b077ffd6dfdc1493073445c8f/pynif-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "8093e2c07e3e8cb918d6646594f7c6d6", "sha256": "5d4948c8016f9d6b221a435618163c0f74d92e18048532a5882aeb3e6e457df8" }, "downloads": -1, "filename": "pynif-0.1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8093e2c07e3e8cb918d6646594f7c6d6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 16475, "upload_time": "2019-02-04T14:42:40", "url": "https://files.pythonhosted.org/packages/23/aa/0a0d262b1829cf4f544a2e6e03d27f5ad9352150f209509d3a6b766475de/pynif-0.1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e2d745efe3e0298dccde273e26b0bac3", "sha256": "edb13c8b8aef01325750b917a49376d35a90e66becb49a84b3148ccea9c5546d" }, "downloads": -1, "filename": "pynif-0.1.4.tar.gz", "has_sig": false, "md5_digest": "e2d745efe3e0298dccde273e26b0bac3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15539, "upload_time": "2019-02-04T14:42:44", "url": "https://files.pythonhosted.org/packages/4c/ee/0b58b1ef2defcf3202742e343f2dfd7f63cc2740b30fbcfb67d9dcb6f8bf/pynif-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8093e2c07e3e8cb918d6646594f7c6d6", "sha256": "5d4948c8016f9d6b221a435618163c0f74d92e18048532a5882aeb3e6e457df8" }, "downloads": -1, "filename": "pynif-0.1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8093e2c07e3e8cb918d6646594f7c6d6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 16475, "upload_time": "2019-02-04T14:42:40", "url": "https://files.pythonhosted.org/packages/23/aa/0a0d262b1829cf4f544a2e6e03d27f5ad9352150f209509d3a6b766475de/pynif-0.1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e2d745efe3e0298dccde273e26b0bac3", "sha256": "edb13c8b8aef01325750b917a49376d35a90e66becb49a84b3148ccea9c5546d" }, "downloads": -1, "filename": "pynif-0.1.4.tar.gz", "has_sig": false, "md5_digest": "e2d745efe3e0298dccde273e26b0bac3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15539, "upload_time": "2019-02-04T14:42:44", "url": "https://files.pythonhosted.org/packages/4c/ee/0b58b1ef2defcf3202742e343f2dfd7f63cc2740b30fbcfb67d9dcb6f8bf/pynif-0.1.4.tar.gz" } ] }