Spaces:
Sleeping
Sleeping
Upload patch_index.js with huggingface_hub
Browse files- patch_index.js +13 -0
patch_index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const fs = require('fs');
|
| 2 |
+
let code = fs.readFileSync('index.js', 'utf8');
|
| 3 |
+
|
| 4 |
+
code = code.replace(
|
| 5 |
+
'const queryFuzzy = "SELECT audio FROM \'data/*.parquet\' WHERE regexp_replace(word_ar, \'[ูููููููููฐ]\', \'\', \'g\') = ? LIMIT 1";',
|
| 6 |
+
`const hasTanween = word.match(/[ููู]/) !== null;
|
| 7 |
+
let queryFuzzy = "SELECT audio FROM 'data/*.parquet' WHERE regexp_replace(word_ar, '[ูููููููููฐ]', '', 'g') = ? LIMIT 1";
|
| 8 |
+
if (!hasTanween) {
|
| 9 |
+
queryFuzzy = "SELECT audio FROM 'data/*.parquet' WHERE regexp_replace(word_ar, '[ูููููููููฐ]', '', 'g') = ? AND right(word_ar, 1) NOT IN ('ู', 'ู', 'ู') LIMIT 1";
|
| 10 |
+
}`
|
| 11 |
+
);
|
| 12 |
+
|
| 13 |
+
fs.writeFileSync('index.js', code);
|