Parser adventure conventions in different languages

Bear with me - I did mean to put this in general, but move/delete if necessary.

I am curious about how grammar conventions vary by language for parser text games, specifically with regard to what I noticed in this picture from an old thread about Discord IF bots. Specifically that in French the infinitive is used (e.g. prendre, to take), rather than the imperative (prenez, take), in commands to the parser:

Is that true of other non-English languages? I would expect other stuff like accents/diacrits are omitted for ease of use, except where necessary to disambiguate different words/meanings.

I have heard that German inform libraries had to be rewritten at a deep level to parse German (verbs saved till the end). Irish might be fun (verbs at the beginning instead, and lots of initial letter mutations/lenitions). Varying/gendered definite and indefinite articles add an extra headache for localising also, I imagine.

But are there any more specific quirks or expectations like that (infinitive not imperative) that happen in other languages? Perhaps I mean indo-European specifically, as this gets a little less meaningful when talking about other branches of language, I guess.

2 Likes

In English, there’s debate regarding whether people interpret a command as the bare infinitive or the imperative. I’m of the latter camp.

1 Like

And I’m not sure I understand the distinction between infinitive and imperative


Infinitive: I want to eat. (to do something)
Bare infinitive: I can eat (do something)
Imperative: Eat your vegetables (do something!)

So whether it’s a “neutral” verb or a command to the player character.

2 Likes

Apologies - I should have been clearer on that. The word forms are a little bit ambiguous/redundant in English, but generally quite distinct in other (Indo-European) languages.

I’m pretty sure I’ve seen lots of OG text adventures talk about ‘just tell me what you want me to do / give me instructions’. I think the usage is pretty clearly imperative in English.

1 Like

That said, maybe in French but definitely in Spanish, the infinitive is used as a sort of polite imperative (no pisar el cĂ©sped = don’t walk on the grass). So is there some kind of cultural acceptance of a text parser / computer / text adventure avatar as a respected / formal thing?

The use of the infinitive does also skirt the question of whether to use formal or informal forms (in the imperative, or in anything else). e.g. tu vs vous in French, and whether to use usted/3rd person forms in Spanish.

And I wonder did the convention to use the infinitive arise because of technical considerations (easier for early engines and simple translations thereof to parse?)

1 Like

So is there some kind of cultural acceptance of a text parser / computer / text adventure avatar as a respected / formal thing?

and would people type the same things in ChatGPT I wonder?

TLDR: Polish uses imperative. The rest of this post is me going down a rabbit hole.

I’ll be honest, I don’t think I’ve ever seen a parser game in Polish (which is my native language) and so, this post made me think about what parser commands would be like in Polish. I assumed that they’d be in imperative as infinitive wouldn’t make sense, but it’d also probably require the parser to be able to recognize Polish declension. But if we’re taking declension into account, it also means you have to do a lot of coding around it


Let’s take for example, a classic: GET LAMP. “To get” is “wziąć”, “lamp” is “lampa”, but “wziąć lampa” is very clunky and makes no sense. We need the imperative of “wziąć” (“weĆș”) and accusative of “lampa” (“lampę”). “WeĆș lampę” is natural and therefore probably most likely to be used. But what about EXAMINE LAMP? That’s a whole different case for “lampa”!

Again, I don’t know Polish parsers or parsers translated to Polish, so I decided to try and find something. This is how I found Polish library for Inform 6. There are a couple of test adventures included so I decided to check how things are being solved, even though I know even less I6 than I7. This, naturally, leads to me not being able to parse (heh) the code properly and I might be wrong, but I think I might have a gist of what happens here.

There are some encoded grammar rules (please don’t ask me how it works, I have no idea) and every object gets a full declension. Let’s take a look at the Colossal Cave Adventure’s random object — brass lamp.

Long excerpt of the code
Object  -> brass_lantern "mosiÄ™ĆŒna lampa"
  with  name 'lampa' 'latarnia' 'ƛwiatƂo' 'mosiÄ™ĆŒna' 'bƂyszcząca',
        name_dop 'lampy' 'latarni' 'ƛwiatƂa' 'mosiÄ™ĆŒnej' 'bƂyszczącej',
        name_cel 'lampie' 'latarni' 'ƛwiatƂu' 'mosiÄ™ĆŒnej' 'bƂyszczącej',
        name_bie 'lampę' 'latarnię' 'ƛwiatƂo' 'mosiÄ™ĆŒną' 'bƂyszczącą',
        name_nar 'lampą' 'latarnią' 'ƛwiatƂem' 'mosiÄ™ĆŒną' 'bƂyszczącą',
        name_mie 'lampie' 'latarni' 'ƛwietle' 'mosiÄ™ĆŒnym' 'bƂyszczącym',
        desc_dop "mosiÄ™ĆŒnej lampy",
        desc_cel "mosiÄ™ĆŒnej lampie",
        desc_bie "mosiÄ™ĆŒną lampę",
        desc_nar "mosiÄ™ĆŒną lampą",
        desc_mie "mosiÄ™ĆŒnej lampie"

Uhm, wow, okay, let’s unpack this! See, Polish has seven cases (nominative, genitive, dative, accusative, instrumental, locative, and vocative). What this bit of code above seems to be doing is establishing six variants (as vocative would be useless for a parser game) for “lamp”, “lantern”, “light” (in terms of illumination, not weight), “brass”, and “shiny”. The three letter abbreviations like “dop” and “bie” are short forms of the case names in Polish. This seems to be used later on in commands. There’s also a long list of commands which can be used
 though it seems like “take” was bringing some trouble.

 Verb 'weĆș' 'zabierz' 'podnieƛ'  ! TU ZMIANA
    * biernikmulti                                          -> Take
    * multiinside 'from' noun                               -> Remove;          ! <- tu jest problem, ktĂłry wymaga poprawek w parserze... :(

The comments say “! CHANGE HERE” (as in, indication that something has changed) and a note “here’s a problem which requires fixing the parser :(”. I have no idea what “multi” means in this place but I presented this bit anyway because it shows that “biernik” is used. What is “biernik”? Polish word for accusative. Let’s take a different bit of code
 let’s EXAMINE the lamp.

Verb 'przyjrzyj'
    * 'się' celowniknoun                        			-> Examine;

See, in Polish, examining is used with a reflexive pronoun, so it’s “przyjrzeć się”, and it’s paired with dative (“celownik”). “Przyjrzyj” alone would be extremely unnatural.

So, what I assume happens? You establish every grammatical possibility (outside of vocative) so you can both TAKE LAMP (weĆș lampę) and EXAMINE LAMP (przyjrzyj się lampie), and also TAKE BRASS LAMP (weĆș mosiÄ™ĆŒną lampę) and EXAMINE BRASS LAMP (przyjrzyj się mosiÄ™ĆŒnej lampie), and- you get me.

I’m so sorry for an entire massive post but if I went down this rabbit hole and learned, I think I have a full right to share this knowledge.

Sidenote, the name_mie segment for the lamp seems to be incorrect. It’s responsible for miejscownik, or locative. You can think of it as of answering the question: “about who? about what?”, and it should go 'lampie' 'latarni' 'ƛwietle' 'mosiÄ™ĆŒnej' 'bƂyszczącej'. The way it currently goes, it seems like someone made a mistake and started declension for “light” instead of “lamp”, as the declension here follows a pattern that’d fit the gender-neutral light instead of a feminine lamp. This doesn’t happen anywhere else so I assume it’s a mistake.

14 Likes

Oh, I am loving the rabbit hole, and my post was intended to be a bit rabbit-holey anyway. It’s fascinating stuff to me.

The ‘multi’ I assume relates to the fact that you can ‘take all’, and ‘all’ will be given a reasonable interpretation as regards any items in the scene (ignoring those that are visible but inside things, and so on, I believe).

If I was coding a parser for this sort of case, I would probably try to recognise all forms of verb and all declensions of noun (unless that created too much ambiguity), so that the correct form would be recognised, as well as a large number of combinations that didn’t (but the impact of that is effectively zero, I think).

3 Likes

One begins to appreciate how simplifying using the infinitive can be, especially if you - as a translator - have your hands tied by the stuff you are translating.

2 Likes

I tend to use the infinitive when I play Spanish parser games and IIRC it’s always at least been recognized, but I don’t know what native-speaker players tend to do.

I believe Japanese parser games tended to use the dictionary form of the verb (which is similar to the infinitive) rather than the imperative, when they didn’t just take English input because that was easier. The Portopia Serial Murder Case, which was the big commercial success of that era and very influential, did use the imperative because in-universe the player character was giving commands to his assistant, Yasu. But I don’t think a lot of other games picked that up. Even when you get into stuff that’s more point-and-click you see dictionary form verbs given as the options—みる、べる、はăȘす.

8 Likes

(Edit: written before seeing post above re Japanese)

As an aside, I think Chinese is an interesting case to deal with, because in some ways the grammar is quite simple, but the lack of spaces between ‘words’ is a nightmare for parsing.

I don’t know what is out there in terms of text parser IF in Chinese, but I imagine there may be some simplifying conventions there too. Maybe pinyin with spaces?

2 Likes

I don’t know how much a lack of spaces would be an issue, since a lot of the time spaces are not the crucial delimiter in parser commands. e.g. “use blue key to open blue door”, blue key and blue door can both be understood as the name of 1 object each.

I couldn’t find any Chinese parser tools in a few minutes of search but I didn’t look that hard. Some discussion of Twine, inkle, renpy and stuff but not much parser. Seems like the main barrier to entry for would-be Chinese parser players/creators is that every single parser tool expects you to know English. Plus it’s a retro gaming tool and there wasn’t much of a market for old school English text adventures in China in the era when they were popular in the US. Not sure about translations of old school English text adventures but I imagine the same dynamics apply.

1 Like

That’s a reasonable way to do it! Inform, for example, reasons that the impact of a false positive (accepting an invalid command) is negligible, while the impact of a false negative (rejecting a valid command) is large, so it’s better to accept too much than too little.

Except


What happens when we have verbs with two nouns? Now the case has important semantic meaning! I don’t know Polish, but in many languages with case, a sentence like “give X to Y” will have X in the accusative and Y in the dative—and allow them to appear in either order.

4 Likes

I feel I should add, I refer to Japanese parser games in the past tense because once point-and-clicks/visual novels took off (we Anglophones draw a sharp distinction between those two categories but Japanese gamers/game devs do not), Japanese parser games pretty much completely stopped being made, including by hobbyists. Discussions I’ve seen (in Japanese) of why this is have mostly cited the existing tools (TADS, Inform, etc.) being unsuitable for the Japanese language, but you might then ask why no one made parser authoring tools that were suitable for Japanese. From what I’ve read about the development of games like Portopia, making parser systems for a language that uses three different writing systems (intermingled on a character-by-character basis) was a headache even with the resources of a commercial enterprise, much less without, so that’s probably a factor. (It was notable that Portopia was capable of taking input for two out of the three instead of one or zero!) You do occasionally see nostalgia throwback games with homebrew parsers, but I’m not aware of there being a substantial community around this.

6 Likes

Alright, a follow-up post since it’s clearly of interest. I forgot to check every file and it turns out, things are actually explained. Polish library has additional properties made specifically to handle Polish grammar. I think that’s really cool!

Good question! Especially since Polish won’t have an equivalent of “to”. I went back to the library to check how GIVE is being handled.

Verb 'daj' 'oddaj'
    * biernikheld celownikcreature              			-> Give
    * celownikcreature biernikheld              			-> Give reverse;

So, both DAJ LAMPĘ SMOKOWI (GIVE LAMP TO DRAGON) and DAJ SMOKOWI LAMPĘ (same thing, just exchanged) would work.

8 Likes

Good question! Especially since Polish won’t have an equivalent of “to”. I went back to the library to check how GIVE is being handled.

Verb 'daj' 'oddaj'
    * biernikheld celownikcreature              			-> Give
    * celownikcreature biernikheld              			-> Give reverse;

So, both DAJ LAMPĘ SMOKOWI (GIVE LAMP TO DRAGON) and DAJ SMOKOWI LAMPĘ (same thing, just exchanged) would work.

Just to clarify, in case misunderstood, in both cases the held thing (biernikheld) is given to the creature/person. My memory of inform is hazy but I think the first parameter is the ‘nominative’ thing and the second parameter is the ‘accusative’ thing, as a hard coded engine type thing, so the give reverse verb works in reverse to normal.

So this relies on matching the parts of the sentence to specific kinds of things, but it may well do this without regard to the specific case used.

It is the same thing in English, as you note.

Give X to Y is one thing to parse. Give Y X is another. For my custom parser, this was tricky because you have to figure out where Y ends and X begins (in my case, I brute force trying all possible combinations and take the one that works, if any).

I guess the problem exists both ways in Polish, but the case could be use as a clue. One word for each thing is relatively easy. Harder when you use multiple words for at least one of the things (and more so if you add modifiers like ‘X in A’ or ‘X of A’).

3 Likes

Yep, in both cases you’re giving your object to the creature/person. I guess it goes a little like this.

DAJ - imperative of “dać”, to give
LAMPĘ - the biernikheld (accusativeheld), lamp in accusative
SMOKOWI - the celownikcreature (dativecreature), dragon in dative

I assume it doesn’t matter if the lamp or the dragon are first.

I might be misunderstanding something because I’m tired these days but the case here absolutely matters. biernikheld is a specified property tied to the accusative. If I write DAJ LAMPĄ SMOKOWI, it probably won’t work[1] because “lampą” would be narzednikheld, which is a whole different property. If the comment is about something else, well, sorry.

There are some complications that I can see in the code already but none of them seem to come from more than two words being used. Seems like “X in A” type of situation would be covered.

Verb 'wĆ‚ĂłĆŒ'
    * biernikheld                               			-> Wear
    * biernikmultiheld 'w' bierniknoun              	-> Insert
    * biernikmultiheld 'do' dopelniacznoun          	-> Insert;

Which seems to be responsible for things like “wĆ‚ĂłĆŒ zbroję” (wear armor), “wĆ‚ĂłĆŒ miecz w szczelinę” (put sword in gap), and “wĆ‚ĂłĆŒ skarb do skrzyni” (put treasure in chest). I imagine the held properties do the heavy lifting for differentiating between what is put where, otherwise the cases make things fairly unambiguous. Also, since modifiers are in grammatical agreement, I don’t think it’d be very different. If you define “zbroja” as “bƂyszcząca” and “skarb” as “bezcenny”, then it probably should handle “wĆ‚ĂłĆŒ bƂyszczącą zbroję” and “wĆ‚ĂłĆŒ bezcenny skarb do skrzyni”.

Then again, I barely know I7, let alone I6, so perhaps I’m talking nonsense.


  1. though it can be a very informal and wildly non-grammatical way to tell someone to hit the dragon with a lamp, at least where I’m from, but it doesn’t matter because the parser won’t recognize it as such ↩

4 Likes

I can’t imagine myself thinking verbs in English are in infinitive. It’s GET THE DAMN LAMP, MINION. Or so I understood it so far.

in Italian, we use the imperative. Some older games go for the first person (PRENDO LAMPADA, I get lamp). But it’s usually second person (PRENDI LAMPADA, you: get lamp).

7 Likes

As it is written, the keywords use the specific and correct cases. But there is a step of parsing what the player has written and deciding what it is. If it works more or less the same way as in English, the ‘dragon’ creature has words associated with it, and if those words are matched, the parser decides you are talking about a dragon. I expect that it ignores case and just has multiple words defined for the object for various cases (or has a simple grammatical rule to obtain a base word from a grammatical variant). If the Polish translation actually looks at case, then it is relatively sophisticated, but I get the impression from your summary of the comments that it is not doing this.