Tapestry
Source Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Jess

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

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

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

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

Definitions:

Slots:

  • Matched: Used to store matching text.
  • Noun Builder: Indicates a matcher which can define a noun.

Commands:

Commands

An additional set of traits and a kind.

Terms:

commaAnd: CommaAnd
adjectives: Adjectives

Matches additional directions. only used by map_locations.

Terms:

commaAnd: CommaAnd
directionOfLinking: DirectionOfLinking
additionalDirections: optional AdditionalDirections

Matches a kind following another kind.

Terms:

commaAnd: CommaAnd

a separator is required between the names of kinds

kinds: Kinds

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

Terms:

commaAnd: CommaAnd
linking: Linking
additionalLinks: optional AdditionalLinks

Matches a name following another name.

Terms:

commaAnd: CommaAnd

a separator is required between names

names: Names

Matches a text following another some previous text.

Terms:

commaAndOr: CommaAndOr
quotedTexts: QuotedTexts

Matches a trait following another trait.

Terms:

commaAnd: optional CommaAnd
traits: Traits

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

Terms:

traits: optional Traits
commaAnd: optional CommaAnd

exists to support phrases like: `the box is transparent and a container.`

kind: optional Kind
additionalAdjectives: optional AdditionalAdjectives

Matches the words "is" or "are".

Terms:

matched: Matched

Article text:

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

Also note:

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

Terms:

text: Text

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

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

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

Terms:

aspect: Kind
are: Are
plainNames: Names

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

Terms:

called: Called
name: Name

Matches the word "called".

Terms:

matched: Matched

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

Terms:

matched: Matched

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

Terms:

matched: Matched

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

Slots:

Terms:

article: optional Article
matchingNum: MatchingNum
kind: Kind
matched: Matched

Partial phrase for mapping declarations.

Terms:

direction: Direction
fromOf: Words
linking: Linking

a room or door.

Matches some existing compass direction.

Terms:

text: Text

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.

Terms:

traits: optional Traits

note: doesn't use 'adjectives' because this doesn't allow repetitions of the traits and kind.

kind: Kind
called: Called
namedNoun: NamedNoun

Matches the name of an existing kind. Can generate a single anonymous noun.

Slots:

Terms:

article: optional Article

while an article can precede every kind it doesn't influence which kind gets matched.

matched: Matched

the string that matched

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

A thing can be open or closed.

Terms:

kind: Kind
canBe: Words
traits: NewTrait

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

Terms:

names: Names

can match plain names and existing kinds; only allows a leading kind called, and errors on all counted kinds.

are: Are
kindsAreKind: Words

the phrases "a kind of" or "kinds of"

traits: optional Traits

inform doesnt allow commas or ands here, jess reuses the traits list here, so it does allow comma/and.

name: Name

inform (weirdly) allows multiple kinds on the rhs: `A box is a kind of container and things.` but not if traits are specified, suggesting a switch there; possibly to detect and reject `A box is a kind of closed and openable container.` which it wants written as `A box is a kind of closed openable container.` this doesnt switch to special traits, and doesnt allow multiple kinds.

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

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

The closed containers are fixed in place.

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

Terms:

kinds: Kinds
are: Are
usually: Words
traits: Traits

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

Things have some text called a description.

Terms:

kind: Kind
have: Words
article: optional Article
listOf: optional Text
propertyType: PropertyType
calledName: optional CalledName

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

Terms:

traits: optional Traits

inform uses traits specified here to select matching nouns; jess is not that clever.

article: optional Article
matched: Matched

matches a span ending with "is/are/comma/and"

additionalKinds: optional AdditionalKinds

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

Terms:

nowhere: optional Bool
kindCalled: optional KindCalled
noun: optional Noun
name: optional Name

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

Terms:

through: Bool
doors: Linking
additionalLinks: optional AdditionalLinks
are: Are
room: Linking

A mapping declaration starting with a direction.

Terms:

directionOfLinking: DirectionOfLinking
are: Are
linking: optional Linking

ex. `[Inside from the Meadow] is... the woodcutter's hut.`

redirect: optional DirectionOfLinking

ex. `[West of the Garden] is ... south of the Meadow.`

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.

Terms:

linking: Linking
are: Are
directionOfLinking: DirectionOfLinking
additionalDirections: optional AdditionalDirections

This is the 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. ( tbd: an alternative might be slots and some scheduling metadata; this is fine for now )

Terms:

understand: Understand
timedRule: TimedRule
kindsAreKind: KindsAreKind
aspectsAreTraits: AspectsAreTraits
kindsAreTraits: KindsAreTraits
kindsHaveProperties: KindsHaveProperties
kindsAreEither: KindsAreEither
mapConnections: MapConnections
mapDirections: MapDirections
mapLocations: MapLocations
propertyNounValue: PropertyNounValue
nounPropertyValue: NounPropertyValue
verbNamesAreNames: VerbNamesAreNames
namesVerbNames: NamesVerbNames
namesAreLikeVerbs: NamesAreLikeVerbs

Reads a number specified in words or as digits. Stores the result as the parsed number.

Terms:

value: Num

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 )

Slots:

Terms:

article: optional Article
matched: Matched

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

Slots:

Terms:

noun: optional Noun
name: optional Name

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.

Terms:

names: Names
are: Are
adjectives: Adjectives

adjectives are *not* optional. if there are no adjectives present, then 'names_verb_names' (might) match instead.

verbPhrase: optional VerbPhrase

Names are verb (other) names. ex.

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

Terms:

names: Names
are: Are
verb: Verb
otherNames: Names

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.

Slots:

Terms:

countedKind: optional CountedKind
kindCalled: optional KindCalled

note that because this phrase is greedy once used, no additional names will match.

noun: optional Noun

matches existing nouns

kind: optional Kind

used primarily for anonymous nouns: ex. "the container" note that anonymous nouns are prohibited from starting a sentence.

name: optional Name
additionalNames: optional AdditionalNames

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

Terms:

matched: Matched
newTrait: optional NewTrait

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

Terms:

namedNoun: NamedNoun
has: Words
article: optional Article
property: Property
of: optional Words

the word "of", sometimes reads better this way

singleValue: SingleValue

Matches an existing noun ( by checking multiple words for the best match ).

Slots:

Terms:

article: optional Article
matched: Matched

the string that matched ( a noun name or alias )

Assigns a default value to a noun. ex.

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

As a special case this also allows a list of quoted text indicated with "are" ( versus "is" )

Terms:

article: optional Article
property: Property
of: Words

the word "of"

namedNoun: NamedNoun
are: Are
singleValue: optional SingleValue
quotedTexts: optional QuotedTexts

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

Terms:

primitive: optional Text
kind: optional Kind

kinds|aspects|records

Matches the name of a field in a kind.

Terms:

article: optional Article
matched: Text

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

Terms:

matched: Text

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

Terms:

quotedText: QuotedText
additionalText: optional AdditionalText

Specific names can follow rule declarations. ex.

( this is the witness light rule )

Terms:

prefix: optional Bool

"this is the"

article: optional Text
matched: Matched
suffix: optional Bool

the word "rule"

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

Terms:

None.

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.

Terms:

None.

Terms:

kind: optional Kind
noun: optional Noun

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

Terms:

quotedText: optional QuotedText
matchingNum: optional MatchingNum
noun: optional Noun
kind: optional Kind

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

Terms:

assignment: Assignment

Matches pattern rule definitions.

Terms:

rulePrefix: RulePrefix
someone: optional Bool
pattern: Kind

the pattern this rule targets. the pattern must exist for this phrase to generate successfully. ex. "instead of traveling"

ruleTarget: optional RuleTarget
ruleSuffix: optional RuleSuffix
ruleName: optional RuleName

parenthetical text

subAssignment: SubAssignment

Matches the name of an (existing) trait.

Terms:

article: optional Article

while an article can precede every trait it doesn't influence which trait gets matched.

matched: Text

Matches at least one trait.

Terms:

trait: Trait
additionalTraits: optional AdditionalTraits

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

Terms:

understand: Words
quotedTexts: QuotedTexts

all of jess's understand start with quoted text

as: Words
article: optional Article

inform is smart enough to *not* allow articles before actions. i am lazy.

pluralOf: optional Text

ex. Understand "birds" and "ruddy ducks" as the plural of duck. fix? in jess this (also) influences the story interpretation.

names: Names

this matches one or more nouns or kinds: generation susses out what to do with those nouns or kinds. * aliases for nouns: Understand "floor" or "sawdust" as the message. * aliases for kinds: Understand "cupboard" or "cupboards" or "cabinets" as a cabinet. * grammar for actions: Understand "reach underneath/under/beneath/-- [something]" as looking under. jess doesn't permit aliases for kinds, those generate errors.

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.

Terms:

verb: Verb
names: Names
are: Are
otherNames: Names

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

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

Terms:

verb: Verb
plainNames: Names

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

Terms:

text: Text

Matches one or more predefined words.

Terms:

matched: Matched