GithubHelp home page GithubHelp logo

kmint21 / html2sent Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 2.0 46 KB

HTML2SENT modifies HTML to improve sentences tokenizer quality

License: MIT License

Python 100.00%
nltk nlp text-mining tokenizer sentence-tokenizer sentence-segmentation python

html2sent's Introduction

This library works with HTML-content and modifies it in some tags to improve sentences tokenizer quality.

Install NLTK python package

pip install nltk

Download punkt data

import nltk
nltk.download('punkt')

Download this library

git clone https://github.com/KMiNT21/html2sent.git

Using

import html2sent
sentences = html2sent.tokenize(html, language='english')

If you don't want to use NLTK, you can just use preprocess functions:

import html2sent
text = html2sent.html2text(html)
text = html2sent.preprocess_text(text)

Demo: demo_simple.py and demo_folder_multiprocessing.py

For russian language

Если для разделения полученного текста на предложения используется библиотека nltk, то для русского языка нужно еще скачать обученный ru_punkt-токенизатор.

Варианты:

Скопируйте файл russian.pickle в папку nltk_data (к остальным языковым .pickle файлам)

Альтернативный более точный вариант - библиотека razdel

Подробнее об использовании - https://github.com/natasha/razdel

html2sent's People

Contributors

kmint21 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.