A collection of useful functions for writers to analyze text/stories.

Overview

AuthorTools

AuthorTools provides a multitude of functions for easily analyzing (your?) writing. AuthorTools is made especially for creative writers with some python skills, or developers of writing applications. It contains tools to split strings in a variety of ways, such as into sentences or by chapter, and functions to analyze text, like counting the percent of a text that is composed of dialogue (in quotes).

Installation

AuthorTools is available on PyPI.

pip install authortools

Usage

AuthorTools provides its functions in authortools.py. After installation, you will need to import the tools.

import authortools

Then, all functions should be available to you.

import authortools
authortools.word_count("Sample Text.")

There is also another module that contains samples of many of the functions in authortools.py. It's useful if you just want to see a bunch of results on some writing, without going too deep into the tools here.

from authortools import writing_analysis
writing_analysis.run_tests("Sample Text.")

The easiest way to get started with the tools is to copy-paste your story (or whatever) into a .txt file, and read it into a string in Python. Then run the functions on it.

import authortools

text_file = open("input.txt", "r", encoding="utf8")
text = text_file.read()
text_file.close()

print(authortools.avg_word_length(text))

Functions

Sentences

authortools.sentences("First Sentence.  Second Sentence\nThird Sentence.")

Returns an array of individual sentences found in the text. Based on spaces (two spaces, \n, or \t).

Sentences by punctuation

authortools.sentences_by_punctuation("First Sentence.  Second Sentence\nStill the second sentence.")

Returns an array of individual sentences found in the text. Based on punctuation (.?!).

Words

authortools.words("There's like six different words there.")

Returns an array of individual words found in the text. Splits at all spaces and removes most punctuation except those part of the word itself.

Quotes

authortools.quotes("\"This quote will be added to the returned array,\" he said. \"This one will be too; but mine ends with an exclaimation point, which won't be removed, like your comma will be!\" I clarified.")

Returns an array of quotes found in the text. Trailing comma and quotation marks are trimmed from the resulting array.

Chapters

authortools.chapters("Title: Whether this is included is optional.  Chapter 1\nThis is the first chapter.\nChapter 2: This is the second chapter.")

Returns an array of chapters found in the text. Chapters need to be in the format: "Chapter 00". Spacing and case don't matter. Note that "Chapter XIV" and "Chapter Fourteen" will NOT be found and split by this function.

Two optional parameters: num_chapters (int) -- This is in case you wanted to limit it. num_chapters defaults to 100, but the function returns when it can't find any more chapters. include_title defaults to False; Should any text found before the first chapter be included as the first element of the returned list?

Split into parts

authortools.split_into_parts("Part one  Part two  Part three", 3)

Splits text into an array of n equally sized parts. Good for analyzing writing that doesn't have defined chapters; like, split into three parts, and run avg_sentence_word_count on each part to see if your style changed.

Split by size

authortools.split_by_size("Part one  Part two  Part three", 10)

Splits text into an array with each part being of size n.

Letter count

authortools.letter_count("Ten letters!")

Counts the letters (a-z and A-Z) in a given string.

Word count

authortools.word_count("There are five words here.")

Returns the number of words in a given string.

Average word length

authortools.avg_word_length("avg len is 2.5") 

Returns the average word length in a given string.

Percent char in quotes

authortools.percent_char_in_quotes("\"0.35,\" he said.") 

Returns the percent (0.0-1.0) of characters that are in quotes. Quotation marks not counted as characters. Great for analyzing how frequently one uses dialogue.

Reading time

authortools.reading_time("Not much.") 

Returns the reading time in seconds.

Reading time in minutes

authortools.reading_time_minutes("Even less.") 

Returns the reading time in minutes.

Word counts

my_sentences = authortools.sentences("First Sentence.  Second Sentence\nThird Sentence.")
my_word_counts = authortools.word_counts(my_sentences) 

Returns the word counts for multiple items in a list as a list. Sentence word count should vary in good writing!

Word count change

my_sentences = authortools.sentences("First Sentence.  Second Sentence\nThird Sentence.")
my_word_counts = authortools.word_count_change(my_sentences) 

Returns the word counts change (current - previous) for every item in the list as a list. Sentence word count should vary in good writing!

Average sentence word count

authortools.avg_sentence_word_count("Three words here.  Few here, too.  Average is three.") 

Returns the average amount of words per sentence in a given text.

Word repetitions

authortools.word_repetitions("Words; do any words repeat in this sentence made of words?")

Returns an array containing any words that repeat in the given string. It isn't good to repeat yourself in the same sentence, generally speaking. Pair with authortools.sentences and a loop if you want a per-sentence basis, since this function looks for repetitions in the whole string you give it.

Word frequency

authortools.word_frequency("Two times that two appears in this text.")

Returns a dictionary, with the keys being a word, and the value being the amount of times that word appears in the text. Good for seeing which words are frequently used in a peice of writing.

Owner
Sometimes I upload projects and stuff https://gamejolt.com/@codenameaidan
Packages of Example Data for The Effect

causaldata This repository will contain R, Stata, and Python packages, all called causaldata, which contain data sets that can be used to implement th

103 Dec 24, 2022
Student Management System Built With Python

Student-Management-System Group Members 19BCE183 - Patel Sarthak 19BCE195 - Patel Jinil 19BCE220 - Rana Yash Project Description In our project Studen

Sarthak Patel 6 Oct 20, 2022
Web UI for your scripts with execution management

Script-server is a Web UI for scripts. As an administrator, you add your existing scripts into Script server and other users would be ab

Iaroslav Shepilov 1.1k Jan 09, 2023
Using Python to parse through email logs received through several backup systems.

outlook-automated-backup-control Backup monitoring on a mailbox: In this mailbox there will be backup logs. The identification will based on the follo

Connor 2 Sep 28, 2022
Passenger Car Unit (PCU) Calculator

This is a streamlit web application which can be used to calculate Passenger Car Unit (PCU) values for a selected road section.

Dineth Dhananjaya 1 Apr 26, 2022
RFDesign - Protein hallucination and inpainting with RoseTTAFold

RFDesign: Protein hallucination and inpainting with RoseTTAFold Jue Wang (juewan

139 Jan 06, 2023
Py4J enables Python programs to dynamically access arbitrary Java objects

Py4J Py4J enables Python programs running in a Python interpreter to dynamically access Java objects in a Java Virtual Machine. Methods are called as

Barthelemy Dagenais 1k Jan 02, 2023
A stupid obfuscation thing

StupidObfuscation A stupid obfuscation thing How it works The obfuscator takes a string, splits into pieces of one, then, using the table from letter.

Echo 2 May 03, 2022
You can change your mac address with this program.

1 - Warning! You can use this program with Kali Linux. Therefore if you don't install the Kali Linux. Firstly you need to install Kali Linux. 2 - Star

Mustafa Bahadır Doğrusöz 1 Jun 10, 2022
Read and write life sciences file formats

Python-bioformats is a Python wrapper for Bio-Formats, a standalone Java library for reading and writing life sciences image file formats. Bio-Formats

CellProfiler 106 Dec 19, 2022
TallerStereoVision Convencion Python Chile 2021

TallerStereoVision Convencion Python Chile 2021 Taller Stereo Vision & Python PyCon.cl 2021 Instalación Se recomienta utilizar Virtual Environment pyt

2 Oct 20, 2022
An example project which contains the Unity components necessary to complete Navigation2's SLAM tutorial with a Turtlebot3, using a custom Unity environment in place of Gazebo.

Navigation 2 SLAM Example This example provides a Unity Project and a colcon workspace that, when used together, allows a user to substitute Unity as

Unity Technologies 183 Jan 04, 2023
A timer for bird lovers, plays a random birdcall while displaying its image and info.

Birdcall Timer A timer for bird lovers. Siriema hatchling by Junior Peres Junior Background My partner needed a customizable timer for sitting and sta

Marcelo Sanches 1 Jul 08, 2022
Fully coded Apps by Codex.

OpenAI-Codex-Code-Generation Fully coded Apps by Codex. How I use Codex in VSCode to generate multiple completions with autosorting by highest "mean p

nanowell 47 Jan 01, 2023
Expression interpreter written in Python

Calc Interpreter An interpreter modeled after a calculator implemented in Python 3. The program currently only supports basic mathematical expressions

1 Oct 17, 2021
Zues Auto Claimer Leaked By bazooka#0001

Zues Auto Claimer Leaked By bazooka#0001 put proxies in prox.txt put ssid in sid.txt put all users you want to target in user.txt for the login just t

1 Jan 15, 2022
A simple python project which control paint brush in microsoft paint app

Paint Buddy In Python A simple python project which control paint brush in micro

Ordinary Pythoneer 1 Dec 27, 2021
Checks for Vaccine Availability at your district and notifies you using E-mail, subscribe to our website.

Vaccine Availability Notifier Project Description Checks for Vaccine Availability at your district and notifies you using E-mail every 10 mins. Kindly

Farhan Hai Khan 19 Jun 03, 2021
BridgeWalk is a partially-observed reinforcement learning environment with dynamics of varying stochasticity.

BridgeWalk is a partially-observed reinforcement learning environment with dynamics of varying stochasticity. The player needs to walk along a bridge to reach a goal location. When the player walks o

Danijar Hafner 6 Jun 13, 2022