Skip to content

Commit

Permalink
Fixed several errors in multiple languages. nl it en de close to comp…
Browse files Browse the repository at this point in the history
…letion, still issues with German gendering. altes as neutral may work for maedchen but not for jugendlicher etc
  • Loading branch information
leokim-l committed Aug 27, 2024
1 parent a6d8f98 commit a83be7b
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public String fromIso(Iso8601Age ppktAge) {
components.add(String.format("%d %s", y, years(y)));
}
if (m > 0) {
components.add(String.format("%d %s", m, months(y)));
components.add(String.format("%d %s", m, months(m)));
}
if (d > 0) {
components.add(String.format("%d %s", d, days(y)));
components.add(String.format("%d %s", d, days(d)));
}
return String.join(" ", components);
}
Expand Down Expand Up @@ -80,7 +80,7 @@ public String yearsMonthsDaysOld(int y, int m, int d) {
} else if (d==0) {
return String.format("%d jaar en %d maand oud", y, m);
} else if (d==1){
return String.format("%d maand en %d dag oud", y, d);
return String.format("%d jaar, %d maand en %d dag oud", y, m, d);
} else
return String.format("%d jaar, %d maand en %d dagen oud", y, m, d);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public String fromIso(Iso8601Age ppktAge) {
components.add(String.format("%d %s", y, years(y)));
}
if (m > 0) {
components.add(String.format("%d %s", m, months(y)));
components.add(String.format("%d %s", m, months(m)));
}
if (d > 0) {
components.add(String.format("%d %s", d, days(y)));
components.add(String.format("%d %s", d, days(d)));
}
return String.join(" ", components);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,17 @@ public String child() {

@Override
public String adolescentGirl() {
return "";
return "Jugendliche";
}

@Override
public String adolescentBoy() {
return "";
return "Jugendlicher";
}

@Override
public String adolescentChild() {
return "";
return "Jugendlicher";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,14 @@ private String imAlterVonIsoAgeExact(PhenopacketAge ppktAge) {
return String.format("Im Alter von %d %s", y, y>1?"Jahren" : "Jahr");
}
}
if (m>0) {
return String.format("Im Alter von %d %s y %d %s", m, m>1?"Monaten" : "Monat",
if (m>0 && d>0) {
return String.format("Im Alter von %d %s und %d %s", m, m>1?"Monaten" : "Monat",
d, d>1?"Tagen" : "Tag");
} else {
return String.format("%d Tage", d);
} else if (m>0 && d==0) {
return String.format("Im Alter von %d %s", m, m>1?"Monaten" : "Monat");
}
else {
return String.format("Im Alter von %d %s", d, d>1?"Tagen" : "Tag");
}
}

Expand All @@ -227,24 +230,24 @@ private String iso8601individualDescription(PhenopacketSex psex, Iso8601Age iso8
};
} else if (y > 9) {
return switch (psex) {
case FEMALE -> String.format("%s %s %s", bbGenerator.probandWasA(),
case FEMALE -> String.format("%s eine %s %s", bbGenerator.probandWasA(),
dAlter(iso8601Age, GrammatikalischesGeschlecht.WEIBLICH),
bbGenerator.adolescentGirl());
case MALE -> String.format("%s %s %s", bbGenerator.probandWasA(),
case MALE -> String.format("%s ein %s %s", bbGenerator.probandWasA(),
dAlter(iso8601Age, GrammatikalischesGeschlecht.MAENNLICH),
bbGenerator.adolescentBoy());
default -> String.format("%s %s %s", bbGenerator.probandWasA(),
default -> String.format("%s ein %s %s", bbGenerator.probandWasA(),
dAlter(iso8601Age, GrammatikalischesGeschlecht.NEUTRUM), bbGenerator.adolescentChild());
};
} else if (y > 0) {
return switch (psex) {
case FEMALE -> String.format("%s %s %s", bbGenerator.probandWasA(),
case FEMALE -> String.format("%s ein %s %s", bbGenerator.probandWasA(),
dAlter(iso8601Age, GrammatikalischesGeschlecht.NEUTRUM), // "das Mädchen"
bbGenerator.girl());
case MALE -> String.format("%s ein %s %s", bbGenerator.probandWasA(),
dAlter(iso8601Age, GrammatikalischesGeschlecht.MAENNLICH),
bbGenerator.boy());
default -> String.format("%s %s %s", bbGenerator.probandWasA(),
default -> String.format("%s ein %s %s", bbGenerator.probandWasA(),
dAlter(iso8601Age, GrammatikalischesGeschlecht.NEUTRUM), // Das Individuum
bbGenerator.child());
};
Expand Down Expand Up @@ -300,7 +303,7 @@ private String dAlter(Iso8601Age iso8601Age, GrammatikalischesGeschlecht geschle
return switch (geschlecht) {
case MAENNLICH -> String.format("%s alter", ymd);
case WEIBLICH -> String.format("%s alte", ymd);
case NEUTRUM -> String.format("%s alte", ymd);
case NEUTRUM -> String.format("%s altes", ymd);
//TODO: check this is OK. "alte" in the examples I have seen always refers to "die Person", which is feminine, e.g. "46 Jahre alte erwachsene Person", not "altes"
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public String getVignetteAtAge(PhenopacketAge page, PhenopacketSex psex, List<On
@Override
public String getVignetteAtOnset(PpktIndividual individual){
String person = switch (individual.getSex()) {
case MALE -> "Lui";
case FEMALE -> "Lei";
case MALE -> "Il paziente";
case FEMALE -> "La paziente";
default -> "La persona";
};
return this.ppktPhenotypicFeatureGenerator.featuresAtOnset(person, individual.getPhenotypicFeaturesAtOnset());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,15 @@ private String atIsoAgeExact(PhenopacketAge ppktAge) {
} else {
return String.format("%d anni", y);
}
} else if (m>0) {
} else if (m>0 && d>0) {
return String.format("%d mesi e %d giorni", m, d);
} else {
return String.format("%d giorni", d);
if (m>0 && d==0) {
return String.format("%d mesi", m);
}
else {
return String.format("%d giorni", d);
}
}
}

Expand Down Expand Up @@ -272,8 +277,8 @@ private String hpoOnsetIndividualDescription(PhenopacketSex psex, HpoOnsetAge hp
@Override
public String heSheIndividual(PhenopacketSex psex) {
return switch (psex) {
case FEMALE -> "lei";
case MALE -> "lui";
case FEMALE -> "la paziente";
case MALE -> "il paziente";
default -> "il soggetto";
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ void testEvaluateExpression(TestIndividual testCase) {
private static Stream<TestIdvlHeShe> testGetPPKtSex() {
return Stream.of(
new TestIdvlHeShe("female",
PhenopacketSex.FEMALE, new TestOutcome.Ok("lei")),
PhenopacketSex.FEMALE, new TestOutcome.Ok("la paziente")),
new TestIdvlHeShe("male",
PhenopacketSex.MALE, new TestOutcome.Ok("lui")),
PhenopacketSex.MALE, new TestOutcome.Ok("il paziente")),
new TestIdvlHeShe("proband",
PhenopacketSex.UNKNOWN, new TestOutcome.Ok("il soggetto"))
);
Expand Down

0 comments on commit a83be7b

Please sign in to comment.