Skip to main content

Welcome to clean_plot

Install

The easiest way to install the library is to simply do a pip install.

pip install clean-plot

Another way to install the library would be to build from source. It is more likely that the released version may contain bugs. The source would get updated more often. If you plan to add features to clean_plot yourself, or want to be on the cutting edge, you can use an editable install.

git clone https://github.com/deven367/clean_plot.git
cd clean_plot
pip install -e . 

How to use

The library contains easy to use methods for cleaning text, tokenizing and lemmatizing sentences. These sentences can then be easily fed to a sentence encoder to create sentence embeddings.

fname = '../files/dummy.txt'
text = get_data(fname)
print(text)
MARLEY was dead: to begin with. There is no doubt
whatever about that. The register of his burial was
signed by the clergyman, the clerk, the undertaker,
and the chief mourner. Scrooge signed it: and
Scrooge's name was good upon 'Change, for anything he
chose to put his hand to. Old Marley was as dead as a
door-nail.

Mind! I don't mean to say that I know, of my
own knowledge, what there is particularly dead about
a door-nail. I might have been inclined, myself, to
regard a coffin-nail as the deadest piece of ironmongery
in the trade. But the wisdom of our ancestors
is in the simile; and my unhallowed hands
shall not disturb it, or the Country's done for. You
will therefore permit me to repeat, emphatically, that
Marley was as dead as a door-nail.

This is a new sentence.
sentences = make_sentences(text)
sentences
(#11) ['MARLEY was dead: to begin with.','There is no doubt whatever about that.','The register of his burial was signed by the clergyman, the clerk, the undertaker, and the chief mourner.',"Scrooge signed it: and Scrooge's name was good upon 'Change, for anything he chose to put his hand to.",'Old Marley was as dead as a door-nail.','Mind!',"I don't mean to say that I know, of my own knowledge, what there is particularly dead about a door-nail.",'I might have been inclined, myself, to regard a coffin-nail as the deadest piece of ironmongery in the trade.',"But the wisdom of our ancestors is in the simile; and my unhallowed hands shall not disturb it, or the Country's done for.",'You will therefore permit me to repeat, emphatically, that Marley was as dead as a door-nail.'...]
no_punctuations = []
for sentence in sentences:
    new_sentence = remove_punctuations(sentence)
    no_punctuations.append(new_sentence)
no_punctuations
['MARLEY was dead to begin with',
 'There is no doubt whatever about that',
 'The register of his burial was signed by the clergyman the clerk the undertaker and the chief mourner',
 'Scrooge signed it and Scrooge s name was good upon Change for anything he chose to put his hand to',
 'Old Marley was as dead as a door nail',
 'Mind',
 'I don t mean to say that I know of my own knowledge what there is particularly dead about a door nail',
 'I might have been inclined myself to regard a coffin nail as the deadest piece of ironmongery in the trade',
 'But the wisdom of our ancestors is in the simile and my unhallowed hands shall not disturb it or the Country s done for',
 'You will therefore permit me to repeat emphatically that Marley was as dead as a door nail',
 'This is a new sentence']

Contributing

This library has come into existence because of nbdev (one of many amazing tools made by fast.ai). PRs and Issues are encouraged.

After you clone this repository, please run nbdev_install_hooks in your terminal. This sets up git hooks, which clean up the notebooks to remove the extraneous stuff stored in the notebooks (e.g. which cells you ran) which causes unnecessary merge conflicts.

Before submitting a PR, check that the local library and notebooks match. The script nbdev_fix can let you know if there is a difference between the local library and the notebooks.

If you made a change to the notebooks in one of the exported cells, you can export it to the library with nbdev_export.

If you made a change to the library, you can export it back to the notebooks with nbdev_update.

Release files for clean-plot 0.0.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clean-plot 0.0.13
File Size Uploaded
clean_plot-0.0.13.tar.gz 21.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clean-plot 0.0.13
File Interpreter ABI Platform
clean_plot-0.0.13-py3-none-any.whl Python 3 none any Details

Total release size: 45.1 kB

Release files / clean_plot-0.0.13.tar.gz

Download URL clean_plot-0.0.13.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cdc1b735c199c2c79a11f26f12abc1ca4e2af2da9d4f6976a09d020ed26a3831
BLAKE2b-256 checksum
How to use checksums
81d8cf820fa487e66a0f6f34336342e855be40221153cc8269b3f7f4ddcdead0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / clean_plot-0.0.13-py3-none-any.whl

Download URL clean_plot-0.0.13-py3-none-any.whl
Size 23.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b500664c9c4160865942a7098679e97992427aae0cbe0d592f6ccd8e59df8036
BLAKE2b-256 checksum
How to use checksums
f1d0b3cfc72c6396541c46108da99eeed6c86c528bd927c1f629ac7c413bd09d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.0.13 This release

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page