Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ def run_qvac_benchmark(images):
f.write(img + '\n')
input_file = f.name

output_file = tempfile.mktemp(suffix='.jsonl')
output_fd = tempfile.NamedTemporaryFile(mode='w', suffix='.jsonl', delete=False)
output_file = output_fd.name
output_fd.close()

try:
# Run QVAC batch CLI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ class DevanagariNormalizer extends BaseNormalizer {
}

// replace pipe character for poorna virama
text = text.replace('\u007c', '\u0964')
text = text.replace(/\u007c/g, '\u0964')

// correct visarga
text = text.replace(/([ऀ-ॿ]):/, '$1\u0903')
Expand Down Expand Up @@ -565,7 +565,7 @@ class GurmukhiNormalizer extends BaseNormalizer {
text = text.replace('\u0a65', '\u0965')

// replace pipe character for poorna virama
text = text.replace('\u007c', '\u0964')
text = text.replace(/\u007c/g, '\u0964')

// correct visarga
text = text.replace(/([਀-੿]):/, '$1\u0a03')
Expand Down Expand Up @@ -790,9 +790,9 @@ class BengaliNormalizer extends BaseNormalizer {
text = text.replace('\u09e5', '\u0965')

// replace pipe character for poorna virama
text = text.replace('\u007c', '\u0964')
text = text.replace(/\u007c/g, '\u0964')
// replace bengali currency numerator four for poorna virama (it looks similar and is used as a substitute)
text = text.replace('\u09f7', '\u0964')
text = text.replace(/\u09f7/g, '\u0964')

// two part dependent vowels
text = text.replace('\u09c7\u09be', '\u09cb')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@ class MosesTokenizer {

// Protected patterns
this.BASIC_PROTECTED_PATTERN_1 = /<\/?\S+\/?>/
this.BASIC_PROTECTED_PATTERN_2 = /<\S+( [a-zA-Z0-9]+="?[^"]*")+ ?\/?>/
this.BASIC_PROTECTED_PATTERN_3 = /<\S+( [a-zA-Z0-9]+='?[^']*')+ ?\/?>/
this.BASIC_PROTECTED_PATTERN_2 = /<\S+(?: [a-zA-Z0-9]+="[^"]*")+ ?\/?>/
this.BASIC_PROTECTED_PATTERN_3 = /<\S+(?: [a-zA-Z0-9]+='[^']*')+ ?\/?>/
this.BASIC_PROTECTED_PATTERN_4 = /[\w\-_.]+@([\w\-_]+\.)+[a-zA-Z]{2,}/
this.BASIC_PROTECTED_PATTERN_5 =
/(https?|ftp):\/\/[^:/\s]+(\/\w+)*\/[\w\-.]+/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,11 @@ class IndicProcessor {
this._END_BRACKET_SPACE_PUNC_REGEX = /\) ([.!:?;,])/g

this._URL_PATTERN =
/\b(?<![\w/.])(?:(?:https?|ftp):\/\/)?(?:(?:[\w-]+\.)+(?!\.))(?:[\w/\-?#&=%.]+)+(?!\.\w+)\b/g
/\b(?<![\w/.])(?:(?:https?|ftp):\/\/)?(?:[\w-]+\.)+(?!\.)[\w/\-?#&=%.]*(?!\.\w+)\b/g
this._NUMERAL_PATTERN =
/(~?\d+\.?\d*\s?%?\s?-?\s?~?\d+\.?\d*\s?%|~?\d+%|\d+[-/.,:']\d+[-/.,:'+]\d+(?:\.\d+)?|\d+[-/.:'+]\d+(?:\.\d+)?)/g
/(~?\d{1,20}(?:\.\d{1,20})?\s?%?\s?-?\s?~?\d{1,20}(?:\.\d{1,20})?\s?%|~?\d{1,20}%|\d{1,20}[-/.,:']\d{1,20}[-/.,:']{1,5}\d{1,20}(?:\.\d{1,20})?|\d{1,20}[-/.:'+]\d{1,20}(?:\.\d{1,20})?)/g
this._EMAIL_PATTERN = /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}/g
this._OTHER_PATTERN = /[A-Za-z0-9]*[#|@]\w+/g
this._OTHER_PATTERN = /[A-Za-z0-9]{0,100}[#|@]\w{1,100}/g

// Combined punctuation replacements
this._PUNC_REPLACEMENTS = [
Expand Down
Loading