Documentation
¶
Overview ¶
Package domain implements the core business logic of the application.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidDirPath indicates that the provided directory path is invalid. ErrInvalidDirPath = errors.New("invalid directory path") // ErrFileOperation indicates a failure during file operations. ErrFileOperation = errors.New("file operation failed") // ErrTokenization indicates a failure during tokenization. ErrTextProcessing = errors.New("text processing failed") // ErrEmptyDir indicates that no eligible files were found in the specified // directory. ErrEmptyDir = errors.New("no eligible files found in directory") // ErrTooManyErrors indicates that too many errors occurred during directory // processing, leading to an abort. ErrTooManyErrors = errors.New("too many errors during directory processing") // ErrNoTokensFound indicates that no tokens were found after processing the // files in the specified directory. ErrNoTokensFound = errors.New("no tokens found in directory") )
Functions ¶
func ProcessDirectory ¶
ProcessDirectory tokenizes all eligible files in the specified directory and stores the tokens in the database. It returns an error if a set number of errors occur during processing.
func Progress ¶ added in v0.2.0
func Progress() float64
Progress returns the current progress of directory processing as a float between 0 and 1.
func Prompt ¶
Prompt generates a prompt of the maximum specified character length from tokens of the specified directory. This is the main entry point of the domain package.
The function pools prompts in the background for efficiency.
If the TYPOMAT_PROMPT environment variable is set, its value is used directly as the prompt, bypassing text generation.
Types ¶
type FileStatus ¶
type FileStatus int
FileStatus represents the status of a file with respect to the database.
const ( // FileStatusUnchanged indicates the file is unchanged since last // tokenization. FileStatusUnchanged FileStatus = iota // FileStatusChanged indicates the file has changed since last tokenization. FileStatusChanged // FileStatusNew indicates the file is new and not present in the database. FileStatusNew // FileStatusIneligible indicates the file is ineligible for tokenization. FileStatusIneligible )