Skip to content

Commit

Permalink
fix digit norm
Browse files Browse the repository at this point in the history
  • Loading branch information
bnika committed Jan 27, 2024
1 parent 9593372 commit 939c519
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ private NumberHelper() {}

//1.234 or 1 or 12 or 123
public static final String CARDINAL_THOUSAND_PTRN = "^([1-9]\\.?\\d{3}|[1-9]\\d{0,2})$";
//1.234 or 12.345 or 123.456
public static final String CARDINAL_MILLION_PTRN = "^[1-9]\\d{0,2}\\.\\d{3}$";
//1.234 or 12.345 or 123.456 or 123468
public static final String CARDINAL_MILLION_PTRN = "^[1-9]\\d{0,2}\\.?\\d{3}$";
public static final String CARDINAL_BIG_PTRN = "^[1-9]\\d{0,2}(\\.\\d{3}){2,3}$";

//1.123,4 or 1232,4 or 123,4 or 12,42345 or 1,489
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ public class TTSNormalizer {
CardinalThousandTuples.getTuples())
.flatMap(Collection::stream)
.collect(Collectors.toList());
private final List<CategoryTuple> ThousandsMillionsTupleList = Stream.of(CardinalThousandTuples.getTuples(), CardinalMillionTuples.getTuples())
.flatMap(Collection::stream)
.collect(Collectors.toList());

private final List<CategoryTuple> OnesThousandsCardinalTupleList = Stream.of(CardinalOnesTuples.getTuples(), CardinalThousandTuples.getTuples())
.flatMap(Collection::stream)
.collect(Collectors.toList());
private final List<CategoryTuple> ThousandsMillionsTupleList = Stream.of(OnesThousandsCardinalTupleList, CardinalMillionTuples.getTuples())
.flatMap(Collection::stream)
.collect(Collectors.toList());
private final List<CategoryTuple> DecimalThousandsTupleList = Stream.of(OnesThousandsCardinalTupleList, DecimalThousandTuples.getTuples())
.flatMap(Collection::stream)
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ private Map<String, String> getDigits() {
Map<String, String> digits = new HashMap<>();
// POS-tagger tags 'mínúta' as accusative, hence the wrong case for 32.
// should be 'þrítugasta og önnur' (accusative is 'mínútu')
digits.put("7", "sjö .");
digits.put("77", "sjötíu og sjö .");
digits.put("777", "sjö hundruð sjötíu og sjö .");
digits.put("7777", "sjö þúsund sjö hundruð sjötíu og sjö .");
digits.put("77777", "sjötíu og sjö þúsund sjö hundruð sjötíu og sjö .");
digits.put("119273", "hundrað og nítján þúsund tvö hundruð sjötíu og þrjú .");
digits.put("77.777", "sjötíu og sjö þúsund sjö hundruð sjötíu og sjö .");
digits.put("119.273", "hundrað og nítján þúsund tvö hundruð sjötíu og þrjú .");
digits.put("(32. mín)", "<sil> þrítugustu og aðra mínúta <sil> .");
digits.put("(37. mín)", "<sil> þrítugustu og sjöundu mínúta <sil> .");
digits.put("(24. mín)", "<sil> tuttugustu og fjórðu mínúta <sil> .");
Expand Down

0 comments on commit 939c519

Please sign in to comment.