readingtime

package module
v0.0.0-...-bef8821 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2019 License: MIT Imports: 3 Imported by: 0

README

readingtime

Estimate text reading times

Documentation

Overview

Package readingtime estimates text reading times

We use non-scientific means of first establishing the number of words in a given text and then based on read speeds from http://www.readingsoft.com/ calculate the time required to read that number of words in the text.

Index

Constants

View Source
const (
	InsufficientScreenReaderSpeed = 100.0
	InsufficientPaperReaderSpeed  = 110.0
	AverageScreenReaderSpeed      = 200.0
	AveragePaperReaderSpeed       = 240.0
	FastScreenReaderSpeed         = 300.0
	FastPaperReaderSpeed          = 400.0
	AccomplishedScreenReaderSpeed = 700.0
	AccomplishedPaperReaderSpeed  = 1000.0
)

Reader profile average reading times in words per minute from http://www.readingsoft.com/

Variables

View Source
var (
	DefaultWordsPerMinute = AverageScreenReaderSpeed
	DefaultWords          = regexp.MustCompile(`\s`)
	DefaultRound          = time.Second
	Default               = Estimator{}
)

Defaults.

Functions

func Estimate

func Estimate(text string) time.Duration

Estimate the reading time for a given text using defaults.

Types

type Estimator

type Estimator struct {
	WordsPerMinute float64

	// Words matcher.
	Words *regexp.Regexp

	// Round duration value, set to 1 to disable rounding.
	Round time.Duration

	// NoStrip skips trimming of white space characters.
	NoStrip bool
}

Estimator can estimate the reading time.

func (Estimator) Estimate

func (e Estimator) Estimate(text string) time.Duration

Estimate the reading time for a given text.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL