nlp-tools-py-lib

simple nlp library


License
MIT
Install
pip install nlp-tools-py-lib==0.1.1

Documentation

nlp-tools-py-lib

python simple nlp library

installation

pip install nlp-tools-py-lib

usage

# main.py
from nlp_tools.preprocessing import Preprocessing
from nlp_tools.loaders import MdLoader
from nlp_tools.representations import MergedMatrixRepresentation
from nlp_tools.classifiers import ClassificationProcessor, NaiveBayseTfIdfClassifier

TRAIN_PATH = 'demo_training.md'

def build_classifier():
    loader = MdLoader(TRAIN_PATH)
    processor = Preprocessing(loader)
    repres = MergedMatrixRepresentation(processor.data)
    classifier = ClassificationProcessor(NaiveBayseTfIdfClassifier(), repres.data)
    classifier.train()

    def predict(text: str):
        message = repres.process_new_data(processor.process_sentence(text))
        intent, score = classifier.predict(message)
        return intent, score
    return predict

training.md example :

# intents

## my_first_intent_name

### responses

- ...

### example

- ...