{ "metadata": { "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.8.3-final" }, "orig_nbformat": 2, "kernelspec": { "name": "Python 3.8.3 64-bit", "display_name": "Python 3.8.3 64-bit", "metadata": { "interpreter": { "hash": "0de36b31320ba4c88b4f85a74724f3d16c36a44df48581253710b1065e752d9e" } } } }, "nbformat": 4, "nbformat_minor": 2, "cells": [ { "source": [ "# Training a Nerual Network to generate Trump Nicknames\n", "\n", "The data was scraped directly from [Wikipedia from this link here](https://en.wikipedia.org/wiki/List_of_nicknames_used_by_Donald_Trump). The data was then cleaned and analyzed by me, [click this link here to see that analysis](https://github.com/Alexander-Kahanek/trump_nickname_gen/blob/main/intial_analysis.ipynb). \n", "\n", "This notebook is going to be a word-based approach to nickname generation. We will be going through the preprocessing required to create affix embeddings, tokenize, encode, decode, and finally train the Keras LSTM neural network. \n", "\n", "I also walk through this process [utilizing a character-based approach](https://github.com/Alexander-Kahanek/trump_nickname_gen/blob/main/2_character.nn.gen.ipynb); however, the results were hilariously bad.\n", "\n", "# Grabbing the data" ], "cell_type": "markdown", "metadata": {} }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ " fake name real name len fake len real \\\n", "0 dumbo randolph tex alles 1 3 \n", "1 wheres hunter hunter biden 2 2 \n", "2 1% joe joe biden 2 2 \n", "3 basement joe joe biden 3 2 \n", "4 beijing joe joe biden 3 2 \n", "\n", " category \\\n", "0 domestic political figures \n", "1 domestic political figures \n", "2 domestic political figures \n", "3 domestic political figures \n", "4 domestic political figures \n", "\n", " notes count \n", "0 director of the united states secret service 1 \n", "1 american lawyer and lobbyist who is the second... 1 \n", "2 47th vice president of the united states; form... 1 \n", "3 47th vice president of the united states; form... 1 \n", "4 47th vice president of the united states; form... 1 " ], "text/html": "
\n | fake name | \nreal name | \nlen fake | \nlen real | \ncategory | \nnotes | \ncount | \n
---|---|---|---|---|---|---|---|
0 | \ndumbo | \nrandolph tex alles | \n1 | \n3 | \ndomestic political figures | \ndirector of the united states secret service | \n1 | \n
1 | \nwheres hunter | \nhunter biden | \n2 | \n2 | \ndomestic political figures | \namerican lawyer and lobbyist who is the second... | \n1 | \n
2 | \n1% joe | \njoe biden | \n2 | \n2 | \ndomestic political figures | \n47th vice president of the united states; form... | \n1 | \n
3 | \nbasement joe | \njoe biden | \n3 | \n2 | \ndomestic political figures | \n47th vice president of the united states; form... | \n1 | \n
4 | \nbeijing joe | \njoe biden | \n3 | \n2 | \ndomestic political figures | \n47th vice president of the united states; form... | \n1 | \n