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
- Variables
- func AddKindTraits(w weaver.Weaves, kind string, traits Traitor) (err error)
- func BuildPhrase(phrase string) (ret grammar.ScannerMaker, err error)
- func ConvertTextTemplate(str string) (ret rt.TextEval, err error)
- func GetRuleName(op *RuleName) (ret string, err error)
- func GetRulePrefix(op RulePrefix) rules.Prefix
- func GetRuleSuffix(op *RuleSuffix) (ret rules.Suffix)
- func Optional[M any, IM interface{ ... }](q Query, input *InputState, out **M) (okay bool)
- func ReduceTraits(it Traitor) (ret []string)
- func WordsToNum(s string) (ret int, okay bool)
- type ActualKind
- type ActualNoun
- type AdditionalAdjectives
- type AdditionalAdjectives_Slice
- type AdditionalDirections
- type AdditionalDirections_Slice
- type AdditionalKinds
- type AdditionalKinds_Slice
- type AdditionalLinks
- type AdditionalLinks_Slice
- type AdditionalNames
- type AdditionalNames_Slice
- type AdditionalText
- type AdditionalText_Slice
- type AdditionalTraits
- type AdditionalTraits_Slice
- type Adjectives
- type Adjectives_Slice
- type Are
- type Are_Slice
- type Article
- type ArticleFlags
- type Article_Slice
- type AspectsAreTraits
- func (op *AspectsAreTraits) GetMarkup(ensure bool) map[string]any
- func (op *AspectsAreTraits) Match(q Query, input *InputState) (okay bool)
- func (op *AspectsAreTraits) Phase() weaver.Phase
- func (*AspectsAreTraits) TypeInfo() typeinfo.T
- func (op *AspectsAreTraits) Weave(w weaver.Weaves, _ rt.Runtime) (err error)
- type AspectsAreTraits_Slice
- type Called
- type CalledName
- type CalledName_Slice
- type Called_Slice
- type CommaAnd
- type CommaAndOr
- type CommaAndOr_Slice
- type CommaAnd_Slice
- type Context
- type CountedKind
- func (op *CountedKind) BuildNouns(q Query, w weaver.Weaves, run rt.Runtime, props NounProperties) (ret []DesiredNoun, err error)
- func (op *CountedKind) GetMarkup(ensure bool) map[string]any
- func (op *CountedKind) Match(q Query, input *InputState) (okay bool)
- func (*CountedKind) TypeInfo() typeinfo.T
- type CountedKind_Slice
- type DesiredNoun
- type DesiredValue
- type DirectIt
- type Direction
- type DirectionOfLinking
- type DirectionOfLinking_Slice
- type Direction_Slice
- type Generator
- type InputState
- func (in InputState) Cut(width int) []match.TokenValue
- func (in InputState) GetNext(t match.Token) (ret match.TokenValue, okay bool)
- func (in InputState) Len() int
- func (in InputState) MatchWord(choices ...uint64) (width int)
- func (in InputState) Skip(skip int) InputState
- func (in InputState) Words() []match.TokenValue
- type Interpreter
- type Iterator
- type Kind
- func (op *Kind) BuildNouns(q Query, w weaver.Weaves, run rt.Runtime, props NounProperties) (ret []DesiredNoun, err error)
- func (op *Kind) GetMarkup(ensure bool) map[string]any
- func (op *Kind) Match(q Query, input *InputState) (okay bool)
- func (*Kind) TypeInfo() typeinfo.T
- func (op *Kind) Validate(ks ...kindsOf.Kinds) (ret string, err error)
- type KindCalled
- func (op *KindCalled) BuildNouns(q Query, w weaver.Weaves, run rt.Runtime, props NounProperties) (ret []DesiredNoun, err error)
- func (op *KindCalled) GetKind() (string, error)
- func (op *KindCalled) GetMarkup(ensure bool) map[string]any
- func (op *KindCalled) GetNormalizedName() (string, error)
- func (op *KindCalled) GetTraits() (ret Traitor)
- func (op *KindCalled) Match(q Query, input *InputState) (okay bool)
- func (*KindCalled) TypeInfo() typeinfo.T
- type KindCalled_Slice
- type Kind_Slice
- type Kinder
- type Kinds
- type KindsAreEither
- func (op *KindsAreEither) GetMarkup(ensure bool) map[string]any
- func (op *KindsAreEither) Match(q Query, input *InputState) (okay bool)
- func (op *KindsAreEither) Phase() weaver.Phase
- func (*KindsAreEither) TypeInfo() typeinfo.T
- func (op *KindsAreEither) Weave(w weaver.Weaves, run rt.Runtime) (err error)
- type KindsAreEither_Slice
- type KindsAreTraits
- func (op *KindsAreTraits) GetMarkup(ensure bool) map[string]any
- func (op *KindsAreTraits) Match(q Query, input *InputState) (okay bool)
- func (op *KindsAreTraits) Phase() weaver.Phase
- func (*KindsAreTraits) TypeInfo() typeinfo.T
- func (op *KindsAreTraits) Weave(w weaver.Weaves, run rt.Runtime) (err error)
- type KindsAreTraits_Slice
- type KindsHaveProperties
- func (op *KindsHaveProperties) GetMarkup(ensure bool) map[string]any
- func (op *KindsHaveProperties) Match(q Query, input *InputState) (okay bool)
- func (op *KindsHaveProperties) Phase() weaver.Phase
- func (*KindsHaveProperties) TypeInfo() typeinfo.T
- func (op *KindsHaveProperties) Weave(w weaver.Weaves, run rt.Runtime) (err error)
- type KindsHaveProperties_Slice
- type KindsOf
- type KindsOf_Slice
- type Kinds_Slice
- type LinkIt
- type Linking
- type Linking_Slice
- type MapConnections
- func (op *MapConnections) Generate(ctx Context) error
- func (op *MapConnections) GetDoors() LinkIt
- func (op *MapConnections) GetMarkup(ensure bool) map[string]any
- func (op *MapConnections) Match(q Query, input *InputState) (okay bool)
- func (op *MapConnections) Phase() weaver.Phase
- func (*MapConnections) TypeInfo() typeinfo.T
- type MapConnections_Slice
- type MapDirections
- type MapDirections_Slice
- type MapLocations
- func (op *MapLocations) Generate(ctx Context) error
- func (op *MapLocations) GetMarkup(ensure bool) map[string]any
- func (op *MapLocations) GetOtherLocations() DirectIt
- func (op *MapLocations) Match(q Query, input *InputState) (okay bool)
- func (op *MapLocations) Phase() weaver.Phase
- func (*MapLocations) TypeInfo() typeinfo.T
- type MapLocations_Slice
- type Matched
- type Matched_Slot
- type Matched_Slots
- type MatchingNumber
- type MatchingNumber_Slice
- type MatchingPhrases
- type MatchingPhrases_Slice
- type Name
- func (op *Name) BuildNouns(q Query, w weaver.Weaves, run rt.Runtime, props NounProperties) (ret []DesiredNoun, err error)
- func (op *Name) GetMarkup(ensure bool) map[string]any
- func (op *Name) GetNormalizedName() (string, error)
- func (op *Name) Match(q Query, input *InputState) (okay bool)
- func (*Name) TypeInfo() typeinfo.T
- type Name_Slice
- type NamedNoun
- func (op *NamedNoun) BuildNouns(q Query, w weaver.Weaves, run rt.Runtime, props NounProperties) ([]DesiredNoun, error)
- func (op *NamedNoun) GetMarkup(ensure bool) map[string]any
- func (op *NamedNoun) GetNormalizedName() (ret string, err error)
- func (op *NamedNoun) Match(q Query, input *InputState) (okay bool)
- func (*NamedNoun) TypeInfo() typeinfo.T
- type NamedNoun_Slice
- type Names
- func (op Names) BuildNouns(q Query, w weaver.Weaves, run rt.Runtime, props NounProperties) (ret []DesiredNoun, err error)
- func (op *Names) GetMarkup(ensure bool) map[string]any
- func (op *Names) GetNames() Iterator
- func (op *Names) GetTraits() (ret Traitor)
- func (op *Names) HasAnonymousKind() bool
- func (op *Names) Match(q Query, input *InputState) (okay bool)
- func (*Names) TypeInfo() typeinfo.T
- type NamesAreLikeVerbs
- func (op *NamesAreLikeVerbs) Generate(ctx Context) (err error)
- func (op *NamesAreLikeVerbs) GetAdjectives() Adjectives
- func (op *NamesAreLikeVerbs) GetMarkup(ensure bool) map[string]any
- func (op *NamesAreLikeVerbs) GetNouns() Names
- func (op *NamesAreLikeVerbs) GetOtherNouns() (ret Names)
- func (op *NamesAreLikeVerbs) GetVerb() (ret string)
- func (op *NamesAreLikeVerbs) Match(q Query, input *InputState) (okay bool)
- func (op *NamesAreLikeVerbs) Phase() weaver.Phase
- func (*NamesAreLikeVerbs) TypeInfo() typeinfo.T
- type NamesAreLikeVerbs_Slice
- type NamesVerbNames
- func (op *NamesVerbNames) Generate(ctx Context) (err error)
- func (op *NamesVerbNames) GetAdjectives() (_ Adjectives)
- func (op *NamesVerbNames) GetMarkup(ensure bool) map[string]any
- func (op *NamesVerbNames) GetNouns() Names
- func (op *NamesVerbNames) GetOtherNouns() Names
- func (op *NamesVerbNames) GetVerb() string
- func (op *NamesVerbNames) Match(q Query, input *InputState) (okay bool)
- func (op *NamesVerbNames) Phase() weaver.Phase
- func (*NamesVerbNames) TypeInfo() typeinfo.T
- type NamesVerbNames_Slice
- type Names_Slice
- type NewTrait
- type NewTraitIterator
- type NewTrait_Slice
- type Noun
- type NounBuilder
- type NounBuilder_Slot
- type NounBuilder_Slots
- type NounProperties
- type NounPropertyValue
- func (op *NounPropertyValue) Generate(ctx Context) error
- func (op *NounPropertyValue) GetMarkup(ensure bool) map[string]any
- func (op *NounPropertyValue) GetNamedNoun() NamedNoun
- func (op *NounPropertyValue) GetProperty() Property
- func (op *NounPropertyValue) GetValue() rt.Assignment
- func (op *NounPropertyValue) Match(q Query, input *InputState) (okay bool)
- func (op *NounPropertyValue) Phase() weaver.Phase
- func (*NounPropertyValue) TypeInfo() typeinfo.T
- type NounPropertyValue_Slice
- type Noun_Slice
- type Paragraph
- type PrefixValue
- type Property
- type PropertyNounValue
- func (op *PropertyNounValue) Generate(ctx Context) error
- func (op *PropertyNounValue) GetMarkup(ensure bool) map[string]any
- func (op *PropertyNounValue) GetNamedNoun() NamedNoun
- func (op *PropertyNounValue) GetProperty() Property
- func (op *PropertyNounValue) GetValue() (ret rt.Assignment)
- func (op *PropertyNounValue) Match(q Query, input *InputState) (okay bool)
- func (op *PropertyNounValue) Phase() weaver.Phase
- func (*PropertyNounValue) TypeInfo() typeinfo.T
- type PropertyNounValue_Slice
- type PropertyType
- type PropertyType_Slice
- type Property_Slice
- type Query
- type QuotedText
- func (op *QuotedText) Assignment() rt.Assignment
- func (op *QuotedText) GetMarkup(ensure bool) map[string]any
- func (op *QuotedText) Match(q Query, input *InputState) (okay bool)
- func (op *QuotedText) String() string
- func (op *QuotedText) TextEval() (ret rt.TextEval)
- func (*QuotedText) TypeInfo() typeinfo.T
- type QuotedText_Slice
- type QuotedTexts
- func (op *QuotedTexts) Assignment() (ret rt.Assignment)
- func (op *QuotedTexts) GetMarkup(ensure bool) map[string]any
- func (op *QuotedTexts) Iterate() TextListIterator
- func (op *QuotedTexts) Match(q Query, input *InputState) (okay bool)
- func (op *QuotedTexts) Reduce() (ret []string)
- func (*QuotedTexts) TypeInfo() typeinfo.T
- type QuotedTexts_Slice
- type RuleName
- type RuleName_Slice
- type RulePrefix
- type RulePrefix_Slice
- type RuleSuffix
- type RuleSuffix_Slice
- type RuleTarget
- type RuleTarget_Slice
- type Scheduler
- type Separator
- type SingleValue
- type SingleValue_Slice
- type SubAssignment
- type SubAssignment_Slice
- type SuffixValue
- type TextListIterator
- type TimedRule
- type TimedRule_Slice
- type Trait
- type Trait_Slice
- type Traitor
- type Traits
- type Traits_Slice
- type Understand
- type Understand_Slice
- type Verb
- type VerbDesc
- type VerbNamesAreNames
- func (op *VerbNamesAreNames) Generate(ctx Context) error
- func (op *VerbNamesAreNames) GetAdjectives() (_ Adjectives)
- func (op *VerbNamesAreNames) GetMarkup(ensure bool) map[string]any
- func (op *VerbNamesAreNames) GetNouns() Names
- func (op *VerbNamesAreNames) GetOtherNouns() Names
- func (op *VerbNamesAreNames) GetVerb() string
- func (op *VerbNamesAreNames) Match(q Query, input *InputState) (okay bool)
- func (op *VerbNamesAreNames) Phase() weaver.Phase
- func (*VerbNamesAreNames) TypeInfo() typeinfo.T
- type VerbNamesAreNames_Slice
- type VerbPhrase
- type VerbPhrase_Slice
- type Verb_Slice
- type Words
- type Words_Slice
Constants ¶
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
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 ¶
var Z_Types = typeinfo.TypeSet{ Name: "jess", Slot: z_slot_list, Flow: z_flow_list, Signatures: z_signatures, }
package listing of type data
var Zt_AdditionalAdjectives typeinfo.Flow
additional_adjectives, a type of flow.
var Zt_AdditionalDirections typeinfo.Flow
additional_directions, a type of flow.
var Zt_AdditionalKinds typeinfo.Flow
additional_kinds, a type of flow.
var Zt_AdditionalLinks typeinfo.Flow
additional_links, a type of flow.
var Zt_AdditionalNames typeinfo.Flow
additional_names, a type of flow.
var Zt_AdditionalText typeinfo.Flow
additional_text, a type of flow.
var Zt_AdditionalTraits typeinfo.Flow
additional_traits, a type of flow.
var Zt_Adjectives typeinfo.Flow
adjectives, a type of flow.
var Zt_Are typeinfo.Flow
are, a type of flow.
var Zt_Article typeinfo.Flow
article, a type of flow.
var Zt_AspectsAreTraits typeinfo.Flow
aspects_are_traits, a type of flow.
var Zt_Called typeinfo.Flow
called, a type of flow.
var Zt_CalledName typeinfo.Flow
called_name, a type of flow.
var Zt_CommaAnd typeinfo.Flow
comma_and, a type of flow.
var Zt_CommaAndOr typeinfo.Flow
comma_and_or, a type of flow.
var Zt_CountedKind typeinfo.Flow
counted_kind, a type of flow.
var Zt_Direction typeinfo.Flow
direction, a type of flow.
var Zt_DirectionOfLinking typeinfo.Flow
direction_of_linking, a type of flow.
var Zt_Kind typeinfo.Flow
kind, a type of flow.
var Zt_KindCalled typeinfo.Flow
kind_called, a type of flow.
var Zt_Kinds typeinfo.Flow
kinds, a type of flow.
var Zt_KindsAreEither typeinfo.Flow
kinds_are_either, a type of flow.
var Zt_KindsAreTraits typeinfo.Flow
kinds_are_traits, a type of flow.
var Zt_KindsHaveProperties typeinfo.Flow
kinds_have_properties, a type of flow.
var Zt_KindsOf typeinfo.Flow
kinds_of, a type of flow.
var Zt_Linking typeinfo.Flow
linking, a type of flow.
var Zt_MapConnections typeinfo.Flow
map_connections, a type of flow.
var Zt_MapDirections typeinfo.Flow
map_directions, a type of flow.
var Zt_MapLocations typeinfo.Flow
map_locations, a type of flow.
var Zt_Matched = typeinfo.Slot{ Name: "matched", Markup: map[string]any{ "comment": "Used to store matching text", }, }
matched, a type of slot.
var Zt_MatchingNumber typeinfo.Flow
matching_number, a type of flow.
var Zt_MatchingPhrases typeinfo.Flow
matching_phrases, a type of flow.
var Zt_Name typeinfo.Flow
name, a type of flow.
var Zt_NamedNoun typeinfo.Flow
named_noun, a type of flow.
var Zt_Names typeinfo.Flow
names, a type of flow.
var Zt_NamesAreLikeVerbs typeinfo.Flow
names_are_like_verbs, a type of flow.
var Zt_NamesVerbNames typeinfo.Flow
names_verb_names, a type of flow.
var Zt_NewTrait typeinfo.Flow
new_trait, a type of flow.
var Zt_Noun typeinfo.Flow
noun, a type of flow.
var Zt_NounBuilder = typeinfo.Slot{
Name: "noun_builder",
}
noun_builder, a type of slot.
var Zt_NounPropertyValue typeinfo.Flow
noun_property_value, a type of flow.
var Zt_Property typeinfo.Flow
property, a type of flow.
var Zt_PropertyNounValue typeinfo.Flow
property_noun_value, a type of flow.
var Zt_PropertyType typeinfo.Flow
property_type, a type of flow.
var Zt_QuotedText typeinfo.Flow
quoted_text, a type of flow.
var Zt_QuotedTexts typeinfo.Flow
quoted_texts, a type of flow.
var Zt_RuleName typeinfo.Flow
rule_name, a type of flow.
var Zt_RulePrefix typeinfo.Flow
rule_prefix, a type of flow.
var Zt_RuleSuffix typeinfo.Flow
rule_suffix, a type of flow.
var Zt_RuleTarget typeinfo.Flow
rule_target, a type of flow.
var Zt_SingleValue typeinfo.Flow
single_value, a type of flow.
var Zt_SubAssignment typeinfo.Flow
sub_assignment, a type of flow.
var Zt_TimedRule typeinfo.Flow
timed_rule, a type of flow.
var Zt_Trait typeinfo.Flow
trait, a type of flow.
var Zt_Traits typeinfo.Flow
traits, a type of flow.
var Zt_Understand typeinfo.Flow
understand, a type of flow.
var Zt_Verb typeinfo.Flow
verb, a type of flow.
var Zt_VerbNamesAreNames typeinfo.Flow
verb_names_are_names, a type of flow.
var Zt_VerbPhrase typeinfo.Flow
verb_phrase, a type of flow.
var Zt_Words typeinfo.Flow
words, a type of flow.
Functions ¶
func AddKindTraits ¶
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 ¶
returns a string or a FromText assignment as a slice of bytes
func GetRuleName ¶
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 ¶
fix: is this all trait iteration is being used for?
func WordsToNum ¶
Currently good up to twenty. maybe https://github.com/donna-legal/word2number?
Types ¶
type ActualKind ¶
type ActualNoun ¶
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 ¶
func (*AdditionalAdjectives_Slice) TypeInfo() typeinfo.T
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 ¶
func (*AdditionalDirections_Slice) TypeInfo() typeinfo.T
implements typeinfo.Instance
type AdditionalKinds ¶
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 ¶
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 ¶
type AdditionalLinks_Slice []AdditionalLinks
holds a slice of type additional_links
func (*AdditionalLinks_Slice) Repeats ¶
func (op *AdditionalLinks_Slice) Repeats() bool
implements typeinfo.Repeats
func (*AdditionalLinks_Slice) TypeInfo ¶
func (*AdditionalLinks_Slice) TypeInfo() typeinfo.T
implements typeinfo.Instance
type AdditionalNames ¶
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 ¶
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)
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 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"
type ArticleFlags ¶
type Article_Slice ¶
type Article_Slice []Article
holds a slice of type article
func (*Article_Slice) TypeInfo ¶
func (*Article_Slice) TypeInfo() typeinfo.T
implements typeinfo.Instance
type AspectsAreTraits ¶
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
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 CalledName ¶
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)
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) TypeInfo ¶
func (*Called_Slice) TypeInfo() typeinfo.T
implements typeinfo.Instance
type CommaAnd ¶
conjunction junction. matches "," or "and" or ", and" relies on the fact package match treats commas and ands each as their own words.
type CommaAndOr ¶
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)
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 ¶
func NewContext ¶
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)
type Direction ¶
matches some existing compass direction.
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 ¶
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 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"
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)
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 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) GetNormalizedName ¶
type KindsAreEither ¶
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
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
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
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.
type KindsOf_Slice ¶
type KindsOf_Slice []KindsOf
holds a slice of type kinds_of
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) TypeInfo ¶
func (*Kinds_Slice) TypeInfo() typeinfo.T
implements typeinfo.Instance
type LinkIt ¶
type LinkIt struct {
// contains filtered or unexported fields
}
links iterator
func IterateLinks ¶
func IterateLinks(first *Linking, queue *AdditionalLinks) LinkIt
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.
type Linking_Slice ¶
type Linking_Slice []Linking
holds a slice of type linking
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 ¶
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) TypeInfo ¶
func (*Matched_Slots) TypeInfo() typeinfo.T
implements typeinfo.Instance for a series of slots.
type MatchingNumber ¶
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 ¶
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) GetNormalizedName ¶
type NamedNoun ¶
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) GetNormalizedName ¶
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) HasAnonymousKind ¶
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 )
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 ¶
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) TypeInfo ¶
func (*Names_Slice) TypeInfo() typeinfo.T
implements typeinfo.Instance
type NewTrait ¶
one or more new trait names, separated by the word "or"
func (*NewTrait) Iterate ¶
func (op *NewTrait) Iterate() NewTraitIterator
unwind the tree of additional kinds
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)
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 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 Paragraph ¶
type Paragraph [][]match.TokenValue
represents a block of text
func NewParagraph ¶
func NewParagraph(str string, assign rt.Assignment) (ret Paragraph, err error)
type PrefixValue ¶
type Property ¶
matches the name of a field in a kind.
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 ¶
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 ¶
adds flags to the query ( via or )
type QuotedText ¶
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)
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 )"
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)
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)
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 ¶
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)
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 Separator ¶
type Separator int
flags indicating the presence of a comma followed by an optional and.
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)
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) 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 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
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 ¶
matches the name of an (existing) trait.
type Trait_Slice ¶
type Trait_Slice []Trait
holds a slice of type trait
func (*Trait_Slice) TypeInfo ¶
func (*Trait_Slice) TypeInfo() typeinfo.T
implements typeinfo.Instance
type Traits ¶
type Traits struct { Trait Trait AdditionalTraits *AdditionalTraits Markup map[string]any }
matches at least one trait.
type Traits_Slice ¶
type Traits_Slice []Traits
holds a slice of type traits
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
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 ¶
matches one or more predefined verbs ( verbs are nouns of the verb kind )
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 ¶
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)
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 Words ¶
matches one or more predefined words
type Words_Slice ¶
type Words_Slice []Words
holds a slice of type words
func (*Words_Slice) TypeInfo ¶
func (*Words_Slice) TypeInfo() typeinfo.T
implements typeinfo.Instance
Source Files ¶
- doc.go
- jess.go
- jessAdj.go
- jessAnd.go
- jessArticle.go
- jessAspects.go
- jessCalled.go
- jessConnections.go
- jessConst.go
- jessContext.go
- jessCount.go
- jessDirections.go
- jessEitherOr.go
- jessGen.go
- jessGrammar.go
- jessInput.go
- jessKeywords.go
- jessKind.go
- jessKinds.go
- jessKindsAreTraits.go
- jessKindsOf.go
- jessLink.go
- jessLocations.go
- jessMapping.go
- jessMatches.go
- jessName.go
- jessNameList.go
- jessNamedNoun.go
- jessNames.go
- jessNoun.go
- jessNounBuilder.go
- jessNounValue.go
- jessNum.go
- jessOpt.go
- jessParagraph.go
- jessPriority.go
- jessProperties.go
- jessReg.go
- jessResults.go
- jessRule.go
- jessTextList.go
- jessTraits.go
- jessUnderstand.go
- jessValue.go
- jessVerbInfo.go
- jessVerbing.go
- jess_types.go