jess

package
v0.24.8 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2024 License: BSD-3-Clause Imports: 28 Imported by: 1

Documentation

Overview

Game world modeling using English-like sentences. For example:

The kitchen is a room. The closed container called the cabinet is in the kitchen.
The cabinet contains a mug. The mug is transparent.

The commands in this idl aren't used directly by authors. Instead, these commands are created as a byproduct of reading a sentence. Each successfully matched English sentence results in a single [matched_phrase] with exactly one valid member.

The types of sentences jess can process are based on the sentences described in Inform7's documentation. However, Inform can handle a much wider range of sentences than jess.

Index

Constants

View Source
const (
	// special names:
	PlayerSelf    = "self"
	FactDirection = "dir"
	// the most basic kind of physical object;
	// and sometimes used as a placeholder when the particular kind isnt known.
	// ( esp. for instance, a potential room or door when building directions )
	Objects = "objects"
	// other kinds:
	Actors     = "actors"     // for player self
	Directions = "directions" // a special kind of object representing movement of travel
	Rooms      = "rooms"      // possible player locale
	Things     = "things"     // the default for named objects if nothing else is specified
	Doors      = "doors"      // portals which connect rooms
	Verbs      = "verbs"      // nouns are used to describe verbs
	// traits
	CountedTrait     = "counted"
	PluralNamedTrait = "plural named"
	ProperNameTrait  = "proper named"
	// fields:
	Compass           = "compass"
	DoorDestination   = "destination"
	IndefiniteArticle = "indefinite article"
	PrintedName       = "printed name"
	Private           = "privately named"
	Scenery           = "scenery"
	DirectionOpposite = "opposite"
	// relations:
	Whereabouts = "whereabouts"
	// verbs:
	VerbSubject   = "subject"
	VerbAlternate = "alternate subject"
	VerbObject    = "object"
	VerbRelation  = "relation"
	VerbImplies   = "implications"
	VerbReversed  = "reversed status"
	ReversedTrait = "reversed"
)

names ( of properties, kinds, etc. ) that jess expects from the tapestry standard library

View Source
const (
	// only allow simple names when matching.
	PlainNameMatching = (1 << iota)
	// this limits matching to kinds which can be instanced
	// so that names which match other kinds can still become nouns
	// for instance, there can be a pattern called "on" and a verb called "on".
	MatchKindsOfKinds
	MatchKindsOfAspects
	//
	MatchPronouns
	// "called" checks for when the indefinite article
	// is *not* an indefinite article (a/an), and records it.
	// printing references to the noun will the specified article.
	CheckIndefiniteArticles
	// log each match automatically; used for testing
	LogMatches
)

Variables

View Source
var Z_Types = typeinfo.TypeSet{
	Name: "jess",
	Comment: []string{
		"Game world modeling using English-like sentences.",
		"For example:",
		"",
		" The kitchen is a room. The closed container called the cabinet is in the kitchen.",
		" The cabinet contains a mug. The mug is transparent.",
		"",
		"The commands in this idl aren't used directly by authors. Instead, these commands are created as a byproduct of reading a sentence. Each successfully matched English sentence results in a single [matched_phrase] with exactly one valid member.",
		"",
		"The types of sentences jess can process are based on the sentences described in Inform7's documentation. However, Inform can handle a much wider range of sentences than jess.",
	},

	Slot:       z_slot_list,
	Flow:       z_flow_list,
	Signatures: z_signatures,
}

package listing of type data

View Source
var Zt_AdditionalAdjectives typeinfo.Flow

additional_adjectives, a type of flow.

View Source
var Zt_AdditionalDirections typeinfo.Flow

additional_directions, a type of flow.

View Source
var Zt_AdditionalKinds typeinfo.Flow

additional_kinds, a type of flow.

View Source
var Zt_AdditionalLinks typeinfo.Flow

additional_links, a type of flow.

View Source
var Zt_AdditionalNames typeinfo.Flow

additional_names, a type of flow.

View Source
var Zt_AdditionalPossessions typeinfo.Flow

additional_possessions, a type of flow.

View Source
var Zt_AdditionalText typeinfo.Flow

additional_text, a type of flow.

View Source
var Zt_AdditionalTraits typeinfo.Flow

additional_traits, a type of flow.

are, a type of flow.

View Source
var Zt_Article typeinfo.Flow

article, a type of flow.

View Source
var Zt_AspectsAreTraits typeinfo.Flow

aspects_are_traits, a type of flow.

View Source
var Zt_Called typeinfo.Flow

called, a type of flow.

View Source
var Zt_CalledName typeinfo.Flow

called_name, a type of flow.

View Source
var Zt_CommaAnd typeinfo.Flow

comma_and, a type of flow.

View Source
var Zt_CommaAndOr typeinfo.Flow

comma_and_or, a type of flow.

View Source
var Zt_CountedKind typeinfo.Flow

counted_kind, a type of flow.

View Source
var Zt_Direction typeinfo.Flow

direction, a type of flow.

View Source
var Zt_DirectionOfLinking typeinfo.Flow

direction_of_linking, a type of flow.

View Source
var Zt_ExistingNoun typeinfo.Flow

existing_noun, a type of flow.

View Source
var Zt_ImplicitNoun typeinfo.Flow

implicit_noun, a type of flow.

View Source
var Zt_InlineKind typeinfo.Flow

inline_kind, a type of flow.

View Source
var Zt_InlineNoun typeinfo.Flow

inline_noun, a type of flow.

View Source
var Zt_Kind typeinfo.Flow

kind, a type of flow.

View Source
var Zt_KindCalled typeinfo.Flow

kind_called, a type of flow.

View Source
var Zt_KindsAreEither typeinfo.Flow

kinds_are_either, a type of flow.

View Source
var Zt_KindsAreKind typeinfo.Flow

kinds_are_kind, a type of flow.

View Source
var Zt_KindsAreTraits typeinfo.Flow

kinds_are_traits, a type of flow.

View Source
var Zt_KindsHaveProperties typeinfo.Flow

kinds_have_properties, a type of flow.

View Source
var Zt_LineMatcher = typeinfo.Slot{
	Name: "line_matcher",
}

line_matcher, a type of slot.

View Source
var Zt_Linking typeinfo.Flow

linking, a type of flow.

View Source
var Zt_MapConnections typeinfo.Flow

map_connections, a type of flow.

View Source
var Zt_MapDirections typeinfo.Flow

map_directions, a type of flow.

View Source
var Zt_MapLocations typeinfo.Flow

map_locations, a type of flow.

View Source
var Zt_Matched = typeinfo.Slot{
	Name: "matched",
	Markup: map[string]any{
		"--": "Used to store matching text.",
	},
}

matched, a type of slot.

View Source
var Zt_MatchedPhrase typeinfo.Flow

matched_phrase, a type of flow.

View Source
var Zt_MatchingNum typeinfo.Flow

matching_num, a type of flow.

View Source
var Zt_MultipleAdjectives typeinfo.Flow

multiple_adjectives, a type of flow.

View Source
var Zt_MultipleKinds typeinfo.Flow

multiple_kinds, a type of flow.

View Source
var Zt_MultipleNames typeinfo.Flow

multiple_names, a type of flow.

View Source
var Zt_Name typeinfo.Flow

name, a type of flow.

View Source
var Zt_NamesAreLikeVerbs typeinfo.Flow

names_are_like_verbs, a type of flow.

View Source
var Zt_NamesVerbNames typeinfo.Flow

names_verb_names, a type of flow.

View Source
var Zt_NewTrait typeinfo.Flow

new_trait, a type of flow.

View Source
var Zt_NounMaker = typeinfo.Slot{
	Name: "noun_maker",
	Markup: map[string]any{
		"--": "Indicates a matcher which can define a noun.",
	},
}

noun_maker, a type of slot.

View Source
var Zt_NounPropertyValue typeinfo.Flow

noun_property_value, a type of flow.

View Source
var Zt_PromisedMatcher = typeinfo.Slot{
	Name: "promised_matcher",
}

promised_matcher, a type of slot.

View Source
var Zt_Pronoun typeinfo.Flow

pronoun, a type of flow.

View Source
var Zt_Property typeinfo.Flow

property, a type of flow.

View Source
var Zt_PropertyNoun = typeinfo.Slot{
	Name: "property_noun",
	Markup: map[string]any{
		"--": []string{"Matches an existing noun, or if not: then something new.", "Noun property uses this to find the best property field based on a noun's kind."},
	},
}

property_noun, a type of slot.

View Source
var Zt_PropertyNounValue typeinfo.Flow

property_noun_value, a type of flow.

View Source
var Zt_PropertyPossessions typeinfo.Flow

property_possessions, a type of flow.

View Source
var Zt_PropertyType typeinfo.Flow

property_type, a type of flow.

View Source
var Zt_PropertyValue = typeinfo.Slot{
	Name: "property_value",
	Markup: map[string]any{
		"--": []string{"A value used to initialize a noun.", "( Can either be a single value, or a value containing a list. )"},
	},
}

property_value, a type of slot.

View Source
var Zt_QuotedText typeinfo.Flow

quoted_text, a type of flow.

View Source
var Zt_QuotedTexts typeinfo.Flow

quoted_texts, a type of flow.

View Source
var Zt_RuleName typeinfo.Flow

rule_name, a type of flow.

View Source
var Zt_RulePrefix typeinfo.Flow

rule_prefix, a type of flow.

View Source
var Zt_RuleSuffix typeinfo.Flow

rule_suffix, a type of flow.

View Source
var Zt_RuleTarget typeinfo.Flow

rule_target, a type of flow.

View Source
var Zt_SubAssignment typeinfo.Flow

sub_assignment, a type of flow.

View Source
var Zt_TimedRule typeinfo.Flow

timed_rule, a type of flow.

View Source
var Zt_Trait typeinfo.Flow

trait, a type of flow.

View Source
var Zt_Traits typeinfo.Flow

traits, a type of flow.

View Source
var Zt_Understand typeinfo.Flow

understand, a type of flow.

View Source
var Zt_Verb typeinfo.Flow

verb, a type of flow.

View Source
var Zt_VerbNamesAreNames typeinfo.Flow

verb_names_are_names, a type of flow.

View Source
var Zt_VerbPhrase typeinfo.Flow

verb_phrase, a type of flow.

View Source
var Zt_Words typeinfo.Flow

words, a type of flow.

Functions

func AddKindTraits

func AddKindTraits(w weaver.Weaves, kind string, it *Traits) (err error)

setup the default traits for the passed kind

func After added in v0.24.8

func After(p weaver.Phase) weaver.Phase

func BuildPhrase

func BuildPhrase(phrase string) (ret grammar.ScannerMaker, err error)

generate an user input parser from a string written in a special format. words separated by forward slashes indicate a choice between words; double dashes as a choice means defer trying to match a word; the equal sign is used as an escape for forward slashes, open brackets, and dashes; brackets are used to indicate noun names of the specified type. ex. `hang [objects] on/onto/-- [objects]`, public for testing

func ConvertTextTemplate

func ConvertTextTemplate(str string) (ret rt.TextEval, err error)

returns a string or a FromText assignment as a slice of bytes

func GetRuleName

func GetRuleName(op *RuleName) (ret string, err error)

func GetRulePrefix

func GetRulePrefix(op RulePrefix) rules.Prefix

func GetRuleSuffix

func GetRuleSuffix(op *RuleSuffix) (ret rules.Suffix)

func Optional

func Optional[M any,
	IM interface {
		*M
		OptionalMatcher
	}](q JessContext, input *InputState, out **M) (okay bool)

a generic method to read an optional element. optional elements are implemented by pointer types the pointers are required to implement Interpreter. returns true if matched.

func ReduceTraits

func ReduceTraits(it *Traits) (ret []string)

fix: is this all trait iteration is being used for?

func Register added in v0.24.7

func Register(reg func(any))

gob like registration

func TryAdditionalPossessions added in v0.24.8

func TryAdditionalPossessions(pb *PropertyBuilder, in InputState,
	accept func(*AdditionalPossessions),
	reject func(error),
)

recursively a series of property values. expects to eat the entire input, and therefore doesn't return next InputState. because the values are optional, the input can be empty, in which case the accepted additional values are nil. "ex. "and the description ...."

func TryArticle added in v0.24.8

func TryArticle(q JessContext, in InputState,
	accept func(*Article, InputState),
	reject func(error),
)

func TryExistingNoun added in v0.24.8

func TryExistingNoun(q JessContext, in InputState,
	accept func(ExistingNoun, InputState),
	reject func(error),
)

match an existing noun

func TryImplicitNoun added in v0.24.8

func TryImplicitNoun(q JessContext, in InputState,
	accept func(ImplicitNoun, InputState),
	reject func(error),
)

a phrase implies a noun exists, but no particular kind has been assigned.

func TryImpliedPronoun added in v0.24.8

func TryImpliedPronoun(q JessContext,
	accept func(Pronoun),
	reject func(error),
)

property pronouns can be implied: "The description is".

func TryInlineKind added in v0.24.8

func TryInlineKind(q JessContext, in InputState,
	accept func(InlineKind, InputState),
	reject func(error))

"the closed transparent container..." expects to consume all of the input sends itself to the done function.

func TryInlineNoun added in v0.24.8

func TryInlineNoun(q JessContext, in InputState,
	accept func(InlineNoun, InputState),
	reject func(error))

"the <inline kind: container> called the box..."

func TryKind added in v0.24.8

func TryKind(q JessContext, in InputState,
	accept func(Kind, InputState),
	reject func(error))

search ancestry for an existing kind

func TryNounPropertyValue added in v0.24.8

func TryNounPropertyValue(q JessContext, in InputState,
	accept func(PromisedMatcher),
	reject func(error),
)

`The pen has (the) description (of) "mightier than the sword."` `The bottle has age 42 and the description "A plain glass bottle."`

func TryPromisedMatch added in v0.24.8

func TryPromisedMatch(jc JessContext, in InputState)

launch background attempts to match success and failure talks to the Phrase itself

func TryPronoun added in v0.24.8

func TryPronoun(q JessContext, in InputState,
	accept func(Pronoun, InputState),
	reject func(error),
)

search for a pronoun and the noun that it represents. accept fires in the value phase; reject can fire asap if it doesn't look like a pronoun.

func TryPropertyName added in v0.24.8

func TryPropertyName(q JessContext, in InputState, kind string,
	accept func(Property, InputState), reject func(error),
)

match the name of a property

func TryPropertyNoun added in v0.24.8

func TryPropertyNoun(q JessContext, in InputState,
	accept func(PropertyNoun, InputState),
	reject func(error))

func TryPropertyNounValue added in v0.24.8

func TryPropertyNounValue(q JessContext, in InputState,
	accept func(PromisedMatcher), reject func(error),
)

func TryPropertyPossessions added in v0.24.8

func TryPropertyPossessions(pb *PropertyBuilder, in InputState,
	accept func(PropertyPossessions),
	reject func(error),
)

recursively generate a list of property values. expects to eat the entire input, and therefore doesn't return next InputState. ex. `age of 42, color red, and the description "A plain glass bottle."`

func TryPropertyValue added in v0.24.8

func TryPropertyValue(q JessContext, in InputState, flags PvFlags,
	accept func(PropertyValue, InputState),
	reject func(error),
)

match and apply a value

func TryTraits added in v0.24.8

func TryTraits(q JessContext, in InputState,
	accept func(*Traits, InputState),
	reject func(error),
)

search the input left to right for zero or matching traits; regardless of the desired kind.

func WordsToNum

func WordsToNum(s string) (ret int, okay bool)

Convert from a string containing numbers as digits, or as words. For words, good up to "twenty".

Types

type ActualKind

type ActualKind struct {
	Name     string // as opposed to just what matched
	BaseKind kindsOf.Kinds
}

type ActualNoun

type ActualNoun struct {
	Name string
	Kind string
}

the noun that matched ( as opposed to the name that matched )

func (ActualNoun) BuildPropertyNoun added in v0.24.8

func (an ActualNoun) BuildPropertyNoun(BuildContext) ActualNoun

func (ActualNoun) IsValid added in v0.24.8

func (an ActualNoun) IsValid() bool

type AdditionalAdjectives

type AdditionalAdjectives struct {
	CommaAnd   CommaAnd
	Adjectives MultipleAdjectives
	Markup     map[string]any `json:",omitempty"`
}

An additional set of traits and a kind.

func (*AdditionalAdjectives) GetMarkup

func (op *AdditionalAdjectives) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*AdditionalAdjectives) Match

func (op *AdditionalAdjectives) Match(q JessContext, input *InputState) (okay bool)

func (*AdditionalAdjectives) TypeInfo

func (*AdditionalAdjectives) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type AdditionalAdjectives_Slice

type AdditionalAdjectives_Slice []AdditionalAdjectives

Holds a slice of type AdditionalAdjectives.

func (*AdditionalAdjectives_Slice) Repeats

func (op *AdditionalAdjectives_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of AdditionalAdjectives.

func (*AdditionalAdjectives_Slice) TypeInfo

Implements typeinfo.Instance for a slice of AdditionalAdjectives.

type AdditionalDirections

type AdditionalDirections struct {
	CommaAnd             CommaAnd
	DirectionOfLinking   DirectionOfLinking
	AdditionalDirections *AdditionalDirections
	Markup               map[string]any `json:",omitempty"`
}

Matches additional directions. only used by map_locations.

func (*AdditionalDirections) GetMarkup

func (op *AdditionalDirections) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*AdditionalDirections) Match

func (op *AdditionalDirections) Match(q JessContext, input *InputState) (okay bool)

----

func (*AdditionalDirections) TypeInfo

func (*AdditionalDirections) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type AdditionalDirections_Slice

type AdditionalDirections_Slice []AdditionalDirections

Holds a slice of type AdditionalDirections.

func (*AdditionalDirections_Slice) Repeats

func (op *AdditionalDirections_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of AdditionalDirections.

func (*AdditionalDirections_Slice) TypeInfo

Implements typeinfo.Instance for a slice of AdditionalDirections.

type AdditionalKinds

type AdditionalKinds struct {
	CommaAnd CommaAnd
	Kinds    MultipleKinds
	Markup   map[string]any `json:",omitempty"`
}

Matches a kind following another kind.

func (*AdditionalKinds) GetMarkup

func (op *AdditionalKinds) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*AdditionalKinds) Match

func (op *AdditionalKinds) Match(q JessContext, input *InputState) (okay bool)

func (*AdditionalKinds) TypeInfo

func (*AdditionalKinds) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type AdditionalKinds_Slice

type AdditionalKinds_Slice []AdditionalKinds

Holds a slice of type AdditionalKinds.

func (*AdditionalKinds_Slice) Repeats

func (op *AdditionalKinds_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of AdditionalKinds.

func (*AdditionalKinds_Slice) TypeInfo

func (*AdditionalKinds_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of AdditionalKinds.

type AdditionalLinks struct {
	CommaAnd        CommaAnd
	Linking         Linking
	AdditionalLinks *AdditionalLinks
	Markup          map[string]any `json:",omitempty"`
}

Partial phrase used for map connections. This allows multiple doors, etc. on the lhs.

func (*AdditionalLinks) GetMarkup

func (op *AdditionalLinks) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*AdditionalLinks) Match

func (op *AdditionalLinks) Match(q JessContext, input *InputState) (okay bool)

----

func (*AdditionalLinks) TypeInfo

func (*AdditionalLinks) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type AdditionalLinks_Slice []AdditionalLinks

Holds a slice of type AdditionalLinks.

func (op *AdditionalLinks_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of AdditionalLinks.

func (*AdditionalLinks_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of AdditionalLinks.

type AdditionalNames

type AdditionalNames struct {
	CommaAnd CommaAnd
	Names    MultipleNames
	Markup   map[string]any `json:",omitempty"`
}

Matches a name following another name.

func (*AdditionalNames) GetMarkup

func (op *AdditionalNames) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*AdditionalNames) Match

func (op *AdditionalNames) Match(q JessContext, input *InputState) (okay bool)

func (*AdditionalNames) TypeInfo

func (*AdditionalNames) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type AdditionalNames_Slice

type AdditionalNames_Slice []AdditionalNames

Holds a slice of type AdditionalNames.

func (*AdditionalNames_Slice) Repeats

func (op *AdditionalNames_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of AdditionalNames.

func (*AdditionalNames_Slice) TypeInfo

func (*AdditionalNames_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of AdditionalNames.

type AdditionalPossessions added in v0.24.8

type AdditionalPossessions struct {
	CommaAnd            CommaAnd
	PropertyPossessions PropertyPossessions
	Markup              map[string]any `json:",omitempty"`
}

Matches a value following another value.

func (*AdditionalPossessions) GetMarkup added in v0.24.8

func (op *AdditionalPossessions) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*AdditionalPossessions) TypeInfo added in v0.24.8

func (*AdditionalPossessions) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type AdditionalPossessions_Slice added in v0.24.8

type AdditionalPossessions_Slice []AdditionalPossessions

Holds a slice of type AdditionalPossessions.

func (*AdditionalPossessions_Slice) Repeats added in v0.24.8

func (op *AdditionalPossessions_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of AdditionalPossessions.

func (*AdditionalPossessions_Slice) TypeInfo added in v0.24.8

Implements typeinfo.Instance for a slice of AdditionalPossessions.

type AdditionalText

type AdditionalText struct {
	CommaAndOr  CommaAndOr
	QuotedTexts QuotedTexts
	Markup      map[string]any `json:",omitempty"`
}

Matches a text following another some previous text.

func (*AdditionalText) GetMarkup

func (op *AdditionalText) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*AdditionalText) Match

func (op *AdditionalText) Match(q JessContext, input *InputState) (okay bool)

func (*AdditionalText) TypeInfo

func (*AdditionalText) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type AdditionalText_Slice

type AdditionalText_Slice []AdditionalText

Holds a slice of type AdditionalText.

func (*AdditionalText_Slice) Repeats

func (op *AdditionalText_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of AdditionalText.

func (*AdditionalText_Slice) TypeInfo

func (*AdditionalText_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of AdditionalText.

type AdditionalTraits

type AdditionalTraits struct {
	CommaAnd *CommaAnd
	Traits   Traits
	Markup   map[string]any `json:",omitempty"`
}

Matches a trait following another trait.

func (*AdditionalTraits) GetMarkup

func (op *AdditionalTraits) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*AdditionalTraits) Match

func (op *AdditionalTraits) Match(q JessContext, input *InputState) (okay bool)

func (*AdditionalTraits) TypeInfo

func (*AdditionalTraits) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type AdditionalTraits_Slice

type AdditionalTraits_Slice []AdditionalTraits

Holds a slice of type AdditionalTraits.

func (*AdditionalTraits_Slice) Repeats

func (op *AdditionalTraits_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of AdditionalTraits.

func (*AdditionalTraits_Slice) TypeInfo

func (*AdditionalTraits_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of AdditionalTraits.

type Are

type Are struct {
	Matched Matched
	Markup  map[string]any `json:",omitempty"`
}

Matches the words "is" or "are".

func (*Are) GetMarkup

func (op *Are) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Are) IsPlural

func (op *Are) IsPlural() bool

only valid after matching

func (*Are) Match

func (op *Are) Match(_ JessContext, input *InputState) (okay bool)

func (*Are) Split added in v0.24.8

func (op *Are) Split(input InputState) (lhs, rhs InputState, okay bool)

given a phrase, split around the word is or are.

func (*Are) TypeInfo

func (*Are) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type Are_Slice

type Are_Slice []Are

Holds a slice of type Are.

func (*Are_Slice) Repeats

func (op *Are_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Are.

func (*Are_Slice) TypeInfo

func (*Are_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Are.

type Article

type Article struct {
	Text string

	Markup map[string]any `json:",omitempty"`
	// contains filtered or unexported fields
}

One of a predefined set of determiners: the, a/n, some, our. This only matches if the first letter is lowercase, or uppercase at the start of a sentence; otherwise, the article gets treated as part of the name.

Also note:

  • The lack of a recognized article makes something proper-named.
  • See 'counted_kind' for names with leading numbers: (ex. five or 27).
  • Using "some" (ex. "some coins") will set nouns as "plural named".

func (*Article) GetMarkup

func (op *Article) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Article) Match

func (op *Article) Match(q JessContext, input *InputState) (okay bool)

match articles ( such as: a, the, some ) when the query is flagged with CheckIndefiniteArticles records *definite* article for use in indefinite contexts. ( re: append/applyArticle )

note: capitalized articles in the middle of a sentence are treated as part of the name. ex. "a man called The Vampire" assumes The Vampire is proper named."

func (*Article) TypeInfo

func (*Article) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type ArticleFlags

type ArticleFlags struct {
	Indefinite bool // use the specified article in indefinite contexts
	Plural     bool
}

extra info about specified articles determined during matching. stored as a private part of the Article generated type.

type Article_Slice

type Article_Slice []Article

Holds a slice of type Article.

func (*Article_Slice) Repeats

func (op *Article_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Article.

func (*Article_Slice) TypeInfo

func (*Article_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Article.

type AspectsAreTraits

type AspectsAreTraits struct {
	Aspect     Kind
	Are        Are
	PlainNames MultipleNames
	Markup     map[string]any `json:",omitempty"`
}

Defines traits for aspects that can be (re)used by various other kinds. ex.

The colors are a kind of aspect. The colors are red, blue, and greasy green.

The commands aspects_are_traits, kinds_are_traits, and names_are_like_verbs all handle similar phrasing.

func (*AspectsAreTraits) GetMarkup

func (op *AspectsAreTraits) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*AspectsAreTraits) MatchLine added in v0.24.8

func (op *AspectsAreTraits) MatchLine(q JessContext, line InputState) (ret InputState, okay bool)

the colors are.... ( see also KindsOf )

func (*AspectsAreTraits) Phase

func (op *AspectsAreTraits) Phase() weaver.Phase

runs in the AncestryPhase; but requires that the kind is known already. so "The colors are a kind of aspect. The colors are black and blue." is fine; but reversing those two sentences will fail.

func (*AspectsAreTraits) TypeInfo

func (*AspectsAreTraits) TypeInfo() typeinfo.T

Implements typeinfo.Instance

func (*AspectsAreTraits) Weave

func (op *AspectsAreTraits) Weave(w weaver.Weaves, _ rt.Runtime) (err error)

type AspectsAreTraits_Slice

type AspectsAreTraits_Slice []AspectsAreTraits

Holds a slice of type AspectsAreTraits.

func (*AspectsAreTraits_Slice) Repeats

func (op *AspectsAreTraits_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of AspectsAreTraits.

func (*AspectsAreTraits_Slice) TypeInfo

func (*AspectsAreTraits_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of AspectsAreTraits.

type BuildContext added in v0.24.8

type BuildContext struct {
	Query
	weaver.Weaves
	// contains filtered or unexported fields
}

type Builder added in v0.24.8

type Builder interface {
	Build(BuildContext) error
}

the process of matching an english phrase creates a builder. after the first successful match, the associated builder is triggered.

type Called

type Called struct {
	Matched Matched
	Markup  map[string]any `json:",omitempty"`
}

Matches the word "called".

func (*Called) GetMarkup

func (op *Called) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Called) Match

func (op *Called) Match(_ JessContext, input *InputState) (okay bool)

func (*Called) Split added in v0.24.8

func (op *Called) Split(in InputState) (lhs, rhs InputState, okay bool)

func (*Called) TypeInfo

func (*Called) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type CalledName

type CalledName struct {
	Called Called
	Name   Name
	Markup map[string]any `json:",omitempty"`
}

Used for kinds_have_properties. like kind_called, specifying "called the/our ..." gives the noun an indefinite article.

func (*CalledName) GetMarkup

func (op *CalledName) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*CalledName) GetNormalizedName

func (op *CalledName) GetNormalizedName() (string, error)

func (*CalledName) Match

func (op *CalledName) Match(q JessContext, input *InputState) (okay bool)

func (*CalledName) TypeInfo

func (*CalledName) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type CalledName_Slice

type CalledName_Slice []CalledName

Holds a slice of type CalledName.

func (*CalledName_Slice) Repeats

func (op *CalledName_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of CalledName.

func (*CalledName_Slice) TypeInfo

func (*CalledName_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of CalledName.

type Called_Slice

type Called_Slice []Called

Holds a slice of type Called.

func (*Called_Slice) Repeats

func (op *Called_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Called.

func (*Called_Slice) TypeInfo

func (*Called_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Called.

type CommaAnd

type CommaAnd struct {
	Matched Matched
	Markup  map[string]any `json:",omitempty"`
}

This matches commas, "and", or ", and". It relies on the fact package match treats commas and the word "and" each as their own words.

func (*CommaAnd) GetMarkup

func (op *CommaAnd) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*CommaAnd) InputMatch added in v0.24.8

func (op *CommaAnd) InputMatch(input *InputState) (okay bool)

func (*CommaAnd) Match

func (op *CommaAnd) Match(_ JessContext, input *InputState) bool

func (*CommaAnd) TypeInfo

func (*CommaAnd) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type CommaAndOr

type CommaAndOr struct {
	Matched Matched
	Markup  map[string]any `json:",omitempty"`
}

Matches commas, "and", or "or". relies on the fact package match treats commas and ands each as their own words.

func (*CommaAndOr) GetMarkup

func (op *CommaAndOr) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*CommaAndOr) Match

func (op *CommaAndOr) Match(_ JessContext, input *InputState) (okay bool)

func (*CommaAndOr) TypeInfo

func (*CommaAndOr) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type CommaAndOr_Slice

type CommaAndOr_Slice []CommaAndOr

Holds a slice of type CommaAndOr.

func (*CommaAndOr_Slice) Repeats

func (op *CommaAndOr_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of CommaAndOr.

func (*CommaAndOr_Slice) TypeInfo

func (*CommaAndOr_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of CommaAndOr.

type CommaAnd_Slice

type CommaAnd_Slice []CommaAnd

Holds a slice of type CommaAnd.

func (*CommaAnd_Slice) Repeats

func (op *CommaAnd_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of CommaAnd.

func (*CommaAnd_Slice) TypeInfo

func (*CommaAnd_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of CommaAnd.

type CountedKind

type CountedKind struct {
	Article     *Article
	MatchingNum MatchingNum
	Kind        Kind
	Matched     Matched
	Markup      map[string]any `json:",omitempty"`
}

Provides English specification of a number of objects. ( yes, `the five the containers` is permitted. )

func (*CountedKind) BuildNouns

func (op *CountedKind) BuildNouns(q JessContext, w weaver.Weaves, run rt.Runtime, props NounProperties) (ret []DesiredNoun, err error)

generates n initial instances (and their aliases, cause why not.) delays the desired traits and additional kinds ( tbd if that makes sense or not )

func (*CountedKind) GetMarkup

func (op *CountedKind) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*CountedKind) Match

func (op *CountedKind) Match(q JessContext, input *InputState) (okay bool)

func (*CountedKind) TypeInfo

func (*CountedKind) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type CountedKind_Slice

type CountedKind_Slice []CountedKind

Holds a slice of type CountedKind.

func (*CountedKind_Slice) Repeats

func (op *CountedKind_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of CountedKind.

func (*CountedKind_Slice) TypeInfo

func (*CountedKind_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of CountedKind.

type DesiredNoun

type DesiredNoun struct {
	Noun        string   // key ( once it has been created; or if it already exists. )
	Aliases     []string // used specifically for anonymous nouns
	Traits      []string
	Values      []DesiredValue
	CreatedKind string // hacking for pronouns
	//
	ArticleTrait      string
	IndefiniteArticle string
}

stores information about nouns during the parsing and generation process

type DesiredValue

type DesiredValue struct {
	Field  string
	Assign rt.Assignment
}

type DirectIt

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

additional directions iterator

func IterateDirections

func IterateDirections(first *DirectionOfLinking, queue *AdditionalDirections) DirectIt

func (*DirectIt) GetNext

func (it *DirectIt) GetNext() (ret DirectionOfLinking)

func (DirectIt) HasNext

func (it DirectIt) HasNext() bool

type Direction

type Direction struct {
	Text   string
	Markup map[string]any `json:",omitempty"`
}

Matches some existing compass direction.

func (*Direction) GetMarkup

func (op *Direction) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Direction) Match

func (op *Direction) Match(q JessContext, input *InputState) (okay bool)

----

func (*Direction) TypeInfo

func (*Direction) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type DirectionOfLinking

type DirectionOfLinking struct {
	Direction Direction
	FromOf    Words
	Linking   Linking
	Markup    map[string]any `json:",omitempty"`
}

Partial phrase for mapping declarations.

func (*DirectionOfLinking) GetMarkup

func (op *DirectionOfLinking) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*DirectionOfLinking) Match

func (op *DirectionOfLinking) Match(q JessContext, input *InputState) (okay bool)

----

func (*DirectionOfLinking) TypeInfo

func (*DirectionOfLinking) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type DirectionOfLinking_Slice

type DirectionOfLinking_Slice []DirectionOfLinking

Holds a slice of type DirectionOfLinking.

func (*DirectionOfLinking_Slice) Repeats

func (op *DirectionOfLinking_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of DirectionOfLinking.

func (*DirectionOfLinking_Slice) TypeInfo

func (*DirectionOfLinking_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of DirectionOfLinking.

type Direction_Slice

type Direction_Slice []Direction

Holds a slice of type Direction.

func (*Direction_Slice) Repeats

func (op *Direction_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Direction.

func (*Direction_Slice) TypeInfo

func (*Direction_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Direction.

type ExistingNoun added in v0.24.8

type ExistingNoun struct {
	Article *Article
	Matched Matched

	Markup map[string]any `json:",omitempty"`
	// contains filtered or unexported fields
}

Matches an existing noun ( by checking multiple words for the best match ). Can be used as a property value: the property receives the noun's name.

func (*ExistingNoun) Assignment added in v0.24.8

func (op *ExistingNoun) Assignment() rt.Assignment

so that nouns can be used as the *value* of a property

func (*ExistingNoun) BuildNouns added in v0.24.8

func (op *ExistingNoun) BuildNouns(_ JessContext, w weaver.Weaves, _ rt.Runtime, props NounProperties) (ret []DesiredNoun, err error)

fix: used for old phrase matching; but doesn't make a lot of sense for existing nouns.

func (*ExistingNoun) BuildPropertyNoun added in v0.24.8

func (op *ExistingNoun) BuildPropertyNoun(ctx BuildContext) (ActualNoun, error)

valid after match ( because it already exists )

func (*ExistingNoun) GetKind added in v0.24.8

func (op *ExistingNoun) GetKind() string

valid after match

func (*ExistingNoun) GetMarkup added in v0.24.8

func (op *ExistingNoun) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*ExistingNoun) Match added in v0.24.8

func (op *ExistingNoun) Match(q JessContext, input *InputState) (okay bool)

func (*ExistingNoun) TypeInfo added in v0.24.8

func (*ExistingNoun) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type ExistingNoun_Slice added in v0.24.8

type ExistingNoun_Slice []ExistingNoun

Holds a slice of type ExistingNoun.

func (*ExistingNoun_Slice) Repeats added in v0.24.8

func (op *ExistingNoun_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of ExistingNoun.

func (*ExistingNoun_Slice) TypeInfo added in v0.24.8

func (*ExistingNoun_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of ExistingNoun.

type FailedMatch added in v0.24.8

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

func (FailedMatch) Error added in v0.24.8

func (m FailedMatch) Error() string

type FieldName added in v0.24.8

type FieldName = string

type Generator

type Generator interface {
	Generate(JessContext) error
}

implemented by phrases so that they can create story fragments based on the english language text they have parsed.

type ImplicitNoun added in v0.24.8

type ImplicitNoun struct {
	Name   Name
	Markup map[string]any `json:",omitempty"`
}

func (*ImplicitNoun) BuildPropertyNoun added in v0.24.8

func (op *ImplicitNoun) BuildPropertyNoun(ctx BuildContext) (ret ActualNoun, err error)

func (*ImplicitNoun) GetKind added in v0.24.8

func (op *ImplicitNoun) GetKind() string

implicit nouns can only use properties of things. there is however an earlier phase check for Noun.

func (*ImplicitNoun) GetMarkup added in v0.24.8

func (op *ImplicitNoun) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*ImplicitNoun) TypeInfo added in v0.24.8

func (*ImplicitNoun) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type ImplicitNoun_Slice added in v0.24.8

type ImplicitNoun_Slice []ImplicitNoun

Holds a slice of type ImplicitNoun.

func (*ImplicitNoun_Slice) Repeats added in v0.24.8

func (op *ImplicitNoun_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of ImplicitNoun.

func (*ImplicitNoun_Slice) TypeInfo added in v0.24.8

func (*ImplicitNoun_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of ImplicitNoun.

type InlineKind added in v0.24.8

type InlineKind struct {
	Article *Article
	Traits  *Traits
	Kind    Kind
	Markup  map[string]any `json:",omitempty"`
}

unlike 'multiple_adjectives' this can only specify a single trailing kind

func (*InlineKind) GetKind added in v0.24.8

func (op *InlineKind) GetKind() string

func (*InlineKind) GetMarkup added in v0.24.8

func (op *InlineKind) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*InlineKind) GetTraits added in v0.24.8

func (op *InlineKind) GetTraits() []string

func (*InlineKind) TypeInfo added in v0.24.8

func (*InlineKind) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type InlineKind_Slice added in v0.24.8

type InlineKind_Slice []InlineKind

Holds a slice of type InlineKind.

func (*InlineKind_Slice) Repeats added in v0.24.8

func (op *InlineKind_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of InlineKind.

func (*InlineKind_Slice) TypeInfo added in v0.24.8

func (*InlineKind_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of InlineKind.

type InlineNoun added in v0.24.8

type InlineNoun struct {
	InlineKind InlineKind
	Called     Called
	Name       Name
	Markup     map[string]any `json:",omitempty"`
}

"the closed container called the box."

func (*InlineNoun) BuildPropertyNoun added in v0.24.8

func (op *InlineNoun) BuildPropertyNoun(ctx BuildContext) (ActualNoun, error)

func (*InlineNoun) GetKind added in v0.24.8

func (op *InlineNoun) GetKind() string

func (*InlineNoun) GetMarkup added in v0.24.8

func (op *InlineNoun) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*InlineNoun) GetTraits added in v0.24.8

func (op *InlineNoun) GetTraits() []string

func (*InlineNoun) TypeInfo added in v0.24.8

func (*InlineNoun) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type InlineNoun_Slice added in v0.24.8

type InlineNoun_Slice []InlineNoun

Holds a slice of type InlineNoun.

func (*InlineNoun_Slice) Repeats added in v0.24.8

func (op *InlineNoun_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of InlineNoun.

func (*InlineNoun_Slice) TypeInfo added in v0.24.8

func (*InlineNoun_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of InlineNoun.

type InputState

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

The English language phrase being matched.

func (InputState) Cut

func (in InputState) Cut(width int) Matched

return the specified number of words from the input as a slice of words

func (InputState) DebugString added in v0.24.8

func (in InputState) DebugString() string

func (InputState) GetNext

func (in InputState) GetNext(t match.Token) (ret match.TokenValue, okay bool)

func (InputState) Len

func (in InputState) Len() int

func (InputState) MatchWord

func (in InputState) MatchWord(choices ...uint64) (width int)

see if the input begins with any of the passed choices always returns 1.

func (InputState) Skip

func (in InputState) Skip(skip int) InputState

return an input state that is the passed number of words after this one.

func (InputState) Slice added in v0.24.8

func (in InputState) Slice(width int) InputState

return an input state of the passed width; dropping the trailing ones.

func (InputState) Words

func (in InputState) Words() []match.TokenValue

type JessContext added in v0.24.8

type JessContext struct {
	Query
	Scheduler
	// contains filtered or unexported fields
}

func AddContext

func AddContext(q JessContext, flags int) JessContext

adds flags to the query

func ClearContext added in v0.24.8

func ClearContext(q JessContext, flags int) (ret JessContext)

remove flags from the query

func (JessContext) CurrentPhrase added in v0.24.8

func (jc JessContext) CurrentPhrase() *Phrase

func (JessContext) FindNoun added in v0.24.8

func (jc JessContext) FindNoun(name []match.TokenValue, pkind *string) (string, int)

overrides the normal find noun to map "you" to the object "self" fix: it'd be nice if the mapping of "you" to "self" was handled by script ( ex. registering the appropriate names )

func (JessContext) GetContext added in v0.24.8

func (jc JessContext) GetContext() int

override query context to provide additional flags see AddContext, ClearContext

func (JessContext) RejectTopic added in v0.24.8

func (jc JessContext) RejectTopic(e error)

when a sentence doesn't use a topic

func (JessContext) Schedule added in v0.24.8

func (jc JessContext) Schedule(when weaver.Phase, cb func(weaver.Weaves, rt.Runtime) error) (err error)

run the passed function now or in the future.

func (JessContext) SetTopic added in v0.24.8

func (jc JessContext) SetTopic(an ActualNoun)

ideally this would be in BuildContext, or even returned from Build() but not not everything uses that.

func (JessContext) Source added in v0.24.8

func (jc JessContext) Source() (ret compact.Source)

func (JessContext) Try added in v0.24.8

func (jc JessContext) Try(z weaver.Phase, cb func(weaver.Weaves, rt.Runtime), reject func(error))

func (JessContext) TryTopic added in v0.24.8

func (jc JessContext) TryTopic(accept func(ActualNoun), reject func(error))

type Kind

type Kind struct {
	Article *Article
	Matched Matched

	Markup map[string]any `json:",omitempty"`
	// contains filtered or unexported fields
}

Matches the name of an existing kind. In some contexts, can generate a single anonymous noun. Can be used as a property value: the property receives the name of kind.

func (*Kind) Assignment added in v0.24.8

func (op *Kind) Assignment() rt.Assignment

so that kinds can be used as the *value* of a property

func (*Kind) BuildNouns

func (op *Kind) BuildNouns(q JessContext, w weaver.Weaves, run rt.Runtime, props NounProperties) (ret []DesiredNoun, err error)

anonymous kinds: "the supporter"

func (*Kind) GetMarkup

func (op *Kind) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Kind) Match

func (op *Kind) Match(q JessContext, input *InputState) (okay bool)

func (*Kind) TypeInfo

func (*Kind) TypeInfo() typeinfo.T

Implements typeinfo.Instance

func (*Kind) Validate

func (op *Kind) Validate(ks ...kindsOf.Kinds) (ret string, err error)

returns the real ( generally plural ) name of the kind

type KindCalled

type KindCalled struct {
	Traits *Traits
	Kind   Kind
	Called Called
	Name   Name
	Markup map[string]any `json:",omitempty"`
}

Defines a name and its kind in a single phrase. Matches: (traits) kind "called" {the name}. For example:

The closed container called the trunk is in the lobby.

As per inform, the name includes all text after the word "called" until "is", "are", or the end of the sentence; and specifying "called the/our ..." gives the noun an indefinite article.

func (*KindCalled) BuildNouns

func (op *KindCalled) BuildNouns(q JessContext, w weaver.Weaves, run rt.Runtime, props NounProperties) (ret []DesiredNoun, err error)

called can have its own kind, its own specific article, and its name is flagged as "exact" ( where regular names are treated as potential aliases of existing names. )

func (*KindCalled) GetKind

func (op *KindCalled) GetKind() (string, error)

func (*KindCalled) GetMarkup

func (op *KindCalled) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*KindCalled) GetNormalizedName

func (op *KindCalled) GetNormalizedName() (string, error)

func (*KindCalled) GetTraits

func (op *KindCalled) GetTraits() (ret *Traits)

func (*KindCalled) Match

func (op *KindCalled) Match(q JessContext, input *InputState) (okay bool)

transparent container called (the) box.

func (*KindCalled) TypeInfo

func (*KindCalled) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type KindCalled_Slice

type KindCalled_Slice []KindCalled

Holds a slice of type KindCalled.

func (*KindCalled_Slice) Repeats

func (op *KindCalled_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of KindCalled.

func (*KindCalled_Slice) TypeInfo

func (*KindCalled_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of KindCalled.

type Kind_Slice

type Kind_Slice []Kind

Holds a slice of type Kind.

func (*Kind_Slice) Repeats

func (op *Kind_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Kind.

func (*Kind_Slice) TypeInfo

func (*Kind_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Kind.

type KindsAreEither

type KindsAreEither struct {
	Kind   Kind
	CanBe  Words
	Traits NewTrait
	Markup map[string]any `json:",omitempty"`
}

Kinds ("can be"|"are either") new_trait [or new_trait...]. ex.

A thing can be open or closed.

func (*KindsAreEither) GetMarkup

func (op *KindsAreEither) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*KindsAreEither) MatchLine added in v0.24.8

func (op *KindsAreEither) MatchLine(q JessContext, line InputState) (ret InputState, okay bool)

func (*KindsAreEither) Phase

func (op *KindsAreEither) Phase() weaver.Phase

runs in the PropertyPhase; relies on the named kind existing.

func (*KindsAreEither) TypeInfo

func (*KindsAreEither) TypeInfo() typeinfo.T

Implements typeinfo.Instance

func (*KindsAreEither) Weave

func (op *KindsAreEither) Weave(w weaver.Weaves, run rt.Runtime) (err error)

type KindsAreEither_Slice

type KindsAreEither_Slice []KindsAreEither

Holds a slice of type KindsAreEither.

func (*KindsAreEither_Slice) Repeats

func (op *KindsAreEither_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of KindsAreEither.

func (*KindsAreEither_Slice) TypeInfo

func (*KindsAreEither_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of KindsAreEither.

type KindsAreKind added in v0.24.6

type KindsAreKind struct {
	Names        MultipleNames
	Are          Are
	KindsAreKind Words
	Traits       *Traits
	Name         Name
	Markup       map[string]any `json:",omitempty"`
}

Names are "a kind of"/"kinds of" traits kind:any. Interesting to note that inform allows "some kind/s of", but this is more strict. Like inform `The animals called kittens are a kind of things.` is legal.

func (*KindsAreKind) Generate added in v0.24.6

func (op *KindsAreKind) Generate(ctx JessContext) error

The closed containers called safes are a kind of fixed in place thing.

func (*KindsAreKind) GetMarkup added in v0.24.6

func (op *KindsAreKind) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*KindsAreKind) GetTraits added in v0.24.6

func (op *KindsAreKind) GetTraits() (ret *Traits)

func (*KindsAreKind) MatchLine added in v0.24.8

func (op *KindsAreKind) MatchLine(q JessContext, line InputState) (ret InputState, okay bool)

func (*KindsAreKind) Phase added in v0.24.6

func (op *KindsAreKind) Phase() weaver.Phase

runs in the AncestryPhase phase

func (*KindsAreKind) TypeInfo added in v0.24.6

func (*KindsAreKind) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type KindsAreKind_Slice added in v0.24.6

type KindsAreKind_Slice []KindsAreKind

Holds a slice of type KindsAreKind.

func (*KindsAreKind_Slice) Repeats added in v0.24.6

func (op *KindsAreKind_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of KindsAreKind.

func (*KindsAreKind_Slice) TypeInfo added in v0.24.6

func (*KindsAreKind_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of KindsAreKind.

type KindsAreTraits

type KindsAreTraits struct {
	Kinds   MultipleKinds
	Are     Are
	Usually Words
	Traits  Traits
	Markup  map[string]any `json:",omitempty"`
}

Assigns default traits to a kind. kinds:objects are "usually" traits. Inform doesn't require the "usually", but i like it as a way to differentiate phrases about kinds vs. phrases about nouns.

Future: allow limiting traits to kinds with other traits. For example, in Inform:

The closed containers are fixed in place.

makes any containers that are *initially* closed also immovable.

func (*KindsAreTraits) GetMarkup

func (op *KindsAreTraits) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*KindsAreTraits) MatchLine added in v0.24.8

func (op *KindsAreTraits) MatchLine(q JessContext, line InputState) (ret InputState, okay bool)

func (*KindsAreTraits) Phase

func (op *KindsAreTraits) Phase() weaver.Phase

runs in the PropertyPhase

func (*KindsAreTraits) TypeInfo

func (*KindsAreTraits) TypeInfo() typeinfo.T

Implements typeinfo.Instance

func (*KindsAreTraits) Weave

func (op *KindsAreTraits) Weave(w weaver.Weaves, run rt.Runtime) (err error)

type KindsAreTraits_Slice

type KindsAreTraits_Slice []KindsAreTraits

Holds a slice of type KindsAreTraits.

func (*KindsAreTraits_Slice) Repeats

func (op *KindsAreTraits_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of KindsAreTraits.

func (*KindsAreTraits_Slice) TypeInfo

func (*KindsAreTraits_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of KindsAreTraits.

type KindsHaveProperties

type KindsHaveProperties struct {
	Kind         Kind
	Have         Words
	Article      *Article
	ListOf       string
	PropertyType PropertyType
	CalledName   *CalledName
	Markup       map[string]any `json:",omitempty"`
}

Kinds "have" a ("list of") type ("called" name). ex.

Things have some text called a description.

func (*KindsHaveProperties) GetMarkup

func (op *KindsHaveProperties) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*KindsHaveProperties) MatchLine added in v0.24.8

func (op *KindsHaveProperties) MatchLine(q JessContext, line InputState) (ret InputState, okay bool)

func (*KindsHaveProperties) Phase

func (op *KindsHaveProperties) Phase() weaver.Phase

runs in the PropertyPhase

func (*KindsHaveProperties) TypeInfo

func (*KindsHaveProperties) TypeInfo() typeinfo.T

Implements typeinfo.Instance

func (*KindsHaveProperties) Weave

func (op *KindsHaveProperties) Weave(w weaver.Weaves, run rt.Runtime) (err error)

register a single field

type KindsHaveProperties_Slice

type KindsHaveProperties_Slice []KindsHaveProperties

Holds a slice of type KindsHaveProperties.

func (*KindsHaveProperties_Slice) Repeats

func (op *KindsHaveProperties_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of KindsHaveProperties.

func (*KindsHaveProperties_Slice) TypeInfo

func (*KindsHaveProperties_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of KindsHaveProperties.

type LineMatcher added in v0.24.8

type LineMatcher interface {
	MatchLine(JessContext, InputState) (InputState, bool)
	typeinfo.Instance // for logging
	typeinfo.Markup
}

the top level matching interface implemented by members of MatchedPhrase. "Line" here means "sentence of a paragraph"

type LineMatcher_Slot added in v0.24.8

type LineMatcher_Slot struct{ Value LineMatcher }

Holds a single slot.

func (*LineMatcher_Slot) TypeInfo added in v0.24.8

func (*LineMatcher_Slot) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a single slot.

type LineMatcher_Slots added in v0.24.8

type LineMatcher_Slots []LineMatcher

Holds a slice of slots.

func (*LineMatcher_Slots) Repeats added in v0.24.8

func (op *LineMatcher_Slots) Repeats() bool

Implements typeinfo.Repeats for a slice of slots.

func (*LineMatcher_Slots) TypeInfo added in v0.24.8

func (*LineMatcher_Slots) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of slots.

type LinkIt

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

links iterator

func IterateLinks(first *Linking, queue *AdditionalLinks) LinkIt

func (*LinkIt) GetNext

func (it *LinkIt) GetNext() (ret Linking)

func (LinkIt) HasNext

func (it LinkIt) HasNext() bool

type Linking

type Linking struct {
	Nowhere    bool
	KindCalled *KindCalled
	Name       *Name
	Markup     map[string]any `json:",omitempty"`
}

Generates a room, a door, or nowhere. ( This i similar to, but distinct from other noun matching phrases. )

func (*Linking) BuildNoun

func (op *Linking) BuildNoun(q JessContext, w weaver.Weaves, run rt.Runtime, props NounProperties) (ret *DesiredNoun, err error)

generate a room or door; an object if there's not enough information to know; or nil for nowhere.

func (*Linking) GetMarkup

func (op *Linking) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Linking) Match

func (op *Linking) Match(q JessContext, input *InputState) (okay bool)

----

func (*Linking) TypeInfo

func (*Linking) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type Linking_Slice

type Linking_Slice []Linking

Holds a slice of type Linking.

func (*Linking_Slice) Repeats

func (op *Linking_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Linking.

func (*Linking_Slice) TypeInfo

func (*Linking_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Linking.

type MapConnections

type MapConnections struct {
	Through         bool
	Doors           Linking
	AdditionalLinks *AdditionalLinks
	Are             Are
	Room            Linking
	Markup          map[string]any `json:",omitempty"`
}

A mapping declaration to set the destination of doors. ex.

Through the long slide is the cellar.
Through the blue door and the red door is the kitchen.

The destination of a door is always treated as a room or nowhere. ( Inform doesn't allow nowhere, but it seems like a good idea. )

func (*MapConnections) Generate

func (op *MapConnections) Generate(ctx JessContext) error

goals of generation: 1. ensure the rhs link is a room. 2. ensure all of the lhs links are doors 3. set the destination of those doors to the rhs room.

func (*MapConnections) GetDoors

func (op *MapConnections) GetDoors() LinkIt

func (*MapConnections) GetMarkup

func (op *MapConnections) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*MapConnections) MatchLine added in v0.24.8

func (op *MapConnections) MatchLine(q JessContext, line InputState) (ret InputState, okay bool)

func (*MapConnections) Phase

func (op *MapConnections) Phase() weaver.Phase

runs in the NounPhase phase

func (*MapConnections) TypeInfo

func (*MapConnections) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type MapConnections_Slice

type MapConnections_Slice []MapConnections

Holds a slice of type MapConnections.

func (*MapConnections_Slice) Repeats

func (op *MapConnections_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of MapConnections.

func (*MapConnections_Slice) TypeInfo

func (*MapConnections_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of MapConnections.

type MapDirections

type MapDirections struct {
	DirectionOfLinking DirectionOfLinking
	Are                Are
	Linking            *Linking
	Redirect           *DirectionOfLinking
	Markup             map[string]any `json:",omitempty"`
}

A mapping declaration starting with a direction.

func (*MapDirections) Generate

func (op *MapDirections) Generate(ctx JessContext) (err error)

func (*MapDirections) GetMarkup

func (op *MapDirections) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*MapDirections) MatchLine added in v0.24.8

func (op *MapDirections) MatchLine(q JessContext, line InputState) (ret InputState, okay bool)

func (*MapDirections) Phase

func (op *MapDirections) Phase() weaver.Phase

runs in the NounPhase phase

func (*MapDirections) TypeInfo

func (*MapDirections) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type MapDirections_Slice

type MapDirections_Slice []MapDirections

Holds a slice of type MapDirections.

func (*MapDirections_Slice) Repeats

func (op *MapDirections_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of MapDirections.

func (*MapDirections_Slice) TypeInfo

func (*MapDirections_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of MapDirections.

type MapLocations

type MapLocations struct {
	Linking              Linking
	Are                  Are
	DirectionOfLinking   DirectionOfLinking
	AdditionalDirections *AdditionalDirections
	Markup               map[string]any `json:",omitempty"`
}

A mapping declaration starting with a room or door. ex.

A dead end called the Airport is west of the Road and north of the Farm.

func (*MapLocations) Generate

func (op *MapLocations) Generate(ctx JessContext) error

func (*MapLocations) GetMarkup

func (op *MapLocations) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*MapLocations) GetOtherLocations

func (op *MapLocations) GetOtherLocations() DirectIt

return an iterator that is capable of walking over the right hand side of the mapping.

func (*MapLocations) MatchLine added in v0.24.8

func (op *MapLocations) MatchLine(q JessContext, line InputState) (ret InputState, okay bool)

func (*MapLocations) Phase

func (op *MapLocations) Phase() weaver.Phase

runs in the NounPhase phase

func (*MapLocations) TypeInfo

func (*MapLocations) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type MapLocations_Slice

type MapLocations_Slice []MapLocations

Holds a slice of type MapLocations.

func (*MapLocations_Slice) Repeats

func (op *MapLocations_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of MapLocations.

func (*MapLocations_Slice) TypeInfo

func (*MapLocations_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of MapLocations.

type Matched

type Matched []match.TokenValue

Matched - so autogenerated types can refer to tokens

func (Matched) DebugString

func (m Matched) DebugString() string

type MatchedPhrase added in v0.24.6

type MatchedPhrase struct {
	Understand          Understand
	TimedRule           TimedRule
	KindsAreKind        KindsAreKind
	AspectsAreTraits    AspectsAreTraits
	KindsAreTraits      KindsAreTraits
	KindsHaveProperties KindsHaveProperties
	KindsAreEither      KindsAreEither
	MapConnections      MapConnections
	MapDirections       MapDirections
	MapLocations        MapLocations
	PropertyNounValue   PropertyNounValue
	NounPropertyValue   NounPropertyValue
	VerbNamesAreNames   VerbNamesAreNames
	NamesVerbNames      NamesVerbNames
	NamesAreLikeVerbs   NamesAreLikeVerbs
	Markup              map[string]any `json:",omitempty"`
}

This is the union of all possible line matchers. For any given plain text sentence, jess tries each of these looking for the first to succeed. Different phrases belong to different scheduled phases; scheduling is handled manually. ( tbd: an alternative might be slots and some scheduling metadata; this is fine for now )

func (*MatchedPhrase) GetMarkup added in v0.24.6

func (op *MatchedPhrase) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*MatchedPhrase) TypeInfo added in v0.24.6

func (*MatchedPhrase) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type MatchedPhrase_Slice added in v0.24.6

type MatchedPhrase_Slice []MatchedPhrase

Holds a slice of type MatchedPhrase.

func (*MatchedPhrase_Slice) Repeats added in v0.24.6

func (op *MatchedPhrase_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of MatchedPhrase.

func (*MatchedPhrase_Slice) TypeInfo added in v0.24.6

func (*MatchedPhrase_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of MatchedPhrase.

type Matched_Slot

type Matched_Slot struct{ Value Matched }

Holds a single slot.

func (*Matched_Slot) TypeInfo

func (*Matched_Slot) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a single slot.

type Matched_Slots

type Matched_Slots []Matched

Holds a slice of slots.

func (*Matched_Slots) Repeats

func (op *Matched_Slots) Repeats() bool

Implements typeinfo.Repeats for a slice of slots.

func (*Matched_Slots) TypeInfo

func (*Matched_Slots) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of slots.

type MatchingNum added in v0.24.6

type MatchingNum struct {
	Value  float64
	Markup map[string]any `json:",omitempty"`
}

Reads a number specified in words or as digits. Stores the result as the parsed number. Can be used as the value of a property.

func (*MatchingNum) Assignment added in v0.24.6

func (op *MatchingNum) Assignment() rt.Assignment

func (*MatchingNum) GetMarkup added in v0.24.6

func (op *MatchingNum) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*MatchingNum) Match added in v0.24.6

func (op *MatchingNum) Match(q JessContext, input *InputState) (okay bool)

matches a natural number in words, or a literal natural number.

func (*MatchingNum) TypeInfo added in v0.24.6

func (*MatchingNum) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type MatchingNum_Slice added in v0.24.6

type MatchingNum_Slice []MatchingNum

Holds a slice of type MatchingNum.

func (*MatchingNum_Slice) Repeats added in v0.24.6

func (op *MatchingNum_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of MatchingNum.

func (*MatchingNum_Slice) TypeInfo added in v0.24.6

func (*MatchingNum_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of MatchingNum.

type MultipleAdjectives added in v0.24.8

type MultipleAdjectives struct {
	Traits               *Traits
	CommaAnd             *CommaAnd
	Kind                 *Kind
	AdditionalAdjectives *AdditionalAdjectives
	Markup               map[string]any `json:",omitempty"`
}

One or more phrases consisting of traits and a kind. while all parts are marked as optional, matching expects there will be at least one trait or one kind and that there can only be additional adjective phrases if the previous one ended with a kind. ex.

a container
closed and fixed in place
a closed container and a fixed in place thing

func (*MultipleAdjectives) GetMarkup added in v0.24.8

func (op *MultipleAdjectives) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*MultipleAdjectives) GetTraits added in v0.24.8

func (op *MultipleAdjectives) GetTraits() (ret *Traits)

func (*MultipleAdjectives) Match added in v0.24.8

func (op *MultipleAdjectives) Match(q JessContext, input *InputState) (okay bool)

func (*MultipleAdjectives) Next added in v0.24.8

func (op *MultipleAdjectives) Next() (ret *MultipleAdjectives)

func (MultipleAdjectives) Reduce added in v0.24.8

func (op MultipleAdjectives) Reduce() (ret NounProperties, err error)

func (*MultipleAdjectives) TypeInfo added in v0.24.8

func (*MultipleAdjectives) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type MultipleAdjectives_Slice added in v0.24.8

type MultipleAdjectives_Slice []MultipleAdjectives

Holds a slice of type MultipleAdjectives.

func (*MultipleAdjectives_Slice) Repeats added in v0.24.8

func (op *MultipleAdjectives_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of MultipleAdjectives.

func (*MultipleAdjectives_Slice) TypeInfo added in v0.24.8

func (*MultipleAdjectives_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of MultipleAdjectives.

type MultipleKinds added in v0.24.8

type MultipleKinds struct {
	Traits          *Traits
	Article         *Article
	Matched         Matched
	AdditionalKinds *AdditionalKinds
	Markup          map[string]any `json:",omitempty"`
}

Matches a set of possible kinds as part of kinds_are_traits. jess looks for but prohibits leading traits.

func (*MultipleKinds) GetMarkup added in v0.24.8

func (op *MultipleKinds) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*MultipleKinds) GetNormalizedName added in v0.24.8

func (op *MultipleKinds) GetNormalizedName() (string, error)

func (*MultipleKinds) GetTraits added in v0.24.8

func (op *MultipleKinds) GetTraits() (ret *Traits)

unwind the tree of traits

func (*MultipleKinds) Match added in v0.24.8

func (op *MultipleKinds) Match(q JessContext, input *InputState) (okay bool)

note: traits are matched, but prohibited by "kinds_are_traits"

func (*MultipleKinds) Next added in v0.24.8

func (op *MultipleKinds) Next() (ret *MultipleKinds)

iterator helper

func (*MultipleKinds) TypeInfo added in v0.24.8

func (*MultipleKinds) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type MultipleKinds_Slice added in v0.24.8

type MultipleKinds_Slice []MultipleKinds

Holds a slice of type MultipleKinds.

func (*MultipleKinds_Slice) Repeats added in v0.24.8

func (op *MultipleKinds_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of MultipleKinds.

func (*MultipleKinds_Slice) TypeInfo added in v0.24.8

func (*MultipleKinds_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of MultipleKinds.

type MultipleNames added in v0.24.8

type MultipleNames struct {
	Pronoun         *Pronoun
	CountedKind     *CountedKind
	KindCalled      *KindCalled
	Kind            *Kind
	Name            *Name
	AdditionalNames *AdditionalNames
	Markup          map[string]any `json:",omitempty"`
	// contains filtered or unexported fields
}

Matches one or more names for nouns or kinds. Subsequent names are separated by ands ( or commas. ) Only one of the options here, plus possibly 'additional_names', will match. Not all options are valid in all contexts.

func (*MultipleNames) BuildNouns added in v0.24.8

func (op *MultipleNames) BuildNouns(q JessContext, w weaver.Weaves, run rt.Runtime, props NounProperties) (ret []DesiredNoun, err error)

implements NounMaker by calling BuildNouns on all matched names

func (*MultipleNames) GetMarkup added in v0.24.8

func (op *MultipleNames) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*MultipleNames) GetTraits added in v0.24.8

func (op *MultipleNames) GetTraits() (ret *Traits)

unwind the traits ( if any ) of the names

func (*MultipleNames) HasAnonymousKind added in v0.24.8

func (op *MultipleNames) HasAnonymousKind() bool

some callers want to fail matching on anonymous leading kinds tbd: would it be better to match, and error on generation? ( ie. to produce a message )

func (*MultipleNames) Match added in v0.24.8

func (op *MultipleNames) Match(q JessContext, input *InputState) (okay bool)

checks Query flags to control matching

func (*MultipleNames) Next added in v0.24.8

func (op *MultipleNames) Next() (ret *MultipleNames)

func (*MultipleNames) TypeInfo added in v0.24.8

func (*MultipleNames) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type MultipleNames_Slice added in v0.24.8

type MultipleNames_Slice []MultipleNames

Holds a slice of type MultipleNames.

func (*MultipleNames_Slice) Repeats added in v0.24.8

func (op *MultipleNames_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of MultipleNames.

func (*MultipleNames_Slice) TypeInfo added in v0.24.8

func (*MultipleNames_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of MultipleNames.

type Name

type Name struct {
	Article *Article
	Matched Matched
	Markup  map[string]any `json:",omitempty"`
}

Specifies a name who's meaning depends on context. For example, when matching: "Gold Roger's treasure chest is a container. The chest is open." the "chest" implies the noun "treasure chest." In other cases, the name might be a kind, or trait, or pretty much anything else.

To optimizing matching the words "is/are/comma/and" are never part of name names.

Future: allow quoted "titles" ( which are then allowed to break those assumptions )

func (*Name) BuildNoun added in v0.24.8

func (op *Name) BuildNoun(q Query, w weaver.Weaves, props NounProperties) (ret DesiredNoun, err error)

note: this doesn't apply values ( nor articles ) it stores them until writeNounValues ( left until after the kind of the noun is firmly established )

func (*Name) BuildNouns

func (op *Name) BuildNouns(q JessContext, w weaver.Weaves, run rt.Runtime, props NounProperties) (ret []DesiredNoun, err error)

names are often potential nouns; this helper treats them as such, ensuring that they exist in the database.

func (*Name) GetMarkup

func (op *Name) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Name) GetNormalizedName

func (op *Name) GetNormalizedName() (string, error)

the exact name specified by the player

func (*Name) Match

func (op *Name) Match(q JessContext, input *InputState) (okay bool)

func (*Name) TypeInfo

func (*Name) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type Name_Slice

type Name_Slice []Name

Holds a slice of type Name.

func (*Name_Slice) Repeats

func (op *Name_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Name.

func (*Name_Slice) TypeInfo

func (*Name_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Name.

type NamesAreLikeVerbs

type NamesAreLikeVerbs struct {
	Names      MultipleNames
	Are        Are
	Adjectives MultipleAdjectives
	VerbPhrase *VerbPhrase
	Markup     map[string]any `json:",omitempty"`
}

Names are adjectives [verb names]. ex.

The bottle is a transparent, open, container.
The coffin is a closed container [in the antechamber].

This is the *only* way of assigning names initial states directly. All other phrases require a kind to be involved, here the kind is optional.

func (*NamesAreLikeVerbs) Generate

func (op *NamesAreLikeVerbs) Generate(ctx JessContext) (err error)

func (*NamesAreLikeVerbs) GetAdjectives

func (op *NamesAreLikeVerbs) GetAdjectives() MultipleAdjectives

func (*NamesAreLikeVerbs) GetMarkup

func (op *NamesAreLikeVerbs) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*NamesAreLikeVerbs) GetNouns

func (op *NamesAreLikeVerbs) GetNouns() *MultipleNames

func (*NamesAreLikeVerbs) GetOtherNouns

func (op *NamesAreLikeVerbs) GetOtherNouns() (ret *MultipleNames)

func (*NamesAreLikeVerbs) GetVerb

func (op *NamesAreLikeVerbs) GetVerb() (ret string)

func (*NamesAreLikeVerbs) MatchLine added in v0.24.8

func (op *NamesAreLikeVerbs) MatchLine(q JessContext, in InputState) (ret InputState, okay bool)

func (*NamesAreLikeVerbs) Phase

func (op *NamesAreLikeVerbs) Phase() weaver.Phase

------------------------------------------------------------------------- NamesAreLikeVerbs The bottle is closed [*in* the library.] the adjectives ( traits and kinds ) are required; the verb and other noun are optional. ------------------------------------------------------------------------- matches in the NounPhase phase

func (*NamesAreLikeVerbs) TypeInfo

func (*NamesAreLikeVerbs) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type NamesAreLikeVerbs_Slice

type NamesAreLikeVerbs_Slice []NamesAreLikeVerbs

Holds a slice of type NamesAreLikeVerbs.

func (*NamesAreLikeVerbs_Slice) Repeats

func (op *NamesAreLikeVerbs_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of NamesAreLikeVerbs.

func (*NamesAreLikeVerbs_Slice) TypeInfo

func (*NamesAreLikeVerbs_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of NamesAreLikeVerbs.

type NamesVerbNames

type NamesVerbNames struct {
	Names      MultipleNames
	Are        Are
	Verb       Verb
	OtherNames MultipleNames
	Markup     map[string]any `json:",omitempty"`
}

Names are verb (other) names. ex.

The thing called the stake is on the supporter called the altar.

func (*NamesVerbNames) Generate

func (op *NamesVerbNames) Generate(ctx JessContext) (err error)

func (*NamesVerbNames) GetAdjectives

func (op *NamesVerbNames) GetAdjectives() (_ MultipleAdjectives)

func (*NamesVerbNames) GetMarkup

func (op *NamesVerbNames) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*NamesVerbNames) GetNouns

func (op *NamesVerbNames) GetNouns() *MultipleNames

func (*NamesVerbNames) GetOtherNouns

func (op *NamesVerbNames) GetOtherNouns() *MultipleNames

func (*NamesVerbNames) GetVerb

func (op *NamesVerbNames) GetVerb() string

func (*NamesVerbNames) MatchLine added in v0.24.8

func (op *NamesVerbNames) MatchLine(q JessContext, line InputState) (ret InputState, okay bool)

func (*NamesVerbNames) Phase

func (op *NamesVerbNames) Phase() weaver.Phase

------------------------------------------------------------------------- NamesVerbNames A container called the trunk is *in* the lobby. ------------------------------------------------------------------------- matches in the NounPhase phase

func (*NamesVerbNames) TypeInfo

func (*NamesVerbNames) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type NamesVerbNames_Slice

type NamesVerbNames_Slice []NamesVerbNames

Holds a slice of type NamesVerbNames.

func (*NamesVerbNames_Slice) Repeats

func (op *NamesVerbNames_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of NamesVerbNames.

func (*NamesVerbNames_Slice) TypeInfo

func (*NamesVerbNames_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of NamesVerbNames.

type NewTrait

type NewTrait struct {
	Matched  Matched
	NewTrait *NewTrait
	Markup   map[string]any `json:",omitempty"`
}

One or more new trait names, separated by the word "or".

func (*NewTrait) GetMarkup

func (op *NewTrait) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*NewTrait) Iterate

func (op *NewTrait) Iterate() NewTraitIterator

unwind the tree of additional kinds

func (*NewTrait) Match

func (op *NewTrait) Match(q JessContext, input *InputState) (okay bool)

func (*NewTrait) TypeInfo

func (*NewTrait) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type NewTraitIterator

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

func (*NewTraitIterator) GetNext

func (it *NewTraitIterator) GetNext() (ret *NewTrait)

func (NewTraitIterator) HasNext

func (it NewTraitIterator) HasNext() bool

type NewTrait_Slice

type NewTrait_Slice []NewTrait

Holds a slice of type NewTrait.

func (*NewTrait_Slice) Repeats

func (op *NewTrait_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of NewTrait.

func (*NewTrait_Slice) TypeInfo

func (*NewTrait_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of NewTrait.

type NounMaker added in v0.24.8

type NounMaker interface {
	BuildNouns(JessContext, weaver.Weaves, rt.Runtime, NounProperties) ([]DesiredNoun, error)
}

really this builds "pending nouns".... to support "counted nouns" any given specification can generate multiple nouns ( even though all, other than "names" and "counted nouns" only generate one a piece. )

type NounMakerRef added in v0.24.8

type NounMakerRef struct {
	NounMaker
	IsNil bool
}

type NounMaker_Slot added in v0.24.8

type NounMaker_Slot struct{ Value NounMaker }

Holds a single slot.

func (*NounMaker_Slot) TypeInfo added in v0.24.8

func (*NounMaker_Slot) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a single slot.

type NounMaker_Slots added in v0.24.8

type NounMaker_Slots []NounMaker

Holds a slice of slots.

func (*NounMaker_Slots) Repeats added in v0.24.8

func (op *NounMaker_Slots) Repeats() bool

Implements typeinfo.Repeats for a slice of slots.

func (*NounMaker_Slots) TypeInfo added in v0.24.8

func (*NounMaker_Slots) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of slots.

type NounProperties

type NounProperties struct {
	Traits []string
	Kinds  []string
}

type NounPropertyValue

type NounPropertyValue struct {
	PropertyNoun        PropertyNoun
	Has                 Words
	PropertyPossessions PropertyPossessions

	Markup map[string]any `json:",omitempty"`
	// contains filtered or unexported fields
}

Assigns a default value to a noun. ex.

The pen has (the) description (of) "mightier than the sword."

like inform, adjectives ( in phrases with "is" ) cannot be combined with property phrases ( "has/of" )

func (*NounPropertyValue) GetBuilder added in v0.24.8

func (op *NounPropertyValue) GetBuilder() Builder

see: TryNounPropertyValue

func (*NounPropertyValue) GetMarkup

func (op *NounPropertyValue) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*NounPropertyValue) TypeInfo

func (*NounPropertyValue) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type NounPropertyValue_Slice

type NounPropertyValue_Slice []NounPropertyValue

Holds a slice of type NounPropertyValue.

func (*NounPropertyValue_Slice) Repeats

func (op *NounPropertyValue_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of NounPropertyValue.

func (*NounPropertyValue_Slice) TypeInfo

func (*NounPropertyValue_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of NounPropertyValue.

type OptionalMatcher added in v0.24.8

type OptionalMatcher interface {
	Match(JessContext, *InputState) bool
}

used internally for matching some kinds of phrases.

type Paragraph

type Paragraph struct {
	File string
	// sentences within the paragraph.
	// each sentence is its own slice of tokens.
	// weaving winnows this list.
	Phrases []Phrase
	// contains filtered or unexported fields
}

represents a block of text

func MakeParagraph added in v0.24.8

func MakeParagraph(file string, phrases [][]match.TokenValue) Paragraph

use the existing tokens as a paragraph ( ex. from parsing a plain text section )

func NewParagraph

func NewParagraph(pos compact.Source, str string, assign rt.Assignment) (ret Paragraph, err error)

parse the passed string into a paragraph of sentences. ( ex. parsing a story DeclareStatement )

func (*Paragraph) WeaveParagraph added in v0.24.8

func (p *Paragraph) WeaveParagraph(z weaver.Phase, q Query, u Scheduler) (okay bool, err error)

tries to match every (remaining) sentence of the paragraph. expects to be called every phase returns true when it no longer needs to be called because everything is scheduled

type Phrase added in v0.24.8

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

a sentence within a paragraph.

func (*Phrase) Build added in v0.24.8

func (el *Phrase) Build(jc JessContext) (okay bool)

returns true if a build was initiated

type PrefixValue

type PrefixValue rules.Prefix

type PromisedMatcher added in v0.24.8

type PromisedMatcher interface {
	GetBuilder() Builder
	typeinfo.Instance // helps with logging: they are all generated classes.
}

what do accept/reject function pairs generate? they generate builders.

type PromisedMatcher_Slot added in v0.24.8

type PromisedMatcher_Slot struct{ Value PromisedMatcher }

Holds a single slot.

func (*PromisedMatcher_Slot) TypeInfo added in v0.24.8

func (*PromisedMatcher_Slot) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a single slot.

type PromisedMatcher_Slots added in v0.24.8

type PromisedMatcher_Slots []PromisedMatcher

Holds a slice of slots.

func (*PromisedMatcher_Slots) Repeats added in v0.24.8

func (op *PromisedMatcher_Slots) Repeats() bool

Implements typeinfo.Repeats for a slice of slots.

func (*PromisedMatcher_Slots) TypeInfo added in v0.24.8

func (*PromisedMatcher_Slots) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of slots.

type Pronoun added in v0.24.8

type Pronoun struct {
	Matched Matched

	Markup map[string]any `json:",omitempty"`
	// contains filtered or unexported fields
}

Matches the word "it". note: in inform, pronouns can be implicit. ex. The description is "something about the former noun." and they can apply to kinds `A thing has a number called age. The age is 42.`

func (*Pronoun) BuildNouns added in v0.24.8

func (op *Pronoun) BuildNouns(q JessContext, w weaver.Weaves, run rt.Runtime, props NounProperties) (ret []DesiredNoun, err error)

names are often potential nouns; this helper generates them as such.

func (*Pronoun) BuildPropertyNoun added in v0.24.8

func (op *Pronoun) BuildPropertyNoun(ctx BuildContext) (ActualNoun, error)

PropertyNoun interface, only valid after a match.

func (*Pronoun) GetKind added in v0.24.8

func (op *Pronoun) GetKind() string

PropertyNoun interface, only valid after a match. ( the kind of the sentence topic is needed to match properties )

func (*Pronoun) GetMarkup added in v0.24.8

func (op *Pronoun) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Pronoun) Match added in v0.24.8

func (op *Pronoun) Match(q JessContext, input *InputState) (okay bool)

for non-promise matching code pathss when the query context has "MatchPronouns", try to match the *use* of a pronoun ( ex. "it" ).

func (*Pronoun) TypeInfo added in v0.24.8

func (*Pronoun) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type Pronoun_Slice added in v0.24.8

type Pronoun_Slice []Pronoun

Holds a slice of type Pronoun.

func (*Pronoun_Slice) Repeats added in v0.24.8

func (op *Pronoun_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Pronoun.

func (*Pronoun_Slice) TypeInfo added in v0.24.8

func (*Pronoun_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Pronoun.

type Property

type Property struct {
	Article *Article
	Matched Matched

	Markup map[string]any `json:",omitempty"`
	// contains filtered or unexported fields
}

Matches the name of a field in a kind.

func (*Property) GetMarkup

func (op *Property) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Property) TypeInfo

func (*Property) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type PropertyBuilder added in v0.24.8

type PropertyBuilder struct {
	Context JessContext // maybe
	// contains filtered or unexported fields
}

func (*PropertyBuilder) Build added in v0.24.8

func (pb *PropertyBuilder) Build(out BuildContext) (err error)

func (*PropertyBuilder) GetKind added in v0.24.8

func (pb *PropertyBuilder) GetKind() string

type PropertyNoun added in v0.24.8

type PropertyNoun interface {
	GetKind() string // to pick the names of properties from phrases.
	BuildPropertyNoun(BuildContext) (ActualNoun, error)
}

type PropertyNounValue

type PropertyNounValue struct {
	Property      Property
	Of            Words
	PropertyNoun  PropertyNoun
	Are           Are
	PropertyValue PropertyValue

	Markup map[string]any `json:",omitempty"`
	// contains filtered or unexported fields
}

Assigns a default value to a noun. ex.

The description of the pen is "mightier than the sword."

As a special case this also allows a list of quoted text. ( indicated with "are", versus "is" ) ex. The implications of carrying are "not worn" and "portable".

func (*PropertyNounValue) GetBuilder added in v0.24.8

func (op *PropertyNounValue) GetBuilder() Builder

func (*PropertyNounValue) GetMarkup

func (op *PropertyNounValue) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*PropertyNounValue) TypeInfo

func (*PropertyNounValue) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type PropertyNounValue_Slice

type PropertyNounValue_Slice []PropertyNounValue

Holds a slice of type PropertyNounValue.

func (*PropertyNounValue_Slice) Repeats

func (op *PropertyNounValue_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of PropertyNounValue.

func (*PropertyNounValue_Slice) TypeInfo

func (*PropertyNounValue_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of PropertyNounValue.

type PropertyNoun_Slot added in v0.24.8

type PropertyNoun_Slot struct{ Value PropertyNoun }

Holds a single slot.

func (*PropertyNoun_Slot) TypeInfo added in v0.24.8

func (*PropertyNoun_Slot) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a single slot.

type PropertyNoun_Slots added in v0.24.8

type PropertyNoun_Slots []PropertyNoun

Holds a slice of slots.

func (*PropertyNoun_Slots) Repeats added in v0.24.8

func (op *PropertyNoun_Slots) Repeats() bool

Implements typeinfo.Repeats for a slice of slots.

func (*PropertyNoun_Slots) TypeInfo added in v0.24.8

func (*PropertyNoun_Slots) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of slots.

type PropertyPossessions added in v0.24.8

type PropertyPossessions struct {
	Property              Property
	Of                    *Words
	PropertyValue         PropertyValue
	AdditionalPossessions *AdditionalPossessions
	Markup                map[string]any `json:",omitempty"`
}

Matches one or more pairs of property and value. Each pair is separated by ands ( or commas. ) For example: `has age 42 and height 32.`

func (*PropertyPossessions) GetMarkup added in v0.24.8

func (op *PropertyPossessions) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*PropertyPossessions) TypeInfo added in v0.24.8

func (*PropertyPossessions) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type PropertyPossessions_Slice added in v0.24.8

type PropertyPossessions_Slice []PropertyPossessions

Holds a slice of type PropertyPossessions.

func (*PropertyPossessions_Slice) Repeats added in v0.24.8

func (op *PropertyPossessions_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of PropertyPossessions.

func (*PropertyPossessions_Slice) TypeInfo added in v0.24.8

func (*PropertyPossessions_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of PropertyPossessions.

type PropertyType

type PropertyType struct {
	Primitive string
	Kind      *Kind
	Markup    map[string]any `json:",omitempty"`
}

Matches text, number, kind ( kind|aspect|record ) as part of 'kinds_have_properties'. Exactly one member can match.

func (*PropertyType) GetMarkup

func (op *PropertyType) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*PropertyType) GetType

func (op *PropertyType) GetType(listOf bool) (ret mdl.FieldInfo, err error)

return a default field name, its affine type and its optional class name

func (*PropertyType) Match

func (op *PropertyType) Match(q JessContext, input *InputState) (okay bool)

func (*PropertyType) TypeInfo

func (*PropertyType) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type PropertyType_Slice

type PropertyType_Slice []PropertyType

Holds a slice of type PropertyType.

func (*PropertyType_Slice) Repeats

func (op *PropertyType_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of PropertyType.

func (*PropertyType_Slice) TypeInfo

func (*PropertyType_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of PropertyType.

type PropertyValue added in v0.24.8

type PropertyValue interface {
	Assignment() rt.Assignment
}

type PropertyValue_Slot added in v0.24.8

type PropertyValue_Slot struct{ Value PropertyValue }

Holds a single slot.

func (*PropertyValue_Slot) TypeInfo added in v0.24.8

func (*PropertyValue_Slot) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a single slot.

type PropertyValue_Slots added in v0.24.8

type PropertyValue_Slots []PropertyValue

Holds a slice of slots.

func (*PropertyValue_Slots) Repeats added in v0.24.8

func (op *PropertyValue_Slots) Repeats() bool

Implements typeinfo.Repeats for a slice of slots.

func (*PropertyValue_Slots) TypeInfo added in v0.24.8

func (*PropertyValue_Slots) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of slots.

type Property_Slice

type Property_Slice []Property

Holds a slice of type Property.

func (*Property_Slice) Repeats

func (op *Property_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Property.

func (*Property_Slice) TypeInfo

func (*Property_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Property.

type PvFlags added in v0.24.8

type PvFlags int
const (
	AllowPlural PvFlags = (1 << iota)
	AllowSingular
)

type Query

type Query interface {
	// provides for customization of individual queries.
	// implementations should return 0;
	// individual parse trees can then wrap the query with their own context specific information..
	GetContext() int

	// find the name of the kind which best matches the passed span.
	// return the number of words that matched ( if any. )
	// optionally, return its base kind.
	FindKind([]match.TokenValue, *kindsOf.Kinds) (string, int)

	// find the name of the trait which best matches the passed span.
	// return the number of words that matched ( if any. )
	FindTrait([]match.TokenValue) (string, int)

	// find the name of the field which best matches the passed span.
	// return the number of words that matched ( if any. )
	FindField(kind string, field []match.TokenValue) (string, int)

	// find the name of the noun which best matches the passed span.
	// return the number of words that matched ( if any. )
	// the kind, if specified, will ensure the noun is of that kind;
	// [ so that the caller doesn't have to validate materialized kind paths ]
	// the actual kind of the noun is also optionally returned via kind.
	FindNoun(name []match.TokenValue, pkind *string) (string, int)
}

Matching requires identifying kinds, traits, and macros. tdb: the returned objects are all "string" -- but it might be more useful if they were "resources" and if generator functions required those resources as targets.

type QuotedText

type QuotedText struct {
	Matched string
	Markup  map[string]any `json:",omitempty"`
}

Text that begins and ends with double quotes. The quotes themselves are not part of the matched text. Can be used as the value of a property.

func (*QuotedText) Assignment

func (op *QuotedText) Assignment() rt.Assignment

func (*QuotedText) GetMarkup

func (op *QuotedText) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*QuotedText) Match

func (op *QuotedText) Match(q JessContext, input *InputState) (okay bool)

match combines double quoted and backtick text: generating a leading "QuotedText" indicator and a single "word" containing the entire quoted text.

func (*QuotedText) String

func (op *QuotedText) String() string

func (*QuotedText) TextEval

func (op *QuotedText) TextEval() (ret rt.TextEval)

func (*QuotedText) TypeInfo

func (*QuotedText) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type QuotedText_Slice

type QuotedText_Slice []QuotedText

Holds a slice of type QuotedText.

func (*QuotedText_Slice) Repeats

func (op *QuotedText_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of QuotedText.

func (*QuotedText_Slice) TypeInfo

func (*QuotedText_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of QuotedText.

type QuotedTexts

type QuotedTexts struct {
	QuotedText     QuotedText
	AdditionalText *AdditionalText
	Markup         map[string]any `json:",omitempty"`
}

One or more strings of quoted text separated by the words "and", "comma", or "or".

func (*QuotedTexts) Assignment

func (op *QuotedTexts) Assignment() (ret rt.Assignment)

implements PropertyValue

func (*QuotedTexts) GetMarkup

func (op *QuotedTexts) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*QuotedTexts) Match

func (op *QuotedTexts) Match(q JessContext, input *InputState) (okay bool)

its interesting that we dont have to store anything else all the trait info is in this... even additional traits.

func (*QuotedTexts) Next added in v0.24.8

func (op *QuotedTexts) Next() (ret *QuotedTexts)

-------------------------------------------------------------- QuotedTexts --------------------------------------------------------------

func (*QuotedTexts) Reduce

func (op *QuotedTexts) Reduce() (ret []string)

func (*QuotedTexts) TypeInfo

func (*QuotedTexts) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type QuotedTexts_Slice

type QuotedTexts_Slice []QuotedTexts

Holds a slice of type QuotedTexts.

func (*QuotedTexts_Slice) Repeats

func (op *QuotedTexts_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of QuotedTexts.

func (*QuotedTexts_Slice) TypeInfo

func (*QuotedTexts_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of QuotedTexts.

type RuleName

type RuleName struct {
	Prefix  bool
	Article string
	Matched Matched
	Suffix  bool
	Markup  map[string]any `json:",omitempty"`
}

Specific names can follow rule declarations. ex.

( this is the witness light rule )

func (*RuleName) GetMarkup

func (op *RuleName) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*RuleName) Match

func (op *RuleName) Match(q JessContext, input *InputState) (okay bool)

assumes we are inside the parens

func (*RuleName) TypeInfo

func (*RuleName) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type RuleName_Slice

type RuleName_Slice []RuleName

Holds a slice of type RuleName.

func (*RuleName_Slice) Repeats

func (op *RuleName_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of RuleName.

func (*RuleName_Slice) TypeInfo

func (*RuleName_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of RuleName.

type RulePrefix

type RulePrefix struct {
	Markup map[string]any `json:",omitempty"`
	// contains filtered or unexported fields
}

Matches rule prefixes: before, instead of, when, after, report

func (*RulePrefix) GetMarkup

func (op *RulePrefix) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*RulePrefix) Match

func (op *RulePrefix) Match(q JessContext, input *InputState) (okay bool)

func (*RulePrefix) TypeInfo

func (*RulePrefix) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type RulePrefix_Slice

type RulePrefix_Slice []RulePrefix

Holds a slice of type RulePrefix.

func (*RulePrefix_Slice) Repeats

func (op *RulePrefix_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of RulePrefix.

func (*RulePrefix_Slice) TypeInfo

func (*RulePrefix_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of RulePrefix.

type RuleSuffix

type RuleSuffix struct {
	Markup map[string]any `json:",omitempty"`
	// contains filtered or unexported fields
}

Controls what to do after matching a rule. Matches "then continue", "then stop", "then skip phase", and "begins", "ends" ( for domain rules ) with an optional leading comma.

func (*RuleSuffix) GetMarkup

func (op *RuleSuffix) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*RuleSuffix) Match

func (op *RuleSuffix) Match(q JessContext, input *InputState) (okay bool)

", and then continue"

func (*RuleSuffix) TypeInfo

func (*RuleSuffix) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type RuleSuffix_Slice

type RuleSuffix_Slice []RuleSuffix

Holds a slice of type RuleSuffix.

func (*RuleSuffix_Slice) Repeats

func (op *RuleSuffix_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of RuleSuffix.

func (*RuleSuffix_Slice) TypeInfo

func (*RuleSuffix_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of RuleSuffix.

type RuleTarget

type RuleTarget struct {
	Pronoun      *Pronoun
	Kind         *Kind
	ExistingNoun *ExistingNoun
	Markup       map[string]any `json:",omitempty"`
}

func (*RuleTarget) GetMarkup

func (op *RuleTarget) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*RuleTarget) Match

func (op *RuleTarget) Match(q JessContext, input *InputState) (okay bool)

func (*RuleTarget) TypeInfo

func (*RuleTarget) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type RuleTarget_Slice

type RuleTarget_Slice []RuleTarget

Holds a slice of type RuleTarget.

func (*RuleTarget_Slice) Repeats

func (op *RuleTarget_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of RuleTarget.

func (*RuleTarget_Slice) TypeInfo

func (*RuleTarget_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of RuleTarget.

type Scheduler

type Scheduler interface {
	// can return error if out of phase
	Schedule(weaver.Phase, func(weaver.Weaves, rt.Runtime) error) error
	SchedulePos(compact.Source, weaver.Phase, func(weaver.Weaves, rt.Runtime) error) error
}

type Separator

type Separator int

flags indicating the presence of a comma followed by an optional and.

const (
	CommaSep Separator = 1 << iota
	AndSep
)

func ReadCommaAnd

func ReadCommaAnd(ws []match.TokenValue) (ret Separator, err error)

tests for an optional `, and` or `and` and returns the number of words necessary to skip them. errors if it detects an unexpected sequence of commas or ands. note: when words were hashed, commas became their own Word.

func ReadCommaAndOr

func ReadCommaAndOr(ws []match.TokenValue) (ret Separator, err error)

func (Separator) Len

func (s Separator) Len() int

type Split added in v0.24.8

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

type SubAssignment

type SubAssignment struct {
	Assignment rtti.Assignment
	Markup     map[string]any `json:",omitempty"`
}

Phrases can break out of plain text and into structured tell docs. The documents start with a colon (:) followed by a newline the next line is assumed to be an indented tell mapping or sequence which ends with the first unindented line. Sequences are treated as execute blocks; Mappings are assumed to be a valid eval ( ie. an implementation of one of the rtti interfaces. )

func (*SubAssignment) GetExe

func (op *SubAssignment) GetExe() (ret []rt.Execute, okay bool)

func (*SubAssignment) GetMarkup

func (op *SubAssignment) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*SubAssignment) GetRuleName added in v0.24.8

func (op *SubAssignment) GetRuleName() (ret string)

backdoor for determining a reasonable rule name for plain text sections. generated by flex during parsing.

func (*SubAssignment) Match

func (op *SubAssignment) Match(input *InputState) (okay bool)

func (*SubAssignment) TypeInfo

func (*SubAssignment) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type SubAssignment_Slice

type SubAssignment_Slice []SubAssignment

Holds a slice of type SubAssignment.

func (*SubAssignment_Slice) Repeats

func (op *SubAssignment_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of SubAssignment.

func (*SubAssignment_Slice) TypeInfo

func (*SubAssignment_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of SubAssignment.

type SuffixValue

type SuffixValue rules.Suffix

type TimedRule

type TimedRule struct {
	RulePrefix    RulePrefix
	Someone       bool
	Pattern       Kind
	RuleTarget    *RuleTarget
	RuleSuffix    *RuleSuffix
	RuleName      *RuleName
	SubAssignment SubAssignment
	Markup        map[string]any `json:",omitempty"`
}

Matches pattern rule definitions.

func (*TimedRule) Generate

func (op *TimedRule) Generate(ctx JessContext) (err error)

goal: schedule the rule

func (*TimedRule) GetMarkup

func (op *TimedRule) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*TimedRule) MatchLine added in v0.24.8

func (op *TimedRule) MatchLine(q JessContext, line InputState) (ret InputState, okay bool)

func (*TimedRule) TypeInfo

func (*TimedRule) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type TimedRule_Slice

type TimedRule_Slice []TimedRule

Holds a slice of type TimedRule.

func (*TimedRule_Slice) Repeats

func (op *TimedRule_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of TimedRule.

func (*TimedRule_Slice) TypeInfo

func (*TimedRule_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of TimedRule.

type Topic added in v0.24.8

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

has three states: contains error, contains a noun, contains either.

func (*Topic) Resolve added in v0.24.8

func (tc *Topic) Resolve() (ret ActualNoun, err error)

returns errMissing so the scheduler will loop until the topic completes or errors.

type Trait

type Trait struct {
	Article *Article
	Matched string
	Markup  map[string]any `json:",omitempty"`
}

Matches the name of an (existing) trait.

func (*Trait) GetMarkup

func (op *Trait) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Trait) Match

func (op *Trait) Match(q JessContext, input *InputState) (okay bool)

func (*Trait) String

func (op *Trait) String() string

func (*Trait) TypeInfo

func (*Trait) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type Trait_Slice

type Trait_Slice []Trait

Holds a slice of type Trait.

func (*Trait_Slice) Repeats

func (op *Trait_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Trait.

func (*Trait_Slice) TypeInfo

func (*Trait_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Trait.

type Traits

type Traits struct {
	Trait            Trait
	AdditionalTraits *AdditionalTraits
	Markup           map[string]any `json:",omitempty"`
}

Matches at least one trait.

func (*Traits) GetMarkup

func (op *Traits) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Traits) GetTraits

func (op *Traits) GetTraits() *Traits

unwind the tree of additional traits

func (*Traits) Match

func (op *Traits) Match(q JessContext, input *InputState) (okay bool)

its interesting that we dont have to store anything else all the trait info is in this... even additional traits.

func (*Traits) Next added in v0.24.8

func (op *Traits) Next() (ret *Traits)

iterator helper

func (*Traits) TypeInfo

func (*Traits) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type Traits_Slice

type Traits_Slice []Traits

Holds a slice of type Traits.

func (*Traits_Slice) Repeats

func (op *Traits_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Traits.

func (*Traits_Slice) TypeInfo

func (*Traits_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Traits.

type Understand

type Understand struct {
	Understand  Words
	QuotedTexts QuotedTexts
	As          Words
	Article     *Article
	PluralOf    string
	Names       MultipleNames
	Markup      map[string]any `json:",omitempty"`
}

Various phrases, all starting with the word "Understand".

func (*Understand) Generate

func (op *Understand) Generate(ctx JessContext) error

func (*Understand) GetMarkup

func (op *Understand) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Understand) MatchLine added in v0.24.8

func (op *Understand) MatchLine(q JessContext, line InputState) (ret InputState, okay bool)

func (*Understand) Phase

func (op *Understand) Phase() weaver.Phase

func (*Understand) TypeInfo

func (*Understand) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type Understand_Slice

type Understand_Slice []Understand

Holds a slice of type Understand.

func (*Understand_Slice) Repeats

func (op *Understand_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Understand.

func (*Understand_Slice) TypeInfo

func (*Understand_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Understand.

type Verb

type Verb struct {
	Text   string
	Markup map[string]any `json:",omitempty"`
}

Matches one or more predefined verbs. ( verbs are nouns of the verb kind )

func (*Verb) GetMarkup

func (op *Verb) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Verb) Match

func (op *Verb) Match(q JessContext, input *InputState) (okay bool)

the passed phrase is the macro to match

func (*Verb) TypeInfo

func (*Verb) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type VerbDesc

type VerbDesc struct {
	Subject,
	Object,
	Alternate,
	Relation string
	Implies  []string
	Reversed bool
}

a snapshot of the verb; represented as a noun in the db.

type VerbNamesAreNames

type VerbNamesAreNames struct {
	Verb       Verb
	Names      MultipleNames
	Are        Are
	OtherNames MultipleNames
	Markup     map[string]any `json:",omitempty"`
}

Verb names are (other) names. ex.

In the coffin are some coins, a notebook, and the gripping hand.

This intentionally doesn't recognize adjectives attached to named names. "In the closed coffin" generates a name with the name "closed coffin" not a coffin in an initially closed state.

func (*VerbNamesAreNames) Generate

func (op *VerbNamesAreNames) Generate(ctx JessContext) error

func (*VerbNamesAreNames) GetAdjectives

func (op *VerbNamesAreNames) GetAdjectives() (_ MultipleAdjectives)

func (*VerbNamesAreNames) GetMarkup

func (op *VerbNamesAreNames) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*VerbNamesAreNames) GetNouns

func (op *VerbNamesAreNames) GetNouns() *MultipleNames

func (*VerbNamesAreNames) GetOtherNouns

func (op *VerbNamesAreNames) GetOtherNouns() *MultipleNames

func (*VerbNamesAreNames) GetVerb

func (op *VerbNamesAreNames) GetVerb() string

func (*VerbNamesAreNames) MatchLine added in v0.24.8

func (op *VerbNamesAreNames) MatchLine(q JessContext, line InputState) (ret InputState, okay bool)

func (*VerbNamesAreNames) Phase

func (op *VerbNamesAreNames) Phase() weaver.Phase

runs in the NounPhase phase

func (*VerbNamesAreNames) TypeInfo

func (*VerbNamesAreNames) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type VerbNamesAreNames_Slice

type VerbNamesAreNames_Slice []VerbNamesAreNames

Holds a slice of type VerbNamesAreNames.

func (*VerbNamesAreNames_Slice) Repeats

func (op *VerbNamesAreNames_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of VerbNamesAreNames.

func (*VerbNamesAreNames_Slice) TypeInfo

func (*VerbNamesAreNames_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of VerbNamesAreNames.

type VerbPhrase

type VerbPhrase struct {
	Verb       Verb
	PlainNames MultipleNames
	Markup     map[string]any `json:",omitempty"`
}

A phrase, starting with a verb, that ends a sentence. ex.

... in the kitchen.
... carries the football and sousaphone.

func (*VerbPhrase) GetMarkup

func (op *VerbPhrase) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*VerbPhrase) Match

func (op *VerbPhrase) Match(q JessContext, input *InputState) (okay bool)

func (*VerbPhrase) TypeInfo

func (*VerbPhrase) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type VerbPhrase_Slice

type VerbPhrase_Slice []VerbPhrase

Holds a slice of type VerbPhrase.

func (*VerbPhrase_Slice) Repeats

func (op *VerbPhrase_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of VerbPhrase.

func (*VerbPhrase_Slice) TypeInfo

func (*VerbPhrase_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of VerbPhrase.

type Verb_Slice

type Verb_Slice []Verb

Holds a slice of type Verb.

func (*Verb_Slice) Repeats

func (op *Verb_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Verb.

func (*Verb_Slice) TypeInfo

func (*Verb_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Verb.

type Words

type Words struct {
	Matched Matched
	Markup  map[string]any `json:",omitempty"`
}

Matches one or more predefined words.

func (*Words) GetMarkup

func (op *Words) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Words) Match

func (op *Words) Match(_ JessContext, input *InputState, hashes ...uint64) (okay bool)

func (*Words) Split added in v0.24.8

func (op *Words) Split(in InputState, hashes ...uint64) (lhs, rhs InputState, okay bool)

func (*Words) TypeInfo

func (*Words) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type Words_Slice

type Words_Slice []Words

Holds a slice of type Words.

func (*Words_Slice) Repeats

func (op *Words_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Words.

func (*Words_Slice) TypeInfo

func (*Words_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Words.

Jump to

Keyboard shortcuts

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