indic-itn 0.2.2__tar.gz → 0.2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. {indic_itn-0.2.2/src/indic_itn.egg-info → indic_itn-0.2.4}/PKG-INFO +1 -1
  2. {indic_itn-0.2.2 → indic_itn-0.2.4}/pyproject.toml +1 -1
  3. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/__init__.py +1 -1
  4. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/detector.py +42 -8
  5. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/parsers/date.py +7 -2
  6. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/parsers/number.py +5 -1
  7. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/parsers/otp.py +1 -1
  8. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/parsers/phone.py +46 -15
  9. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/resources/hi/keywords.json +1 -1
  10. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/resources/hi/numbers.json +17 -0
  11. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/resources/hi/ordinals.json +20 -1
  12. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/resources/hi/temporal.json +2 -1
  13. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/resources/kn/keywords.json +1 -1
  14. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/resources/kn/numbers.json +21 -0
  15. indic_itn-0.2.4/src/indic_itn/resources/kn/ordinals.json +35 -0
  16. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/resources/kn/temporal.json +2 -1
  17. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/resources/ta/keywords.json +1 -1
  18. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/resources/ta/numbers.json +64 -2
  19. indic_itn-0.2.4/src/indic_itn/resources/ta/ordinals.json +68 -0
  20. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/resources/ta/temporal.json +2 -1
  21. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/resources/te/keywords.json +1 -1
  22. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/resources/te/numbers.json +24 -0
  23. indic_itn-0.2.4/src/indic_itn/resources/te/ordinals.json +63 -0
  24. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/resources/te/temporal.json +2 -1
  25. {indic_itn-0.2.2 → indic_itn-0.2.4/src/indic_itn.egg-info}/PKG-INFO +1 -1
  26. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_hindi_itn.py +28 -0
  27. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_kannada_itn.py +28 -0
  28. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_tamil_itn.py +27 -0
  29. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_telugu_itn.py +28 -0
  30. indic_itn-0.2.2/src/indic_itn/resources/kn/ordinals.json +0 -16
  31. indic_itn-0.2.2/src/indic_itn/resources/ta/ordinals.json +0 -7
  32. indic_itn-0.2.2/src/indic_itn/resources/te/ordinals.json +0 -25
  33. {indic_itn-0.2.2 → indic_itn-0.2.4}/LICENSE +0 -0
  34. {indic_itn-0.2.2 → indic_itn-0.2.4}/README.md +0 -0
  35. {indic_itn-0.2.2 → indic_itn-0.2.4}/setup.cfg +0 -0
  36. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/base.py +0 -0
  37. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/loader.py +0 -0
  38. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/main.py +0 -0
  39. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/parsers/__init__.py +0 -0
  40. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/parsers/base.py +0 -0
  41. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/parsers/currency.py +0 -0
  42. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/parsers/decimal.py +0 -0
  43. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/parsers/percentage.py +0 -0
  44. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/parsers/time.py +0 -0
  45. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/rewriter.py +0 -0
  46. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn/tokenizer.py +0 -0
  47. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn.egg-info/SOURCES.txt +0 -0
  48. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn.egg-info/dependency_links.txt +0 -0
  49. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn.egg-info/requires.txt +0 -0
  50. {indic_itn-0.2.2 → indic_itn-0.2.4}/src/indic_itn.egg-info/top_level.txt +0 -0
  51. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_architecture.py +0 -0
  52. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_code_mixing.py +0 -0
  53. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_currency_parser.py +0 -0
  54. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_date_parser.py +0 -0
  55. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_decimal_parser.py +0 -0
  56. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_detector.py +0 -0
  57. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_hindi_parsers.py +0 -0
  58. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_itn.py +0 -0
  59. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_native_digits.py +0 -0
  60. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_number_parser.py +0 -0
  61. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_otp_parser.py +0 -0
  62. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_percentage_parser.py +0 -0
  63. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_phone_parser.py +0 -0
  64. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_resources.py +0 -0
  65. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_rewriter.py +0 -0
  66. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_telugu_detector.py +0 -0
  67. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_telugu_parsers.py +0 -0
  68. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_time_parser.py +0 -0
  69. {indic_itn-0.2.2 → indic_itn-0.2.4}/tests/test_tokenizer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: indic-itn
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Inverse Text Normalization (ITN) for Indic languages
5
5
  License: MIT
6
6
  Classifier: Development Status :: 3 - Alpha
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "indic-itn"
7
- version = "0.2.2"
7
+ version = "0.2.4"
8
8
  description = "Inverse Text Normalization (ITN) for Indic languages"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -31,7 +31,7 @@ from indic_itn.tokenizer import (
31
31
  TeluguTokenizer,
32
32
  )
33
33
 
34
- __version__ = "0.2.2"
34
+ __version__ = "0.2.4"
35
35
  __all__ = [
36
36
  "BaseEntityDetector",
37
37
  "BaseParser",
@@ -40,8 +40,11 @@ class IndicEntityDetector(BaseEntityDetector):
40
40
  | set(numbers_res.get("crore", {}).keys())
41
41
  )
42
42
 
43
+ self._ordinals = set(ordinals_res.get("ordinals", {}).keys())
43
44
  self._months = set(temporal_res.get("months", {}).keys())
45
+ self._months_lower = {k.lower(): k for k in self._months}
44
46
  self._weekdays = set(temporal_res.get("weekdays", {}).keys())
47
+ self._date_words = set(w.lower() for w in temporal_res.get("date_words", []))
45
48
 
46
49
  # Load keyword sets from keywords.json (data-driven, 0 hardcoded if/else logic)
47
50
  curr_kw = keywords_res.get("currency", {})
@@ -100,15 +103,28 @@ class IndicEntityDetector(BaseEntityDetector):
100
103
  """Check if a token represents a digit or a number word."""
101
104
  text = token.text
102
105
  text_lower = text.lower()
103
- clean_ord = re.sub(r"(st|nd|rd|th)$", "", text_lower)
106
+ clean_ord = re.sub(
107
+ r"(st|nd|rd|th|ஆம்|ஆவது|வது|వ|వవ|నే|ನೇಯ|वां|वा|वीं|वी|वें)$",
108
+ "",
109
+ text_lower,
110
+ )
104
111
  return (
105
112
  text.isdigit()
106
113
  or text in self._numbers
107
114
  or text_lower in self._numbers
108
115
  or text in self._digits
109
116
  or text_lower in self._digits
117
+ or text in self._ordinals
118
+ or text_lower in self._ordinals
110
119
  or text.replace(".", "", 1).isdigit()
111
- or (clean_ord != "" and (clean_ord.isdigit() or clean_ord in self._numbers))
120
+ or (
121
+ clean_ord != ""
122
+ and (
123
+ clean_ord.isdigit()
124
+ or clean_ord in self._numbers
125
+ or clean_ord in self._ordinals
126
+ )
127
+ )
112
128
  )
113
129
 
114
130
  def _get_num_sequence_len(self, tokens: list[Token], start_idx: int) -> int:
@@ -302,13 +318,19 @@ class IndicEntityDetector(BaseEntityDetector):
302
318
  i = next_idx + 1 + sub_num_len
303
319
  continue
304
320
 
305
- # F. Date: [NumSequence] [Month]
321
+ # F. Date: [NumSequence] [Month] (optional DateWord)
306
322
  if next_idx < n and (
307
323
  tokens[next_idx].text in self._months
308
324
  or tokens[next_idx].text.lower() in self._months
309
325
  ):
310
- entities.append(make_entity(i, next_idx + 1, "date"))
311
- i = next_idx + 1
326
+ end_idx = next_idx + 1
327
+ if (
328
+ end_idx < n
329
+ and tokens[end_idx].text.lower() in self._date_words
330
+ ):
331
+ end_idx += 1
332
+ entities.append(make_entity(i, end_idx, "date"))
333
+ i = end_idx
312
334
  continue
313
335
 
314
336
  # G. Decimal: [NumSequence] [DecimalIndicator] [NumSequence]
@@ -368,10 +390,22 @@ class IndicEntityDetector(BaseEntityDetector):
368
390
  i = i + 1 + sub_num_len
369
391
  continue
370
392
 
371
- # Date: [Month] [NumSequence]
372
- if token.text in self._months and i + 1 < n and self._is_num(tokens[i + 1]):
393
+ # Date: [Month] [NumSequence] (optional DateWord)
394
+ if (
395
+ (token.text in self._months or token.text.lower() in self._months)
396
+ and i + 1 < n
397
+ and self._is_num(tokens[i + 1])
398
+ ):
373
399
  sub_num_len = self._get_num_sequence_len(tokens, i + 1)
374
- entities.append(make_entity(i, i + 1 + sub_num_len, "date"))
400
+ end_idx = i + 1 + sub_num_len
401
+ if (
402
+ end_idx < n
403
+ and tokens[end_idx].text.lower() in self._date_words
404
+ ):
405
+ end_idx += 1
406
+ entities.append(make_entity(i, end_idx, "date"))
407
+ i = end_idx
408
+ continue
375
409
  i = i + 1 + sub_num_len
376
410
  continue
377
411
 
@@ -22,6 +22,7 @@ class DateParser(BaseParser):
22
22
 
23
23
  temporal_res = load_resource(lang, "temporal")
24
24
  self._months = set(temporal_res.get("months", {}).keys())
25
+ self._date_words = set(w.lower() for w in temporal_res.get("date_words", []))
25
26
 
26
27
  @property
27
28
  def entity_type(self) -> str:
@@ -54,8 +55,12 @@ class DateParser(BaseParser):
54
55
  # Standalone weekday or numeric date formatting
55
56
  return entity.text
56
57
 
57
- left_tokens = tokens[:month_idx]
58
- right_tokens = tokens[month_idx + 1 :]
58
+ left_tokens = [
59
+ t for t in tokens[:month_idx] if t.lower() not in self._date_words
60
+ ]
61
+ right_tokens = [
62
+ t for t in tokens[month_idx + 1 :] if t.lower() not in self._date_words
63
+ ]
59
64
  month_word = tokens[month_idx]
60
65
 
61
66
  # Scenario 1: Month is preceded by Day (e.g. పచ్చిస్ డిసెంబర్ రెండు వేల ఇరవై ఐదు)
@@ -67,7 +67,11 @@ class NumberParser(BaseParser):
67
67
 
68
68
  import re
69
69
 
70
- clean_ord = re.sub(r"(st|nd|rd|th)$", "", text_lower)
70
+ clean_ord = re.sub(
71
+ r"(st|nd|rd|th|ஆம்|ஆவது|வது|వ|వవ|నే|ನೇಯ|वां|वा|वीं|वी|वें)$",
72
+ "",
73
+ text_lower,
74
+ )
71
75
  if clean_ord and clean_ord in self._word_to_val:
72
76
  return self._word_to_val[clean_ord]
73
77
 
@@ -23,7 +23,7 @@ class OtpParser(BaseParser):
23
23
 
24
24
  numbers_res = load_resource(lang, "numbers")
25
25
  self._word_to_digit: dict[str, str] = {}
26
- for category in ["digits", "numbers", "tens"]:
26
+ for category in ["digits", "numbers", "tens", "hundreds"]:
27
27
  if category in numbers_res:
28
28
  for word, val in numbers_res[category].items():
29
29
  self._word_to_digit[word] = str(val)
@@ -27,11 +27,17 @@ class PhoneParser(BaseParser):
27
27
 
28
28
  numbers_res = load_resource(lang, "numbers")
29
29
  self._word_to_digit: dict[str, str] = {}
30
- for category in ["digits", "numbers", "tens"]:
30
+ for category in ["digits", "numbers", "tens", "hundreds"]:
31
31
  if category in numbers_res:
32
32
  for word, val in numbers_res[category].items():
33
33
  self._word_to_digit[word] = str(val)
34
34
 
35
+ from indic_itn.parsers.number import NumberParser
36
+ self._number_parser = NumberParser(lang=lang)
37
+ self._multipliers_keys = set(
38
+ numbers_res.get("hundreds", {}).keys()
39
+ ) | set(numbers_res.get("multipliers", {}).keys())
40
+
35
41
  @property
36
42
  def entity_type(self) -> str:
37
43
  """The entity type this parser handles.
@@ -61,30 +67,55 @@ class PhoneParser(BaseParser):
61
67
  tokens = tokens[1:]
62
68
 
63
69
  repeat = 1
64
- for token in tokens:
70
+ idx = 0
71
+ n = len(tokens)
72
+ while idx < n:
73
+ token = tokens[idx]
65
74
  token_lower = token.lower()
75
+
66
76
  # Check for double/triple modifiers
67
77
  if token in self._double_tokens or token_lower in self._double_tokens:
68
78
  repeat = 2
79
+ idx += 1
69
80
  continue
70
81
  if token in self._triple_tokens or token_lower in self._triple_tokens:
71
82
  repeat = 3
83
+ idx += 1
72
84
  continue
73
85
 
74
86
  digit_str = ""
75
- if token in self._word_to_digit:
76
- digit_str = self._word_to_digit[token]
77
- elif token_lower in self._word_to_digit:
78
- digit_str = self._word_to_digit[token_lower]
79
- else:
80
- mapped_chars = []
81
- for c in token:
82
- if c in self._script_digits:
83
- mapped_chars.append(self._script_digits[c])
84
- elif c.isdigit():
85
- mapped_chars.append(c)
86
- if mapped_chars:
87
- digit_str = "".join(mapped_chars)
87
+ # Check 2-token multiplier sequence (e.g. "आठ सौ", "eight hundred", "ఎనిమిది వందల")
88
+ if idx + 1 < n:
89
+ t_next = tokens[idx + 1]
90
+ if (
91
+ t_next in self._multipliers_keys
92
+ or t_next.lower() in self._multipliers_keys
93
+ ):
94
+ sub_val = self._number_parser._parse_token_value(token)
95
+ if 1 <= sub_val <= 9:
96
+ sub_phrase = f"{token} {t_next}"
97
+ val = self._number_parser.parse(
98
+ Entity(sub_phrase, "number", 0, len(sub_phrase))
99
+ )
100
+ if val != "0":
101
+ digit_str = val
102
+ idx += 2
103
+
104
+ if not digit_str:
105
+ if token in self._word_to_digit:
106
+ digit_str = self._word_to_digit[token]
107
+ elif token_lower in self._word_to_digit:
108
+ digit_str = self._word_to_digit[token_lower]
109
+ else:
110
+ mapped_chars = []
111
+ for c in token:
112
+ if c in self._script_digits:
113
+ mapped_chars.append(self._script_digits[c])
114
+ elif c.isdigit():
115
+ mapped_chars.append(c)
116
+ if mapped_chars:
117
+ digit_str = "".join(mapped_chars)
118
+ idx += 1
88
119
 
89
120
  if digit_str:
90
121
  result_digits.append(digit_str * repeat)
@@ -13,7 +13,7 @@
13
13
  "९": "9"
14
14
  },
15
15
  "currency": {
16
- "rupee_words": ["रुपया", "रुपये", "रुपए", "रु", "रू", "rupees", "rupee", "rs"],
16
+ "rupee_words": ["रुपये", "रुपया", "रुपयों", "रुपए", "रू", "रू.", "rupees", "rupee", "rs", "inr", "₹"],
17
17
  "paise_words": ["पैसे", "पैसा", "paise", "paisa"]
18
18
  },
19
19
  "time": {
@@ -205,6 +205,23 @@
205
205
  "सौ": 100,
206
206
  "सैकड़ा": 100,
207
207
  "सैकड़ा": 100,
208
+ "दो सौ": 200,
209
+ "दोसौ": 200,
210
+ "तीन सौ": 300,
211
+ "तीनसौ": 300,
212
+ "चार सौ": 400,
213
+ "चारसौ": 400,
214
+ "पांच सौ": 500,
215
+ "पाँच सौ": 500,
216
+ "पांचसौ": 500,
217
+ "छह सौ": 600,
218
+ "छहसौ": 600,
219
+ "सात सौ": 700,
220
+ "सातसौ": 700,
221
+ "आठ सौ": 800,
222
+ "आठसौ": 800,
223
+ "नौ सौ": 900,
224
+ "नौसौ": 900,
208
225
  "hundred": 100,
209
226
  "hundreds": 100
210
227
  },
@@ -44,6 +44,25 @@
44
44
  "दसवें": 10,
45
45
  "दसवाँ": 10,
46
46
  "दसवीं": 10,
47
- "दसवें": 10
47
+ "दसवें": 10,
48
+ "ग्यारहवां": 11,
49
+ "बारहवां": 12,
50
+ "तेरहवां": 13,
51
+ "चौदहवां": 14,
52
+ "पंद्रहवां": 15,
53
+ "सोलहवां": 16,
54
+ "सत्रहवां": 17,
55
+ "अठारहवां": 18,
56
+ "उन्नीसवां": 19,
57
+ "बीसवां": 20,
58
+ "पच्चीसवां": 25,
59
+ "तीसवां": 30,
60
+ "चालीसवां": 40,
61
+ "पचासवां": 50,
62
+ "साठवां": 60,
63
+ "सत्तरवां": 70,
64
+ "अस्सीवां": 80,
65
+ "नब्बेवां": 90,
66
+ "सौवां": 100
48
67
  }
49
68
  }
@@ -53,5 +53,6 @@
53
53
  "nov": 11,
54
54
  "december": 12,
55
55
  "dec": 12
56
- }
56
+ },
57
+ "date_words": ["तारीख", "तिथि", "दिनांक", "date"]
57
58
  }
@@ -13,7 +13,7 @@
13
13
  "೯": "9"
14
14
  },
15
15
  "currency": {
16
- "rupee_words": ["ರೂಪಾಯಿ", "ರೂಪಾಯಿಗಳು", "ರೂ", "ರೂ.", "rupees", "rupee", "rs"],
16
+ "rupee_words": ["ರೂಪಾಯಿ", "ರೂಪಾಯಿಗಳ", "ರೂಪಾಯಿಯ", "ರೂ", "ರೂ.", "rupees", "rupee", "rs", "inr", "₹"],
17
17
  "paise_words": ["ಪೈಸೆ", "ಪೈಸಾ", "paise", "paisa"]
18
18
  },
19
19
  "time": {
@@ -210,6 +210,27 @@
210
210
  "hundreds": {
211
211
  "ನೂರು": 100,
212
212
  "ನೂರ": 100,
213
+ "ಎರಡು ನೂರು": 200,
214
+ "ಇರ್ನೂರು": 200,
215
+ "ಎರಡುನೂರು": 200,
216
+ "ಮೂರು ನೂರು": 300,
217
+ "ಮುನ್ನೂರು": 300,
218
+ "ಮೂರುನೂರು": 300,
219
+ "ನಾಲ್ಕು ನೂರು": 400,
220
+ "ನಾಲ್ನೂರು": 400,
221
+ "ನಾಲ್ಕುನೂರು": 400,
222
+ "ಐದು ನೂರು": 500,
223
+ "ಐನ್ನೂರು": 500,
224
+ "ಐದುನೂರು": 500,
225
+ "ಆರು ನೂರು": 600,
226
+ "ಆರ್ನೂರು": 600,
227
+ "ಆರುನೂರು": 600,
228
+ "ಏಳು ನೂರು": 700,
229
+ "ಏಳುನೂರು": 700,
230
+ "ಎಂಟು ನೂರು": 800,
231
+ "ಎಂಟುನೂರು": 800,
232
+ "ಒಂಬತ್ತು ನೂರು": 900,
233
+ "ಒಂಬತ್ತನೂರು": 900,
213
234
  "ಶತಕ": 100,
214
235
  "hundred": 100,
215
236
  "hundreds": 100
@@ -0,0 +1,35 @@
1
+ {
2
+ "ordinals": {
3
+ "ಮೊದಲ": 1,
4
+ "ಮೊದಲನೇ": 1,
5
+ "ಒಂದನೇ": 1,
6
+ "ಎರಡನೇ": 2,
7
+ "ಮೂರನೇ": 3,
8
+ "ನಾಲ್ಕನೇ": 4,
9
+ "ಐದನೇ": 5,
10
+ "ಆರನೇ": 6,
11
+ "ಏಳನೇ": 7,
12
+ "ಎಂಟನೇ": 8,
13
+ "ಒಂಬತ್ತನೇ": 9,
14
+ "ಹತ್ತನೇ": 10,
15
+ "ಹದಿನೊಂದನೇ": 11,
16
+ "ಹನ್ನೆರಡನೇ": 12,
17
+ "ಹದಿಮೂರನೇ": 13,
18
+ "ಹದಿನಾಲ್ಕನೇ": 14,
19
+ "ಹದಿನೈದನೇ": 15,
20
+ "ಹದಿನಾರನೇ": 16,
21
+ "ಹದಿನೇಳನೇ": 17,
22
+ "ಹದಿನೆಂಟನೇ": 18,
23
+ "ಹತ್ತೊಂಬತ್ತನೇ": 19,
24
+ "ಇಪ್ಪತ್ತನೇ": 20,
25
+ "ಇಪ್ಪತ್ತೈದನೇ": 25,
26
+ "ಮೂವತ್ತನೇ": 30,
27
+ "ನಲವತ್ತನೇ": 40,
28
+ "ಐವತ್ತನೇ": 50,
29
+ "ಅರವತ್ತನೇ": 60,
30
+ "ಎಪ್ಪತ್ತನೇ": 70,
31
+ "ಎಂಭತ್ತನೇ": 80,
32
+ "ತೊಂಬತ್ತನೇ": 90,
33
+ "ನೂರನೇ": 100
34
+ }
35
+ }
@@ -46,5 +46,6 @@
46
46
  "nov": 11,
47
47
  "december": 12,
48
48
  "dec": 12
49
- }
49
+ },
50
+ "date_words": ["ದಿನಾಂಕ", "ತಾರೀಖು", "date"]
50
51
  }
@@ -13,7 +13,7 @@
13
13
  "௯": "9"
14
14
  },
15
15
  "currency": {
16
- "rupee_words": ["ரூபாய்", "ரூ", "ரூ.", "rupees", "rupee", "rs", "inr", "₹"],
16
+ "rupee_words": ["ரூபாய்", "ரூபாய்க்கு", "ரூபாய்கள்", "ரூ", "ரூ.", "rupees", "rupee", "rs", "inr", "₹"],
17
17
  "paise_words": ["பைசா", "பைசே", "paise", "paisa", "p"]
18
18
  },
19
19
  "time": {
@@ -64,13 +64,15 @@
64
64
  "பதினொன்னு": 11,
65
65
  "பன்னிரண்டு": 12,
66
66
  "பன்னிரெண்டு": 12,
67
+ "பன்னெண்டு": 12,
67
68
  "பதின்மூன்று": 13,
68
69
  "பதினாறு": 16,
69
70
  "பதினேழு": 17,
70
71
  "பதினெட்டு": 18,
71
72
  "பத்தொன்பது": 19,
72
73
  "இருபது": 20,
73
- "இருபத்தி ஒன்று": 21,
74
+ "இருபத்தி": 20,
75
+ "இருபத்து": 20,
74
76
  "இருபத்தி ஒன்று": 21,
75
77
  "இருபத்தி இரண்டு": 22,
76
78
  "இருபத்தி மூன்று": 23,
@@ -82,17 +84,44 @@
82
84
  "இருபத்தி எட்டு": 28,
83
85
  "இருபத்தி ஒன்பது": 29,
84
86
  "முப்பது": 30,
87
+ "முப்பத்தி": 30,
88
+ "முப்பத்து": 30,
85
89
  "முப்பத்தி ஐந்து": 35,
86
90
  "முப்பத்தைந்து": 35,
87
91
  "நாற்பது": 40,
92
+ "நாற்பத்தி": 40,
93
+ "நாற்பத்து": 40,
88
94
  "நாற்பத்தி ஐந்து": 45,
89
95
  "ஐம்பது": 50,
96
+ "ஐம்பத்தி": 50,
97
+ "ஐம்பத்து": 50,
90
98
  "ஐம்பத்தி ஐந்து": 55,
91
99
  "ஐம்பத்தி ஆறு": 56,
92
100
  "அறுபது": 60,
101
+ "அறுபத்தி": 60,
102
+ "அறுபத்து": 60,
93
103
  "எழுபது": 70,
104
+ "எழுபத்தி": 70,
105
+ "எழுபத்து": 70,
94
106
  "எண்பது": 80,
107
+ "எண்பத்தி": 80,
108
+ "எண்பத்து": 80,
95
109
  "தொண்ணூறு": 90,
110
+ "தொண்ணூத்தி": 90,
111
+ "தொண்ணூத்து": 90,
112
+ "நூறு": 100,
113
+ "இருநூறு": 200,
114
+ "முன்னூறு": 300,
115
+ "முன்னூத்தி": 300,
116
+ "நானூறு": 400,
117
+ "ஐநூறு": 500,
118
+ "ஐநூத்தி": 500,
119
+ "அறுநூறு": 600,
120
+ "எழுநூறு": 700,
121
+ "எண்ணூறு": 800,
122
+ "எட்நூறு": 800,
123
+ "எட்நூத்தி": 800,
124
+ "தொள்ளாயிரம்": 900,
96
125
  "zero": 0,
97
126
  "one": 1,
98
127
  "two": 2,
@@ -126,20 +155,28 @@
126
155
  "பத்து": 10,
127
156
  "இருபது": 20,
128
157
  "இருபத்தி": 20,
158
+ "இருபத்து": 20,
129
159
  "முப்பது": 30,
130
160
  "முப்பத்தி": 30,
161
+ "முப்பத்து": 30,
131
162
  "நாற்பது": 40,
132
163
  "நாற்பத்தி": 40,
164
+ "நாற்பத்து": 40,
133
165
  "ஐம்பது": 50,
134
166
  "ஐம்பத்தி": 50,
167
+ "ஐம்பத்து": 50,
135
168
  "அறுபது": 60,
136
169
  "அறுபத்தி": 60,
170
+ "அறுபத்து": 60,
137
171
  "எழுபது": 70,
138
172
  "எழுபத்தி": 70,
173
+ "எழுபத்து": 70,
139
174
  "எண்பது": 80,
140
175
  "எண்பத்தி": 80,
176
+ "எண்பத்து": 80,
141
177
  "தொண்ணூறு": 90,
142
- "தொண்ணூற்றி": 90,
178
+ "தொண்ணூத்தி": 90,
179
+ "தொண்ணூத்து": 90,
143
180
  "ten": 10,
144
181
  "twenty": 20,
145
182
  "thirty": 30,
@@ -154,6 +191,31 @@
154
191
  "நூறு": 100,
155
192
  "நூற்று": 100,
156
193
  "நூறுகள்": 100,
194
+ "நூத்தி": 100,
195
+ "இருநூறு": 200,
196
+ "இருநூற்று": 200,
197
+ "இருநூத்தி": 200,
198
+ "முன்னூறு": 300,
199
+ "முன்னூற்று": 300,
200
+ "முன்னூத்தி": 300,
201
+ "நானூறு": 400,
202
+ "நானூற்று": 400,
203
+ "நானூத்தி": 400,
204
+ "ஐநூறு": 500,
205
+ "ஐநூற்று": 500,
206
+ "ஐநூத்தி": 500,
207
+ "அறுநூறு": 600,
208
+ "அறுநூற்று": 600,
209
+ "அறுநூத்தி": 600,
210
+ "எழுநூறு": 700,
211
+ "எழுநூற்று": 700,
212
+ "எழுநூத்தி": 700,
213
+ "எண்ணூறு": 800,
214
+ "எட்நூறு": 800,
215
+ "எட்நூற்று": 800,
216
+ "எட்நூத்தி": 800,
217
+ "தொள்ளாயிரம்": 900,
218
+ "தொள்ளாயிரத்து": 900,
157
219
  "hundred": 100,
158
220
  "hundreds": 100
159
221
  },
@@ -0,0 +1,68 @@
1
+ {
2
+ "ordinals": {
3
+ "முதல்": 1,
4
+ "முதலாவது": 1,
5
+ "ஒன்றாம்": 1,
6
+ "இரண்டாம்": 2,
7
+ "இரண்டாவது": 2,
8
+ "ரண்டாம்": 2,
9
+ "மூன்றாம்": 3,
10
+ "மூன்றாவது": 3,
11
+ "நான்காம்": 4,
12
+ "நான்காவது": 4,
13
+ "நாலாவது": 4,
14
+ "ஐந்தாம்": 5,
15
+ "ஐந்தாவது": 5,
16
+ "அஞ்சாவது": 5,
17
+ "ஆறாம்": 6,
18
+ "ஆறாவது": 6,
19
+ "ஏழாம்": 7,
20
+ "ஏழாவது": 7,
21
+ "எட்டாம்": 8,
22
+ "எட்டாவது": 8,
23
+ "ஒன்பதாம்": 9,
24
+ "ஒன்பதாவது": 9,
25
+ "பத்தாம்": 10,
26
+ "பத்தாவது": 10,
27
+ "பதினொன்றாம்": 11,
28
+ "பதினொன்றாவது": 11,
29
+ "பன்னிரண்டாம்": 12,
30
+ "பன்னிரண்டாவது": 12,
31
+ "பதின்மூன்றாம்": 13,
32
+ "பதின்மூன்றாவது": 13,
33
+ "பதினான்காம்": 14,
34
+ "பதினான்காவது": 14,
35
+ "பதினைந்தாம்": 15,
36
+ "பதினைந்தாவது": 15,
37
+ "பதினாறாம்": 16,
38
+ "பதினாறாவது": 16,
39
+ "பதினேழாம்": 17,
40
+ "பதினேழாவது": 17,
41
+ "பதினெட்டாம்": 18,
42
+ "பதினெட்டாவது": 18,
43
+ "பத்தொன்பதாம்": 19,
44
+ "பத்தொன்பதாவது": 19,
45
+ "இருபதாம்": 20,
46
+ "இருபதாவது": 20,
47
+ "இருபத்தி ஐந்தாம்": 25,
48
+ "இருபத்தைந்தாம்": 25,
49
+ "இருபத்தி ஐந்தாவது": 25,
50
+ "இருபத்தைந்தாவது": 25,
51
+ "முப்பத்தாம்": 30,
52
+ "முப்பதாவது": 30,
53
+ "நாற்பதாம்": 40,
54
+ "நாற்பதாவது": 40,
55
+ "ஐம்பதாம்": 50,
56
+ "ஐம்பதாவது": 50,
57
+ "அறுபதாம்": 60,
58
+ "அறுபதாவது": 60,
59
+ "எழுபதாம்": 70,
60
+ "எழுபதாவது": 70,
61
+ "எண்பதாம்": 80,
62
+ "எண்பதாவது": 80,
63
+ "தொண்ணூறாம்": 90,
64
+ "தொண்ணூறாவது": 90,
65
+ "நூறாம்": 100,
66
+ "நூறாவது": 100
67
+ }
68
+ }
@@ -52,5 +52,6 @@
52
52
  "nov": 11,
53
53
  "december": 12,
54
54
  "dec": 12
55
- }
55
+ },
56
+ "date_words": ["தேதி", "திகதி", "தாரிக்கு", "date"]
56
57
  }
@@ -13,7 +13,7 @@
13
13
  "౯": "9"
14
14
  },
15
15
  "currency": {
16
- "rupee_words": ["రూపాయి", "రూపాయలు", "రూ", "రూ.", "rupees", "rupee", "rs"],
16
+ "rupee_words": ["రూపాయి", "రూపాయలు", "రూపాయల", "రూ", "రూ.", "rupees", "rupee", "rs", "inr", "₹"],
17
17
  "paise_words": ["పైసలు", "పైసా", "paise", "paisa"]
18
18
  },
19
19
  "time": {
@@ -222,6 +222,30 @@
222
222
  "వంద": 100,
223
223
  "వందల": 100,
224
224
  "నూరు": 100,
225
+ "రెండు వందల": 200,
226
+ "రెండువందల": 200,
227
+ "రెండు వందలు": 200,
228
+ "మూడు వందల": 300,
229
+ "మూడువందల": 300,
230
+ "మూడు వందలు": 300,
231
+ "నాలుగు వందల": 400,
232
+ "నాలుగువందల": 400,
233
+ "నాలుగు వందలు": 400,
234
+ "ఐదు వందల": 500,
235
+ "ఐదువందల": 500,
236
+ "ఐదు వందలు": 500,
237
+ "ఆరు వందల": 600,
238
+ "ఆరువందల": 600,
239
+ "ఆరు వందలు": 600,
240
+ "ఏడు వందల": 700,
241
+ "ఏడువందల": 700,
242
+ "ఏడు వందలు": 700,
243
+ "ఎనిమిది వందల": 800,
244
+ "ఎనిమిదివందల": 800,
245
+ "ఎనిమిది వందలు": 800,
246
+ "తొమ్మిది వందల": 900,
247
+ "తొమ్మిదివందల": 900,
248
+ "తొమ్మిది వందలు": 900,
225
249
  "శతాబ్దం": 100,
226
250
  "శతం": 100,
227
251
  "hundred": 100,
@@ -0,0 +1,63 @@
1
+ {
2
+ "ordinals": {
3
+ "మొదటి": 1,
4
+ "ఒకటో": 1,
5
+ "ఒకటవ": 1,
6
+ "రెండో": 2,
7
+ "రెండవ": 2,
8
+ "మూడో": 3,
9
+ "మూడవ": 3,
10
+ "నాలుగో": 4,
11
+ "నాలుగవ": 4,
12
+ "ఐదో": 5,
13
+ "ఐదవ": 5,
14
+ "ఆరో": 6,
15
+ "ఆరవ": 6,
16
+ "ఏడో": 7,
17
+ "ఏడవ": 7,
18
+ "ఎనిమిదో": 8,
19
+ "ఎనిమిదవ": 8,
20
+ "తొమ్మిదో": 9,
21
+ "తొమ్మిదవ": 9,
22
+ "పదో": 10,
23
+ "పదవ": 10,
24
+ "పదకొండో": 11,
25
+ "పదకొండవ": 11,
26
+ "పన్నెండో": 12,
27
+ "పన్నెండవ": 12,
28
+ "పదమూడో": 13,
29
+ "పదమూడవ": 13,
30
+ "పదునాలుగో": 14,
31
+ "పదునాలుగవ": 14,
32
+ "పదిహేనో": 15,
33
+ "పదిహేనవ": 15,
34
+ "పదహారో": 16,
35
+ "పదహారవ": 16,
36
+ "పదిహేడో": 17,
37
+ "పదిహేడవ": 17,
38
+ "పద్ధెనిమిదో": 18,
39
+ "పద్ధెనిమిదవ": 18,
40
+ "పంతొమ్మిదో": 19,
41
+ "పంతొమ్మిదవ": 19,
42
+ "ఇరవైయో": 20,
43
+ "ఇరవైవ": 20,
44
+ "ఇరవై ఐదో": 25,
45
+ "ఇరవై ఐదవ": 25,
46
+ "ముప్పైయో": 30,
47
+ "ముప్పైవ": 30,
48
+ "నలభైయో": 40,
49
+ "నలభైవ": 40,
50
+ "యాభైయో": 50,
51
+ "యాభైవ": 50,
52
+ "అరవైయో": 60,
53
+ "అరవైవ": 60,
54
+ "దెబ్బైయో": 70,
55
+ "దెబ్బైవ": 70,
56
+ "ఎనభైయో": 80,
57
+ "ఎనభైవ": 80,
58
+ "తొంబైయో": 90,
59
+ "తొంబైవ": 90,
60
+ "వందో": 100,
61
+ "వందవ": 100
62
+ }
63
+ }
@@ -46,5 +46,6 @@
46
46
  "nov": 11,
47
47
  "december": 12,
48
48
  "dec": 12
49
- }
49
+ },
50
+ "date_words": ["తేదీ", "దినాంక", "తారీఖు", "date"]
50
51
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: indic-itn
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Inverse Text Normalization (ITN) for Indic languages
5
5
  License: MIT
6
6
  Classifier: Development Status :: 3 - Alpha
@@ -51,10 +51,12 @@ def test_hindi_itn_pipeline_integration() -> None:
51
51
  assert itn.normalize("दो सौ रुपये") == "₹200"
52
52
  assert itn.normalize("पचास रुपये बीस पैसे") == "₹50.20"
53
53
  assert itn.normalize("500 rupees") == "₹500"
54
+ assert itn.normalize("₹1000") == "₹1000"
54
55
 
55
56
  # Date
56
57
  assert itn.normalize("पच्चीस दिसंबर दो हजार पच्चीस") == "25 दिसंबर 2025"
57
58
  assert itn.normalize("25th December 2025") == "25 December 2025"
59
+ assert itn.normalize("पंद्रह अप्रैल तारीख") == "15 अप्रैल"
58
60
 
59
61
  # Time
60
62
  assert itn.normalize("पाँच बजकर तीस मिनट") == "5:30"
@@ -113,3 +115,29 @@ def test_hindi_itn_pipeline_edge_cases() -> None:
113
115
  # Unknown parser type fallback
114
116
  custom_itn = HindiITN(detector=UnknownEntityDetector())
115
117
  assert custom_itn.normalize("कक्षा दो") == "कक्षा दो"
118
+
119
+
120
+ def test_hindi_realtime_examples() -> None:
121
+ """Test real-time Hindi spoken examples for phone, date, currency, and class ordinals."""
122
+ itn = HindiITN()
123
+
124
+ # Real-time Example 1: Spoken phone sequence & class ordinal
125
+ ex1 = (
126
+ "मेरा नाम रामकुमार है मैं बारहवीं कक्षा में पढ़ता हूँ मेरा फोन नंबर "
127
+ "नब्बे 71 आठ सौ 50 तीन सौ बारह है"
128
+ )
129
+ res1 = itn.normalize(ex1)
130
+ assert "12" in res1 or "12वीं" in res1
131
+ assert "90718005030012" in res1
132
+
133
+ # Real-time Example 2: Spoken date with month, ordinal day, and date context word
134
+ ex2 = "मैं पंद्रहवें अप्रैल तारीख को स्कूल गया था"
135
+ res2 = itn.normalize(ex2)
136
+ assert "15 अप्रैल" in res2 or "अप्रैल 15" in res2
137
+
138
+ # Real-time Example 3: Currency with symbol and spoken words
139
+ ex3 = "मेरे पिता ने मुझे ₹1000 दिए मैंने उसमें पाँच सौ रुपये की चॉकलेट खरीदी"
140
+ res3 = itn.normalize(ex3)
141
+ assert "₹1000" in res3
142
+ assert "₹500" in res3
143
+
@@ -31,9 +31,11 @@ def test_kannada_itn_pipeline_integration() -> None:
31
31
  # Currency
32
32
  assert itn.normalize("ಎರಡು ನೂರು ರೂಪಾಯಿ") == "₹200"
33
33
  assert itn.normalize("ಐದು ಲಕ್ಷ ರೂಪಾಯಿ") == "₹500000"
34
+ assert itn.normalize("₹1000") == "₹1000"
34
35
 
35
36
  # Date
36
37
  assert itn.normalize("ಇಪ್ಪತ್ತೈದು ಡಿಸೆಂಬರ್ ಎರಡು ಸಾವಿರ ಇಪ್ಪತ್ತೈದು") == "25 ಡಿಸೆಂಬರ್ 2025"
38
+ assert itn.normalize("ಏಪ್ರಿಲ್ ಹದಿನೈದನೇ ದಿನಾಂಕ") == "ಏಪ್ರಿಲ್ 15"
37
39
 
38
40
  # Time
39
41
  assert itn.normalize("ಐದು ಗಂಟೆಗೆ") == "5:00"
@@ -96,3 +98,29 @@ def test_kannada_parsers_direct() -> None:
96
98
  assert KannadaPercentageParser().entity_type == "percentage"
97
99
  assert KannadaDecimalParser().entity_type == "decimal"
98
100
 
101
+
102
+ def test_kannada_realtime_examples() -> None:
103
+ """Test real-time Kannada spoken examples for phone, date, currency, and class ordinals."""
104
+ itn = KannadaITN()
105
+
106
+ # Real-time Example 1: Spoken phone sequence & class ordinal
107
+ ex1 = (
108
+ "ನನ್ನ ಹೆಸರು ರಾಮ್‌ಕುಮಾರ್ ನಾನು ಹನ್ನೆರಡನೇ ತರಗತಿ ಓದುತ್ತಿದ್ದೇನೆ ನನ್ನ ಫೋನ್ ಸಂಖ್ಯೆ "
109
+ "ತೊಂಬತ್ತು 71 ಎಂಟು ನೂರು 50 ಮೂರು ನೂರು ಹನ್ನೆರಡು"
110
+ )
111
+ res1 = itn.normalize(ex1)
112
+ assert "12" in res1 or "12ನೇ" in res1
113
+ assert "90718005030012" in res1
114
+
115
+ # Real-time Example 2: Spoken date with month, ordinal day, and date context word
116
+ ex2 = "ನಾನು ಹದಿನೈದನೇ ಏಪ್ರಿಲ್ ದಿನಾಂಕ ಶಾಲೆಗೆ ಹೋದೆ"
117
+ res2 = itn.normalize(ex2)
118
+ assert "15 ಏಪ್ರಿಲ್" in res2 or "ಏಪ್ರಿಲ್ 15" in res2
119
+
120
+ # Real-time Example 3: Currency with symbol and spoken words
121
+ ex3 = "ನನ್ನ ತಂದೆ ನನಗೆ ₹1000 ಕೊಟ್ಟರು ನಾನು ಅದರಲ್ಲಿ ಐದು ನೂರು ರೂಪಾಯಿ ಚಾಕೊಲೇಟ್ ಖರೀದಿಸಿದೆ"
122
+ res3 = itn.normalize(ex3)
123
+ assert "₹1000" in res3
124
+ assert "₹500" in res3
125
+
126
+
@@ -94,3 +94,30 @@ def test_tamil_parsers_direct() -> None:
94
94
  assert TamilPercentageParser().entity_type == "percentage"
95
95
  assert TamilDecimalParser().entity_type == "decimal"
96
96
 
97
+
98
+ def test_user_reported_realtime_examples() -> None:
99
+ """Test real-time user reported Tamil ASR examples for numbers, dates, currency, and phone numbers."""
100
+ itn = TamilITN()
101
+
102
+ # Real-time Example 1: Spoken phone number & class ordinal
103
+ ex1 = (
104
+ "என் பெயர் ராம்குமார் நான் அரசு மேல்நிலைப்பள்ளியில் பன்னிரண்டாம் வகுப்பு "
105
+ "பிடித்தவன் கொண்டிருக்கிறேன் என்னுடைய தந்தை பே நல்லுசாமி "
106
+ "என் போன் நம்பர் தொண்ணூத்தி 71 எட்நூத்தி 50 முன்னூத்தி பன்னெண்டு"
107
+ )
108
+ res1 = itn.normalize(ex1)
109
+ assert "12" in res1 or "12-ஆம்" in res1 or "12" in res1
110
+ assert "போன் நம்பர் 90718005030012" in res1 or "90718005030012" in res1
111
+
112
+ # Real-time Example 2: Spoken date with month, ordinal day, and date context word
113
+ ex2 = "நான் ஏப்ரல் பதினைந்தாம் தேதி பள்ளிக்கூடத்திற்குப் போனேன்"
114
+ res2 = itn.normalize(ex2)
115
+ assert "15 ஏப்ரல்" in res2 or "ஏப்ரல் 15" in res2
116
+
117
+ # Real-time Example 3: Currency with symbol and spoken words
118
+ ex3 = "என் தந்தை எனக்கு ₹1000 கொடுத்தார் நான் அதில் ஐநூறு ரூபாய் சாக்லேட் வாங்கினேன்"
119
+ res3 = itn.normalize(ex3)
120
+ assert "₹1000" in res3
121
+ assert "₹500" in res3
122
+
123
+
@@ -39,10 +39,12 @@ def test_telugu_itn_pipeline_integration() -> None:
39
39
  assert itn.normalize("ఐదు లక్షల అరవై వేల రూపాయలు") == "₹560000"
40
40
  assert itn.normalize("రెండు వందల రూపాయలు") == "₹200"
41
41
  assert itn.normalize("యాభై రూపాయలు ఇరవై పైసలు") == "₹50.20"
42
+ assert itn.normalize("₹1000") == "₹1000"
42
43
 
43
44
  # Date
44
45
  assert itn.normalize("ఇరవై ఐదు డిసెంబర్ రెండు వేల ఇరవై ఐదు") == "25 డిసెంబర్ 2025"
45
46
  assert itn.normalize("డిసెంబర్ ఇరవై ఐదు") == "డిసెంబర్ 25"
47
+ assert itn.normalize("ఏప్రిల్ పదిహేనో తేదీ") == "ఏప్రిల్ 15"
46
48
 
47
49
  # Time
48
50
  assert itn.normalize("ఐదు గంటల ముప్పై నిమిషాలు") == "5:30"
@@ -88,3 +90,29 @@ def test_telugu_itn_pipeline_edge_cases() -> None:
88
90
  # Unknown parser type fallback
89
91
  custom_itn = TeluguITN(detector=UnknownEntityDetector())
90
92
  assert custom_itn.normalize("తరగతి రెండు") == "తరగతి రెండు"
93
+
94
+
95
+ def test_telugu_realtime_examples() -> None:
96
+ """Test real-time Telugu spoken examples for phone, date, currency, and class ordinals."""
97
+ itn = TeluguITN()
98
+
99
+ # Real-time Example 1: Spoken phone sequence & class ordinal
100
+ ex1 = (
101
+ "నా పేరు రామకుమార్ నేను పన్నెండో తరగతి చదువుతున్నాను నా ఫోన్ నంబర్ "
102
+ "తొంబై 71 ఎనిమిది వందల 50 మూడు వందల పన్నెండు"
103
+ )
104
+ res1 = itn.normalize(ex1)
105
+ assert "12" in res1 or "12వ" in res1
106
+ assert "90718005030012" in res1
107
+
108
+ # Real-time Example 2: Spoken date with month, ordinal day, and date context word
109
+ ex2 = "నేను పదిహేనో ఏప్రిల్ తేదీన బడికి వెళ్లాను"
110
+ res2 = itn.normalize(ex2)
111
+ assert "15 ఏప్రిల్" in res2 or "ఏప్రిల్ 15" in res2
112
+
113
+ # Real-time Example 3: Currency with symbol and spoken words
114
+ ex3 = "మా నాన్న నాకు ₹1000 ఇచ్చారు నేను అందులో ఐదు వందల రూపాయల చాక్లెట్ కొన్నాను"
115
+ res3 = itn.normalize(ex3)
116
+ assert "₹1000" in res3
117
+ assert "₹500" in res3
118
+
@@ -1,16 +0,0 @@
1
- {
2
- "ordinals": {
3
- "ಮೊದಲ": 1,
4
- "ಮೊದಲನೇ": 1,
5
- "ಒಂದನೇ": 1,
6
- "ಎರಡನೇ": 2,
7
- "ಮೂರನೇ": 3,
8
- "ನಾಲ್ಕನೇ": 4,
9
- "ಐದನೇ": 5,
10
- "ಆರನೇ": 6,
11
- "ಏಳನೇ": 7,
12
- "ಎಂಟನೇ": 8,
13
- "ಒಂಬತ್ತನೇ": 9,
14
- "ಹತ್ತನೇ": 10
15
- }
16
- }
@@ -1,7 +0,0 @@
1
- {
2
- "ordinals": {
3
- "முதல்": 1,
4
- "இரண்டாம்": 2,
5
- "மூன்றாம்": 3
6
- }
7
- }
@@ -1,25 +0,0 @@
1
- {
2
- "ordinals": {
3
- "మొదటి": 1,
4
- "ఒకటో": 1,
5
- "ఒకటవ": 1,
6
- "రెండో": 2,
7
- "రెండవ": 2,
8
- "మూడో": 3,
9
- "మూడవ": 3,
10
- "నాలుగో": 4,
11
- "నాలుగవ": 4,
12
- "ఐదో": 5,
13
- "ఐదవ": 5,
14
- "ఆరో": 6,
15
- "ఆరవ": 6,
16
- "ఏడో": 7,
17
- "ఏడవ": 7,
18
- "ఎనిమిదో": 8,
19
- "ఎనిమిదవ": 8,
20
- "తొమ్మిదో": 9,
21
- "తొమ్మిదవ": 9,
22
- "పదో": 10,
23
- "పదవ": 10
24
- }
25
- }
File without changes
File without changes
File without changes
File without changes