langchain/docs/extras/integrations/document_loaders/imsdb.ipynb

120 lines
2.7 KiB
Plaintext
Raw Normal View History

2023-02-09 15:52:50 +00:00
{
"cells": [
{
"cell_type": "markdown",
"id": "cc9b809c",
"metadata": {},
"source": [
"# IMSDb\n",
"\n",
">[IMSDb](https://imsdb.com/) is the `Internet Movie Script Database`.\n",
"\n",
"This covers how to load `IMSDb` webpages into a document format that we can use downstream."
2023-02-09 15:52:50 +00:00
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "9d1f867e",
"metadata": {
"tags": []
},
2023-02-09 15:52:50 +00:00
"outputs": [],
"source": [
"from langchain.document_loaders import IMSDbLoader"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "84a32aa1",
"metadata": {
"tags": []
},
2023-02-09 15:52:50 +00:00
"outputs": [],
"source": [
"loader = IMSDbLoader(\"https://imsdb.com/scripts/BlacKkKlansman.html\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "8ae5ffe2",
"metadata": {
"tags": []
},
2023-02-09 15:52:50 +00:00
"outputs": [],
"source": [
"data = loader.load()"
]
},
{
"cell_type": "code",
"execution_count": 8,
2023-02-09 15:52:50 +00:00
"id": "d41da111",
"metadata": {
"tags": []
},
2023-02-09 15:52:50 +00:00
"outputs": [
{
"data": {
"text/plain": [
"'\\n\\r\\n\\r\\n\\r\\n\\r\\n BLACKKKLANSMAN\\r\\n \\r\\n \\r\\n \\r\\n \\r\\n Written by\\r\\n\\r\\n Charlie Wachtel & David Rabinowitz\\r\\n\\r\\n and\\r\\n\\r\\n Kevin Willmott & Spike Lee\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n FADE IN:\\r\\n \\r\\n SCENE FROM \"GONE WITH'"
2023-02-09 15:52:50 +00:00
]
},
"execution_count": 8,
2023-02-09 15:52:50 +00:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data[0].page_content[:500]"
2023-02-09 15:52:50 +00:00
]
},
{
"cell_type": "code",
"execution_count": 6,
2023-02-09 15:52:50 +00:00
"id": "207bc39b",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"{'source': 'https://imsdb.com/scripts/BlacKkKlansman.html'}"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data[0].metadata"
]
2023-02-09 15:52:50 +00:00
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
2023-02-09 15:52:50 +00:00
}
},
"nbformat": 4,
"nbformat_minor": 5
}