Skip to content

Commit

Permalink
Fix french numbers for some cases (21,31,...200,300,...) (#41)
Browse files Browse the repository at this point in the history
* Fix french numbers for some cases (21,31,...200,300,...)

A second attempt to fix French numbers. All tests are passing
locally.

21,31... have been changed to vingt-et-un etc. and tests modified.
200,300,... haven been changed to deux cents. etc. and tests modified.

A special case regarding pluralization of "cents" has also been taken
into account:

https://www.projet-voltaire.fr/regles-orthographe/cent-ou-cents/
  • Loading branch information
thomaszangerl authored Sep 30, 2021
1 parent cd8ac1c commit f946d1e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,15 @@ public Map<Integer, GenderForms> baseNumbers() {
.put(18, "dix-huit")
.put(19, "dix-neuf")
.put(20, "vingt")
.put(21, "vingt-et-un")
.put(30, "trente")
.put(31, "trente-et-un")
.put(40, "quarante")
.put(41, "quarante-et-un")
.put(50, "cinquante")
.put(51, "cinquante-et-un")
.put(60, "soixante")
.put(61, "soixante-et-un")
.put(70, "soixante-dix")
.put(71, "soixante-et-onze")
.put(72, "soixante-douze")
Expand Down Expand Up @@ -107,7 +112,16 @@ public char twoDigitsNumberSeparator() {
}

public Map<Integer, String> exceptions() {
return ImmutableMap.<Integer, String>builder().put(1000, "mille").build();
return ImmutableMap.<Integer, String>builder()
.put(200, "deux cents")
.put(300, "trois cents")
.put(400, "quatre cents")
.put(500, "cinq cents")
.put(600, "six cents")
.put(700, "sept cents")
.put(800, "huit cents")
.put(900, "neuf cents")
.put(1000, "mille").build();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,30 @@ class FrenchValuesTest extends Specification {
80 | "quatre-vingts"
90 | "quatre-vingt-dix"

21 | "vingt-un"
21 | "vingt-et-un"
22 | "vingt-deux"
31 | "trente-et-un"
32 | "trente-deux"
37 | "trente-sept"
41 | "quarante-et-un"
43 | "quarante-trois"
51 | "cinquante-et-un"
58 | "cinquante-huit"
61 | "soixante-et-un"
69 | "soixante-neuf"
76 | "soixante-seize"
82 | "quatre-vingt-deux"
95 | "quatre-vingt-quinze"

100 | "cent"
200 | "deux cent"
300 | "trois cent"
400 | "quatre cent"
500 | "cinq cent"
600 | "six cent"
700 | "sept cent"
800 | "huit cent"
900 | "neuf cent"
200 | "deux cents"
300 | "trois cents"
400 | "quatre cents"
500 | "cinq cents"
600 | "six cents"
700 | "sept cents"
800 | "huit cents"
900 | "neuf cents"

111 | "cent onze"
272 | "deux cent soixante-douze"
Expand All @@ -84,11 +90,11 @@ class FrenchValuesTest extends Specification {
7_634 | "sept mille six cent trente-quatre"
11_000 | "onze mille"
15_000 | "quinze mille"
21_000 | "vingt-un mille"
21_000 | "vingt-et-un mille"
24_190 | "vingt-quatre mille cent quatre-vingt-dix"
653_000 | "six cent cinquante-trois mille"
123_454 | "cent vingt-trois mille quatre cent cinquante-quatre"
700_000 | "sept cent mille"
700_000 | "sept cents mille"
999_999 | "neuf cent quatre-vingt-dix-neuf mille neuf cent quatre-vingt-dix-neuf"

1_000_000 | "un million"
Expand Down

0 comments on commit f946d1e

Please sign in to comment.