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
Simple script to match riders with drivers.

theBestPooler Simple script to match riders with drivers. It's a greedy, unoptimised search, so no guarantees that it works. It just seems to work (ve

Devansh 1 Nov 22, 2021
The calculator on Python.

Calculator Contributors: Delitanast An official website. Information Hello! I am Damir. It`s my first Python project. I think you want see this. I imp

3 Mar 13, 2022
Turn crypto miner on/off depending on powerwall charge level

Mining Crypto with Tesla Solar and Powerwalls This script turns a crypto miner on and off when the Tesla Powerwall level drops/rises above a certain t

Matt 1 Nov 09, 2021
✨ Udemy Coupon Finder For Discord. Supports Turkish & English Language.

Udemy Course Finder Bot | Udemy Kupon Bulucu Botu This bot finds new udemy coupons and sends to the channel. Before Setup You must have python = 3.6

Penguen 4 May 04, 2022
Python-Course-V1 - This Repo contains a series of Python Jupyter Notebooks and assignments

This Repo contains a series of Python Jupyter Notebooks and assignments. The assignments are taken from Python Crash Course book by Eric Matthes.

2 Nov 15, 2022
Render your templates using .txt files

PizzaX About Run Run tests To run the tests, open your terminal and type python tests.py (WIN) or python3 tests.py (UNX) Using the function To use the

Marcello Belanda 2 Nov 24, 2021
An extension for Arma 3 that lets you write extensions in Python 3

An Arma 3 extension that lets you to write python extensions for Arma 3. And it's really simple and straightforward to use!

Lukasz Taczuk 48 Dec 18, 2022
My Analysis of the VC4 Assembly Code from the RPI4

My Analysis of the VC4 Assembly Code from the RPI4

Nicholas Starke 31 Jul 13, 2022
Freeze your objects in python

gelidum Freeze your objects in python. Latin English Caelum est hieme frigidum et gelidum; myrtos oleas quaeque alia assiduo tepore laetantur, asperna

Diego J. 51 Dec 22, 2022
Project Interface For nextcord-ext

Project Interface For nextcord-ext

nextcord-ext 1 Nov 13, 2021
Percolation simulation using python

PythonPercolation Percolation simulation using python Exemple de percolation : Etude statistique sur le pourcentage de remplissage jusqu'à percolation

Tony Chouteau 1 Sep 08, 2022
Prometheus exporter for chess.com player data

chess-exporter Prometheus exporter for chess.com player data implemented via chess.com's published data API and Prometheus Python Client Example use c

Mário Uhrík 7 Feb 28, 2022
Gunakan Dengan Bijak!!

YMBF Made with ❤️ by ikiwzXD_ menu Results notice me: if you get cp results, save 3/7 days then log in. Install script on Termux $ pkg update && pkg u

Ikiwz 0 Jul 11, 2022
Team Hash Brown Science4Cast Submission

Team Hash Brown Science4Cast Submission This code reproduces Team Hash Brown's (@princengoc, @Xieyangxinyu) best submission (ee5a) for the competition

3 Feb 02, 2022
HomeAssistant Linux Companion

Application to run on linux desktop computer to provide sensors data to homeasssistant, and get notifications as if it was a mobile device.

Javier Lopez 10 Dec 27, 2022
A Python library for inspecting JVM class files (.class)

lawu Lawu is a human-friendly library for assembling, disassembling, and exploring JVM class files. It's highly suitable for automation tasks. Documen

Tyler Kennedy 45 Oct 23, 2022
Search and Find Jobs in Ethiopia

✨ EthioJobs ✨ Search and Find Jobs in Ethiopia Easy start critical warning Use pycharm No vscode No sublime No Vim No nothing when you want to use

Abdimk 12 Nov 09, 2022
Really bad lisp implementation. Fun with pattern matching.

Lisp-py This is a horrible, ugly interpreter for a trivial lisp. Don't use it. It was written as an excuse to mess around with the new pattern matchin

Erik Derohanian 1 Nov 23, 2021
The Doodle Master seeks to turn your UI mockups into real code.

Doodle Master The Doodle Master seeks to turn your UI mockups into real code. Currently this repository just serves to demonstrate a Proof Of Concept

Karanbir Chahal 2.4k Dec 09, 2022
Python bilgilerimi eğlenceli bir şekilde hatırlamak ve daha da geliştirmek için The Big Book of Small Python Projects isimli bir kitap almıştım.

Python bilgilerimi eğlenceli bir şekilde hatırlamak ve daha da geliştirmek için The Big Book of Small Python Projects isimli bir kitap almıştım. Bu repo kitaptaki örnek programları çalıştığım oyun al

Burak Selim Senyurt 22 Oct 26, 2022