gender or pronoun tag

merge-requests/21/head
Bob Mottram 2021-03-03 14:30:50 +00:00
parent ce75a26a3c
commit dd3d4d27fc
16 changed files with 41 additions and 19 deletions

View File

@ -386,5 +386,6 @@
"He/Him": "هو", "He/Him": "هو",
"She/Her": "هي", "She/Her": "هي",
"girl": "فتاة", "girl": "فتاة",
"boy": "صبي" "boy": "صبي",
"pronoun": "ضمير"
} }

View File

@ -386,5 +386,6 @@
"He/Him": "Ell", "He/Him": "Ell",
"She/Her": "Ella", "She/Her": "Ella",
"girl": "noia", "girl": "noia",
"boy": "noi" "boy": "noi",
"pronoun": "pronom"
} }

View File

@ -386,5 +386,6 @@
"He/Him": "Ef", "He/Him": "Ef",
"She/Her": "Hi/Ei", "She/Her": "Hi/Ei",
"girl": "merch", "girl": "merch",
"boy": "bachgen" "boy": "bachgen",
"pronoun": "rhagenw"
} }

View File

@ -386,5 +386,6 @@
"He/Him": "Er/ihm", "He/Him": "Er/ihm",
"She/Her": "Sie", "She/Her": "Sie",
"girl": "mädchen", "girl": "mädchen",
"boy": "junge" "boy": "junge",
"pronoun": "pronomen"
} }

View File

@ -386,5 +386,6 @@
"He/Him": "He/Him", "He/Him": "He/Him",
"She/Her": "She/Her", "She/Her": "She/Her",
"girl": "girl", "girl": "girl",
"boy": "boy" "boy": "boy",
"pronoun": "pronoun"
} }

View File

@ -386,5 +386,6 @@
"He/Him": "El", "He/Him": "El",
"She/Her": "Ella", "She/Her": "Ella",
"girl": "muchacha", "girl": "muchacha",
"boy": "niño" "boy": "niño",
"pronoun": "pronombre"
} }

View File

@ -386,5 +386,6 @@
"He/Him": "Il/Lui", "He/Him": "Il/Lui",
"She/Her": "Elle", "She/Her": "Elle",
"girl": "fille", "girl": "fille",
"boy": "garçon" "boy": "garçon",
"pronoun": "pronom"
} }

View File

@ -386,5 +386,6 @@
"He/Him": "Sé/Eisean", "He/Him": "Sé/Eisean",
"She/Her": "Sí", "She/Her": "Sí",
"girl": "cailín", "girl": "cailín",
"boy": "buachaill" "boy": "buachaill",
"pronoun": "forainm"
} }

View File

@ -386,5 +386,6 @@
"He/Him": "वह/उसे", "He/Him": "वह/उसे",
"She/Her": "वह/उसकी", "She/Her": "वह/उसकी",
"girl": "लड़की", "girl": "लड़की",
"boy": "लड़का" "boy": "लड़का",
"pronoun": "सवर्नाम"
} }

View File

@ -386,5 +386,6 @@
"He/Him": "Lui", "He/Him": "Lui",
"She/Her": "Lei", "She/Her": "Lei",
"girl": "ragazza", "girl": "ragazza",
"boy": "ragazzo" "boy": "ragazzo",
"pronoun": "pronome"
} }

View File

@ -386,5 +386,6 @@
"He/Him": "彼", "He/Him": "彼",
"She/Her": "彼女", "She/Her": "彼女",
"girl": "女の子", "girl": "女の子",
"boy": "男の子" "boy": "男の子",
"pronoun": "代名詞"
} }

View File

@ -382,5 +382,6 @@
"He/Him": "He/Him", "He/Him": "He/Him",
"She/Her": "She/Her", "She/Her": "She/Her",
"girl": "girl", "girl": "girl",
"boy": "boy" "boy": "boy",
"pronoun": "pronoun"
} }

View File

@ -386,5 +386,6 @@
"He/Him": "Ele", "He/Him": "Ele",
"She/Her": "Ela", "She/Her": "Ela",
"girl": "garota", "girl": "garota",
"boy": "garoto" "boy": "garoto",
"pronoun": "pronome"
} }

View File

@ -386,5 +386,6 @@
"He/Him": "Он/Его", "He/Him": "Он/Его",
"She/Her": "Она/Ее", "She/Her": "Она/Ее",
"girl": "девочка", "girl": "девочка",
"boy": "мальчик" "boy": "мальчик",
"pronoun": "местоимение"
} }

View File

@ -386,5 +386,6 @@
"He/Him": "他", "He/Him": "他",
"She/Her": "她", "She/Her": "她",
"girl": "女孩", "girl": "女孩",
"boy": "男生" "boy": "男生",
"pronoun": "代词"
} }

View File

@ -678,6 +678,7 @@ def getGenderFromBio(baseDir: str, actor: str, personCache: {},
if not personCache.get(actor): if not personCache.get(actor):
return None return None
bioFound = None bioFound = None
pronounStr = translate['pronoun'].lower()
if personCache[actor].get('actor'): if personCache[actor].get('actor'):
# is gender defined as a profile tag? # is gender defined as a profile tag?
if personCache[actor]['actor'].get('attachment'): if personCache[actor]['actor'].get('attachment'):
@ -692,6 +693,9 @@ def getGenderFromBio(baseDir: str, actor: str, personCache: {},
translate['gender'].lower(): translate['gender'].lower():
bioFound = tag['value'] bioFound = tag['value']
break break
elif tag['name'].lower().startswith(pronounStr):
bioFound = tag['value']
break
# if not then use the bio # if not then use the bio
if not bioFound and personCache[actor]['actor'].get('summary'): if not bioFound and personCache[actor]['actor'].get('summary'):
bioFound = personCache[actor]['actor']['summary'] bioFound = personCache[actor]['actor']['summary']
@ -715,6 +719,9 @@ def getGenderFromBio(baseDir: str, actor: str, personCache: {},
translate['gender'].lower(): translate['gender'].lower():
bioFound = tag['value'] bioFound = tag['value']
break break
elif tag['name'].lower().startswith(pronounStr):
bioFound = tag['value']
break
# if not then use the bio # if not then use the bio
if not bioFound and actorJson.get('summary'): if not bioFound and actorJson.get('summary'):
bioFound = actorJson['summary'] bioFound = actorJson['summary']
@ -723,11 +730,11 @@ def getGenderFromBio(baseDir: str, actor: str, personCache: {},
gender = 'They/Them' gender = 'They/Them'
bioFoundOrig = bioFound bioFoundOrig = bioFound
bioFound = bioFound.lower() bioFound = bioFound.lower()
if translate['He/Him'] in bioFound or \ if translate['He/Him'].lower() in bioFound or \
translate['boy'] in bioFound: translate['boy'].lower() in bioFound:
gender = 'He/Him' gender = 'He/Him'
elif (translate['She/Her'] in bioFound or elif (translate['She/Her'].lower() in bioFound or
translate['girl'] in bioFound): translate['girl'].lower() in bioFound):
gender = 'She/Her' gender = 'She/Her'
elif 'him' in bioFound or 'male' in bioFound: elif 'him' in bioFound or 'male' in bioFound:
gender = 'He/Him' gender = 'He/Him'