Skip to main content

A package to provide data and use tools on a text.

Reason this release was yanked:

Stability Issues

Project description

# TextTools4

TextTools4 is a library that gives you the all the details on your provided text.

Alpha Release v0.1.2

## Installing and Importing TextTools4

You can install TextTools4 through PyPi.

`sh pip install TextTools4 `

Import TextTools4 as you would normally import a library.

`py import TextTools4 as tt4 `

You can also import the classes individually.

`py from TextTools4 import GetText, Chart, Tools `

## Modules

## GetText

The GetText class contains functions to extract text from a PDF or a docx file and return a string representation of the text.

`py tt4.GetText.get_pdf(filepath) ` This function takes in a valid filepath to a PDF document and uses PyPDF4 to get the text. It then returns a string with all of the raw content on the page. (We are adding functionality to return a list of strings, with each item being the raw text of a single page).

`py tt4.GetText.get_doc(filepath) ` This function takes in a valid filepath to a doc or docx document and uses the docx library to get the text. It then returns a string with all of the raw content on the page.

## Chart

The Chart class creates a bar chart of the most popular words in a provided text.

`py tt4.Chart.create(src = None, top = 10, other = False, text_title = None, common_words = 'default') `

  • src: provide source text to create chart on

  • top: number of words you want displayed on the chart

  • other: adds ‘other’ to chart, showing the number of all the words not in the chart

  • text_title: title of chart, if not provided provides default title

  • common_words: words to exclude from the graph. There are three presets: ‘default’, ‘none’, and ‘strict’.

Default: [“the”, “be”, “to”, “of”, “and”, “a”, “an”, “in”, “is”, “you”, “but”, “for”, “I”] None: [ ] Strict: [“the”, “be”, “to”, “of”, “and”, “a”, “an”, “in”, “is”, “you”, “but”, “for”, “I”, “with”, “it”, “my”, “me”, “us”]

You can also provide a custom list with the words you choose to exclude.

## Tools

The Tools class contains tools to help you understand your text.

`py tt4.Tools.reading_ease(text) `

This function takes in a text and returns the Flesch Reading Ease Score. Reading ease is important because if your text has too low of a reading ease, you will not be able to reach as many people. The FRE is the most popular and widely accepted method to measure reading ease.

More information on the [Flesch Reading Ease Score.](https://en.wikipedia.org/wiki/Flesch–Kincaid_readability_tests#Flesch_reading_ease)

`py tt4.Tools.grade_level(text) `

This function takes in a text and returns the Flesch-Kincaid Grade Level of the text. This number represents the number of years of schooling (from Grade 1) a person should have to understand this text. The Flesch-Kincaid Grade Level is the most popular method of finding the grade level for a given text.

More information on the [Flesch-Kincaid Grade Level.](https://en.wikipedia.org/wiki/Flesch–Kincaid_readability_tests#Flesch–Kincaid_grade_level)

`py tt4.Tools.split(text, length) `

This function takes in a text and a length and splits the text into chunks of length, and returns a list of strings of equal (if there is no remainder) length.

`py tt4.Tools.sarcastext(text) `

This function takes in a text and returns a string with all of the characters in the text randomly made uppercase/lowercase to make the text sarcastic.

`py tt4.Tools.table(data, sides=["|", "_"]) `

This function takes in two parameters, the data of type dict and a list sides. It returns a string table with two columns, with the vertical borders as sides[0] and the horizontal borders as sides[1].

## License

MIT

### Thank you for using TextTools4! - SR2020

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

TextTools4-0.1.2.tar.gz (5.3 kB view details)

Uploaded Source

File details

Details for the file TextTools4-0.1.2.tar.gz.

File metadata

  • Download URL: TextTools4-0.1.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for TextTools4-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d5d8781b633bf9b0be39a03405711ee0f6a55104011a4c82dac9a36e831b455d
MD5 5e7bb9f6596a933dd1b88b9ea0d4ab2e
BLAKE2b-256 384b447e5bb95b7e72a1e4e706a4b7935e49c1c0bff0e3c5beb96f1737a0ec5b

See more details on using hashes here.

Supported by

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