Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pipeline {
MR_TN_CACHE='/home/jenkins/TestData/text_norm/ci/grammars/03-12-24-1'
JA_TN_CACHE='/home/jenkins/TestData/text_norm/ci/grammars/10-17-24-1'
KO_TN_CACHE='/home/jenkins/TestData/text_norm/ci/grammars/04-23-26-0'
HI_TN_CACHE='/home/jenkins/TestData/text_norm/ci/grammars/07-10-26-0'
HI_TN_CACHE='/home/jenkins/TestData/text_norm/ci/grammars/07-24-26-0'
DEFAULT_TN_CACHE='/home/jenkins/TestData/text_norm/ci/grammars/06-08-23-0'
}
stages {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,4 @@
वेस्ट
सामने
पीछे
वीया
आर डी
वीया

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
com कॉम
org ऑर्ग
net नेट
edu ई डी यू
gov जी ओ वी
in इन
co सी ओ
io आई ओ
ai ए आई
uk यू के
us यू एस
au ए यू
ca सी ए
ac ए सी
res आर ई एस
nic एन आई सी
ernet ई आर नेट
tv टी वी
me एम ई
tech टेक
dev डी ई वी
app ऐप
biz बिज़
info इन्फो
com
org
net
edu
gov
in
co
io
ai
uk
us
au
ca
ac
res
nic
ernet
tv
me
tech
dev
app
biz
info
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
jpg जे पी जी
jpeg जे पी ई जी
png पी एन जी
gif जी आई एफ
pdf पी डी एफ
doc डी ओ सी
docx डी ओ सी एक्स
xls एक्स एल एस
xlsx एक्स एल एस एक्स
ppt पी पी टी
pptx पी पी टी एक्स
csv सी एस वी
txt टी एक्स टी
html एच टी एम एल
xml एक्स एम एल
json जे एस ओ एन
css सी एस एस
js जे एस
py पी वाई
java जावा
cpp सी पी पी
zip ज़िप
rar आर ए आर
tar टी ए आर
mp3 एम पी तीन
mp4 एम पी चार
avi ए वी आई
mkv एम के वी
mov एम ओ वी
wav डब्ल्यू ए वी
svg एस वी जी
apk ए पी के
exe ई एक्स ई
sql एस क्यू एल
jpg
jpeg
png
gif
pdf
doc
docx
xls
xlsx
ppt
pptx
csv
txt
html
xml
json
css
js
py
java
cpp
zip
rar
tar
mp3
mp4
avi
mkv
mov
wav
svg
apk
exe
sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
https एच टी टी पी एस कोलन फॉरवर्ड स्लैश फॉरवर्ड स्लैश
http एच टी टी पी कोलन फॉरवर्ड स्लैश फॉरवर्ड स्लैश
www डब्ल्यू डब्ल्यू डब्ल्यू डॉट
httpswww एच टी टी पी एस कोलन फॉरवर्ड स्लैश फॉरवर्ड स्लैश डब्ल्यू डब्ल्यू डब्ल्यू डॉट
httpwww एच टी टी पी कोलन फॉरवर्ड स्लैश फॉरवर्ड स्लैश डब्ल्यू डब्ल्यू डब्ल्यू डॉट
https https कोलन फॉरवर्ड स्लैश फॉरवर्ड स्लैश
http http कोलन फॉरवर्ड स्लैश फॉरवर्ड स्लैश
www www डॉट
httpswww https कोलन फॉरवर्ड स्लैश फॉरवर्ड स्लैश www डॉट
httpwww http कोलन फॉरवर्ड स्लैश फॉरवर्ड स्लैश www डॉट

This file was deleted.

18 changes: 17 additions & 1 deletion nemo_text_processing/text_normalization/hi/taggers/cardinal.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,24 @@ def create_larger_number_graph(digit_graph, suffix, zeros_counts, sub_graph):
)
cardinal_with_leading_zeros = pynutil.add_weight(cardinal_with_leading_zeros, 0.5)

# Handle large numbers written with digit-group separators.
delete_separator = pynutil.delete(",")
two_digits = NEMO_ALL_DIGIT + NEMO_ALL_DIGIT
three_digits = NEMO_ALL_DIGIT + NEMO_ALL_DIGIT + NEMO_ALL_DIGIT
# Indian grouping: 1-2 leading digits, groups of 2, final group of 3.
indian_grouping = (
pynini.closure(NEMO_ALL_DIGIT, 1, 2)
+ pynini.closure(delete_separator + two_digits)
+ delete_separator
+ three_digits
)
# International grouping: 1-3 leading digits, one or more groups of 3.
western_grouping = pynini.closure(NEMO_ALL_DIGIT, 1, 3) + pynini.closure(delete_separator + three_digits, 1)
strip_separators = (indian_grouping | western_grouping).optimize()
cardinal_with_separators = pynini.compose(strip_separators, graph_without_leading_zeros).optimize()

# Full graph including leading zeros - for standalone cardinal matching
final_graph = graph_without_leading_zeros | cardinal_with_leading_zeros
final_graph = graph_without_leading_zeros | cardinal_with_leading_zeros | cardinal_with_separators

optional_minus_graph = pynini.closure(pynutil.insert("negative: ") + pynini.cross("-", "\"true\" "), 0, 1)

Expand Down
24 changes: 7 additions & 17 deletions nemo_text_processing/text_normalization/hi/taggers/electronic.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class ElectronicFst(GraphFst):
"""
Finite state transducer for classifying electronic: as URLs, email addresses, file paths,
IP addresses, domains, chemical formulas, and alphanumeric codes.
IP addresses, domains, and chemical formulas.
e.g. kumar@gmail.com -> tokens { electronic { username: "kumar" domain: "gmail.com" } }
e.g. https://google.com/ -> tokens { electronic { protocol: "https" domain: "google.com/" } }
e.g. C:\\Users\\HP\\Desktop -> tokens { electronic { path: "C:\\Users\\HP\\Desktop" } }
Expand Down Expand Up @@ -157,22 +157,13 @@ def __init__(self, deterministic: bool = True):
unbalanced_trailing = pynini.intersect(no_open, ends_with_close)
valid_chemical = pynini.difference(raw_chemical, unbalanced_trailing).optimize()

chemical_formula = pynutil.insert("domain: \"") + valid_chemical + pynutil.insert("\"")
# Recognise a chemical formula only when it uses subscript notation
chem_sigma = pynini.closure(NEMO_ALPHA | NEMO_DIGIT | subscript_digit | chemical_symbols)
contains_subscript = chem_sigma + subscript_digit + chem_sigma
valid_chemical = pynini.intersect(valid_chemical, contains_subscript).optimize()

alnum_seg = pynini.closure(NEMO_ALPHA | NEMO_DIGIT, 1)
separator = pynini.accep("-") | pynini.accep(".")
alphanumeric_pattern = alnum_seg + pynini.closure(separator + alnum_seg)

alnum_hyp_dot_sigma = pynini.closure(NEMO_ALPHA | NEMO_DIGIT | pynini.accep("-") | pynini.accep("."))

contains_alpha = alnum_hyp_dot_sigma + NEMO_ALPHA + alnum_hyp_dot_sigma
contains_digit = alnum_hyp_dot_sigma + NEMO_DIGIT + alnum_hyp_dot_sigma

alphanumeric_code_fst = pynini.intersect(
pynini.intersect(alphanumeric_pattern, contains_alpha), contains_digit
).optimize()

alphanumeric_code = pynutil.insert("domain: \"") + alphanumeric_code_fst + pynutil.insert("\"")
# Chemical formulas carry a dedicated tag so the verbalizer can spell element
chemical_formula = pynutil.insert("fragment_id: \"") + valid_chemical + pynutil.insert("\"")

graph = (
pynutil.add_weight(url_graph, 1.0)
Expand All @@ -184,7 +175,6 @@ def __init__(self, deterministic: bool = True):
| pynutil.add_weight(combined_domain, 1.1)
| pynutil.add_weight(file_with_extension, 1.1)
| pynutil.add_weight(chemical_formula, 1.2)
| pynutil.add_weight(alphanumeric_code, 1.2)
)

self.graph = graph.optimize()
Expand Down
Loading