Skip to main content

Punctuation restoration library

Project description

Punctuation restoration

Adds punctuation and capitalization for a given text.

Works on Danish, German and English.

Models hosted on huggingface! <3

Status with python 3.8

example workflow example workflow

Installation

pip install punctfix

Usage

Its quite simple to use!

>>> from punctfix import PunctFixer
>>> model = PunctFixer(language="da")

>>> example_text = "mit navn det er rasmus og jeg kommer fra firmaet alvenir det er mig som har trænet denne lækre model"
>>> print(model.punctuate(example_text))
'Mit navn det er Rasmus og jeg kommer fra firmaet Alvenir. Det er mig som har trænet denne lækre model.'

>>> example_text = "en dag bliver vi sku glade for, at vi nu kan sætte punktummer og kommaer i en sætning det fungerer da meget godt ikke"
>>> print(fixer.punctuate(example_text)) 
'En dag bliver vi sku glade for, at vi nu kan sætte punktummer og kommaer i en sætning. Det fungerer da meget godt, ikke?' 

Parameters for PunctFixer

  • Pass device="cuda" or device="cpu" to indicate where to run inference. Default is device="cpu"
  • To handle long sequences, we use a chunk size and an overlap. These can be modified. For higher speed but lower acuracy use a chunk size of 150-200 and very little overlap i.e. 5-10. These parameters are set with default values word_chunk_size=100, word_overlap=70 which makes it run a bit slow. The default parameters will be updated when we have some results on variations.
  • Supported languages are "en" for English, "da" for Danish and "de" for German. Default is language="da".

Contribute

If you encounter issues, feel free to open issues in the repo and then we will fix. Even better, create issue and then a PR that fixes the issue! ;-)

Happy punctuating!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

punctfix-0.0.9.tar.gz (12.1 kB view details)

Uploaded Source

File details

Details for the file punctfix-0.0.9.tar.gz.

File metadata

  • Download URL: punctfix-0.0.9.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for punctfix-0.0.9.tar.gz
Algorithm Hash digest
SHA256 eebcabfb845b7dacb50f28fd165dc6dc8573a328df65e42785b0070712a11368
MD5 26e0f01e0d248cc9c515830b7896238d
BLAKE2b-256 c2c2facd6664c55b2a9173ccc2d2c18a55efc265a51e27a5100c6534a6cc5e03

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page