dataset
Browse files- README.md +10 -0
- extract.ipynb +100 -0
- manuela.parquet +3 -0
- manuela.tsv +0 -0
README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Manuela: novela de costumbres colombianas
|
| 2 |
+
|
| 3 |
+
This repository contains text extracted from the novel _Manuela: Novela de Costumbres Colombianas_. All content has been sourced from the Biblioteca Virtual Miguel de Cervantes.
|
| 4 |
+
|
| 5 |
+
**None of the content in this repository is original or authored by me. It is solely taken from the Biblioteca Virtual Miguel de Cervantes for educational and non-commercial purposes. If you wish to explore the original work or learn more about it, please visit the [Biblioteca Virtual Miguel de Cervantes](https://www.cervantesvirtual.com/).**
|
| 6 |
+
|
| 7 |
+
- [Tomo I](https://www.cervantesvirtual.com/obra-visor/manuela-novela-de-costumbres-colombianas-tomo-primero--0/html/ff1e97e4-82b1-11df-acc7-002185ce6064_2.html)
|
| 8 |
+
- [Tomo II](https://www.cervantesvirtual.com/obra-visor/manuela-novela-de-costumbres-colombianas-tomo-segundo--0/html/ff1ea73e-82b1-11df-acc7-002185ce6064_7.html)
|
| 9 |
+
|
| 10 |
+
|
extract.ipynb
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 1,
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"outputs": [],
|
| 8 |
+
"source": [
|
| 9 |
+
"import requests\n",
|
| 10 |
+
"from bs4 import BeautifulSoup\n",
|
| 11 |
+
"import re"
|
| 12 |
+
]
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"cell_type": "code",
|
| 16 |
+
"execution_count": 2,
|
| 17 |
+
"metadata": {},
|
| 18 |
+
"outputs": [],
|
| 19 |
+
"source": [
|
| 20 |
+
"def parse(url):\n",
|
| 21 |
+
" response = requests.get(url)\n",
|
| 22 |
+
" response.raise_for_status()\n",
|
| 23 |
+
"\n",
|
| 24 |
+
" soup = BeautifulSoup(response.text, \"html.parser\")\n",
|
| 25 |
+
"\n",
|
| 26 |
+
" pattern = re.compile(r\"—\\d+→\")\n",
|
| 27 |
+
"\n",
|
| 28 |
+
" cuerpo_div = soup.find(\"div\", id=\"cuerpo\")\n",
|
| 29 |
+
"\n",
|
| 30 |
+
" text_list = []\n",
|
| 31 |
+
" if cuerpo_div:\n",
|
| 32 |
+
" for p in cuerpo_div.find_all(\"p\"): # Iterate through all <p> elements\n",
|
| 33 |
+
" full_text = \" \".join(p.stripped_strings).replace(\"\\n\", \" \")\n",
|
| 34 |
+
" cleaned_text = pattern.sub(\"\", full_text)\n",
|
| 35 |
+
" if cleaned_text:\n",
|
| 36 |
+
" text_list.append(cleaned_text)\n",
|
| 37 |
+
"\n",
|
| 38 |
+
" return text_list"
|
| 39 |
+
]
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"cell_type": "code",
|
| 43 |
+
"execution_count": 3,
|
| 44 |
+
"metadata": {},
|
| 45 |
+
"outputs": [],
|
| 46 |
+
"source": [
|
| 47 |
+
"t1 = parse(\n",
|
| 48 |
+
" \"https://www.cervantesvirtual.com/obra-visor/manuela-novela-de-costumbres-colombianas-tomo-primero--0/html/ff1e97e4-82b1-11df-acc7-002185ce6064_2.html\"\n",
|
| 49 |
+
")\n",
|
| 50 |
+
"t2 = parse(\n",
|
| 51 |
+
" \"https://www.cervantesvirtual.com/obra-visor/manuela-novela-de-costumbres-colombianas-tomo-segundo--0/html/ff1ea73e-82b1-11df-acc7-002185ce6064_7.html\"\n",
|
| 52 |
+
")"
|
| 53 |
+
]
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"cell_type": "code",
|
| 57 |
+
"execution_count": 8,
|
| 58 |
+
"metadata": {},
|
| 59 |
+
"outputs": [],
|
| 60 |
+
"source": [
|
| 61 |
+
"texts = t1[:-2] + t2[:-2]\n",
|
| 62 |
+
"volume = [1] * len(t1[:-2]) + [2] * len(t2[:-2])"
|
| 63 |
+
]
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"cell_type": "code",
|
| 67 |
+
"execution_count": null,
|
| 68 |
+
"metadata": {},
|
| 69 |
+
"outputs": [],
|
| 70 |
+
"source": [
|
| 71 |
+
"import pandas as pd\n",
|
| 72 |
+
"\n",
|
| 73 |
+
"df = pd.DataFrame({\"volume\": volume, \"text\": texts})\n",
|
| 74 |
+
"df.to_csv(\"manuela.tsv\", sep='\\t', index=False)\n",
|
| 75 |
+
"df.to_parquet(\"manuela.parquet\", index=False)"
|
| 76 |
+
]
|
| 77 |
+
}
|
| 78 |
+
],
|
| 79 |
+
"metadata": {
|
| 80 |
+
"kernelspec": {
|
| 81 |
+
"display_name": "Python 3",
|
| 82 |
+
"language": "python",
|
| 83 |
+
"name": "python3"
|
| 84 |
+
},
|
| 85 |
+
"language_info": {
|
| 86 |
+
"codemirror_mode": {
|
| 87 |
+
"name": "ipython",
|
| 88 |
+
"version": 3
|
| 89 |
+
},
|
| 90 |
+
"file_extension": ".py",
|
| 91 |
+
"mimetype": "text/x-python",
|
| 92 |
+
"name": "python",
|
| 93 |
+
"nbconvert_exporter": "python",
|
| 94 |
+
"pygments_lexer": "ipython3",
|
| 95 |
+
"version": "3.11.9"
|
| 96 |
+
}
|
| 97 |
+
},
|
| 98 |
+
"nbformat": 4,
|
| 99 |
+
"nbformat_minor": 2
|
| 100 |
+
}
|
manuela.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:92634faf3cb810f47aa277e0b3369cf29715ca9558325ae80ff86b9524e7cdb1
|
| 3 |
+
size 187129
|
manuela.tsv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|