readingtime: maze.io/x/readingtime Index | Files

package readingtime

import "maze.io/x/readingtime"

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

Package Files

readingtime.go

Constants

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

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

Defaults.

func Estimate Uses

func Estimate(text string) time.Duration

Estimate the reading time for a given text using defaults.

type Estimator Uses

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 Uses

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

Estimate the reading time for a given text.

Package readingtime imports 3 packages (graph). Updated 2019-01-30. Refresh now. Tools for package owners.