Fairslator

FREEMIUM
By Michal Měchura | Updated 2ヶ月前 | Translation
Popularity

0 / 10

Latency

1,368ms

Service Level

100%

Health Check

N/A

Back to All Tutorials (3)

How to rewrite forms of address with the Fairslator API

This tutorial assumes you have read and understood the previous tutorial about gender rewriting. We will now move on from gender to forms of address.

What is a form of address?

Some texts address the reader by appealing to him or her with pronouns such as you or with imperative verbs (e.g. please open the window). Some languages (of which English is not one!) have more than one way of doing this, depending on whether the text is addressing one person or a group of persons, and depending on whether the addressing is being done formally or informally. This combination of number (singular versus plural) and register (formal versus informal) constitutes what in Fairslator we call the text’s form of address.

In this tutorial we will use examples from German. In German, three forms of address are possible:

  • an informal singular form of address (using the pronoun du) when talking to one person informally
  • an informal plural form of address (using the pronoun ihr) when talking to a group of people informally
  • a formal form of address (using the pronoun Sie) when talking to one or more people formally

And now, let’s do some rewriting!

If you want to rewrite a German text from one of these into another, you can send a JSON object like this to the /rewrite endpoint:

{
  "sourceText": "Have you remembered it?",
  "sourceLang": "en",
  "text": "Hast du es dir gemerkt?",
  "lang": "de",
  "secondPerson": "pt"
}

Output:

"Habt ihr es euch gemerkt?"

The string you put in secondPerson can be any combination of the following:

  • s for singular number or p for plural number
  • t for informal register or v for formal register

So, what have we just done? We have rewritten the text from the singular informal form of address (st, aka du) into the plural informal form of address (pt, aka ihr).

The other option is v, the formal form of address (aka Sie). Notice that this code contains no indication of number (no s or p) because, in German, the formal form of address is the same for both numbers.

{
  "sourceText": "Have you remembered it?",
  "sourceLang": "en",
  "text": "Hast du es dir gemerkt?",
  "lang": "de",
  "secondPerson": "v"
}

Output:

"Haben Sie es sich gemerkt?"

Summary

Let’s look at all this again. German has three possible forms of address and the codes for them are:

  • st for du
  • pt for ihr
  • v for Sie

Other languages have slightly different repertoires of forms of address (for example French has two) so they will have slightly different codes in the Fairslator API, but they will always be combinations of the letters s, p, t, v.

By the way, in case you’re wondering why the letters t and v aren’t mnemonic like the others, it’s because they come from something called the T/V distinction. That’s what linguists call the register thing and it comes from Latin pronouns tu and vos.

Forms of address combined with gender

Now it all comes together! Sometimes you’ll get sentences which you want to rewrite for both gender and form of address. In such cases you can combine the gender codes and the form-of-address codes into a single string.

{
  "text": "Sind Sie mein Anwalt?",
  "lang": "de",
  "secondPerson": "stf"
}

Output:

"Bist du meine Anwältin?"

The st tells Fairslator to change the du into a Sie, and the f tells it to change the Anwalt into an Anwältin, all in one go.

Time for a secret

This is a good opportunity to let you in on a secret. In the codes you put in as firstPerson, secondPerson and thirdPersons, the order of the letters doesn’t matter! So, stf could just as well be tsf or fst and the effect would be the same. The codes are always a combination, in any order, of these characters:

  • m or f for gender
  • s or p for number
  • t or v for register

These six letters are all you need to express any combination of gender and form of address in (almost) every (European) language, and it’s what Fairslator uses.

In conclusion…

Congratulations, you now know pretty much everything you need about form-of-address rewriting with the Fairslator API. Now’s a good time to look at other tutorials or to start using the API.