Documentation
¶
Index ¶
- Constants
- func AnsiColorTokens(cmds string) string
- func ComputeCommandProbabilities(ctx context.Context, settings *Settings, queries DatabaseQuerer, cwd string, ...) (map[string]float64, error)
- func ProcessCmd(fs StatFileSystem, cmd string) string
- type Core
- type DBTX
- type DatabaseQuerer
- type FileSystem
- type OsFs
- type Queries
- func (q *Queries) ConditionalEventCounts(ctx context.Context, cwd *string, previousCmd *string, minEventCount *int) (map[string]int, error)
- func (q *Queries) CreateSchema(ctx context.Context) error
- func (q *Queries) GetRow(ctx context.Context, cwd, previousCmd, currentCmd string) (Row, error)
- func (q *Queries) InsertRow(ctx context.Context, arg Row) error
- func (q *Queries) UpdateRow(ctx context.Context, arg Row) error
- func (q *Queries) WithTx(tx *sql.Tx) *Queries
- type Row
- type Settings
- type StatFileSystem
- type Token
Constants ¶
View Source
const BayeshDirEnvVar = "BAYESH_DIR"
View Source
const LogLevelEnvVar = "BAYESH_LOG_LEVEL"
View Source
const MinRequiredEventsEnvVar = "BAYESH_MIN_REQUIRED_EVENTS"
Variables ¶
This section is empty.
Functions ¶
func AnsiColorTokens ¶
func ComputeCommandProbabilities ¶ added in v0.0.2
func ComputeCommandProbabilities(ctx context.Context, settings *Settings, queries DatabaseQuerer, cwd string, processedPreviousCmd string) (map[string]float64, error)
Computes a weighted average of conditional probabilities. I.e. it computes the average of P(cmd|cwd), P(cmd|previousCmd), and P(cmd|cwd, previousCmd). This can be thought of as a Bayesian inference (E(P(cmd|a)) where a is the context).
func ProcessCmd ¶
func ProcessCmd(fs StatFileSystem, cmd string) string
Update ProcessCmd to use StatFileSystem
Types ¶
type Core ¶
type Core struct {
Settings *Settings
// contains filtered or unexported fields
}
func (*Core) InferCommands ¶
type DatabaseQuerer ¶ added in v0.0.2
type FileSystem ¶
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) ConditionalEventCounts ¶ added in v0.0.2
type Settings ¶
type Settings struct {
BayeshDir string `json:"BAYESH_DIR" validate:"required,dir"`
Database string `json:"BAYESH_DATABASE" validate:"required,file"`
LogLevel slog.Level `json:"BAYESH_LOG_LEVEL" validate:"required"`
MinRequiredEvents int `json:"BAYESH_MIN_REQUIRED_EVENTS" validate:"required,min=0"`
}
Click to show internal directories.
Click to hide internal directories.