How to configure Answers for languages with grammatical gender

This is an issue that is particular to German but could be relevant in any language that has distinct male and female forms of words that describe a person’s profession or other kind of specification.

In German, speakers generally use the generic masculine. That means you would use the male form if you don’t know the gender of the person you’re referring to. However, if you know the gender is female, you would generally use the female form.

Example:
Lehrer = teacher
er ist Lehrer = he’s a teacher
sie ist Lehrerin = she’s a teacher

In search, it’s reasonable to assume that a searcher using the female form of a word would expect results that are in fact female. It’s easy to configure a Knowledge Graph and a related Answers Experience to support that expected search experience.

In my example, I’ve created a Knowledge Graph with Lehrer entities (teachers). I have included a field I’ve called Geschlecht (= Gender) that lets me specify an entity’s gender.

In the Answers config, I’ve made sure that the field Geschlecht is set to NLP Filter. I’ve also added a synonym set for Lehrerin and weiblich (= female teacher and female).

"lehrer": {
      "entityTypes": [
       "ce_lehrer"
      ],
      "name": "Lehrer",
      "searchableFields": {
        ...
        "c_geschlecht": {
          "nlpFilter": true
        }
      },
...
"synonyms": {
    "oneWay": [],
    "synonymSet": [
      [
        "weiblich", "lehrerin"
      ]
    ]
  },

Let’s take a quick look at the search results:

A search for “Lehrerin in Berlin” shows only the relevant female teachers. You can see the NLP filter correctly applied in the Experience Preview.

A search for “Lehrer in Berlin” shows all relevant teachers. This is expected as Lehrer could mean male teacher but more likely is simply the generic masculine.

If you need to replicate this behavior for your experience, simply apply the steps above and make sure to include the correct term according to your entity type (e.g. Beraterin, Ärztin, Anwältin etc.) in your synonym set.

3 Likes

What a great resource! Thanks for putting this together, Max!

1 Like