jess

package
v0.24.5 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: BSD-3-Clause Imports: 27 Imported by: 0

Documentation

Overview

Package jess helps to turn english like sentences into story fragments destined for a story db. 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 types of sentences jess can process are based on Inform7's modeling language.

The matching algorithm uses parse trees defined by the Tapestry commands in jess.tells. The top level command -- the root of all parse trees -- is the type "MatchingPhrases". Each successfully matched sentence results a single MatchingPhrases object with one ( and only one ) of its members containing the parsed data.

Code generated by Tapestry; edit at your own risk.

Index

Constants

View Source
const (
	// special names:
	PlayerSelf    = "self"
	FactDirection = "dir"
	// kinds:
	Actors     = "actors"     // for player self
	Objects    = "objects"    // the kind of a potential room or door
	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)
	ExcludeNounMatching
	// 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
	// "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",
	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_AdditionalText typeinfo.Flow

additional_text, a type of flow.

View Source
var Zt_AdditionalTraits typeinfo.Flow

additional_traits, a type of flow.

View Source
var Zt_Adjectives typeinfo.Flow

adjectives, 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_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_Kinds typeinfo.Flow

kinds, a type of flow.

View Source
var Zt_KindsAreEither typeinfo.Flow

kinds_are_either, 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_KindsOf typeinfo.Flow

kinds_of, a type of flow.

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{
		"comment": "Used to store matching text",
	},
}

matched, a type of slot.

View Source
var Zt_MatchingNumber typeinfo.Flow

matching_number, a type of flow.

View Source
var Zt_MatchingPhrases typeinfo.Flow

matching_phrases, a type of flow.

View Source
var Zt_Name typeinfo.Flow

name, a type of flow.

View Source
var Zt_NamedNoun typeinfo.Flow

named_noun, a type of flow.

View Source
var Zt_Names typeinfo.Flow

names, 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_Noun typeinfo.Flow

noun, a type of flow.

View Source
var Zt_NounBuilder = typeinfo.Slot{
	Name: "noun_builder",
}

noun_builder, a type of slot.

View Source
var Zt_NounPropertyValue typeinfo.Flow

noun_property_value, a type of flow.

View Source
var Zt_Property typeinfo.Flow

property, a type of flow.

View Source
var Zt_PropertyNounValue typeinfo.Flow

property_noun_value, a type of flow.

View Source
var Zt_PropertyType typeinfo.Flow

property_type, a type of flow.

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_SingleValue typeinfo.Flow

single_value, 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, traits Traitor) (err error)

setup the default traits for the passed kind

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
		Interpreter
	}](q Query, 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 Traitor) (ret []string)

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

func WordsToNum

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

Currently good up to twenty. maybe https://github.com/donna-legal/word2number?

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 )

type AdditionalAdjectives

type AdditionalAdjectives struct {
	CommaAnd   CommaAnd
	Adjectives Adjectives
	Markup     map[string]any
}

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 Query, 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 additional_adjectives

func (*AdditionalAdjectives_Slice) Repeats

func (op *AdditionalAdjectives_Slice) Repeats() bool

implements typeinfo.Repeats

func (*AdditionalAdjectives_Slice) TypeInfo

implements typeinfo.Instance

type AdditionalDirections

type AdditionalDirections struct {
	CommaAnd             CommaAnd
	DirectionOfLinking   DirectionOfLinking
	AdditionalDirections *AdditionalDirections
	Markup               map[string]any
}

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 Query, 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 additional_directions

func (*AdditionalDirections_Slice) Repeats

func (op *AdditionalDirections_Slice) Repeats() bool

implements typeinfo.Repeats

func (*AdditionalDirections_Slice) TypeInfo

implements typeinfo.Instance

type AdditionalKinds

type AdditionalKinds struct {
	CommaAnd CommaAnd
	Kinds    Kinds
	Markup   map[string]any
}

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 Query, 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 additional_kinds

func (*AdditionalKinds_Slice) Repeats

func (op *AdditionalKinds_Slice) Repeats() bool

implements typeinfo.Repeats

func (*AdditionalKinds_Slice) TypeInfo

func (*AdditionalKinds_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type AdditionalLinks struct {
	CommaAnd        CommaAnd
	Linking         Linking
	AdditionalLinks *AdditionalLinks
	Markup          map[string]any
}

partial phrase used for map connections 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 Query, input *InputState) (okay bool)

----

func (*AdditionalLinks) TypeInfo

func (*AdditionalLinks) TypeInfo() typeinfo.T

implements typeinfo.Instance

type AdditionalLinks_Slice []AdditionalLinks

holds a slice of type additional_links

func (op *AdditionalLinks_Slice) Repeats() bool

implements typeinfo.Repeats

func (*AdditionalLinks_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type AdditionalNames

type AdditionalNames struct {
	CommaAnd CommaAnd
	Names    Names
	Markup   map[string]any
}

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 Query, 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 additional_names

func (*AdditionalNames_Slice) Repeats

func (op *AdditionalNames_Slice) Repeats() bool

implements typeinfo.Repeats

func (*AdditionalNames_Slice) TypeInfo

func (*AdditionalNames_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type AdditionalText

type AdditionalText struct {
	CommaAndOr  CommaAndOr
	QuotedTexts QuotedTexts
	Markup      map[string]any
}

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 Query, 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 additional_text

func (*AdditionalText_Slice) Repeats

func (op *AdditionalText_Slice) Repeats() bool

implements typeinfo.Repeats

func (*AdditionalText_Slice) TypeInfo

func (*AdditionalText_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type AdditionalTraits

type AdditionalTraits struct {
	CommaAnd *CommaAnd
	Traits   Traits
	Markup   map[string]any
}

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 Query, 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 additional_traits

func (*AdditionalTraits_Slice) Repeats

func (op *AdditionalTraits_Slice) Repeats() bool

implements typeinfo.Repeats

func (*AdditionalTraits_Slice) TypeInfo

func (*AdditionalTraits_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Adjectives

type Adjectives struct {
	Traits               *Traits
	CommaAnd             *CommaAnd
	Kind                 *Kind
	AdditionalAdjectives *AdditionalAdjectives
	Markup               map[string]any
}

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 (*Adjectives) GetMarkup

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

implements typeinfo.Markup

func (*Adjectives) GetTraits

func (op *Adjectives) GetTraits() (ret Traitor)

func (*Adjectives) Match

func (op *Adjectives) Match(q Query, input *InputState) (okay bool)

func (Adjectives) Reduce

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

func (*Adjectives) TypeInfo

func (*Adjectives) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Adjectives_Slice

type Adjectives_Slice []Adjectives

holds a slice of type adjectives

func (*Adjectives_Slice) Repeats

func (op *Adjectives_Slice) Repeats() bool

implements typeinfo.Repeats

func (*Adjectives_Slice) TypeInfo

func (*Adjectives_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Are

type Are struct {
	Matched Matched
	Markup  map[string]any
}

matches "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(_ Query, input *InputState) (okay bool)

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

func (*Are_Slice) TypeInfo

func (*Are_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Article

type Article struct {
	Text   string
	Flags  ArticleFlags
	Markup map[string]any
}

one of a predefined set of determiners: the, a/n, some, our. 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. 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 Query, input *InputState) (okay bool)

func (*Article) TypeInfo

func (*Article) TypeInfo() typeinfo.T

implements typeinfo.Instance

type ArticleFlags

type ArticleFlags struct {
	Indefinite bool
	Plural     bool
}

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

func (*Article_Slice) TypeInfo

func (*Article_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type AspectsAreTraits

type AspectsAreTraits struct {
	Aspect     Kind
	Are        Are
	PlainNames Names
	Markup     map[string]any
}

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.` 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) Match

func (op *AspectsAreTraits) Match(q Query, input *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 aspects_are_traits

func (*AspectsAreTraits_Slice) Repeats

func (op *AspectsAreTraits_Slice) Repeats() bool

implements typeinfo.Repeats

func (*AspectsAreTraits_Slice) TypeInfo

func (*AspectsAreTraits_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Called

type Called struct {
	Matched Matched
	Markup  map[string]any
}

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(_ Query, input *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
}

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 Query, 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 called_name

func (*CalledName_Slice) Repeats

func (op *CalledName_Slice) Repeats() bool

implements typeinfo.Repeats

func (*CalledName_Slice) TypeInfo

func (*CalledName_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

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

func (*Called_Slice) TypeInfo

func (*Called_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type CommaAnd

type CommaAnd struct {
	Matched Matched
	Markup  map[string]any
}

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

func (*CommaAnd) GetMarkup

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

implements typeinfo.Markup

func (*CommaAnd) Match

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

func (*CommaAnd) TypeInfo

func (*CommaAnd) TypeInfo() typeinfo.T

implements typeinfo.Instance

type CommaAndOr

type CommaAndOr struct {
	Matched Matched
	Markup  map[string]any
}

conjunction or junction. matches commas, ands, and ors. 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(_ Query, 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 comma_and_or

func (*CommaAndOr_Slice) Repeats

func (op *CommaAndOr_Slice) Repeats() bool

implements typeinfo.Repeats

func (*CommaAndOr_Slice) TypeInfo

func (*CommaAndOr_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type CommaAnd_Slice

type CommaAnd_Slice []CommaAnd

holds a slice of type comma_and

func (*CommaAnd_Slice) Repeats

func (op *CommaAnd_Slice) Repeats() bool

implements typeinfo.Repeats

func (*CommaAnd_Slice) TypeInfo

func (*CommaAnd_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Context

type Context struct {
	Query
	Scheduler
}

func NewContext

func NewContext(q Query, n Scheduler) Context

type CountedKind

type CountedKind struct {
	Article        *Article
	MatchingNumber MatchingNumber
	Kind           Kind
	Matched        Matched
	Markup         map[string]any
}

provides english specification of a number of objects. ( note: yes, `the five the containers` is permitted. )

func (*CountedKind) BuildNouns

func (op *CountedKind) BuildNouns(q Query, 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 Query, 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 counted_kind

func (*CountedKind_Slice) Repeats

func (op *CountedKind_Slice) Repeats() bool

implements typeinfo.Repeats

func (*CountedKind_Slice) TypeInfo

func (*CountedKind_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type DesiredNoun

type DesiredNoun struct {
	Noun    string // key ( once it has been created; or if it already exists. )
	Aliases []string
	Traits  []string
	Values  []DesiredValue
	//
	ArticleTrait      string
	IndefiniteArticle string
}

fix: maybe move this into weave as a "noun builder" to reduce duplicate queries? maybe has an interface -- so that "AddKind" might be immediately adding for mock; but not for real

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
}

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 Query, 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
}

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 Query, 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 direction_of_linking

func (*DirectionOfLinking_Slice) Repeats

func (op *DirectionOfLinking_Slice) Repeats() bool

implements typeinfo.Repeats

func (*DirectionOfLinking_Slice) TypeInfo

func (*DirectionOfLinking_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

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

func (*Direction_Slice) TypeInfo

func (*Direction_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Generator

type Generator interface {
	Generate(Context) error
}

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

type InputState

type InputState []match.TokenValue

the input state consists of a series of hashes and chunks of the original string. fix? change to a "reader" ( pull ) rather than pre-process?

func (InputState) Cut

func (in InputState) Cut(width int) []match.TokenValue

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

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) Words

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

type Interpreter

type Interpreter interface {
	Match(Query, *InputState) bool
}

used internally for matching some kinds of phrases.

type Iterator

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

func (*Iterator) GetNext

func (it *Iterator) GetNext() (ret *Names)

func (Iterator) HasNext

func (it Iterator) HasNext() bool

type Kind

type Kind struct {
	Article    *Article
	Matched    Matched
	ActualKind ActualKind
	Markup     map[string]any
}

matches the name of an existing kind; can generate a single anonymous noun.

func (*Kind) BuildNouns

func (op *Kind) BuildNouns(q Query, 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 Query, 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
	NamedNoun NamedNoun
	Markup    map[string]any
}

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 Query, 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 Traitor)

func (*KindCalled) Match

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

func (*KindCalled) TypeInfo

func (*KindCalled) TypeInfo() typeinfo.T

implements typeinfo.Instance

type KindCalled_Slice

type KindCalled_Slice []KindCalled

holds a slice of type kind_called

func (*KindCalled_Slice) Repeats

func (op *KindCalled_Slice) Repeats() bool

implements typeinfo.Repeats

func (*KindCalled_Slice) TypeInfo

func (*KindCalled_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

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

func (*Kind_Slice) TypeInfo

func (*Kind_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Kinder

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

func (*Kinder) GetNext

func (it *Kinder) GetNext() (ret *Kinds)

func (Kinder) HasNext

func (it Kinder) HasNext() bool

type Kinds

type Kinds struct {
	Traits          *Traits
	Article         *Article
	Matched         Matched
	AdditionalKinds *AdditionalKinds
	Markup          map[string]any
}

matches a set of possible kinds as part of kinds_are_traits jess tests for but prohibits leading traits.

func (*Kinds) GetMarkup

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

implements typeinfo.Markup

func (*Kinds) GetNormalizedName

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

func (*Kinds) GetTraits

func (op *Kinds) GetTraits() (ret Traitor)

unwind the tree of traits

func (*Kinds) Iterate

func (op *Kinds) Iterate() Kinder

unwind the tree of additional kinds

func (*Kinds) Match

func (op *Kinds) Match(q Query, input *InputState) (okay bool)

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

func (*Kinds) TypeInfo

func (*Kinds) TypeInfo() typeinfo.T

implements typeinfo.Instance

type KindsAreEither

type KindsAreEither struct {
	Kind   Kind
	CanBe  Words
	Traits NewTrait
	Markup map[string]any
}

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) Match

func (op *KindsAreEither) Match(q Query, input *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 kinds_are_either

func (*KindsAreEither_Slice) Repeats

func (op *KindsAreEither_Slice) Repeats() bool

implements typeinfo.Repeats

func (*KindsAreEither_Slice) TypeInfo

func (*KindsAreEither_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type KindsAreTraits

type KindsAreTraits struct {
	Kinds   Kinds
	Are     Are
	Usually Words
	Traits  Traits
	Markup  map[string]any
}

assigns default traits to a kind. kinds:objects are "usually" traits inform doesn't require the "usually" --

i like it as a way to differentiate phrases about kinds vs. phrases about nouns.

future: inform allows limiting traits to kinds with other traits: for example, `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) Match

func (op *KindsAreTraits) Match(q Query, input *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 kinds_are_traits

func (*KindsAreTraits_Slice) Repeats

func (op *KindsAreTraits_Slice) Repeats() bool

implements typeinfo.Repeats

func (*KindsAreTraits_Slice) TypeInfo

func (*KindsAreTraits_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type KindsHaveProperties

type KindsHaveProperties struct {
	Kind         Kind
	Have         Words
	Article      *Article
	ListOf       string
	PropertyType PropertyType
	CalledName   *CalledName
	Markup       map[string]any
}

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) Match

func (op *KindsHaveProperties) Match(q Query, input *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 kinds_have_properties

func (*KindsHaveProperties_Slice) Repeats

func (op *KindsHaveProperties_Slice) Repeats() bool

implements typeinfo.Repeats

func (*KindsHaveProperties_Slice) TypeInfo

func (*KindsHaveProperties_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type KindsOf

type KindsOf struct {
	Names   Names
	Are     Are
	KindsOf Words
	Traits  *Traits
	Name    Name
	Markup  map[string]any
}

names are "a kind of"/"kinds of" traits kind:any. interesting to note that inform allows "some kind/s of" this is more strict. like inform `The animals called kittens are a kind of things.` is legal.

func (*KindsOf) Generate

func (op *KindsOf) Generate(ctx Context) error

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

func (*KindsOf) GetMarkup

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

implements typeinfo.Markup

func (*KindsOf) GetTraits

func (op *KindsOf) GetTraits() (ret Traitor)

func (*KindsOf) Match

func (op *KindsOf) Match(q Query, input *InputState) (okay bool)

func (*KindsOf) Phase

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

runs in the AncestryPhase phase

func (*KindsOf) TypeInfo

func (*KindsOf) TypeInfo() typeinfo.T

implements typeinfo.Instance

type KindsOf_Slice

type KindsOf_Slice []KindsOf

holds a slice of type kinds_of

func (*KindsOf_Slice) Repeats

func (op *KindsOf_Slice) Repeats() bool

implements typeinfo.Repeats

func (*KindsOf_Slice) TypeInfo

func (*KindsOf_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Kinds_Slice

type Kinds_Slice []Kinds

holds a slice of type kinds

func (*Kinds_Slice) Repeats

func (op *Kinds_Slice) Repeats() bool

implements typeinfo.Repeats

func (*Kinds_Slice) TypeInfo

func (*Kinds_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

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
	Noun       *Noun
	Name       *Name
	Markup     map[string]any
}

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

func (*Linking) BuildNoun

func (op *Linking) BuildNoun(q Query, 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 Query, 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

func (*Linking_Slice) TypeInfo

func (*Linking_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type MapConnections

type MapConnections struct {
	Through         bool
	Doors           Linking
	AdditionalLinks *AdditionalLinks
	Are             Are
	Room            Linking
	Markup          map[string]any
}

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 Context) 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) Match

func (op *MapConnections) Match(q Query, input *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 map_connections

func (*MapConnections_Slice) Repeats

func (op *MapConnections_Slice) Repeats() bool

implements typeinfo.Repeats

func (*MapConnections_Slice) TypeInfo

func (*MapConnections_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type MapDirections

type MapDirections struct {
	DirectionOfLinking DirectionOfLinking
	Are                Are
	Linking            *Linking
	Redirect           *DirectionOfLinking
	Markup             map[string]any
}

A mapping declaration starting with a direction.

func (*MapDirections) Generate

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

func (*MapDirections) GetMarkup

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

implements typeinfo.Markup

func (*MapDirections) Match

func (op *MapDirections) Match(q Query, input *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 map_directions

func (*MapDirections_Slice) Repeats

func (op *MapDirections_Slice) Repeats() bool

implements typeinfo.Repeats

func (*MapDirections_Slice) TypeInfo

func (*MapDirections_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type MapLocations

type MapLocations struct {
	Linking              Linking
	Are                  Are
	DirectionOfLinking   DirectionOfLinking
	AdditionalDirections *AdditionalDirections
	Markup               map[string]any
}

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 Context) 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) Match

func (op *MapLocations) Match(q Query, input *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 map_locations

func (*MapLocations_Slice) Repeats

func (op *MapLocations_Slice) Repeats() bool

implements typeinfo.Repeats

func (*MapLocations_Slice) TypeInfo

func (*MapLocations_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Matched

type Matched []match.TokenValue

Matched - so autogenerated types can refer to tokens

func (Matched) DebugString

func (m Matched) DebugString() string

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

func (*Matched_Slots) TypeInfo

func (*Matched_Slots) TypeInfo() typeinfo.T

implements typeinfo.Instance for a series of slots.

type MatchingNumber

type MatchingNumber struct {
	Number float64
	Markup map[string]any
}

reads a number specified in words or as digits. stores the result as the parsed number.

func (*MatchingNumber) Assignment

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

func (*MatchingNumber) GetMarkup

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

implements typeinfo.Markup

func (*MatchingNumber) Match

func (op *MatchingNumber) Match(q Query, input *InputState) (okay bool)

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

func (*MatchingNumber) TypeInfo

func (*MatchingNumber) TypeInfo() typeinfo.T

implements typeinfo.Instance

type MatchingNumber_Slice

type MatchingNumber_Slice []MatchingNumber

holds a slice of type matching_number

func (*MatchingNumber_Slice) Repeats

func (op *MatchingNumber_Slice) Repeats() bool

implements typeinfo.Repeats

func (*MatchingNumber_Slice) TypeInfo

func (*MatchingNumber_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type MatchingPhrases

type MatchingPhrases struct {
	Understand          Understand
	TimedRule           TimedRule
	KindsOf             KindsOf
	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
}

union of all possible matching phrases. 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. ( an alternative might be slots and some scheduling metadata; | this is fine for now )

func (*MatchingPhrases) GetMarkup

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

implements typeinfo.Markup

func (*MatchingPhrases) TypeInfo

func (*MatchingPhrases) TypeInfo() typeinfo.T

implements typeinfo.Instance

type MatchingPhrases_Slice

type MatchingPhrases_Slice []MatchingPhrases

holds a slice of type matching_phrases

func (*MatchingPhrases_Slice) Repeats

func (op *MatchingPhrases_Slice) Repeats() bool

implements typeinfo.Repeats

func (*MatchingPhrases_Slice) TypeInfo

func (*MatchingPhrases_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Name

type Name struct {
	Article *Article
	Matched Matched
	Markup  map[string]any
}

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) BuildNouns

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

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

func (*Name) GetMarkup

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

implements typeinfo.Markup

func (*Name) GetNormalizedName

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

func (*Name) Match

func (op *Name) Match(q Query, 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

func (*Name_Slice) TypeInfo

func (*Name_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type NamedNoun

type NamedNoun struct {
	Noun   *Noun
	Name   *Name
	Markup map[string]any
}

matches an existing noun, or if not: then something new.

func (*NamedNoun) BuildNouns

func (op *NamedNoun) BuildNouns(q Query, w weaver.Weaves, run rt.Runtime, props NounProperties) ([]DesiredNoun, error)

panics if not matched

func (*NamedNoun) GetMarkup

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

implements typeinfo.Markup

func (*NamedNoun) GetNormalizedName

func (op *NamedNoun) GetNormalizedName() (ret string, err error)

func (*NamedNoun) Match

func (op *NamedNoun) Match(q Query, input *InputState) (okay bool)

func (*NamedNoun) TypeInfo

func (*NamedNoun) TypeInfo() typeinfo.T

implements typeinfo.Instance

type NamedNoun_Slice

type NamedNoun_Slice []NamedNoun

holds a slice of type named_noun

func (*NamedNoun_Slice) Repeats

func (op *NamedNoun_Slice) Repeats() bool

implements typeinfo.Repeats

func (*NamedNoun_Slice) TypeInfo

func (*NamedNoun_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Names

type Names struct {
	CountedKind     *CountedKind
	KindCalled      *KindCalled
	Noun            *Noun
	Kind            *Kind
	Name            *Name
	AdditionalNames *AdditionalNames
	Markup          map[string]any
}

Specifies one or more nouns, in full or in part. Only one of the options, plus possibly 'additional_names', will match. Not all options are valid in all contexts.

func (Names) BuildNouns

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

implements NounBuilder by calling BuildNouns on all matched names

func (*Names) GetMarkup

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

implements typeinfo.Markup

func (*Names) GetNames

func (op *Names) GetNames() Iterator

unwind the tree of additional names

func (*Names) GetTraits

func (op *Names) GetTraits() (ret Traitor)

unwind the traits ( if any ) of the names

func (*Names) HasAnonymousKind

func (op *Names) 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 (*Names) Match

func (op *Names) Match(q Query, input *InputState) (okay bool)

checks Query flags to control matching

func (*Names) TypeInfo

func (*Names) TypeInfo() typeinfo.T

implements typeinfo.Instance

type NamesAreLikeVerbs

type NamesAreLikeVerbs struct {
	Names      Names
	Are        Are
	Adjectives Adjectives
	VerbPhrase *VerbPhrase
	Markup     map[string]any
}

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 Context) (err error)

func (*NamesAreLikeVerbs) GetAdjectives

func (op *NamesAreLikeVerbs) GetAdjectives() Adjectives

func (*NamesAreLikeVerbs) GetMarkup

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

implements typeinfo.Markup

func (*NamesAreLikeVerbs) GetNouns

func (op *NamesAreLikeVerbs) GetNouns() Names

func (*NamesAreLikeVerbs) GetOtherNouns

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

func (*NamesAreLikeVerbs) GetVerb

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

func (*NamesAreLikeVerbs) Match

func (op *NamesAreLikeVerbs) Match(q Query, input *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 names_are_like_verbs

func (*NamesAreLikeVerbs_Slice) Repeats

func (op *NamesAreLikeVerbs_Slice) Repeats() bool

implements typeinfo.Repeats

func (*NamesAreLikeVerbs_Slice) TypeInfo

func (*NamesAreLikeVerbs_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type NamesVerbNames

type NamesVerbNames struct {
	Names      Names
	Are        Are
	Verb       Verb
	OtherNames Names
	Markup     map[string]any
}

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 Context) (err error)

func (*NamesVerbNames) GetAdjectives

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

func (*NamesVerbNames) GetMarkup

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

implements typeinfo.Markup

func (*NamesVerbNames) GetNouns

func (op *NamesVerbNames) GetNouns() Names

func (*NamesVerbNames) GetOtherNouns

func (op *NamesVerbNames) GetOtherNouns() Names

func (*NamesVerbNames) GetVerb

func (op *NamesVerbNames) GetVerb() string

func (*NamesVerbNames) Match

func (op *NamesVerbNames) Match(q Query, input *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 names_verb_names

func (*NamesVerbNames_Slice) Repeats

func (op *NamesVerbNames_Slice) Repeats() bool

implements typeinfo.Repeats

func (*NamesVerbNames_Slice) TypeInfo

func (*NamesVerbNames_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Names_Slice

type Names_Slice []Names

holds a slice of type names

func (*Names_Slice) Repeats

func (op *Names_Slice) Repeats() bool

implements typeinfo.Repeats

func (*Names_Slice) TypeInfo

func (*Names_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type NewTrait

type NewTrait struct {
	Matched  Matched
	NewTrait *NewTrait
	Markup   map[string]any
}

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 Query, 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 new_trait

func (*NewTrait_Slice) Repeats

func (op *NewTrait_Slice) Repeats() bool

implements typeinfo.Repeats

func (*NewTrait_Slice) TypeInfo

func (*NewTrait_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Noun

type Noun struct {
	Article    *Article
	Matched    Matched
	ActualNoun ActualNoun
	Markup     map[string]any
}

matches an existing noun by checking multiple words for the best match.

func (*Noun) BuildNouns

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

func (*Noun) GetMarkup

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

implements typeinfo.Markup

func (*Noun) Match

func (op *Noun) Match(q Query, input *InputState) (okay bool)

func (*Noun) TypeInfo

func (*Noun) TypeInfo() typeinfo.T

implements typeinfo.Instance

type NounBuilder

type NounBuilder interface {
	BuildNouns(Query, 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 NounBuilder_Slot

type NounBuilder_Slot struct{ Value NounBuilder }

holds a single slot.

func (*NounBuilder_Slot) TypeInfo

func (*NounBuilder_Slot) TypeInfo() typeinfo.T

implements typeinfo.Instance for a single slot.

type NounBuilder_Slots

type NounBuilder_Slots []NounBuilder

holds a slice of slots.

func (*NounBuilder_Slots) Repeats

func (op *NounBuilder_Slots) Repeats() bool

implements typeinfo.Repeats

func (*NounBuilder_Slots) TypeInfo

func (*NounBuilder_Slots) TypeInfo() typeinfo.T

implements typeinfo.Instance for a series of slots.

type NounProperties

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

type NounPropertyValue

type NounPropertyValue struct {
	NamedNoun   NamedNoun
	Has         Words
	Article     *Article
	Property    Property
	Of          *Words
	SingleValue SingleValue
	Markup      map[string]any
}

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) Generate

func (op *NounPropertyValue) Generate(ctx Context) error

func (*NounPropertyValue) GetMarkup

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

implements typeinfo.Markup

func (*NounPropertyValue) GetNamedNoun

func (op *NounPropertyValue) GetNamedNoun() NamedNoun

func (*NounPropertyValue) GetProperty

func (op *NounPropertyValue) GetProperty() Property

func (*NounPropertyValue) GetValue

func (op *NounPropertyValue) GetValue() rt.Assignment

func (*NounPropertyValue) Match

func (op *NounPropertyValue) Match(q Query, input *InputState) (okay bool)

func (*NounPropertyValue) Phase

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

like PropertyNounValue, matches in the noun phase, but mostly runs in the fallback and value phase

func (*NounPropertyValue) TypeInfo

func (*NounPropertyValue) TypeInfo() typeinfo.T

implements typeinfo.Instance

type NounPropertyValue_Slice

type NounPropertyValue_Slice []NounPropertyValue

holds a slice of type noun_property_value

func (*NounPropertyValue_Slice) Repeats

func (op *NounPropertyValue_Slice) Repeats() bool

implements typeinfo.Repeats

func (*NounPropertyValue_Slice) TypeInfo

func (*NounPropertyValue_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Noun_Slice

type Noun_Slice []Noun

holds a slice of type noun

func (*Noun_Slice) Repeats

func (op *Noun_Slice) Repeats() bool

implements typeinfo.Repeats

func (*Noun_Slice) TypeInfo

func (*Noun_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Paragraph

type Paragraph [][]match.TokenValue

represents a block of text

func NewParagraph

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

func (*Paragraph) Generate

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

a function that expects to be called every phase returns true when it no longer needs to be called because everything is scheduled

type PrefixValue

type PrefixValue rules.Prefix

type Property

type Property struct {
	Article *Article
	Matched string
	Markup  map[string]any
}

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) Match

func (op *Property) Match(q Query, kind string, input *InputState) (okay bool)

func (*Property) String

func (op *Property) String() string

func (*Property) TypeInfo

func (*Property) TypeInfo() typeinfo.T

implements typeinfo.Instance

type PropertyNounValue

type PropertyNounValue struct {
	Article     *Article
	Property    Property
	Of          Words
	NamedNoun   NamedNoun
	Are         Are
	SingleValue *SingleValue
	QuotedTexts *QuotedTexts
	Markup      map[string]any
}

assigns a default value to a noun. ex. `The description of the pen is "mightier than the sword.` as a special case allows also allows a list of quoted text indicated with "are" ( versus "is" )

func (*PropertyNounValue) Generate

func (op *PropertyNounValue) Generate(ctx Context) error

func (*PropertyNounValue) GetMarkup

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

implements typeinfo.Markup

func (*PropertyNounValue) GetNamedNoun

func (op *PropertyNounValue) GetNamedNoun() NamedNoun

func (*PropertyNounValue) GetProperty

func (op *PropertyNounValue) GetProperty() Property

func (*PropertyNounValue) GetValue

func (op *PropertyNounValue) GetValue() (ret rt.Assignment)

func (*PropertyNounValue) Match

func (op *PropertyNounValue) Match(q Query, input *InputState) (okay bool)

func (*PropertyNounValue) Phase

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

matches in the noun phase, but mostly runs in the fallback and value phase

func (*PropertyNounValue) TypeInfo

func (*PropertyNounValue) TypeInfo() typeinfo.T

implements typeinfo.Instance

type PropertyNounValue_Slice

type PropertyNounValue_Slice []PropertyNounValue

holds a slice of type property_noun_value

func (*PropertyNounValue_Slice) Repeats

func (op *PropertyNounValue_Slice) Repeats() bool

implements typeinfo.Repeats

func (*PropertyNounValue_Slice) TypeInfo

func (*PropertyNounValue_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type PropertyType

type PropertyType struct {
	Primitive string
	Kind      *Kind
	Markup    map[string]any
}

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 Query, 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 property_type

func (*PropertyType_Slice) Repeats

func (op *PropertyType_Slice) Repeats() bool

implements typeinfo.Repeats

func (*PropertyType_Slice) TypeInfo

func (*PropertyType_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

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

func (*Property_Slice) TypeInfo

func (*Property_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

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.

func AddContext

func AddContext(q Query, flags int) (ret Query)

adds flags to the query ( via or )

type QuotedText

type QuotedText struct {
	Matched string
	Markup  map[string]any
}

text that begins and ends with double quotes. the quotes themselves are not part of the matched text.

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 Query, 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 quoted_text

func (*QuotedText_Slice) Repeats

func (op *QuotedText_Slice) Repeats() bool

implements typeinfo.Repeats

func (*QuotedText_Slice) TypeInfo

func (*QuotedText_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type QuotedTexts

type QuotedTexts struct {
	QuotedText     QuotedText
	AdditionalText *AdditionalText
	Markup         map[string]any
}

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)

func (*QuotedTexts) GetMarkup

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

implements typeinfo.Markup

func (*QuotedTexts) Iterate

func (op *QuotedTexts) Iterate() TextListIterator

unwind the tree of additional traits

func (*QuotedTexts) Match

func (op *QuotedTexts) Match(q Query, 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) 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 quoted_texts

func (*QuotedTexts_Slice) Repeats

func (op *QuotedTexts_Slice) Repeats() bool

implements typeinfo.Repeats

func (*QuotedTexts_Slice) TypeInfo

func (*QuotedTexts_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type RuleName

type RuleName struct {
	Prefix  bool
	Article string
	Matched Matched
	Suffix  bool
	Markup  map[string]any
}

specific names can follow rule declarations "( 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 Query, 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 rule_name

func (*RuleName_Slice) Repeats

func (op *RuleName_Slice) Repeats() bool

implements typeinfo.Repeats

func (*RuleName_Slice) TypeInfo

func (*RuleName_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type RulePrefix

type RulePrefix struct {
	PrefixValue PrefixValue
	Markup      map[string]any
}

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 Query, 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 rule_prefix

func (*RulePrefix_Slice) Repeats

func (op *RulePrefix_Slice) Repeats() bool

implements typeinfo.Repeats

func (*RulePrefix_Slice) TypeInfo

func (*RulePrefix_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type RuleSuffix

type RuleSuffix struct {
	SuffixValue SuffixValue
	Markup      map[string]any
}

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 Query, input *InputState) (okay bool)

func (*RuleSuffix) TypeInfo

func (*RuleSuffix) TypeInfo() typeinfo.T

implements typeinfo.Instance

type RuleSuffix_Slice

type RuleSuffix_Slice []RuleSuffix

holds a slice of type rule_suffix

func (*RuleSuffix_Slice) Repeats

func (op *RuleSuffix_Slice) Repeats() bool

implements typeinfo.Repeats

func (*RuleSuffix_Slice) TypeInfo

func (*RuleSuffix_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type RuleTarget

type RuleTarget struct {
	Kind   *Kind
	Noun   *Noun
	Markup map[string]any
}

func (*RuleTarget) GetMarkup

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

implements typeinfo.Markup

func (*RuleTarget) Match

func (op *RuleTarget) Match(q Query, 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 rule_target

func (*RuleTarget_Slice) Repeats

func (op *RuleTarget_Slice) Repeats() bool

implements typeinfo.Repeats

func (*RuleTarget_Slice) TypeInfo

func (*RuleTarget_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Scheduler

type Scheduler interface {
	// can return error if out of phase
	Schedule(phase weaver.Phase, cb 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 SingleValue

type SingleValue struct {
	QuotedText     *QuotedText
	MatchingNumber *MatchingNumber
	Noun           *Noun
	Kind           *Kind
	Markup         map[string]any
}

matches only one of its options ( the options could be represented as a slot; this feels easier for now )

func (*SingleValue) Assignment

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

panics if unmatched

func (*SingleValue) GetMarkup

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

implements typeinfo.Markup

func (*SingleValue) Match

func (op *SingleValue) Match(q Query, input *InputState) (okay bool)

func (*SingleValue) TypeInfo

func (*SingleValue) TypeInfo() typeinfo.T

implements typeinfo.Instance

type SingleValue_Slice

type SingleValue_Slice []SingleValue

holds a slice of type single_value

func (*SingleValue_Slice) Repeats

func (op *SingleValue_Slice) Repeats() bool

implements typeinfo.Repeats

func (*SingleValue_Slice) TypeInfo

func (*SingleValue_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type SubAssignment

type SubAssignment struct {
	Assignment rtti.Assignment
	Markup     map[string]any
}

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) 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 sub_assignment

func (*SubAssignment_Slice) Repeats

func (op *SubAssignment_Slice) Repeats() bool

implements typeinfo.Repeats

func (*SubAssignment_Slice) TypeInfo

func (*SubAssignment_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type SuffixValue

type SuffixValue rules.Suffix

type TextListIterator

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

func (*TextListIterator) GetNext

func (it *TextListIterator) GetNext() string

func (*TextListIterator) GetNextText

func (it *TextListIterator) GetNextText() (ret *QuotedText)

func (TextListIterator) HasNext

func (it TextListIterator) HasNext() bool

type TimedRule

type TimedRule struct {
	RulePrefix    RulePrefix
	Someone       bool
	Pattern       Kind
	RuleTarget    *RuleTarget
	RuleSuffix    *RuleSuffix
	RuleName      *RuleName
	SubAssignment SubAssignment
	Markup        map[string]any
}

matches pattern rule definitions

func (*TimedRule) Generate

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

goal: schedule the rule

func (*TimedRule) GetMarkup

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

implements typeinfo.Markup

func (*TimedRule) Match

func (op *TimedRule) Match(q Query, input *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 timed_rule

func (*TimedRule_Slice) Repeats

func (op *TimedRule_Slice) Repeats() bool

implements typeinfo.Repeats

func (*TimedRule_Slice) TypeInfo

func (*TimedRule_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Trait

type Trait struct {
	Article *Article
	Matched string
	Markup  map[string]any
}

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 Query, 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

func (*Trait_Slice) TypeInfo

func (*Trait_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Traitor

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

trait iterator

func (*Traitor) GetNext

func (it *Traitor) GetNext() (ret Trait)

func (Traitor) HasNext

func (it Traitor) HasNext() bool

type Traits

type Traits struct {
	Trait            Trait
	AdditionalTraits *AdditionalTraits
	Markup           map[string]any
}

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() Traitor

unwind the tree of additional traits

func (*Traits) Match

func (op *Traits) Match(q Query, 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) 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

func (*Traits_Slice) TypeInfo

func (*Traits_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Understand

type Understand struct {
	Understand  Words
	QuotedTexts QuotedTexts
	As          Words
	Article     *Article
	PluralOf    string
	Names       Names
	Markup      map[string]any
}

various phrases, all starting with the word "Understand"

func (*Understand) Generate

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

func (*Understand) GetMarkup

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

implements typeinfo.Markup

func (*Understand) Match

func (op *Understand) Match(q Query, input *InputState) (okay bool)

func (*Understand) Phase

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

runs in the LanguagePhase 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

func (*Understand_Slice) TypeInfo

func (*Understand_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Verb

type Verb struct {
	Text   string
	Markup map[string]any
}

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 Query, 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      Names
	Are        Are
	OtherNames Names
	Markup     map[string]any
}

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 Context) error

func (*VerbNamesAreNames) GetAdjectives

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

func (*VerbNamesAreNames) GetMarkup

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

implements typeinfo.Markup

func (*VerbNamesAreNames) GetNouns

func (op *VerbNamesAreNames) GetNouns() Names

func (*VerbNamesAreNames) GetOtherNouns

func (op *VerbNamesAreNames) GetOtherNouns() Names

func (*VerbNamesAreNames) GetVerb

func (op *VerbNamesAreNames) GetVerb() string

func (*VerbNamesAreNames) Match

func (op *VerbNamesAreNames) Match(q Query, input *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 verb_names_are_names

func (*VerbNamesAreNames_Slice) Repeats

func (op *VerbNamesAreNames_Slice) Repeats() bool

implements typeinfo.Repeats

func (*VerbNamesAreNames_Slice) TypeInfo

func (*VerbNamesAreNames_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type VerbPhrase

type VerbPhrase struct {
	Verb       Verb
	PlainNames Names
	Markup     map[string]any
}

ex. ".... in the kitchen.", or "... 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 Query, 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 verb_phrase

func (*VerbPhrase_Slice) Repeats

func (op *VerbPhrase_Slice) Repeats() bool

implements typeinfo.Repeats

func (*VerbPhrase_Slice) TypeInfo

func (*VerbPhrase_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

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

func (*Verb_Slice) TypeInfo

func (*Verb_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

type Words

type Words struct {
	Matched Matched
	Markup  map[string]any
}

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(_ Query, input *InputState, hashes ...uint64) (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

func (*Words_Slice) TypeInfo

func (*Words_Slice) TypeInfo() typeinfo.T

implements typeinfo.Instance

Jump to

Keyboard shortcuts

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