kunismos

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2025 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OPTIONSEGMENTKEY string = "archytassavedoptions"
	THEME            string = "theme"
	SET              string = "set"
	SEGMENT          string = "segment"
)
View Source
const (
	DEFAULTADDRESS string = "localhost:50060"
)

Variables

This section is empty.

Functions

func GrammarInterceptor

func GrammarInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

Types

type GrammarBasedQuiz

type GrammarBasedQuiz struct {
	Theme           string           `json:"theme"`
	Set             int              `json:"set"`
	Segment         string           `json:"segment"`
	Description     string           `json:"description"`
	Difficulty      string           `json:"difficulty"`
	Content         []GrammarContent `json:"content"`
	ContractionRule string           `json:"contractionRule,omitempty"`
}

type GrammarClient

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

func NewAnisthenesClient

func NewAnisthenesClient(address string) (*GrammarClient, error)

func (*GrammarClient) Answer

func (*GrammarClient) Health

func (g *GrammarClient) Health(ctx context.Context, request *pb.HealthRequest) (*pb.HealthResponse, error)

func (*GrammarClient) Options

func (g *GrammarClient) Options(ctx context.Context, request *pb.OptionsRequest) (*pb.AggregatedOptions, error)

func (*GrammarClient) Question

func (g *GrammarClient) Question(ctx context.Context, request *pb.CreationRequest) (*pb.QuizResponse, error)

func (*GrammarClient) WaitForHealthyState

func (g *GrammarClient) WaitForHealthyState() bool

type GrammarContent

type GrammarContent struct {
	Greek           string `json:"greek"`
	DictionaryForm  string `json:"dictionaryForm"`
	Translation     string `json:"translation"`
	Stem            string `json:"stem"`
	GrammarQuestion struct {
		Tense         string `json:"tense"`
		Voice         string `json:"voice"`
		Mood          string `json:"mood"`
		Person        string `json:"person"`
		Number        string `json:"number"`
		CorrectAnswer string `json:"correctAnswer"`
	} `json:"grammarQuestion"`
}

type GrammarService

type GrammarService interface {
	WaitForHealthyState() bool
	Options(ctx context.Context, request *pb.OptionsRequest) (*pb.AggregatedOptions, error)
	Question(ctx context.Context, request *pb.CreationRequest) (*pb.QuizResponse, error)
	Answer(ctx context.Context, request *pb.AnswerRequest) (*pb.ComprehensiveResponse, error)
}

type GrammarServiceClient

type GrammarServiceClient struct {
	Impl GrammarService
}

type GrammarServiceImpl

type GrammarServiceImpl struct {
	Elastic    aristoteles.Client
	Index      string
	Version    string
	Randomizer randomizer.Random
	Client     service.OdysseiaClient
	Streamer   pbar.TraceService_ChorusClient
	Archytas   archytas.Client
	Progress   *ProgressTracker
	pb.UnimplementedAnisthenesServer
}

func CreateNewConfig

func CreateNewConfig(ctx context.Context) (*GrammarServiceImpl, error)

func (*GrammarServiceImpl) Answer

func (*GrammarServiceImpl) Health

func (*GrammarServiceImpl) Options

func (*GrammarServiceImpl) Question

func (g *GrammarServiceImpl) Question(ctx context.Context, request *pb.CreationRequest) (*pb.QuizResponse, error)

type ProgressTracker

type ProgressTracker struct {
	sync.RWMutex
	Data map[string]*SessionProgress
}

func (*ProgressTracker) ClearSegment

func (p *ProgressTracker) ClearSegment(sessionId, segmentKey string)

func (*ProgressTracker) Exists

func (p *ProgressTracker) Exists(sessionId, segmentKey string) bool

func (*ProgressTracker) GetPlayableWords

func (p *ProgressTracker) GetPlayableWords(sessionId, segmentKey string, doneAfter int) (unplayed, unmastered []string)

func (*ProgressTracker) GetProgressForSegment

func (p *ProgressTracker) GetProgressForSegment(sessionId, segmentKey string, doneAfter int) (map[string]*WordProgress, bool)

func (*ProgressTracker) GetRetryableWords

func (p *ProgressTracker) GetRetryableWords(sessionId, segmentKey string, doneAfter int) []string

func (*ProgressTracker) InitWordsForSegment

func (p *ProgressTracker) InitWordsForSegment(sessionId, segmentKey string, greekWords []string)

func (*ProgressTracker) RecordAnswerResult

func (p *ProgressTracker) RecordAnswerResult(sessionId, segmentKey, greekWord string, correct bool)

func (*ProgressTracker) RecordWordPlay

func (p *ProgressTracker) RecordWordPlay(sessionId, segmentKey, greekWord, translation string)

func (*ProgressTracker) ResetSegment

func (p *ProgressTracker) ResetSegment(sessionId, segmentKey string)

type SessionProgress

type SessionProgress struct {
	// Key: "theme+set+segment"
	// Value: map of Greek word -> WordProgress
	Progress     map[string]map[string]*WordProgress
	PreviousRuns map[string][]map[string]*WordProgress
}

type WordProgress

type WordProgress struct {
	PlayCount      int
	CorrectCount   int
	IncorrectCount int
	Translation    string
	LastPlayed     time.Time
}

func (*WordProgress) Accuracy

func (wp *WordProgress) Accuracy() float64

Jump to

Keyboard shortcuts

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