readingtime

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MIT Imports: 5 Imported by: 0

README

go-readingtime

Estimate how long it takes to read a text

Coded with 💙 by edoardottt

go action go report card

InstallUsageChangelogContributingLicense

Install 📡

go install github.com/edoardottt/go-readingtime/cmd/readt@latest

Usage 💡

CLI tool

readt <filepath>

Golang module

package main

import (
 "fmt"

 reading "github.com/edoardottt/go-readingtime"
)

func main() {
 s := reading.RawEstimate(`Lorem ipsum dolor sit amet, consectetur...`)
 fmt.Println(s) // 130

 d := reading.Estimate(`Lorem ipsum dolor sit amet, consectetur...`)
 fmt.Println(d) // 2m10s

 h := reading.HumanEstimate(`Lorem ipsum dolor sit amet, consectetur...`)
 fmt.Println(h) // 2 minutes
}

Read the package documentation here.

Changelog 📌

Detailed changes for each release are documented in the release notes.

Contributing 🛠

Just open an issue / pull request.

Before opening a pull request, download golangci-lint and run

golangci-lint run

If there aren't errors, go ahead :)

License 📝

This repository is under MIT License.
edoardoottavianelli.it to contact me.

Documentation

Index

Constants

View Source
const (
	Version = "0.0.4"
)

https://www.sciencedirect.com/science/article/abs/pii/S0749596X19300786.

Variables

This section is empty.

Functions

func Estimate

func Estimate(input string) time.Duration

Estimate returns a time.Duration object representing an estimation of how long it would take to read the input text.

func HumanEstimate added in v0.0.2

func HumanEstimate(input string) string

HumanEstimate returns a string representing a humanly readable estimation of how long it would take to read the input text.

func RawEstimate

func RawEstimate(input string) float64

RawEstimate returns a float64 (seconds) representing an estimation of how long it would take to read the input text.

Types

This section is empty.

Directories

Path Synopsis
cmd
readt command

Jump to

Keyboard shortcuts

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