Crate kalosm_sample

Crate kalosm_sample 

Source
Expand description

§kalosm-sample

This is a sampling library for Kalosm.

It handles choosing a token from a probability distribution. Samplers can be used to constrain the generation of text for example you can use a sampler to prevent the model from generating the same word twice in a row. Or you could only allow the model to generate a list of single digit numbers.

Macros§

bail
Bail out with the given error.

Structs§

AnyOfSchema
A schema that matches any of the composite schemas
ArcParser
A boxed parser.
ArraySchema
A schema for an array
BooleanSchema
A schema for a boolean
ChoiceParser
A parser for a choice of two parsers.
ChoiceParserState
State of a choice parser.
ConstSchema
A schema for a constant
EmptyNumber
An error that can occur while parsing a float literal when trying to parse a number with no characters.
EnumSchema
A schema for an enum
FloatParser
A parser for a float.
FloatParserState
The state of an integer parser.
I8Parser
A parser for i8.
I16Parser
A parser for i16.
I32Parser
A parser for i32.
I64Parser
A parser for i64.
IfThenSchema
A schema for an conditional schema
IndexParser
A parser that parses a sequence of parsers and returns the index of the first parser that succeeds
IndexParserState
The state of the IndexParser parser
IntegerParser
A parser for an integer.
IntegerParserState
The state of an integer parser.
IntegerSchema
A schema for an integer
InvalidDecimalLocation
An error that can occur while parsing a float literal when the number contains a decimal point in the wrong place.
InvalidSignLocation
An error that can occur while parsing a float literal when the number contains a sign in the wrong place.
JsonObjectSchema
A schema for an object
JsonPropertySchema
A schema for a property of an object
LazyParser
A parser that is lazily initialized.
LeadingZeroError
An error that can occur while parsing a float literal when the number starts with a leading zero.
LiteralMismatchError
The error type for a literal parser.
LiteralParser
A parser for a literal.
LiteralParserOffset
The state of a literal parser.
MapOutputParser
A parser that maps the output of another parser.
NumberSchema
A schema for a number (floating point or integer)
OneLine
One line of text with some non-whitespace characters
OneLineError
An error that can occur when parsing a OneLine
OneLineState
The state of the OneLine parser
OneOfSchema
A schema that matches one of the composite schemas
OutOfRangeError
An error that can occur while parsing a float literal when the number is out of range.
ParserError
An error that occurred while parsing.
RegexParser
A parser that uses a regex pattern to parse input.
RegexParserState
The state of a regex parser.
RepeatParser
A parser for a repeat of two parsers.
RepeatParserState
State of a repeat parser.
Sentence
A single word.
SentenceParser
A parser for a word.
SeparatedParser
A parser for a repeat of two parsers.
SeparatedParserState
State of a repeat parser.
SequenceParser
A parser for a sequence of two parsers.
StopOn
A parser that parses until a literal is found.
StopOnOffset
The state of a stop on literal parser.
StopOnParseError
An error that can occur while parsing a string literal.
StringParseError
An error that can occur while parsing a string literal.
StringParser
A parser for an ascii string.
StringParserState
The state of a literal parser.
StringSchema
A schema for a string
ThenLazy
A parser that is initialized lazily based on the state of the previous parser.
U8Parser
A parser for u8.
U16Parser
A parser for u16.
U32Parser
A parser for u32.
U64Parser
A parser for u64.
WithInitialState
A parser with lazy initial state
Word
A single word.
WordParser
A parser for a word.

Enums§

Either
A value that can be one of two types.
OwnedParseResult
A parser for a choice between two parsers.
ParseStatus
The state of a parser.
SchemaLiteral
A literal value in a schema
SchemaType
The type of a schema
SeparatedItemState
The state of the item in the separated parser.
SequenceParserState
State of a sequence parser.
StructureParser
A validator for a string
StructureParserState
The state of a structure parser.
ThenLazyParserState
State of a then lazy parser.

Traits§

CreateParserState
A trait for a parser with a default state.
Parse
Data that can be parsed incrementally.
Parser
An incremental parser for a structured input.
ParserExt
An extension trait for parsers.
Schema
A description of the format of a type
SendCreateParserState
An auto trait for a Send parser with a default state.

Type Aliases§

ParseResult
A result type for parsers.

Derive Macros§

Parse
Derive a default JSON parser for a unit value, struct or enum.
Schema