Printing articles, proper names and gender specific pronouns

I have a problem. Now that Adventuron has multi-word input, I am trying to write generic command handlers for each action so that I only have to write specific overrides in the on_command section. In order to make things properly generic, I need to be able to do the following:
(a) Print things with or without an indefinite article, i.e. ‘a’ or ‘an’ for singular common nouns, ‘some’ for plural common nouns or nothing for proper nouns. For example, ‘You can see a present, an umbrella, some chestnuts and Santa Claus’.
(b) Print things with or without a definite article, i.e. ‘the’ for common nouns or nothing for proper nouns. For example, ‘You cut the string and Jack the Ripper’.
(c) Print the object description, rather than the noun entered. (This may be a substitute for (a).)
(d) Print a gender-specific pronoun, i.e. ‘he’, ‘she’, ‘it’ or ‘them’; ‘him’, ‘her’, ‘it’ or ‘them’; ‘his’, ‘hers’, ‘its’ or ‘theirs’; and so on.

Is it possible to do this?

I’m also very interested in the display of articles:


If it is possible to define the properties of the articles in the object, they don’t seem to be considered: apple : object "apple" definite_article = "the" indefinite_article = "an"
I’m just interested in this in a Verb-Noun context and for translation: I need it to display the defined article in front of the object names ${entité} in System Messages.

1 Like

I discovered the definite_article and indefinite_article properties from your post, but I wasn’t able to work out how to use them. I want something like : print {("You don't have {definite_article} " + original "noun1" + ".")}

I’ve been doing some experimenting with this with mixed results.

Firstly, I’ve discovered that you can use : print d(object_id); to print an object description. To do this in a more general way, you can use : print d(s1()); to print the object description for the object corresponding to noun1.

Secondly, with regard to the definite_article and indefinite_article properties, they don’t seem to be used and I can’t find a way to print them. I was hoping to define a blank indefinite article for proper nouns, but Adventuron won’t allow a blank.

To work around the problem with definite articles, I defined a trait called proper_t for proper nouns and a couple of dynamic strings for printing ‘the’ or blank and ‘The’ or blank (for the start of a sentence), then use something like : print {("You get {the} " + d(s1()) + ".")} This works well, except that it prints the full object description, including the indefinite article, so you have to remove the indefinite article from the object description, but then you don’t get the indefinite article in other places where it’s needed. There must be a way to do this, as Adventuron does it itself.

In the system messages, ${entity} and ${entity2} appear to print the object description for noun1 and noun2 respectively, but these can’t be used outside the system messages. There’s also a ${noun} and presumably ${noun2} that appear to print the noun in the input.

Another thing that’s unclear is how Adventuron identifies the indefinite article in an object description. I know that it looks for ‘a’, ‘an’ and ‘some’, but what else does it look for? I have indefinite articles like ‘your’, ‘two’ and ‘eight’.

I raised an issue on the bug tracker at GitHub and @adventuron has added a new function called strip_article in Beta 66i. Apparently there was already a function called definite. With these functions, you can now solve issues (a), (b) and (c) as follows.

Firstly, make sure your object descriptions include the indefinite article (‘a’, ‘an’ or ‘some’).

To print the object without any article, use:
: print {( strip_article(d(s1())) )}

To print the object with the indefinite article (as in your original object definition), use:
: print {( d(s1()) )}

To print the object with the definite article, use:
: print {( definite(d(s1())) )}

This is a bit messy, but it was presumably done this way for backward compatibility.

For issue (d), you can set up some traits for male_t, female_t and plural_t and use dynamic strings. The dynamic strings can use nested ternary operators to choose between things like ‘he’, ‘she’, ‘it’ and ‘them’. This is a stop-gap measure until gender and singular/plural related properties are a standard part of the language.

This is what is odd, and seems to make everything else more difficult.

I’m going to wait until all this is simpler and more intuitive.

The correct way to define object is always with an indefinite article.

apple : object "an apple";

Adventuron will take care of translating indefinite to definite articles for your system messages.

When it comes to listing object (in a room layout) without an article, then simply use this in your theme:

      lister_objects {
         list_type =  single_line_no_article
      }

I will also add the ability to define custom indefinite and definite article pairs in game_settings {} in a future release.

A global definition of definite and indefinite articles can be problematic in some languages. It can be very useful to have a local priority definition of these articles.

Yes, some languages have different articles depending on context. That needs to be taken into account. I think that’s also a good reason why articles should not be included in the object description.

We also have in French a vowel contraction rule with the articles defined as le or la which become l’ in front of a vowel or a non-mute h: l’orange, l’hôtel.
The problem is that there is no space between the article and the noun. The articles property (with an s) of the Inform 6 library allows to remedy this; the article definition should manage the space between the article and the noun:

Object orange "orange"
   with
	   name 'orange',
	   articles "L'" "l'" "une "
   has edible female;

It is therefore also necessary to be able to separate the article from the noun after the player input: >prendre l'orange becomes >prendre l' orange

1 Like

I found a downfall with the new functions to print objects with and without definite or indefinite articles. If these functions are used at the start of a sentence, the first letter is not automatically capitalised. There is no function to convert a string to sentence case. However, yell loud enough and your wishes will be granted.

From Beta 66l, there is now a first_cap() string function. This can be used as follows if your string is at the beginning of a sentence.

To print the object without any article, use:
: print {( first_cap(strip_article(d(s1()))) )}

To print the object with the indefinite article (as in your original object definition), use:
: print {( first_cap(d(s1())) )}

To print the object with the definite article, use:
: print {( first_cap(definite(d(s1()))) )}