Skip to content

Commit 80d25fc

Browse files
authored
[fix] fix tn, week range (#238)
* [fix] fix tn, week range * [fix] fix tn, week range
1 parent 0f386d8 commit 80d25fc

4 files changed

Lines changed: 27 additions & 2 deletions

File tree

tn/english/data/date/week.tsv

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Mon Monday
2+
Mon. Monday
3+
Tu Tuesday
4+
Tu. Tuesday
5+
Wed Wednesday
6+
Wed. Wednesday
7+
Th Thursday
8+
Th. Thursday
9+
Thur Thursday
10+
Thur. Thursday
11+
Thurs Thursday
12+
Thurs. Thursday
13+
Fri Friday
14+
Fri. Friday
15+
Sat Saturday
16+
Sat. Saturday
17+
Sun Sunday
18+
Sun. Sunday

tn/english/data/whitelist/alternatives.tsv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ NO. number
2323
NO. number
2424
No. number
2525
VOL. Volume
26+
Vol. Volume
2627
TV Television

tn/english/rules/range.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from pynini.lib import pynutil
1818

1919
from tn.processor import Processor
20+
from tn.utils import get_abs_path
2021
from tn.english.rules.cardinal import Cardinal
2122
from tn.english.rules.time import Time
2223
from tn.english.rules.date import Date
@@ -45,14 +46,19 @@ def build_tagger(self):
4546
time = time.tagger @ time.verbalizer
4647
date = Date(deterministic=self.deterministic)
4748
date = date.tagger @ date.verbalizer
49+
week = pynini.string_file(get_abs_path("english/data/date/week.tsv"))
4850
delete_space = pynini.closure(pynutil.delete(" "), 0, 1)
4951

5052
approx = pynini.cross("~", "approximately")
5153

54+
# WEEK
55+
week_graph = week + delete_space + (pynini.cross("-", " to ")
56+
| approx) + delete_space + week
57+
5258
# TIME
5359
time_graph = time + delete_space + pynini.cross(
5460
"-", " to ") + delete_space + time
55-
self.graph = time_graph | (approx + time)
61+
self.graph = time_graph | (approx + time) | week_graph
5662

5763
# YEAR
5864
date_year_four_digit = (self.DIGIT**4 +
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
this is 12th game, number 256, 2024-05-06, 2021-03-07 31.990 billion. ¾ people like chattts, let's eat at 03:43 p.m. run 10 km, give me $12.345 please, call 123-123-5678-1 Mt Hill "HAHAHA" billion 4 March => this is twelfth game, number two hundred and fifty six, the sixth of may twenty twenty four, the seventh of march twenty twenty one thirty one point nine nine oh billion. three quarters people like chattts, let' s eat at three forty three PM run ten kilometers, give me twelve point three four five dollars please, call one two three, one two three, five six seven eight, one Mt Hill" HAHAHA" billion the fourth of march
22
The National Map, accessed April 1, 2011" Site Description of Koppers Co. From the quartet's recording" Jefferson Friedman: Quartets,"" String Quartet no, Riots again broke out, Atassi resigned, and Syrian independence was deferred until after World War II. 1988 (1988) ( 1988) ( 1988). Starling, Arthur E.( 1988 ). this is 12th game, number 256, 2024-05-06, 2021-03-07 31.990 billion. 3/4 people like chattts Retrieved December 2011. Information on Album" Thepodule.com"" Biography by Amy Hanson". => The National Map, accessed the first of april , twenty eleven" Site Description of Koppers company From the quartet' s recording" Jefferson Friedman: Quartets,"" String Quartet no, Riots again broke out, Atassi resigned, and Syrian independence was deferred until after World War two nineteen eighty eight( nineteen eighty eight )( nineteen eighty eight )( nineteen eighty eight). Starling, Arthur E.( nineteen eighty eight). this is twelfth game, number two fifty six, the sixth of may twenty twenty four, the seventh of march twenty twenty one thirty one point nine nine oh billion. three quarters people like chattts Retrieved december twenty eleven. Information on Album" Thepodule dot com"" Biography by Amy Hanson".
33
.345" and ".456" "9.456" or 6.7890" => point three four five" and". four hundred and fifty six" " nine point four five six" or six point seven eight nine oh"
4-
The museum is open Mon.-Sun. children of 3-4 years 123 The plan will help you lose 3-4 pounds the first week, and 1-2 pounds the weeks thereafter. => The museum is open Monday.- Sunday. children of three to four years one hundred and twenty three The plan will help you lose three to four pounds the first week, and one to two pounds the weeks thereafter.
4+
The museum is open Mon.-Sun. children of 3-4 years 123 The plan will help you lose 3-4 pounds the first week, and 1-2 pounds the weeks thereafter. => The museum is open Monday to Sunday children of three to four years one hundred and twenty three The plan will help you lose three to four pounds the first week, and one to two pounds the weeks thereafter.

0 commit comments

Comments
 (0)