Metadata-Version: 2.1
Name: nlpia2
Version: 0.0.20
Summary: Natural language processing utilities and examples for the book Natural Language Processing in Action (nlpia) 2nd Edition by Hobson Lane and Maria Dyshel.
Home-page: https://proai.org
License: MIT
Keywords: NLP,Natural Language Processing,Virtual Assistant,chatbot,Text Processing,Machine Learning,Text Mining,Deep Learning
Author: Hobson Lane
Author-email: hobson@tangibleai.com
Requires-Python: >=3.8.3,<4
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Communications
Classifier: Topic :: Communications :: Chat
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing
Classifier: Topic :: Text Processing :: Linguistic
Requires-Dist: Django (>=4.1,<5.0)
Requires-Dist: PyPDF2 (>=2.1.0,<3.0.0)
Requires-Dist: babel (>=2.11.0,<3.0.0)
Requires-Dist: beautifulsoup4 (>=4.11,<5.0)
Requires-Dist: bidict (>=0.22,<0.23)
Requires-Dist: bleach (>=5.0,<6.0)
Requires-Dist: boto3 (>=1.26,<2.0)
Requires-Dist: botocore (>=1.29,<2.0)
Requires-Dist: configargparse (>=1.5,<2.0)
Requires-Dist: cython (>=0.29,<0.30)
Requires-Dist: dataframe-image (>=0.1,<0.2)
Requires-Dist: edit-distance (>=1.0,<2.0)
Requires-Dist: elasticsearch (>=8.5,<9.0)
Requires-Dist: environment (>=1.0,<2.0)
Requires-Dist: gitpython (>=3.1,<4.0)
Requires-Dist: graphviz (>=0.20,<0.21)
Requires-Dist: h5py (>=3.7.0,<4.0.0)
Requires-Dist: html2text (>=2020.1.16,<2021.0.0)
Requires-Dist: html5lib (>=1.1,<2.0)
Requires-Dist: huggingface-hub (>=0.11.0,<0.12.0)
Requires-Dist: jupyter-console (>=6.4.4)
Requires-Dist: lxml (>=4.9.1,<5.0.0)
Requires-Dist: m2r (>=0.3,<0.4)
Requires-Dist: matplotlib (>=3.6,<4.0)
Requires-Dist: matplotlib-inline (>=0.1,<0.2)
Requires-Dist: meilisearch (>=0.22.2,<0.23.0)
Requires-Dist: mistune (>=0.8.4,<0.9.0)
Requires-Dist: nltk (>=3.7,<4.0)
Requires-Dist: pandas (>=1.1,<2.0)
Requires-Dist: pillow (>=9.3.0,<10.0.0)
Requires-Dist: pip (>=22.3.1)
Requires-Dist: poetry (>=1,<2)
Requires-Dist: pronouncing (>=0.2.0,<0.3.0)
Requires-Dist: psutil (>=5.9.4,<6.0.0)
Requires-Dist: python-dotenv (>=0.13.0,<0.14.0)
Requires-Dist: python-slugify (>=7.0.0,<8.0.0)
Requires-Dist: pyyaml (>=6.0,<7.0)
Requires-Dist: rapidfuzz (>=2.13.2)
Requires-Dist: recommonmark (>=0.7,<0.8)
Requires-Dist: scikit-image (>=0.19.3)
Requires-Dist: scikit-learn (>=1.1.3)
Requires-Dist: scipy (>=1.9.3)
Requires-Dist: seaborn (>=0.11.2,<0.12.0)
Requires-Dist: sentence_transformers (>=2.2,<3.0)
Requires-Dist: spacy (==3.2.4)
Requires-Dist: sphinx (>=5.3,<6.0)
Requires-Dist: torch (>=1.13,<2.0)
Requires-Dist: torchtext (>=0.14,<0.15)
Requires-Dist: tox (>=3.25.0,<4.0.0)
Requires-Dist: tqdm (>=4.64,<5.0)
Requires-Dist: unidecode (>=1.3,<2.0)
Requires-Dist: wikipedia (>=1.4,<2.0)
Project-URL: Documentation, https://gitlab.com/tangibleai/nlpia2
Project-URL: Repository, https://gitlab.com/tangibleai/nlpia2
Description-Content-Type: text/markdown

# nlpia2

<!-- [![PyPI version](https://img.shields.io/pypi/pyversions/nlpia2.svg)](https://pypi.org/project/nlpia2/)
 [![License](https://img.shields.io/pypi/l/qary.svg)](https://pypi.python.org/pypi/qary/)
 -->
<!-- https://gitlab.com/username/userproject/badges/master/coverage.svg
 -->
[![codecov](https://codecov.io/gl/tangibleai/nlpia2/branch/master/graph/badge.svg)](https://codecov.io/gl/tangibleai/nlpia2)
[![GitLab CI](https://gitlab.com/tangibleai/nlpia2/badges/master/pipeline.svg)](https://gitlab.com/tangibleai/nlpia2/badges/master/pipeline.svg)

Official [code repository](https://gitlab.com/tangibleai/nlpia2/) for the book [_Natural Language Processing in Action, 2nd Edition_](https://proai.org/nlpia2e) by Maria Dyshel and Hobson Lane at [Tangible AI](https://tangibleai.com) for [Manning Publications](https://manning.com). It would not have happened without the generous work of [contributing authors](AUTHORS.md).

To get the most of this repository, you need to do two things.

1. **Clone the repository** to your local machine if you want to execute the code locally or want local access to the data (recommended).
2. **Create an environment** that has all the helpful/needed modules for Natural Language Processing In Action, 2nd Edition.

## Clone the Repository

If you're currently viewing this file on gitlab, and want in the future to access the data and code local to your machine, you may clone this repository to your local machine. Navigate to your preferred directory to house the local clone (for example, you local _git_ directory) and execute:

`git clone git@gitlab.com:prosocialai/nlpia2`

## Create a Conda Environment

To use the various packages in vogue with today's advanced NLP referenced in the NLPIA 2nd Edition book, such as PyTorch and SpaCy, you need to install them in a conda environment.  To avoid potential conflics of such packages and their dependencies with your other python projects, it is a good practice to create and activate a _new_ conda environment.

Here's how we did that for this book.

1. **Make sure you have Anaconda3 installed.** Make sure you can run conda from within a bash shell (terminal). The `conda --version` command should say something like '`4.10.3`.

2. **Update conda itself**. Keep current the `conda` package, which manages all other packages. Your base environment is most likely called _base_ so you can execute `conda update -n base -c defaults conda` to bring that package up to date.  Even if _base_ is not the activated environment at the moment, this command as presented will update the conda package in the _base_ environment. This way, next time you use the `conda` command, in any environment, the system will use the updated _conda_ package.

3. **Create a new environment and install the variety of modules needed in NLPIA 2nd Edition.**

There are two ways to do that.  

### Use the script already provided in the repository (_`nlpia2/src/nlpia2/scripts/conda_install.sh`_)

If you have cloned the repository, as instructed above, you already have a script that will do this work. From the directory housing the repository, run
`cd nlpia2/src/nlpia2/scripts/` and from there run `bash conda_install.sh` 

### Or manually execute portions of the script as follows

First, create a new environment (or activate it if it exists)

```bash
# create a new environment named "nlpia2" if one doesn't already exist:
conda activate nlpia2 \
    || conda create -n nlpia2 -y 'python==3.9.7' \
    && conda activate nlpia2
```

Once that completes, install all of `nlpia2`'s conda dependences if they aren't already installed:

``` bash
conda install -c defaults -c huggingface -c pytorch -c conda-forge -y \
    emoji \
    ffmpeg \
    glcontext \
    graphviz \
    huggingface_hub \
    jupyter \
    lxml \
    manimpango \
    nltk \
    pyglet \
    pylatex \
    pyrr \
    pyopengl \
    pytest \
    pytorch \
    regex \
    seaborn \
    scipy \
    scikit-learn \
    sentence-transformers \
    statsmodels \
    spacy \
    torchtext \
    transformers \
    wikipedia \
    xmltodict
```

Finally, install via pip any packages not available through conda channels.  In such scenarios it is generally a better practice to apply all pip installs after _all_ conda installs.  Furthermore, to ensure the pip installation is properly configured for the python version used in the conda environment, rather than use `pip` or `pip3`, activate the environment and invoke pip by using `python -m pip`.

``` bash
conda activate nlpia2
python -m pip install manim manimgl
```

## Ready, Set, Go!

Congratulations! You now have the nlpia2 repository cloned which gives you local access to all the data and scripts need in the NLPIA Second Edition book, and you have created a powerful environment to use.  When you're ready to type or execute code, check if this environment is activated. If not, activate by executing:

`conda activate nlpia2`

And off you go tackle some serious Natural Language Processing, in order to make the world a better place for all.

Run a jupyter notebook server within docker:
`jupyter-repo2docker --editable .`

