Coder Social home page Coder Social logo

binbin83 / nlp_pipeline Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 2.0 136 KB

this repo is a wrapper of different NLP libraries into a uniform pipeline object. That will make easy to use them all in one project or to compare them to each other.

License: GNU General Public License v3.0

Python 71.09% Jupyter Notebook 28.91%

nlp_pipeline's Introduction

nlp_pipeline

This repo is a wrapper of different NLP libraries into a uniform pipeline object. That will make easy to use them all in one project or to compare them to each other.

You can use this pipeline to do the following:

  • Tokenization
  • Stemming
  • Lemmatization
  • POS tagging
  • morphological analysis
  • build embeddins on corpora

Now, the library that are supported are:

Installation

  1. Clone the repo
git clone  https://github.com/binbin83/nlp_pipeline.git
  1. Create a virtual environment
python3 -m venv path/to/venv/nlp_pipeline
  1. Install the requirements (if you wan to use gpu, install requirements_gpu.txt)
pip install -r requirements.txt
  1. Read the Notebooks of examples in the folder notebooks
  2. Update the config file with your own paths and parameters
  3. Run the pipeline
python3 main_nlp.py

or

python3 main_embeddings.py

NLP data

The pipelines:

  • StanzaNlpPipeline
  • SpacyNlpPipeline
  • HuggingfaceNlpPipeline
  • StanzaCoreNlpPipeline

Have nearly the same structure and the same methods. The results they return are the same. A dictionaries with the following keys:

  • 'tokens': list of tokens
  • 'lemmas': list of lemmas
  • 'pos': list of pos tags
  • 'morph': list of morphological analysis
  • 'doc': the original doc object of the library

Speed

With used RTX A4000 GPU 8Go, apply the nlp pipeline on a 10 millions words corpus took:

  • ~70 minutes for Stanza (GPU)
  • ~20 minutes for Spacy trf (GPU)
  • ~14 minutes for Spacy lg (11th Gen Intel® Core™ i7-11850H @ 2.50GHz × 16)

Embeddings

The embeddings can be buil with the following models: Word2vec, Fastext, Doc2vec, LDA, LSA, ELDA, and HDP

Todo

[ ] Add hugging models available to the embeddings pipeline. ie make possible to finetune CAMEMBERT embeddings on the data

[ ] Add hops parser to the options: https://github.com/hopsparser/hopsparser

[ ] Add unitests

nlp_pipeline's People

Contributors

binbin83 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

bkeit onurbulbul2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.