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
A full-featured, hackable tiling window manager written and configured in Python

A full-featured, hackable tiling window manager written and configured in Python Features Simple, small and extensible. It's easy to write your own la

Qtile 3.8k Dec 31, 2022
Simple Python tool to check if there is an Office 365 instance linked to a domain.

o365chk.py Simple Python script to check if there is an Office365 instance linked to a particular domain.

Steven Harris 37 Jan 02, 2023
JSEngine is a simple wrapper of Javascript engines.

JSEngine This is a simple wrapper of Javascript engines, it wraps the Javascript interpreter for Python use. There are two ways to call interpreters,

11 Dec 18, 2022
Taking the fight to the establishment.

Throwdown Taking the fight to the establishment. Wat? I wanted a simple markdown interpreter in python and/or javascript to output html for my website

Trevor van Hoof 1 Feb 01, 2022
pyinsim is a InSim module for the Python programming language.

PYINSIM pyinsim is a InSim module for the Python programming language. It creates socket connection with LFS and provides many classes, functions and

2 May 12, 2022
SimBiber - A tool for simplifying bibtex with official info

SimBiber: A tool for simplifying bibtex with official info. We often need to sim

336 Jan 02, 2023
Buffer Overflows

BOF Buffer Overflows 1. BOF tips Practice using mona.py Download vulnerable exe from Exploit DB.

Vinh Nguyễn 27 Dec 08, 2022
Um Script De Mensagem anonimas Para linux e Termux Feito em python

Um Script De Mensagem anonimas Para linux e Termux Feito em python feito em um celular

6 Sep 09, 2021
Bionic is Python Framework for crafting beautiful, fast user experiences for web and is free and open source.

Bionic is Python Framework for crafting beautiful, fast user experiences for web and is free and open source. Getting Started This is an example of ho

14 Apr 10, 2022
bib2xml - A tool for getting Word formatted XML from Bibtex files

bib2xml - A tool for getting Word formatted XML from Bibtex files Processes Bibtex files (.bib), produces Word Bibliography XML (.xml) output Why not

Matheus Sartor 1 May 05, 2022
Removes all archived super productivity tasks. Just run the python script.

delete-archived-sp-tasks.py Removes all archived super productivity tasks. Just run the python script. This is helpful to do a cleanup every 3-6 month

Ben Herbst 1 Jan 09, 2022
Digitales Raumbuch

Helios Digitales Raumbuch Settings Moved to settings. Basic Commands Setting Up Your Users To create a normal user account, just go to Sign Up and fil

1 Nov 19, 2021
Collection of Beginner to Intermediate level Python scripts contributed by members and participants.

Hacktoberfest2021-Python Hello there! This repository contains a 'Collection of Beginner to Intermediate level Python projects', created specially for

12 May 25, 2022
A fishing bot script written in Python!

A fishing bot script written in Python!

Anel Drocic 3 Nov 03, 2021
Creates infinite amount of guilded accounts in seconds.

Guilded Cookie Creator [fuck guilded i quit working on this, they patch like every fucking method after 2/3 days i release shit] Optimizations Asynchr

scripted 7 Feb 28, 2022
Write complicated anonymous functions other than lambdas in Python.

lambdex allows you to write multi-line anonymous function expression (called a lambdex) in an idiomatic manner.

Xie Jingyi 71 May 19, 2022
Usando Multi Player Perceptron e Regressão Logistica para classificação de SPAM

Relatório dos procedimentos executados e resultados obtidos. Objetivos Treinar um modelo para classificação de SPAM usando o dataset train_data. Class

André Mediote 1 Feb 02, 2022
We are building an open database of COVID-19 cases with chest X-ray or CT images.

🛑 Note: please do not claim diagnostic performance of a model without a clinical study! This is not a kaggle competition dataset. Please read this pa

Joseph Paul Cohen 2.9k Dec 30, 2022
Chemical equation balancer

Chemical equation balancer Balance your chemical equations with ease! Installation $ git clone

Marijan Smetko 4 Nov 26, 2022
A pure-Python codified rant aspiring to a world where numbers and types can work together.

Copyright and other protections apply. Please see the accompanying LICENSE file for rights and restrictions governing use of this software. All rights

Matt Bogosian 28 Sep 04, 2022