opennyai


Nameopennyai JSON
Version 0.0.13 PyPI version JSON
download
home_pageNone
SummaryA SpaCy pipeline and models for NLP on indian legal text.
upload_time2024-05-08 12:30:43
maintainerNone
docs_urlNone
authorAman Tiwari
requires_python<4.0,>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <a href="https://github.com/OpenNyAI/Opennyai"><img src="https://github.com/OpenNyAI/Opennyai/raw/master/asset/final-logo-01.jpeg" width="190" height="65" align="right" /></a>

# Opennyai : An efficient NLP Pipeline for Indian Legal documents

[![Current Release Version](https://img.shields.io/github/release/OpenNyAI/opennyai.svg?style=flat-square&logo=github)](https://github.com/OpenNyAI/Opennyai/releases)
[![PyPI version](https://img.shields.io/pypi/v/opennyai.svg?style=flat-square&logo=pypi&logoColor=white)](https://pypi.org/project/opennyai/)
[![python version](https://img.shields.io/badge/Python-%3E=3.8-blue)](https://github.com/OpenNyAI/Opennyai)
[![python version](https://img.shields.io/badge/Python-<3.11-blue)](https://github.com/OpenNyAI/Opennyai)
[![Downloads](https://pepy.tech/badge/opennyai)](https://github.com/OpenNyAI/Opennyai)

Opennyai is a python library for natural language preprocessing on Indian legal texts.

This library provides unified access to the following 3 pre-trained AI models developed by OpenNyAI which focus on
Indian court
judgments:

* Named Entity Recognition (NER): [GitHub](https://github.com/Legal-NLP-EkStep/legal_NER)
  , [paper](https://arxiv.org/pdf/2211.03442.pdf), [Huggingface Datasets](https://huggingface.co/datasets/opennyaiorg/InLegalNER)
* Judgment Structuring using Sentence Rhetorical
  Roles: [GitHub](https://github.com/Legal-NLP-EkStep/rhetorical-role-baseline) 
  , [paper](http://www.lrec-conf.org/proceedings/lrec2022/pdf/2022.lrec-1.470.pdf), [Huggingface Datasets](https://huggingface.co/datasets/opennyaiorg/InRhetoricalRoles)
* Extractive Summarizer: [GitHub](https://github.com/Legal-NLP-EkStep/judgment_extractive_summarizer)

This library is mainly for running the pretrained models on your custom input judgments text. For more details about
data and model training, please refer to individual git repo links.

# 🔧 1. Installation

To get started using opennyai first create a new python virtual environment using [conda](https://www.anaconda.com/):

Supports python 3.8, 3.9, 3.10

```bash
conda create -n opennyai python=3.8
conda activate opennyai
```

Install it using pip by running the following line in your terminal

```bash
pip install -U opennyai
```

#### For GPU support

If you want to utilize spacy with GPU please install [Cupy](https://anaconda.org/conda-forge/cupy) and
[cudatoolkit](https://anaconda.org/anaconda/cudatoolkit) dependency of appropriate version.

```bash
conda install cudatoolkit==<your_cuda_version> #### E.g. cudatoolkit==11.2
pip install cupy-cuda<your_cuda_version> ##### E.g. cupy-cuda112
```

In case of any issue with installation please refer to [spacy installation with cupy](https://spacy.io/usage)

Remember you need spacy of 3.2.4 version for models to work perfectly.

# 📖 2. Documentation

Please refer to the [Documentation](https://opennyai.readthedocs.io/en/latest/index.html#) for more details.

# 👩‍💻 3. Usage

To run the 3 OpenNyAI models on judgment texts of your choice please run following python code

```python
from opennyai import Pipeline
from opennyai.utils import Data
import urllib

# Get court judgment texts on which to run the AI models
text1 = urllib.request.urlopen(
    'https://raw.githubusercontent.com/OpenNyAI/Opennyai/master/samples/sample_judgment1.txt').read().decode()
text2 = urllib.request.urlopen(
    'https://raw.githubusercontent.com/OpenNyAI/Opennyai/master/samples/sample_judgment2.txt').read().decode()

# you can also load your text files directly into this
texts_to_process = [text1, text2]

# create Data object for data  preprocessing before running ML models
data = Data(texts_to_process)

# If you have access to GPU then set this to True else False
use_gpu = True

# Choose which of the AI models you want to run from the 3 models 'NER', 'Rhetorical_Role','Summarizer'. E.g. If just Named Entity is of interest then just select 'NER'

pipeline = Pipeline(components=['NER', 'Rhetorical_Role', 'Summarizer'], use_gpu=use_gpu, verbose=True)

results = pipeline(data)
```

The output of each model is present in following keys of each element of the output

```python
results[0][
    'annotations']  ## shows the result of model at sentence level, each entry will have entities, rhetorical role, and other details
results[0]['summary']  ## shows Summary for each of the Rheorical Role for first judgment text 
```

For more details on usage please refer to the [documentation](https://opennyai.readthedocs.io/en/latest/index.html#)

Google Colab Notebook
----------------------
We encourage you to use the local machine installation of opennyai library instead of Google colab as it works with python 3.8. Since Google colab works with higher versions of python, opennyai installation does not work.

| Description               | Link  |
|---------------------------|-------|
| Run Inference          | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1rNA6XVyD-GCTd0YtosjiKON_p9bGuVwz) |

Visualization of outputs
-----------------------
We encourage users to use [our webapp](https://summarizer-fer6v2lowq-uc.a.run.app/) for visualizing the results for a
judgment of your choice.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "opennyai",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Aman Tiwari",
    "author_email": "work.amantiwari@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ab/75/5a6a1f1a1d1f1ce748938c5cd8a817f1f7a0eb278f1b3b664ec03c8426e6/opennyai-0.0.13.tar.gz",
    "platform": null,
    "description": "<a href=\"https://github.com/OpenNyAI/Opennyai\"><img src=\"https://github.com/OpenNyAI/Opennyai/raw/master/asset/final-logo-01.jpeg\" width=\"190\" height=\"65\" align=\"right\" /></a>\n\n# Opennyai : An efficient NLP Pipeline for Indian Legal documents\n\n[![Current Release Version](https://img.shields.io/github/release/OpenNyAI/opennyai.svg?style=flat-square&logo=github)](https://github.com/OpenNyAI/Opennyai/releases)\n[![PyPI version](https://img.shields.io/pypi/v/opennyai.svg?style=flat-square&logo=pypi&logoColor=white)](https://pypi.org/project/opennyai/)\n[![python version](https://img.shields.io/badge/Python-%3E=3.8-blue)](https://github.com/OpenNyAI/Opennyai)\n[![python version](https://img.shields.io/badge/Python-<3.11-blue)](https://github.com/OpenNyAI/Opennyai)\n[![Downloads](https://pepy.tech/badge/opennyai)](https://github.com/OpenNyAI/Opennyai)\n\nOpennyai is a python library for natural language preprocessing on Indian legal texts.\n\nThis library provides unified access to the following 3 pre-trained AI models developed by OpenNyAI which focus on\nIndian court\njudgments:\n\n* Named Entity Recognition (NER): [GitHub](https://github.com/Legal-NLP-EkStep/legal_NER)\n  , [paper](https://arxiv.org/pdf/2211.03442.pdf), [Huggingface Datasets](https://huggingface.co/datasets/opennyaiorg/InLegalNER)\n* Judgment Structuring using Sentence Rhetorical\n  Roles: [GitHub](https://github.com/Legal-NLP-EkStep/rhetorical-role-baseline) \n  , [paper](http://www.lrec-conf.org/proceedings/lrec2022/pdf/2022.lrec-1.470.pdf), [Huggingface Datasets](https://huggingface.co/datasets/opennyaiorg/InRhetoricalRoles)\n* Extractive Summarizer: [GitHub](https://github.com/Legal-NLP-EkStep/judgment_extractive_summarizer)\n\nThis library is mainly for running the pretrained models on your custom input judgments text. For more details about\ndata and model training, please refer to individual git repo links.\n\n# \ud83d\udd27 1. Installation\n\nTo get started using opennyai first create a new python virtual environment using [conda](https://www.anaconda.com/):\n\nSupports python 3.8, 3.9, 3.10\n\n```bash\nconda create -n opennyai python=3.8\nconda activate opennyai\n```\n\nInstall it using pip by running the following line in your terminal\n\n```bash\npip install -U opennyai\n```\n\n#### For GPU support\n\nIf you want to utilize spacy with GPU please install [Cupy](https://anaconda.org/conda-forge/cupy) and\n[cudatoolkit](https://anaconda.org/anaconda/cudatoolkit) dependency of appropriate version.\n\n```bash\nconda install cudatoolkit==<your_cuda_version> #### E.g. cudatoolkit==11.2\npip install cupy-cuda<your_cuda_version> ##### E.g. cupy-cuda112\n```\n\nIn case of any issue with installation please refer to [spacy installation with cupy](https://spacy.io/usage)\n\nRemember you need spacy of 3.2.4 version for models to work perfectly.\n\n# \ud83d\udcd6 2. Documentation\n\nPlease refer to the [Documentation](https://opennyai.readthedocs.io/en/latest/index.html#) for more details.\n\n# \ud83d\udc69\u200d\ud83d\udcbb 3. Usage\n\nTo run the 3 OpenNyAI models on judgment texts of your choice please run following python code\n\n```python\nfrom opennyai import Pipeline\nfrom opennyai.utils import Data\nimport urllib\n\n# Get court judgment texts on which to run the AI models\ntext1 = urllib.request.urlopen(\n    'https://raw.githubusercontent.com/OpenNyAI/Opennyai/master/samples/sample_judgment1.txt').read().decode()\ntext2 = urllib.request.urlopen(\n    'https://raw.githubusercontent.com/OpenNyAI/Opennyai/master/samples/sample_judgment2.txt').read().decode()\n\n# you can also load your text files directly into this\ntexts_to_process = [text1, text2]\n\n# create Data object for data  preprocessing before running ML models\ndata = Data(texts_to_process)\n\n# If you have access to GPU then set this to True else False\nuse_gpu = True\n\n# Choose which of the AI models you want to run from the 3 models 'NER', 'Rhetorical_Role','Summarizer'. E.g. If just Named Entity is of interest then just select 'NER'\n\npipeline = Pipeline(components=['NER', 'Rhetorical_Role', 'Summarizer'], use_gpu=use_gpu, verbose=True)\n\nresults = pipeline(data)\n```\n\nThe output of each model is present in following keys of each element of the output\n\n```python\nresults[0][\n    'annotations']  ## shows the result of model at sentence level, each entry will have entities, rhetorical role, and other details\nresults[0]['summary']  ## shows Summary for each of the Rheorical Role for first judgment text \n```\n\nFor more details on usage please refer to the [documentation](https://opennyai.readthedocs.io/en/latest/index.html#)\n\nGoogle Colab Notebook\n----------------------\nWe encourage you to use the local machine installation of opennyai library instead of Google colab as it works with python 3.8. Since Google colab works with higher versions of python, opennyai installation does not work.\n\n| Description               | Link  |\n|---------------------------|-------|\n| Run Inference          | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1rNA6XVyD-GCTd0YtosjiKON_p9bGuVwz) |\n\nVisualization of outputs\n-----------------------\nWe encourage users to use [our webapp](https://summarizer-fer6v2lowq-uc.a.run.app/) for visualizing the results for a\njudgment of your choice.\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A SpaCy pipeline and models for NLP on indian legal text.",
    "version": "0.0.13",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1a01a420a1c8861b74d3fd1dbff70b5f04fa9cbeaa61b473468dbafcb4ef1cd9",
                "md5": "c41ee0095b55a3b7b4973f47dd3222ff",
                "sha256": "59c4c2784c872660712f75525b4709e99c89fcaf8a95b5cdc9500f91e6266659"
            },
            "downloads": -1,
            "filename": "opennyai-0.0.13-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c41ee0095b55a3b7b4973f47dd3222ff",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 170200,
            "upload_time": "2024-05-08T12:30:41",
            "upload_time_iso_8601": "2024-05-08T12:30:41.444814Z",
            "url": "https://files.pythonhosted.org/packages/1a/01/a420a1c8861b74d3fd1dbff70b5f04fa9cbeaa61b473468dbafcb4ef1cd9/opennyai-0.0.13-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ab755a6a1f1a1d1f1ce748938c5cd8a817f1f7a0eb278f1b3b664ec03c8426e6",
                "md5": "b8718fd2c03d09cea801aae229536619",
                "sha256": "52f6195d94b744cc6e926a22152059aa2197d82353a9e30ac97f18ad977528ae"
            },
            "downloads": -1,
            "filename": "opennyai-0.0.13.tar.gz",
            "has_sig": false,
            "md5_digest": "b8718fd2c03d09cea801aae229536619",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 426943,
            "upload_time": "2024-05-08T12:30:43",
            "upload_time_iso_8601": "2024-05-08T12:30:43.491215Z",
            "url": "https://files.pythonhosted.org/packages/ab/75/5a6a1f1a1d1f1ce748938c5cd8a817f1f7a0eb278f1b3b664ec03c8426e6/opennyai-0.0.13.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-08 12:30:43",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "opennyai"
}
        
Elapsed time: 0.22505s