reading

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package reading is the agent reading books a passage a sitting over many days, and Wikipedia articles at once. Texts are kept in the store, so a book is downloaded once.

Index

Constants

View Source
const (
	BookName    = "read_book"
	ArticleName = "read_article"

	NotesKind = "reading_notes"

	PassageSize = 12000 // bytes of a book read in one sitting, about 3,000 tokens
	ArticleSize = 20000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	Library Library
	Store   Store
}

func (Article) Describe

func (Article) Describe() string

func (Article) Name

func (Article) Name() string

func (Article) Prepare

func (r Article) Prepare(ctx context.Context, a ability.Act) (ability.Material, error)

func (Article) Risk

func (Article) Risk() ability.Risk

type Book

type Book struct {
	Library Library
	Store   Store
}

func (Book) Continues

func (Book) Continues(p memory.Project) bool

func (Book) Describe

func (Book) Describe() string

func (Book) Name

func (Book) Name() string

func (Book) Prepare

func (b Book) Prepare(ctx context.Context, a ability.Act) (ability.Material, error)

Prepare gives today's passage of the book, and the project with its place moved on (a new project for a book started without one).

func (Book) Risk

func (Book) Risk() ability.Risk

type Library

type Library interface {
	FindBook(ctx context.Context, query string) (library.Book, error)
	BookText(ctx context.Context, b library.Book) (string, error)
	FindArticle(ctx context.Context, query string) (library.Article, error)
}

type Store

type Store interface {
	// SaveSource stores a source and returns its ID: the existing one if its URL was fetched before.
	SaveSource(ctx context.Context, src memory.Source) (ulid.ULID, error)
	SourceText(ctx context.Context, id ulid.ULID) (string, error)
	ReadingProject(ctx context.Context, source ulid.ULID) (memory.Project, bool, error)
}

Jump to

Keyboard shortcuts

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