Second Gender - The Extension

Fredrik Ramsberg’s Swedish translation of Inform 6 features the ability to give things two distinct genders.
So I wrote an extension for Inform 7 (in English) based on his implementation of that feature.

It’s not too long. I’ll post the beta here for all and everyone to test, comment, spot faults and dissuade me from submitting it to the Extension site. (The code shouldn’t be sensitive to tab issues.)

[rant][code]Version 1 of Second Gender by Felix Larsson begins here.

“Lets you give any person or thing any one or two (or none) of the genders male, female and/or neuter.”

“based on original Inform 6 code by Fredrik Ramsberg”

Chapter - Changes in I6 Templates

Section - Get Secondary GNA of Object
[This code is adapted from Fredrik Ramsberg’s Swedish translation of Inform 6.]

[GetSecondaryGNAofObject does just the same thing as GetGNAofObject only backwards; it tests what gender an object has in reverse order compared to GetGNAofObject.]
Include (-
[ GetGNAOfObject obj case gender;
if (obj hasnt animate) case = 6;

if (obj has male) gender = male;
if (obj has neuter) gender = neuter;
if (obj has female) gender = female;

if (gender == 0) {
! if (case == 0)
! gender = LanguageAnimateGender;
! else
gender = LanguageInanimateGender;
}

if (gender == female) case = case + 1;
if (gender == neuter) case = case + 2;
if (obj has pluralname) case = case + 3;

return case;

];

[ GetSecondaryGNAOfObject obj case gender;
if (obj hasnt animate) case = 6;

if (obj has female) gender = female;
if (obj has neuter) gender = neuter;
if (obj has male) gender = male;

if (gender == 0) {
! if (case == 0)
! gender = LanguageAnimateGender;
! else
gender = LanguageInanimateGender;
}

if (gender == female) case = case + 1;
if (gender == neuter) case = case + 2;
if (obj has pluralname) case = case + 3;

return case;

];
-) instead of “Gender” in “Parser.i6t”.

Section - Pronoun Handling
[This code is adapted from Fredrik Ramsberg’s Swedish translation of Inform 6.]

[PronounNotice should consider GetSecondaryObject.]
Include (-
[ SetPronoun dword value x;
for (x=1 : x<=LanguagePronouns–>0 : x=x+3)
if (LanguagePronouns–>x == dword) {
LanguagePronouns–>(x+2) = value; return;
}
RunTimeError(14);
];

[ PronounValue dword x;
for (x=1 : x<=LanguagePronouns–>0 : x=x+3)
if (LanguagePronouns–>x == dword)
return LanguagePronouns–>(x+2);
return 0;
];

[ ResetVagueWords obj; PronounNotice(obj); ];

[ PronounNotice obj x bm;
if (obj == player) return;

bm = PowersOfTwo_TB–>(GetGNAOfObject(obj));
! §#§ Added one line, to allow for an object to have two genders
bm = bm | (PowersOfTwo_TB–>(GetSecondaryGNAOfObject(obj)));

for (x = 1 : x <= LanguagePronouns–>0: x = x+3)
if (bm & (LanguagePronouns–>(x+1)) ~= 0)
LanguagePronouns–>(x+2) = obj;
];

[ PronounNoticeHeldObjects x;
#IFNDEF MANUAL_PRONOUNS;
objectloop(x in player) PronounNotice(x);
#ENDIF;
x = 0; ! To prevent a “not used” error
rfalse;
];
-) instead of “Pronoun Handling” in “Parser.i6t”.

Section - Pronouns

[We see to it that “him” and “her” can be used of inanimate objects, too.]
Include (-
Array LanguagePronouns table
! word possible GNAs connected
! to follow: to:
! a i
! s p s p
! mfnmfnmfnmfn
’it’ $$001000001000 NULL
’her’ $$010000010000 NULL
’him’ $$100000100000 NULL
’them’ $$000111000111 NULL;

-) instead of “Pronouns” in “Language.i6t”.

Chapter - Changes in Standard Rules

Section - (in place of Section SR1/11 - People in Standard Rules by Graham Nelson)

The specification of person is “Despite the name, not necessarily a human being, but anything animate enough to envisage having a conversation with, or bartering with.”

[We don’t want male and female to be exclusive options, and we want all genders to be avialable for inanimate objects as well.
(For some reason Inform protests unless we put these changes inside a section replacement.)]
A thing can be female. A thing is usually not female.
A thing can be male. A thing is usually not male.
A thing can be neuter. A thing is usually neuter.
The male property translates into I6 as “male”.
[End of changes.]

A person has a number called carrying capacity.
The carrying capacity of a person is usually 100.

Include (-
has transparent animate
with before NULL,
-) when defining a person.

The yourself is an undescribed person. The yourself is proper-named.

The description of yourself is usually “As good-looking as ever.”

The yourself object translates into I6 as “selfobj”.
Include (-
with saved_short_name “yourself”,
-) when defining yourself.

Section - (in place of Section SR1/12 - Animals, men and women in Standard Rules by Graham Nelson)

The plural of man is men. The plural of woman is women.

A man is a kind of person.
The specification of man is “Represents a man or boy.”
A man is always male. A man is usually not neuter.

A woman is a kind of person.
The specification of woman is “Represents a woman or girl.”
A woman is always female. A woman is usually not neuter.

An animal is a kind of person.
The specification of animal is “Represents an animal, or at any rate a non-human living creature reasonably large and possible to interact with: a giant Venus fly-trap might qualify, but not a patch of lichen.”

Second Gender ends here.

---- Documentation ----

Things of all kinds (not only persons) can be neuter, female and/or male.

Any combinations of any two of these genders are possible, as are single-gendered and even (in a sense) non-gendered things.

Giving a thing two genders means that the player will be able to refer to that thing with two distinct pronouns (e.g. calling a ship both “it” and “her”, calling a dog both “it” and “him”, calling Hermaphroditus both “him” and “her”)

You can actually a single thing all three genders, but then the player will only be able to refer to that thing with the pronouns “her” and “him” (not with “it”).

N.B.! A thing without any gender property set at all will still be referable to as “it”.

All things except men and women are neuter by default. Persons, too, are neuter by default (as long as they are not declared men or women).

Men are always male; women are always female.

(A thing or person that is declared to be both male or female will be secretly neuter: it won’t react to the pronoun “it”, but it can still be tested for its neuter gender.)

You set genders the ordinary way:
Hermaphroditus is a person in the Woods of Caria. Hermaphroditus is male. Hermaphroditus is female.

The above lines makes Hermaphroditus both male and female (but neither man, woman, or animal).

Compare this with the line below:
Hermaphroditus is a female man in the Woods of Caria.

That line makes Hermaphroditus both male and female but also makes him a man rather than a woman.

Animals are neuter be default, so we dont have to say that explicitly:
Felix the Cat is a male animal.

The above line will make Felix the Cat both male and neuter.

The same goes for things:
The Black Pearl is a female vehicle in the Docks of Tortuga.

That makes the Black Pearl both female and neuter.

To make a thing or a person that has no gender, tell inform that is not neuter:
The omniscient narrator is a person. The omniscient narrator is not neuter.

As remarked above a genderless thing will still answer to the pronoun “it”, however.
[/code][/rant]

Damn, that is impressive. Not having tested it yet I’ll refrain from further comments, but I will say that I’ve begun my recent forays into I6 for this exact reason, although I never expected to actually succeed for years yet.

doffs hat

Thanks (well… obviously the credit for the impressive stuff goes to Fredrik Ramsberg).

I expect a couple of bugs concerning the output of pronouns in Library Messages:

  1. They will choose a neuter pronoun for inanimate things (i.e. non-people), whether or not these things are neuter at all.
  2. They will choose male pronouns for animate things (i.e. people) that are totally genderless (though genderless)
    Both of these should be easy to fix, however.

By the way:
I’ve be working (on and off) on a Swedish translation of Inform 7 since last summer; it should be beta soonish. (A pretty futile enterprise I fear, considering that apparently there has only been eight full games written in or ported to the Swedish edition of Inform 6 since its publication 2003. However, it has been fun. And perhaps – just possibly - Inform 7 may appear less intimidating than Inform 6 to would-be Swedish authors.)

That’s really cool. I should be available as a tester at the end of this semester and onwards, and wouldn’t be averse to writing a short game or two, even if it’s only for purposes of demonstrating the functionality.

(gah, apologies for the verbiage, I’m not at my best today)

:smiley: I’d really appreciate any kind of testing you are prepared to give it!! :smiley:

I’ve had some troubles over testing. There are not really many people to ask. And, anyway, I can’t really go round asking people to take the trouble to write full games just to test my extension. On the other hand, I suppose, an extension like this one can’t be properly tested in any other way. But then, also, writing games will necessarily introduce lots of bugs that is not directly due to the extension.
So, I was thinking about translating Sanddancer (or possibly some other working game, but the copyright license of Sanddancer makes it no-fuss), just to prove to myself that the translation works as intended and to avoid non-extension generated bugs.

It’s a good idea. I think, though, that we (see how quickly the pronouns change? :stuck_out_tongue:) should start with a first milestone, which in my proposal would be Cloak of Darkness.

The choice of Sand-Dancer specifically I’m not so sure about. It is an interesting and atmospheric game possessed of a strong narrative voice, which is good; it’s also the story of a disenfranchised young man faced with hard choices, and it’s told in his own words.

Translating those words into Swedish would risk cutting out the heart of the story, because all those little slang expressions, all the mangled grammar, and all the run-on-sentences wouldn’t carry over, yet they represent a strong element of the story. They show us a character who isn’t prim and neat and proper, who isn’t considered part of respectable society and has to deal with this fact.

I wouldn’t be averse to translating most games, but Sand-Dancer would suffer for it. I’d therefore suggest a different game, one that didn’t attempt to convey quite as much flavour through region-specific prose. As to which specific game that would be, I’m not sure. This is where my unfamiliarity with the vast majority of IF starts to show.

Well, yes, that’s certainly a valid point. Informal language is hard to translate well. It might be wise to choose something that doesn’t present that kind of extra challenges.

I think it’s so polite that you are both having this conversation in English. Good-luck with the project. =) - help us take over the world, or Sweden at least.

You’re Norwegian, aren’t you? squints suspiciously

:slight_smile:

:laughing:

It’s good to see the second gender feature coming to use outside Swedish Inform 6!

I’m very glad to see that someone is working on a Swedish Inform 7 translation. Please let me know if I can be of service somehow in this.

I also wanted to let you know that Eirik Krogstad has made a Norwegian Inform 6 translation, based on the Swedish one. It’s available here: github.com/tangram/Norwegian-Inform

Additionally, there may be a Danish translation coming up.

/Fredrik

I haven’t coded in inform 7 in months now, since the project I’m working on requires me to write a (little?) text synthesizer.
Eventually, it will incorporate various concepts coming from the field of linguistics : an enunciation layer, bits of componential semantics, probably greimas’ semiotic square as well, phonology, chomsky-esque universal grammar (I haven’t decided which “implementation” to choose yet, but since we’re only synthesizing text, that should be enough).
This is a pretty big project and the main reason I stopped developing it is because I feel like I don’t know enough about linguistics to code something well-structured.

This project is also aimed to be “linguistically universal” (looks aloof) and I really want to separate the Language layer from the language (tongue) layer (since I’m french and want my system to work for the english language (among other ones)).

Anyway, i’ll make a thread about it before going wild.

Now, i have a question for you, dear scandinavian fellows :
In my experience (latin, greek, french, english, german, portuguese and somehow japanese) the linguistic genders follow a complementary distribution : a name only has one gender : either male or female or sometimes neutral when the language provides a neutral gender.
Is it different for Scandinavian tongues ? Can names in these languages bear several linguistic genders at the same time ?
I’m not talking about “natural gender”. For example in German, “the young lady” translates as “das mädchen”. Its natural gender is of course female, but linguistically this name has a neutral gender. These belong to two separate analytical levels that shouldn’t be mixed up.

Grammatical gender is slightly confused in Swedish usage.

For some purposes there are four genders, for some purposes there are two (for some, perhaps, there are three).

There are four different third person singular personal pronouns (“han”, “hon”, "den, “det”), corresponding to each of the four genders (masculine, feminine, common and neuter). The common gender is really a mix of all the Old Norse masculine and feminine nouns that didn’t stand for male or female people or animals.

So for the purpose of choosing a personal pronoun, Swedish behaves as if it had four genders.

However, for the purpose of declination it behaves (mostly) as if it had only two: common and neuter.

Adjectives, past participles and articles all agree with their noun as to number and species (definite or indefinite) and gender. But adjectives etc. decline the same (mostly) whether the noun is masculine, feminine or common-gendered. It is as if these were all of one gender, and indeed the common gender is often considered to comprise all nouns that are not neuter (making the masculine and the feminine a kind of sub-genders under the common). Actually this is the unmarked form of the words (so I guess you might say adjectives etc. don’t decline at all when agreeing with common-gendered nouns); it’s the neuter forms that are the marked ones.

“En stor pojke”, “en stor flicka”, “en stor stad”, “ett stort troll”: the first three are masculine, feminine and common; the last is neuter. (Meaning “a big boy”, “a big girl”, “a big city”, “a big troll”.)

At least this is so mostly. Adjectives agreeing with a masculine singular definite noun may decline specially: you can say “den store pojken” (the big boy) instead of “den stora pojken” (the big boy), if you wish to. It is standard Swedish, but the usage is more common in some parts of the country than in others, and I suspect it’s becoming less common over-all. (“Stora” would be the only acceptable form if the adjective were to agree with a definite noun of any other gender than the masculine.) In that sense, then, a third gender (masculine) is added to common and neuter for the purpose of declining adjectives.

Besides there are a few noun like “apelsin” (orange), “paraply” (umbrella), “paket” (parcel) where speakers have so long been divided as to whether they have neuter or common gender that standard grammars recognize both varieties. Individual speakers always give them one of the genders, though, and stick to it. It would be very strange for any one person to use any of these words now as neuter, now as common-gendered.

That was interesting. I don’t doubt that what you say is true, but I don’t think I’ve heard (or even heard of) those variations. Anything but “en apelsin”, “ett paraply” or “ett paket” would sound strange (wrong) to me.

I checked the most recent edition of the Swedish Academy Glossary and one older dictionary to make sure.

I would seem that of the examples I gave one was spurious: “apelsin” is common gender in standard Swedish – the neuter form is Gothenburg dialect :unamused: –; “paket” was listed as neuter or common gender in an older dictionary, but the latest edition of the Swedish Academy Glossary has no mention of a common gender variant form; but in the case of “paraply” linguistic authorities at last seem to agree with my statement; and I might add the case of “finger” (finger), which the Swedish Academy Glossary lists as having neuter or common gender.

Interesting discussion. Just a few notes:

The original reason for writing the code to handle an object having two genders was the possibility of natural gender not being the same as linguistic gender.

I was confronted with “ett apelsin” when I moved to Västervik (which is not anywhere near Gothenburg), and I’m pretty sure I have seen SAOL (the Swedish reference dictionary to end all quarrels) state it can be either common gendered or neuter. But SAOL changes over the years too, so this may have changed.

I came to think of a really funny case in adjective infliction: “rädd” (scared) has no neuter form. So if you’re trying to say “A scared child” in Swedish, you just can’t - you need to choose some other word or phrasing.

That’s probably the use it can be put to in English. As for IF in languages with two (or more) grammatical genders, it might also be useful when the author wants to provide a synonym for an object and thereby ends up with two words with different genders for the same thing.

This reminds me of something I’ve encountered frequently in I7 - synonyms that have different number from the main noun. e.g.:

The crowd is a person. Understand "people" as the crowd.

Although it’s usually acceptable to allow either number to refer to the object, sometimes I wish it were possible to apply number (or gender) to a particular synonym only. It might help with disambiguation in some cases.

This is a flaw of Inform 6 - there are several properties and attributes of game objects which should really belong to synonyms for objects. However, beginners would perhaps find a system that separated synonyms from objects hard to comprehend.

This is excellent news (I echo Fredrik)! Count me in amongst possible testers. My main motivation for wanting a Swedish Inform is to write small IF games for my kids, really (otherwise, i’d be quite happy with the English one), which means that, on one hand, I won’t be likely to stress-test the really big bits :slight_smile: but on the other hand, whatever I come up with might be small enough to use as example code later on.

So, by all means, contact me if you need a tester.