study

package
v0.0.0-...-e3cadf0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package study provides the services for testing and studying flashcards according to Leitner's system.

There are three modules: text generation, flashcards learning and exercises with flashcards.

Index

Constants

View Source
const (
	Bad = models.Mark(iota)
	Satisfactory
	Excellent
)

Variables

View Source
var ErrCardsAmt = fmt.Errorf("wrong amount of cards returned")
View Source
var ErrNoCards = fmt.Errorf("no cards")

Functions

This section is empty.

Types

type IPalmService

type IPalmService interface {
	GenerateTextWithWords(words []string) (string, error)
}

type IStudyService

type IStudyService interface {
	// GetNextRandom returns a random card from the entire set of user cards with expired CoolDown.
	GetNextRandom(ctx context.Context, uid models.UserId, down models.CoolDown) (models.FlashcardId, error)

	// GetNextRandomN returns at most n random card from the entire set of user cards with expired CoolDown.
	GetNextRandomN(ctx context.Context, uid models.UserId, down models.CoolDown, n int) ([]models.FlashcardId, error)

	// GetNextRandomDeck returns a random card from the user's deck with expired CoolDown.
	GetNextRandomDeck(ctx context.Context, uid models.UserId, id models.DeckId, down models.CoolDown) (models.FlashcardId, error)

	// GetNextRandomDeckN returns at most n random cards from the user's deck with expired CoolDown.
	GetNextRandomDeckN(ctx context.Context, uid models.UserId, id models.DeckId, down models.CoolDown, n int) ([]models.FlashcardId, error)

	// Rate moves the card into the box relative to the mark.
	Rate(ctx context.Context, uid models.UserId, id models.FlashcardId, mark models.Mark) error

	// MakeMatching returns a matching comprised from words from the entire set of user cards with expired CoolDown.
	MakeMatching(ctx context.Context, uid models.UserId, down models.CoolDown, size int) (models.Matching, error)

	// MakeMatchingDeck returns a matching comprised from words from the given deck with cards with expired CoolDown.
	MakeMatchingDeck(ctx context.Context, uid models.UserId, id models.DeckId, down models.CoolDown, size int) (models.Matching, error)

	// MakeText returns a text generated by a ***AI_SERVICE_NAME*** from the entire set of user cards with expired CoolDown.
	MakeText(ctx context.Context, uid models.UserId, down models.CoolDown, size int) (models.Text, error)

	// MakeTextDeck returns a text generated by a ***AI_SERVICE_NAME*** from the given deck with cards with expired CoolDown.
	MakeTextDeck(ctx context.Context, uid models.UserId, id models.DeckId, down models.CoolDown, size int) (models.Text, error)
}

func NewService

func NewService(s deck.IService) IStudyService

type Service

type Service struct {
	// contains filtered or unexported fields
}

func (*Service) ConvertIdsToCards

func (s *Service) ConvertIdsToCards(ctx context.Context, uid models.UserId, down models.CoolDown, n int, ids []models.FlashcardId) ([]models.FlashcardId, error)

func (*Service) GetNextRandom

func (s *Service) GetNextRandom(ctx context.Context, uid models.UserId, down models.CoolDown) (models.FlashcardId, error)

GetNextRandom returns a random card from the entire set of user cards with expired CoolDown.

func (*Service) GetNextRandomDeck

func (s *Service) GetNextRandomDeck(ctx context.Context, uid models.UserId, id models.DeckId, down models.CoolDown) (models.FlashcardId, error)

GetNextRandomDeck returns at most n random card from the entire set of user cards with expired CoolDown.

func (*Service) GetNextRandomDeckN

func (s *Service) GetNextRandomDeckN(ctx context.Context, uid models.UserId, id models.DeckId, down models.CoolDown, n int) ([]models.FlashcardId, error)

GetNextRandomDeckN returns at most n random cards from the user's deck with expired CoolDown.

func (*Service) GetNextRandomN

func (s *Service) GetNextRandomN(ctx context.Context, uid models.UserId, down models.CoolDown, n int) ([]models.FlashcardId, error)

GetNextRandomN returns at most n random card from the entire set of user cards with expired CoolDown.

func (*Service) MakeMatching

func (s *Service) MakeMatching(ctx context.Context, uid models.UserId, down models.CoolDown, size int) (models.Matching, error)

MakeMatching returns a matching comprised from words from the entire set of user cards with expired CoolDown.

func (*Service) MakeMatchingBase

func (s *Service) MakeMatchingBase(ctx context.Context, cardIds []models.FlashcardId) (models.Matching, error)

Creates a matching from the given cardIds

func (*Service) MakeMatchingDeck

func (s *Service) MakeMatchingDeck(ctx context.Context, uid models.UserId, id models.DeckId, down models.CoolDown, size int) (models.Matching, error)

MakeMatchingDeck returns a matching comprised from words from the given deck with cards with expired CoolDown.

func (*Service) MakeText

func (s *Service) MakeText(ctx context.Context, uid models.UserId, down models.CoolDown, size int) (models.Text, error)

MakeText returns a text generated by a ***AI_SERVICE_NAME*** from the entire set of user cards with expired CoolDown.

func (*Service) MakeTextBase

func (s *Service) MakeTextBase(ctx context.Context, cardIds []models.FlashcardId) (models.Text, error)

Creates the text from the given cardIds

func (*Service) MakeTextDeck

func (s *Service) MakeTextDeck(ctx context.Context, uid models.UserId, id models.DeckId, down models.CoolDown, size int) (models.Text, error)

MakeTextDeck returns a text generated by a ***AI_SERVICE_NAME*** from the given deck with cards with expired CoolDown.

func (*Service) Rate

func (s *Service) Rate(ctx context.Context, uid models.UserId, id models.FlashcardId, mark models.Mark) error

Rate moves the card into the box relative to the mark.

Jump to

Keyboard shortcuts

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