Hoisting and indefinite articles

I’ve been struggling for years with mysteriously missing indefinite articles. This evening I discovered that if an object is mentioned in code without an article, even if the indefinite article is explicitly declared later, the object will lose it’s article. Grrrr.

The parlor is a room.

A teacup is on table.

The table is a scenery enterable supporter in the parlor.
The indefinite article is "the".

This results in:

Welcome
An Interactive Fiction
Release 1 / Serial number 221207 / Inform 7 build 6M62 (I6/v6.41 lib 6/12N) SD

parlor
On table is a teacup.

And here’s why. During the first mention of the object, it is assumed to be proper-named.

>showme the table
table - supporter
teacup
location: in the parlor
singular-named, proper-named; unlit, inedible, fixed in place, scenery; enterable

Of course, you all already know this, and it’s probably been discussed a million times. But it was new to me.

1 Like

Actually there’s more than one way to control this stuff.

The indefinite article only shows up if the thing is improper-named. Just saying what the indefinite article should be does not make the thing improper-named.

You can declare a thing to be improper-named yourself (during creation or when adding other qualities to the thing):

The table is an improper-named scenery enterable supporter in the parlor.

You can also put ‘a’ in front of it when it’s created to do the same thing. So in your example, instead of saying a teacup is on table, say ‘a teacup is on a table. a table is in parlor.’

(You can’t type ‘table is in parlor’ because then you bump into a special compiler case where lines starting with the word ‘table’ look like, well, the start of Tables to Inform)

Note how the teacup was already correctly improper-named because you happened to put an ‘a’ in front of it. The same will go for the table.

Personally I’m not great at remembering to do this correctly all over the source, so I just explicitly declare what the item should be in its own line for almost everything. This way even if I twiddle the sentences that create things, or rearrange them, the explicit declaration should win out.

-Wade

1 Like

The logic goes like this:

a/an/some/the/-- <object-name> is/are ...

i) if no article is supplied, the object will be singular-named and proper-named meaning that in general the default (a/an/some) or any subsequently defined indefinite article won’t be used.
ii) if the supplied article is a/an/the, the object will be singular-named and improper-named, with no specific indefinite article defined.
iii) if the supplied article is some, the object will be plural-named and improper-named, with no specific indefinite article defined.
iv) it makes no difference whether you write is or are or whether <object-name> is grammatically a plural form- that doesn’t affect whether the object is singular-named or plural-named.
(v) at the start of a sentence, it makes no difference how the article or the name is capitalised (but see small print below).
(vi) a leading ‘a’, ‘an’, ‘some’ or ‘the’ (and if starting a sentence, the sentence case forms ‘A’, ‘An’, ‘Some’ or ‘The’) is parsed as an article and stripped from the name of any object created as a result, which will be improper-named.
(vii) elsewhere in a sentence, a leading ‘A’, ‘An’, ‘Some’ or ‘The’ (in sentence case) are incorporated into the name of an object created as a result, which will be proper-named.*

So, the only way to make something plural-named without explicitly defining it as such is to use some and the only way to make something proper-named without explicitly defining it as such is to omit the article altogether**

*although if an object called e.g ‘Toy’ has already been declared, ‘…The Toy…’ will be interpreted during parsing as referring to that previously-declared object in preference to creating a separate proper-named object called ‘The Toy’. Conversely, if ‘The Toy’ is declared first, it will be created as proper-named ‘The Toy’ and subsequent mentions of ‘the Toy’ matched to it.

**or (except at the start of a sentence) put the article in sentence case (in which case it becomes part of the name and not really an article).

One implication is that if something needs to be both plural-named and proper-named, you’ll need to explicitly define one or the other.

A general way to think about using articles in object definitions is:

  • if the object needs to be proper-named, omit any article (Miss Bennett is...)
  • unless the object needs to be plural-named, use a/an/the
  • for plural-named improper-named objects, use some (Some grapes are...)
  • for plural-named proper-named objects, define ‘plural-named’ separately (ABBA are on the stage. ABBA are plural-named).

The last of these is rarely needed as often such objects will be improper-named and prefaced with the or ‘The’ as indefinite article or fully incorporated into the name itself, as in The Beatles or the Ten Commmandments

small print

(i) <a-number> <name> is/are...

will be created as one singular-named proper-named object called a-number name (e.g. five gold rings) unless <name> is a kind, in which case a-number objects will be created, each being singular-named or proper-named and having an indefinite article according to the default for the kind, e.g. five individual gold rings.

If you want to create a single object called five gold rings when gold rings are also a kind, you’ll have to write something along the lines of

A thing called five gold rings is...

in which specific example the object created will be singular-named and proper-named.

(ii) for the more general case,

A thing called a/an/some/the/-- <object-name> is/are...

the object thus created will have the same properties as if the preamble A thing called were omitted, with the exception that if the supplied article is the, or the capitalised forms The or A or An or Some.

In the case of the, e.g. ... called the King... although the object will be singular-named and improper-named, its indefinite article will be defined as the - which provides an concise alternative to writing a separate phrase to define it thus- The indefinite article of the King is "the". This is the only instance where a specific indefinite article is defined without a separate phrase to do so.

In the case of The or A or An or Some this will be incorporated into a singular-named proper-named object with indefinite article undefined e.g. The Ten Commandments or A Town Called Alice or Some Kind Of Wonderful.

(iii) if you need to enforce improper-naming on an object whose name begins with an article, you can write for example ‘…called the The Importance of Being Earnest review…’ or ‘In the drawer is a Some Like It Hot video tape’. This works even to create names starting with lower-cased articles- ‘…called a the something’- although this will very rarely be needed.

(iv) at the end of the day, you can always finely control how an object is displayed using the printed name property and the rules of the activity printing the name of as well as directly setting the indefinite article, plural-named etc. properties, and finely control what words in typed commands are recognised as the object using Understand... phrases.

(v) Casing most often makes a difference to parsing when asserting mapping connections.

a) as is usual, sentence-case words beginning a sentence are preferentially initially parsed as lower case, although if they turn out to be a name or part of a name they’ll revert to the case as written
b) direction words like ‘north’ or ‘above’ at the start of a sentence will be parsed as a direction in preference to as a name or part of a name
c) direction words in sentence case elsewhere in a sentence will preferentially be parsed as part of a name
d) as for direction words, so for nowhere, so ‘nowhere’ or ‘Nowhere’ at the start of a sentence preferentially parses as (no room) but elsewhere while ‘nowhere’ still preferentially parses as (no room) , ‘Nowhere’ preferentially parses as (a room called Nowhere)

So, an ambiguous sentence such as

  1. North of the Sundial is North of the Sundial’ is read as ‘(mapped) north of (a room called) (the) Sundial is (a room called) North of the Sundial’, creating two rooms- ‘Sundial’ and ‘North of the Sundial’.
  2. North of the Sundial is north of the Sundial’ is read as ‘(an implied turning point) (mapped) north of (a room called) (the) Sundial is (mapped) north of (a room called) (the) Sundial’, creating one room- ‘Sundial’- with a map connection to the north looping back on itself and leading back to the Sundial.
  3. A room called North of the Sundial is North of the Sundial’ is read as ‘a room called North of the Sundial is (a room called) North of the Sundial’, causing a compiler error as it seems to be saying that the room called North of the Sundial is the same as itself.
  4. A room called North of the Sundial is north of the Sundial’ is read as ‘a room called North of the Sundial is (mapped) north of (a room called) (the) Sundial’ and works as expected.
  5. North of the Sundial is a room north of the Sundial’ is read as ‘(mapped) north of (a room called) (the) Sundial is (a room called) (a) room north of the Sundial’, creating two rooms- ‘Sundial’ and (unexpectedly) ‘room north of the Sundial’
  6. Nowhere is above the Crypt’, ‘nowhere is above the Crypt’ and ‘Above the Crypt is nowhere’ all work as expected, but ‘Above the Crypt is Nowhere’ will create a room called ‘Nowhere’ above the Crypt.

postscript

The parser prefers when possible to match as much of the player’s input as a single object as possible. So if you happen to be in a room with a book called Five Gold Rings and five individual gold rings, typing ‘take five gold rings’ will take the book only. Typing the same again however will then take the five rings, as the parser prefers to take things not held by the player. From the start however, typing ‘take rings’, ‘take all rings’ or ‘take gold rings’ or ‘take all gold rings’, commands which don’t match the number-word, will take both book and rings together. This preference for matching a singular interpretation of expressions of the form <a-number> ... when the number is part of the name of a singular object is evoked early in parsing and can’t be affected by Does the player mean... rules, which kick in later once the parser has matched multiple objects. It only occurs when the number-word is the first word of the name, because in this case the name of each individual gold ring doesn’t match the command from that word. It doesn’t happen for example if the room contains eight pieces of eight and a book called Pieces Of Eight, when ‘take eight pieces of eight’ will match all objects.

This happens because the parser doesn’t object to matching one ‘eight’ in the book’s name twice against the two ‘eight’ s in the command. Indeed, in general, the parser doesn’t usually worry about matching words repeatedly, or about word order, or making a full match, so ‘take of pieces of of’ will take all the objects, equivalent to ‘take pieces of eight’.

The exception is Understand ... phrases where a multi-word name is spelled out in a single text, e.g.

Understand "piece of eight" as the gold coin.

In this case the name will only be matched if a command has the full name, without repetitions and with the words in the right order.

Understand "piece" or "of" or "eight" as the gold coin.

or

Understand "piece/of/eight" as the gold coin.

will behave in the same way as a ‘normal’ name.

small print to postscript

If you have a book called Five Sheep and five sheep in the room, where ‘sheep’ could be singular or plural, again the parser defaults to preferring a singular interpretation, such that ‘take sheep’ prompts a disambiguation question: ‘Which do you mean, a sheep or Five Sheep?’. This can’t be disambiguated in favour of the sheep by typing ‘sheep’, but typing ‘a’ or ‘a sheep’ works. It’s tricky to take the five sheep in one command, leaving Five Sheep on the floor. There are two sneaky ways to do this: ‘take 5 sheep’ or ‘take all sheep except five sheep’. In the former example, the somewhat ungrammatical ‘take five ring’ or ‘take all ring’ and the more grammatical ‘take every ring’ will also work.

7 Likes

@drpeterbatesuk explains thoroughly and extensively, but here’s the documentation as well with some examples:

3.18: Articles and proper names

 "Belfry"

 The Belfry is a room. A bat is in the Belfry. The bell is in the Belfry. Some woodworm are in the Belfry. A man called William Snelson is in the Belfry. A woman called the sexton's wife is in the Belfry. A man called a bellringer is in the Belfry.

 In the Belfry is a man called the vicar. The indefinite article of the vicar is "your local".

 Test me with "look".

You can see a bat, a bell, some woodworm, William Snelson, the sexton’s wife, a bellringer and your local vicar here.