Datasets:
laugustyniak
commited on
Commit
•
cf564ba
1
Parent(s):
f375707
notebook update
Browse files- notebooks/convert-dataset.ipynb +12 -33
notebooks/convert-dataset.ipynb
CHANGED
@@ -236,8 +236,8 @@
|
|
236 |
"iob_dataset = pd.DataFrame([\n",
|
237 |
" {\n",
|
238 |
" **convert_spacy_to_iob(row[\"text\"], row[\"spans\"], nlp),\n",
|
239 |
-
" \"url\": row[\"url\"],\n",
|
240 |
-
" \"tweet_id\": row[\"url\"].split(\"/\")[-1],\n",
|
241 |
" }\n",
|
242 |
" for _, row\n",
|
243 |
" in tqdm(data_df.iterrows())\n",
|
@@ -451,63 +451,42 @@
|
|
451 |
{
|
452 |
"cell_type": "code",
|
453 |
"execution_count": null,
|
454 |
-
"id": "
|
455 |
"metadata": {},
|
456 |
"outputs": [],
|
457 |
"source": [
|
458 |
-
"train.
|
459 |
-
"test.
|
460 |
-
"dev.
|
461 |
]
|
462 |
},
|
463 |
{
|
464 |
"cell_type": "code",
|
465 |
"execution_count": null,
|
466 |
-
"id": "
|
467 |
"metadata": {},
|
468 |
"outputs": [],
|
469 |
"source": [
|
470 |
-
"df = pd.
|
471 |
]
|
472 |
},
|
473 |
{
|
474 |
"cell_type": "code",
|
475 |
"execution_count": null,
|
476 |
-
"id": "
|
477 |
"metadata": {},
|
478 |
"outputs": [],
|
479 |
"source": [
|
480 |
"df"
|
481 |
]
|
482 |
-
},
|
483 |
-
{
|
484 |
-
"cell_type": "code",
|
485 |
-
"execution_count": null,
|
486 |
-
"id": "eea225bb",
|
487 |
-
"metadata": {},
|
488 |
-
"outputs": [],
|
489 |
-
"source": [
|
490 |
-
"for idx, row in df.iterrows():\n",
|
491 |
-
" print(row.tweet_id)"
|
492 |
-
]
|
493 |
-
},
|
494 |
-
{
|
495 |
-
"cell_type": "code",
|
496 |
-
"execution_count": null,
|
497 |
-
"id": "7c5b26e9",
|
498 |
-
"metadata": {},
|
499 |
-
"outputs": [],
|
500 |
-
"source": [
|
501 |
-
"print(train.head(1).T.values)"
|
502 |
-
]
|
503 |
}
|
504 |
],
|
505 |
"metadata": {
|
506 |
"interpreter": {
|
507 |
-
"hash": "
|
508 |
},
|
509 |
"kernelspec": {
|
510 |
-
"display_name": "Python 3.9.
|
511 |
"language": "python",
|
512 |
"name": "python3"
|
513 |
},
|
@@ -521,7 +500,7 @@
|
|
521 |
"name": "python",
|
522 |
"nbconvert_exporter": "python",
|
523 |
"pygments_lexer": "ipython3",
|
524 |
-
"version": "3.9.
|
525 |
}
|
526 |
},
|
527 |
"nbformat": 4,
|
|
|
236 |
"iob_dataset = pd.DataFrame([\n",
|
237 |
" {\n",
|
238 |
" **convert_spacy_to_iob(row[\"text\"], row[\"spans\"], nlp),\n",
|
239 |
+
" # \"url\": row[\"url\"],\n",
|
240 |
+
" # \"tweet_id\": row[\"url\"].split(\"/\")[-1],\n",
|
241 |
" }\n",
|
242 |
" for _, row\n",
|
243 |
" in tqdm(data_df.iterrows())\n",
|
|
|
451 |
{
|
452 |
"cell_type": "code",
|
453 |
"execution_count": null,
|
454 |
+
"id": "fdb29857",
|
455 |
"metadata": {},
|
456 |
"outputs": [],
|
457 |
"source": [
|
458 |
+
"train.to_parquet(\"../train.parquet\")\n",
|
459 |
+
"test.to_parquet(\"../test.parquet\")\n",
|
460 |
+
"dev.to_parquet(\"../dev.parquet\")"
|
461 |
]
|
462 |
},
|
463 |
{
|
464 |
"cell_type": "code",
|
465 |
"execution_count": null,
|
466 |
+
"id": "c5b20f97",
|
467 |
"metadata": {},
|
468 |
"outputs": [],
|
469 |
"source": [
|
470 |
+
"df = pd.read_parquet(\"../train.parquet\")"
|
471 |
]
|
472 |
},
|
473 |
{
|
474 |
"cell_type": "code",
|
475 |
"execution_count": null,
|
476 |
+
"id": "e05e0d83",
|
477 |
"metadata": {},
|
478 |
"outputs": [],
|
479 |
"source": [
|
480 |
"df"
|
481 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
482 |
}
|
483 |
],
|
484 |
"metadata": {
|
485 |
"interpreter": {
|
486 |
+
"hash": "97bd981c6355438647fbd6d64b9445f9e50a1f8ddfec47bd063c9ea6e8fe3e87"
|
487 |
},
|
488 |
"kernelspec": {
|
489 |
+
"display_name": "Python 3.9.5 ('embeddings')",
|
490 |
"language": "python",
|
491 |
"name": "python3"
|
492 |
},
|
|
|
500 |
"name": "python",
|
501 |
"nbconvert_exporter": "python",
|
502 |
"pygments_lexer": "ipython3",
|
503 |
+
"version": "3.9.5"
|
504 |
}
|
505 |
},
|
506 |
"nbformat": 4,
|