{"nbformat": 3, "worksheets": [{"cells": [{"cell_type": "code", "language": "python", "input": ["import numpy as np\n", "import numpy.linalg as la\n", "import matplotlib.pyplot as pt"], "collapsed": false, "prompt_number": 9, "metadata": {}, "outputs": []}, {"cell_type": "code", "language": "python", "input": ["with open(\"nixon.txt\") as textf:\n", " nixon = textf.read()\n", "with open(\"clinton.txt\") as textf:\n", " clinton = textf.read()\n", "with open(\"rail-transport.txt\") as textf:\n", " rail = textf.read()"], "collapsed": false, "prompt_number": 10, "metadata": {}, "outputs": []}, {"cell_type": "code", "language": "python", "input": ["print(nixon[:500])"], "collapsed": false, "prompt_number": 11, "metadata": {}, "outputs": [{"stream": "stdout", "text": ["\n", "Richard Nixon\n", "From Wikipedia, the free encyclopedia\n", "Richard Nixon\n", "Richard M. Nixon, ca. 1935 - 1982 - NARA - 530679.jpg\n", "37th President of the United States\n", "In office\n", "January 20, 1969 \u2013 August 9, 1974\n", "Vice President \n", "\n", " Spiro Agnew (1969\u20131973)\n", " None (Oct\u2013Dec 1973)\n", " Gerald Ford (1973\u20131974)\n", "\n", "Preceded by Lyndon Johnson\n", "Succeeded by Gerald Ford\n", "36th Vice President of the United States\n", "In office\n", "January 20, 1953 \u2013 January 20, 1961\n", "President Dwight Eisenhower\n", "Preceded b\n"], "output_type": "stream"}]}, {"source": ["How would you turn this into a vector?"], "metadata": {}, "cell_type": "markdown"}, {"cell_type": "code", "language": "python", "input": ["nixon_vec = [ord(c) for c in nixon]"], "collapsed": false, "prompt_number": 12, "metadata": {}, "outputs": []}, {"cell_type": "code", "language": "python", "input": ["print nixon_vec[:300]"], "collapsed": false, "prompt_number": 13, "metadata": {}, "outputs": [{"stream": "stdout", "text": ["[10, 82, 105, 99, 104, 97, 114, 100, 32, 78, 105, 120, 111, 110, 10, 70, 114, 111, 109, 32, 87, 105, 107, 105, 112, 101, 100, 105, 97, 44, 32, 116, 104, 101, 32, 102, 114, 101, 101, 32, 101, 110, 99, 121, 99, 108, 111, 112, 101, 100, 105, 97, 10, 82, 105, 99, 104, 97, 114, 100, 32, 78, 105, 120, 111, 110, 10, 82, 105, 99, 104, 97, 114, 100, 32, 77, 46, 32, 78, 105, 120, 111, 110, 44, 32, 99, 97, 46, 32, 49, 57, 51, 53, 32, 45, 32, 49, 57, 56, 50, 32, 45, 32, 78, 65, 82, 65, 32, 45, 32, 53, 51, 48, 54, 55, 57, 46, 106, 112, 103, 10, 51, 55, 116, 104, 32, 80, 114, 101, 115, 105, 100, 101, 110, 116, 32, 111, 102, 32, 116, 104, 101, 32, 85, 110, 105, 116, 101, 100, 32, 83, 116, 97, 116, 101, 115, 10, 73, 110, 32, 111, 102, 102, 105, 99, 101, 10, 74, 97, 110, 117, 97, 114, 121, 32, 50, 48, 44, 32, 49, 57, 54, 57, 32, 226, 128, 147, 32, 65, 117, 103, 117, 115, 116, 32, 57, 44, 32, 49, 57, 55, 52, 10, 86, 105, 99, 101, 32, 80, 114, 101, 115, 105, 100, 101, 110, 116, 32, 32, 10, 10, 32, 32, 32, 32, 83, 112, 105, 114, 111, 32, 65, 103, 110, 101, 119, 32, 40, 49, 57, 54, 57, 226, 128, 147, 49, 57, 55, 51, 41, 10, 32, 32, 32, 32, 78, 111, 110, 101, 32, 40, 79, 99, 116, 226, 128, 147, 68, 101, 99, 32, 49, 57, 55, 51, 41, 10, 32, 32, 32, 32, 71, 101, 114, 97, 108, 100, 32, 70, 111, 114, 100, 32, 40, 49, 57, 55, 51, 226, 128]\n"], "output_type": "stream"}]}, {"source": ["Let's try another way."], "metadata": {}, "cell_type": "markdown"}, {"cell_type": "code", "language": "python", "input": ["def split_into_words(s):\n", " import re\n", " return re.split(\"[., \\n\\t]+\", s)"], "collapsed": false, "prompt_number": 14, "metadata": {}, "outputs": []}, {"cell_type": "code", "language": "python", "input": ["print split_into_words(nixon)[:300]"], "collapsed": false, "prompt_number": 17, "metadata": {}, "outputs": [{"stream": "stdout", "text": ["['', 'Richard', 'Nixon', 'From', 'Wikipedia', 'the', 'free', 'encyclopedia', 'Richard', 'Nixon', 'Richard', 'M', 'Nixon', 'ca', '1935', '-', '1982', '-', 'NARA', '-', '530679', 'jpg', '37th', 'President', 'of', 'the', 'United', 'States', 'In', 'office', 'January', '20', '1969', '\\xe2\\x80\\x93', 'August', '9', '1974', 'Vice', 'President', 'Spiro', 'Agnew', '(1969\\xe2\\x80\\x931973)', 'None', '(Oct\\xe2\\x80\\x93Dec', '1973)', 'Gerald', 'Ford', '(1973\\xe2\\x80\\x931974)', 'Preceded', 'by', 'Lyndon', 'Johnson', 'Succeeded', 'by', 'Gerald', 'Ford', '36th', 'Vice', 'President', 'of', 'the', 'United', 'States', 'In', 'office', 'January', '20', '1953', '\\xe2\\x80\\x93', 'January', '20', '1961', 'President', 'Dwight', 'Eisenhower', 'Preceded', 'by', 'Alben', 'Barkley', 'Succeeded', 'by', 'Lyndon', 'Johnson', 'United', 'States', 'Senator', 'from', 'California', 'In', 'office', 'December', '4', '1950', '\\xe2\\x80\\x93', 'January', '1', '1953', 'Preceded', 'by', 'Sheridan', 'Downey', 'Succeeded', 'by', 'Thomas', 'Kuchel', 'Member', 'of', 'the', 'U', 'S', 'House', 'of', 'Representatives', 'from', \"California's\", '12th', 'district', 'In', 'office', 'January', '3', '1947', '\\xe2\\x80\\x93', 'December', '1', '1950', 'Preceded', 'by', 'Jerry', 'Voorhis', 'Succeeded', 'by', 'Patrick', 'Hillings', 'Personal', 'details', 'Born', 'Richard', 'Milhous', 'Nixon', 'January', '9', '1913', 'Yorba', 'Linda', 'California', 'U', 'S', 'Died', 'April', '22', '1994', '(aged', '81)', 'New', 'York', 'City', 'New', 'York', 'U', 'S', 'Resting', 'place', 'Richard', 'Nixon', 'Presidential', 'Library', 'and', 'Museum', 'Yorba', 'Linda', 'California', 'U', 'S', 'Political', 'party', 'Republican', 'Spouse(s)', 'Pat', 'Ryan', '(1940\\xe2\\x80\\x931993;', 'her', 'death)', 'Children', 'Tricia', 'Nixon', 'Julie', 'Nixon', 'Alma', 'mater', 'Whittier', 'College', 'Duke', 'University', 'School', 'of', 'Law', 'Profession', 'Lawyer', 'Religion', 'Quaker', 'Nickname', 'Dick', 'Signature', 'Cursive', 'signature', 'in', 'ink', 'Military', 'service', 'Allegiance', 'United', 'States', 'of', 'America', 'Service/branch', 'United', 'States', 'Navy', 'Years', 'of', 'service', '1942\\xe2\\x80\\x931946', 'Rank', 'US-O4', 'insignia', 'svg', 'Lieutenant', 'commander', 'Battles/wars', 'World', 'War', 'II', '\\xe2\\x80\\xa2', 'Pacific', 'War', 'Awards', 'American', 'Campaign', 'Medal', 'Asiatic-Pacific', 'Campaign', 'Medal', '(2', 'service', 'stars)', 'World', 'War', 'II', 'Victory', 'Medal', 'Richard', 'Milhous', 'Nixon', '(January', '9', '1913', '\\xe2\\x80\\x93', 'April', '22', '1994)', 'was', 'the', '37th', 'President', 'of', 'the', 'United', 'States', 'serving', 'from', '1969', 'to', '1974', 'when', 'he', 'became', 'the', 'only', 'president', 'to', 'resign', 'the', 'office', 'Nixon', 'had', 'previously', 'served', 'as', 'a', 'Republican', 'U', 'S', 'Representative', 'and', 'Senator', 'from', 'California', 'and', 'as']\n"], "output_type": "stream"}]}, {"cell_type": "code", "language": "python", "input": ["\n", "word_numbers = {}\n", "\n", "def learn(s):\n", " for word in split_into_words(s):\n", " if word not in word_numbers:\n", " word_numbers[word] = len(word_numbers)\n", " \n", "def string_to_vec(s):\n", " result = np.zeros(len(word_numbers))\n", " for word in split_into_words(s):\n", " result[word_numbers[word]] += 1\n", " return result"], "collapsed": false, "prompt_number": 18, "metadata": {}, "outputs": []}, {"cell_type": "code", "language": "python", "input": ["\n", "learn(nixon)\n", "learn(clinton)\n", "learn(rail)\n", "\n", "nixon_v = string_to_vec(nixon)\n", "clinton_v = string_to_vec(clinton)\n", "rail_v = string_to_vec(rail)"], "collapsed": false, "prompt_number": 19, "metadata": {}, "outputs": []}, {"source": ["Plotting could give some insight on this data."], "metadata": {}, "cell_type": "markdown"}, {"cell_type": "code", "language": "python", "input": ["pt.plot(nixon_v)"], "collapsed": false, "prompt_number": 20, "metadata": {}, "outputs": [{"text": ["[]"], "prompt_number": 20, "output_type": "pyout", "metadata": {}}, {"text": [""], "png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEACAYAAAC+gnFaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGDpJREFUeJzt3XuQXFWdwPHvQIgKroTR3bzdRCBCxAeIyCJCQ8VspDAJ\nu1VJUDBKdimNaHQLJXEVhrLAwEr5hF1hNzhgEo2PjQFZTIC0okIQCJpkCHkgygQzvAR5iCbQ+8c5\nTff0vG5Puuf29P1+qrruueee2/ccmNxfn3Nu9wFJkiRJkiRJkiRJkiRJkiSpm0XAJmBzTAO0AuuA\nbcBaYFRZ+SXAdmArMH3oqilJqoejCEHglcD+hJv/ocDlwGdimQuApTE9FbgPOACYBOwA9hu66kqS\nqjXQTfoIYAPwAvAi8FPgn4GZQHss0w7MjulZwEpgD/AQIRAcV9MaS5JqaqBAsBl4N2Eo6EDgNGAC\nMBroimW64j7AOKCz7PxOYHytKitJqr0RAxzfClxGmAd4jjDs82JFmUJ89aW/Y5KklA0UCACWxRfA\nJYRP+V3AGGA3MBZ4NB7fBUwsO3dCzOvm0EMPLezcuXOQVZakzNoJHFbrN00ykft3cft64J+AFcAa\nYH7Mnw+sjuk1wDxgJDAZOBy4q/INd+7cSaFQaNrXRRddlHodbJ/ty1rbstA+wsM6NZekR/B94LWE\nCeCFwNOEp4RWAQsIk8JzYtmOmN8B7I3lHRqSpAaWJBCc1Evek8C0PspfGl+SpGHAZ/zrIJfLpV2F\nurJ9w1cztw2av3310pLSdQtxvEuSlFBLSwvU4b5tj0CSMs5AIEkZZyCQpIwzEEhSxhkIJCnjDASS\nlHEGAknKOAOBJGWcgUCSMs5AIEkZZyCQpIwzEEhSxhkIJCnjDASSlHFJAsESYAuwibBM5SuAVmAd\nsI2wsP2oivLbCQvfT69lZSVJtTfQ71pPAm4DjgT+AnwXuA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lhF6fHKSXVoQ38q23dOrMvvKN1friorP9zaJ0mSJEmSJEmSJEmSJEmSJEmS\nJElqVP8PGuI1sWAEWU8AAAAASUVORK5CYII=\n", "output_type": "display_data", "metadata": {}}]}, {"cell_type": "code", "language": "python", "input": ["pt.plot(clinton_v)"], "collapsed": false, "prompt_number": 21, "metadata": {}, "outputs": [{"text": ["[]"], "prompt_number": 21, "output_type": "pyout", "metadata": {}}, {"text": [""], "png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEACAYAAAC+gnFaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGhNJREFUeJzt3XuQHMWd4PHvgADb2CAUEHoBlgzIWA78AFa2zzhoHLKQ\nvTLShlkBsTh0hl3HLmCzXMQaxK1Pw+4GJ3PeNbZ3sX34zA4cCGQeQsK2LNCpOTC2gEOwwCD0QsBI\naMRLPI0eqO6PzKYf0zPTPeqerp76fiIqKisrqypzHvnryqzuBkmSJEmSJEmSJEmSJEmSJKnMfOBJ\n4HHgJuAgYAxwN7AOWAGMrii/HlgLzBjWmkqSGm4SsInQ+QPcAswDrgK+E/MuBRbG9FTgUeCAeOwG\nYL/hqaokaSgG66RfB3YDHwBGxfVW4AygK5bpAubE9GxgUTxmMyEQTGtojSVJDTVYIHgF+GfgOUIA\n2EEYEhoL9MYyvXEbYALQU3J8DzCxUZWVJDXeYIHgGOBvCcM8E4APAudWlEni0p+B9kmSWmzUIPtP\nBh4AXo7btwOfA7YB4+J6PLA97t8CHFVy/JExr8wxxxyTbNy4cei1lqRs2ggc2+iTDnZHsBb4LPB+\noAOYDnQDywiTxsT1kpheCpwNHAhMBo4DHqw86caNG0mSZMQuCxYsaHkdbJ/ty1rbstA+wihNww12\nR/AYcD3wMLAXeAT4n8CHgMXA+YRJ4bmxfHfM7wb2ABfg0JAkpdpggQDCo6JXVeS9Qrg7qObKuEiS\n2oDP+DdBLpdrdRWayva1r5HcNhj57WuWjhZdN4njXZKkGnV0dEAT+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vULW8\n2awdLAGmEyL02Jg3Lm5DiOCldzvLCU9TjSdE/YKzgZ82taa1OxK4BziN4h3BSGnfoYTOstJIaN8Y\nwguTwwgBbhmhU2n3tk2ivKNsZHuWE+4IIfzMXmxUpeswifL2lfoz4H/H9LC0b7g/dG4i8HzJdk/M\nayeTCNF8NeEPs/DJOr0U/1AnENpWUGhnZf4W0tP+HwB/R3jUt2CktG8y4Z/hOuARwhseD2ZktO8V\n4J+B54CtwA7CEMpIaFupRrantB/aA7xGCKhpcR7hFT4MU/uGOxC0+7vIPgjcBlwMVH7QcNPe9TcM\nZgHbCfMD/b23pJ3bNwo4kXC7fCLwFlU/9qQt23cM8LeEFygTCH+jlZ9f2q5t689Ia0+p/wrsIsz1\nDJvhDgRbCBOvBUdRHtXS7ABCELiBMDQE4ZVJ4T2L4wmdKfRt55GEdm6J6dL8Jn7PVs3+E3AG8Ayw\nCPgioZ0jpX09cSl84eithICwjfZv38nAA8DLhFd/txOGYEdC20o14m+xp+SYo2O6MF/0SuOrXLf/\nDHwF+IuSvJHUvve065vNOoDrCcMnpa6iOH53GX0neA4kDEtspPhKezVh/K6DdEw2VjqV4hzBSGrf\n/wXi1wzRSWjbSGjfJwlPsr2fUKcu4ELav22T6DtZ3Kj2XAD8JKbPpjWTqZMob99MwpNfh1eUa9f2\nDaod32x2CmHs/FHC8Mkawg99DGGCtdojbZcT2rgWOL0kv/DI1wbgR82u+BCcSvGpoZHUvk8S7ghK\nH88bKe37DsXHR7sId6/t3LZFhPmOXYSx7m/Q2PYcBCym+HjlpCa0YSCV7Tsv1uVZiv3LNSXl2619\nkiRJkiRJkiRJkiRJkiRJkiRJkqS0+v8FoKfNohU+eAAAAABJRU5ErkJggg==\n", "output_type": "display_data", "metadata": {}}]}, {"cell_type": "code", "language": "python", "input": ["pt.plot(rail_v)"], "collapsed": false, "prompt_number": 22, "metadata": {}, "outputs": [{"text": ["[]"], "prompt_number": 22, "output_type": "pyout", "metadata": {}}, {"text": [""], "png": "iVBORw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Zv4MYEDbT/OX7R+D/AH8kXv3dRWyCbYWy\nFavFZ7G7aJv/nkzn+4sG8cb0mvsMcCbwP4vSWql8f9asPzZrA24hNp8U+zaF9rtZ9O7gGUlslthI\n4Up7FbH9ro3G6GwsdRKFPoJWKt8vgUnJdCexbK1Qvr8n3sn2dmKe5gIzaf6yTaB3Z3GtyjMDuDGZ\nnkY6nakT6Fm+04l3fh1csl6zlq9fzfhjsxOJbedric0na4h/9IOIHazlbmm7lFjGdcBHi9Lzt3xt\nAK6vd8YH4SQKdw21Uvn+nlgjKL49r1XK91UKt4/OJdZem7ls84j9HW8R27o/S23Lsy8wn8LtlRPq\nUIa+lJbvgiQvz1I4v9xQtH6zlU+SJEmSJEmSJEmSJEmSJEmSJEmS1Kj+Pwh/Bk2frWLbAAAAAElF\nTkSuQmCC\n", "output_type": "display_data", "metadata": {}}]}, {"source": ["Now we need a measure of similarity."], "metadata": {}, "cell_type": "markdown"}, {"cell_type": "code", "language": "python", "input": ["def angle_cos(x, y):\n", " return np.dot(x, y)/(la.norm(x)*la.norm(y))"], "collapsed": false, "prompt_number": 23, "metadata": {}, "outputs": []}, {"cell_type": "code", "language": "python", "input": ["print angle_cos(nixon_v, clinton_v)"], "collapsed": false, "prompt_number": 24, "metadata": {}, "outputs": [{"stream": "stdout", "text": ["0.858089212872\n"], "output_type": "stream"}]}, {"cell_type": "code", "language": "python", "input": ["print angle_cos(clinton_v, rail_v)"], "collapsed": false, "prompt_number": 27, "metadata": {}, "outputs": [{"stream": "stdout", "text": ["0.835685969275\n"], "output_type": "stream"}]}, {"cell_type": "code", "language": "python", "input": ["print angle_cos(nixon_v, rail_v)"], "collapsed": false, "prompt_number": 28, "metadata": {}, "outputs": [{"stream": "stdout", "text": ["0.847799936746\n"], "output_type": "stream"}]}], "metadata": {}}], "nbformat_minor": 0, "metadata": {"name": "", "signature": "sha256:f0dd2cf45e1be437a5fbf10b5d1cdc156db3cd5fa241cbe4b9b42892ed36bf94"}}