Datasets:
Tasks:
Question Answering
Modalities:
Text
Formats:
csv
Sub-tasks:
multiple-choice-qa
Languages:
Portuguese
Size:
1M - 10M
License:
ju-resplande
commited on
Commit
•
54519b9
1
Parent(s):
9224bff
Remove non-portuguese domains
Browse files- preprocess_data.ipynb +35 -1
preprocess_data.ipynb
CHANGED
@@ -221,7 +221,7 @@
|
|
221 |
"\n",
|
222 |
"!apt update -y\n",
|
223 |
"!apt install -y enchant libenchant-dev hunspell-pt-br\n",
|
224 |
-
"!pip install pyenchant datasets"
|
225 |
]
|
226 |
},
|
227 |
{
|
@@ -612,6 +612,40 @@
|
|
612 |
")"
|
613 |
]
|
614 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
615 |
{
|
616 |
"cell_type": "code",
|
617 |
"execution_count": null,
|
|
|
221 |
"\n",
|
222 |
"!apt update -y\n",
|
223 |
"!apt install -y enchant libenchant-dev hunspell-pt-br\n",
|
224 |
+
"!pip install pyenchant datasets pycountry"
|
225 |
]
|
226 |
},
|
227 |
{
|
|
|
612 |
")"
|
613 |
]
|
614 |
},
|
615 |
+
{
|
616 |
+
"cell_type": "code",
|
617 |
+
"execution_count": null,
|
618 |
+
"metadata": {},
|
619 |
+
"outputs": [],
|
620 |
+
"source": [
|
621 |
+
"import pycountry\n",
|
622 |
+
"\n",
|
623 |
+
"PT_COUNTRIES = [\n",
|
624 |
+
" 'brazil',\n",
|
625 |
+
" 'portugal',\n",
|
626 |
+
" 'angola',\n",
|
627 |
+
" 'cabo verde',\n",
|
628 |
+
" 'guinea-bissau',\n",
|
629 |
+
" 'mozambique',\n",
|
630 |
+
" 'timor-leste'\n",
|
631 |
+
"]\n",
|
632 |
+
"\n",
|
633 |
+
"def is_portuguese(domain):\n",
|
634 |
+
" end = domain.split('.')[-1]\n",
|
635 |
+
"\n",
|
636 |
+
" if len(end) != 2:\n",
|
637 |
+
" return True\n",
|
638 |
+
"\n",
|
639 |
+
" language = pycountry.countries.get(alpha_2=end)\n",
|
640 |
+
"\n",
|
641 |
+
" if not language:\n",
|
642 |
+
" return True\n",
|
643 |
+
"\n",
|
644 |
+
" return language.name.lower() in PT_COUNTRIES\n",
|
645 |
+
"\n",
|
646 |
+
"prepro_data = prepro_data.filter(lambda examples: is_portuguese(examples['domain'])) "
|
647 |
+
]
|
648 |
+
},
|
649 |
{
|
650 |
"cell_type": "code",
|
651 |
"execution_count": null,
|