Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 55 additions & 38 deletions your-code/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -35,7 +35,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -48,9 +48,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"13637"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(prophet)"
]
Expand All @@ -66,11 +77,11 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"# your code here"
"prophet = prophet[568:]"
]
},
{
Expand All @@ -82,11 +93,19 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['PROPHET\\n\\n|Almustafa,', 'the{7}', 'chosen', 'and', 'the\\nbeloved,', 'who', 'was', 'a', 'dawn', 'unto']\n"
]
}
],
"source": [
"# your code here"
"print(prophet[:10])"
]
},
{
Expand All @@ -100,7 +119,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -119,11 +138,12 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"# your code here"
"def reference(x):\n",
" return x.split('{')[0]"
]
},
{
Expand All @@ -135,11 +155,11 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"# your code here"
"prophet_reference = list(map(reference, prophet))"
]
},
{
Expand All @@ -151,7 +171,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -163,9 +183,7 @@
" Example:\n",
" Input: 'the\\nbeloved'\n",
" Output: ['the', 'beloved']\n",
" '''\n",
" \n",
" # your code here"
" '''\n"
]
},
{
Expand All @@ -177,13 +195,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 17,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"# your code here"
"prophet_line = list(map(line_break, prophet_reference))"
]
},
{
Expand All @@ -195,21 +213,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
"prophet_flat = [i for sub in prophet_line for i in sub]\n",
"prophet_flat"
"prophet_flat = [i for sub in prophet_line if sub is not None for i in sub]\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 23,
"metadata": {},
"outputs": [],
"source": [
"# your code here"
"filtered_prophet = list(filter(word_filter, prophet_flat))"
]
},
{
Expand All @@ -223,7 +240,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 22,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -256,13 +273,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 24,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"# your code here"
"prophet_filter = list(filter(word_filter, prophet_flat))"
]
},
{
Expand All @@ -276,15 +293,14 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 25,
"metadata": {},
"outputs": [],
"source": [
"def word_filter_case(x):\n",
" \n",
" word_list = ['and', 'the', 'a', 'an']\n",
" \n",
" # your code here"
" return x.lower() not in word_list"
]
},
{
Expand All @@ -300,7 +316,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 26,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -319,13 +335,14 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 27,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"# your code here"
"def concat_space(a, b):\n",
" return a +''+ b"
]
},
{
Expand All @@ -337,17 +354,17 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 29,
"metadata": {},
"outputs": [],
"source": [
"# your code here"
"prophet_string = reduce(concat_space, prophet_filter, '')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "base",
"language": "python",
"name": "python3"
},
Expand All @@ -361,7 +378,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.13.5"
}
},
"nbformat": 4,
Expand Down