From 863bdd133169ceb729490c3ec7547d8d5047a20c Mon Sep 17 00:00:00 2001 From: Jason Yee Date: Thu, 18 Apr 2013 01:12:21 -0500 Subject: [PATCH] Added web urls so that pictures show up when editing the notebooks offline. Also print more info about lexical stats. --- ipython_notebooks/Chapter1.ipynb | 465 +++++++++++++++++++++++++++++-- 1 file changed, 447 insertions(+), 18 deletions(-) diff --git a/ipython_notebooks/Chapter1.ipynb b/ipython_notebooks/Chapter1.ipynb index c5f413c..e7979db 100644 --- a/ipython_notebooks/Chapter1.ipynb +++ b/ipython_notebooks/Chapter1.ipynb @@ -38,7 +38,7 @@ "\n", "Twitter implements OAuth 1.0A as its standard authentication mechanism, and in order to use it to make requests to Twitter's API, you'll need to go to https://dev.twitter.com/apps and create a sample application. There are four primary identifiers you'll need to note for an OAuth 1.0A workflow: consumer key, consumer secret, access token, and access token secret. Note that you will need an ordinary Twitter account in order to login, create an app, and get these credentials.\n", "\n", - "" + "" ] }, { @@ -87,7 +87,8 @@ ], "language": "python", "metadata": {}, - "outputs": [] + "outputs": [], + "prompt_number": 1 }, { "cell_type": "markdown", @@ -114,7 +115,16 @@ ], "language": "python", "metadata": {}, - "outputs": [] + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[{u'created_at': u'2013-04-18T06:00:25Z', u'trends': [{u'url': u'http://twitter.com/search?q=%23sometimesiwishthat', u'query': u'%23sometimesiwishthat', u'name': u'#sometimesiwishthat', u'promoted_content': None, u'events': None}, {u'url': u'http://twitter.com/search?q=%23MiPreguntaEs', u'query': u'%23MiPreguntaEs', u'name': u'#MiPreguntaEs', u'promoted_content': None, u'events': None}, {u'url': u'http://twitter.com/search?q=%23WestTX', u'query': u'%23WestTX', u'name': u'#WestTX', u'promoted_content': None, u'events': None}, {u'url': u'http://twitter.com/search?q=%23MentionSomeoneWhoHasAPrettyFace', u'query': u'%23MentionSomeoneWhoHasAPrettyFace', u'name': u'#MentionSomeoneWhoHasAPrettyFace', u'promoted_content': None, u'events': None}, {u'url': u'http://twitter.com/search?q=%23CosasRid%C3%ADculas', u'query': u'%23CosasRid%C3%ADculas', u'name': u'#CosasRid\\xedculas', u'promoted_content': None, u'events': None}, {u'url': u'http://twitter.com/search?q=Texas', u'query': u'Texas', u'name': u'Texas', u'promoted_content': None, u'events': None}, {u'url': u'http://twitter.com/search?q=%22Pervez+Musharraf%22', u'query': u'%22Pervez+Musharraf%22', u'name': u'Pervez Musharraf', u'promoted_content': None, u'events': None}, {u'url': u'http://twitter.com/search?q=OKC', u'query': u'OKC', u'name': u'OKC', u'promoted_content': None, u'events': None}, {u'url': u'http://twitter.com/search?q=Spurs', u'query': u'Spurs', u'name': u'Spurs', u'promoted_content': None, u'events': None}, {u'url': u'http://twitter.com/search?q=Kobe', u'query': u'Kobe', u'name': u'Kobe', u'promoted_content': None, u'events': None}], u'as_of': u'2013-04-18T06:05:03Z', u'locations': [{u'woeid': 1, u'name': u'Worldwide'}]}]\n" + ] + } + ], + "prompt_number": 2 }, { "cell_type": "markdown", @@ -132,7 +142,99 @@ ], "language": "python", "metadata": {}, - "outputs": [] + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[\n", + " {\n", + " \"created_at\": \"2013-04-18T06:00:25Z\", \n", + " \"trends\": [\n", + " {\n", + " \"url\": \"http://twitter.com/search?q=%23sometimesiwishthat\", \n", + " \"query\": \"%23sometimesiwishthat\", \n", + " \"name\": \"#sometimesiwishthat\", \n", + " \"promoted_content\": null, \n", + " \"events\": null\n", + " }, \n", + " {\n", + " \"url\": \"http://twitter.com/search?q=%23MiPreguntaEs\", \n", + " \"query\": \"%23MiPreguntaEs\", \n", + " \"name\": \"#MiPreguntaEs\", \n", + " \"promoted_content\": null, \n", + " \"events\": null\n", + " }, \n", + " {\n", + " \"url\": \"http://twitter.com/search?q=%23WestTX\", \n", + " \"query\": \"%23WestTX\", \n", + " \"name\": \"#WestTX\", \n", + " \"promoted_content\": null, \n", + " \"events\": null\n", + " }, \n", + " {\n", + " \"url\": \"http://twitter.com/search?q=%23MentionSomeoneWhoHasAPrettyFace\", \n", + " \"query\": \"%23MentionSomeoneWhoHasAPrettyFace\", \n", + " \"name\": \"#MentionSomeoneWhoHasAPrettyFace\", \n", + " \"promoted_content\": null, \n", + " \"events\": null\n", + " }, \n", + " {\n", + " \"url\": \"http://twitter.com/search?q=%23CosasRid%C3%ADculas\", \n", + " \"query\": \"%23CosasRid%C3%ADculas\", \n", + " \"name\": \"#CosasRid\\u00edculas\", \n", + " \"promoted_content\": null, \n", + " \"events\": null\n", + " }, \n", + " {\n", + " \"url\": \"http://twitter.com/search?q=Texas\", \n", + " \"query\": \"Texas\", \n", + " \"name\": \"Texas\", \n", + " \"promoted_content\": null, \n", + " \"events\": null\n", + " }, \n", + " {\n", + " \"url\": \"http://twitter.com/search?q=%22Pervez+Musharraf%22\", \n", + " \"query\": \"%22Pervez+Musharraf%22\", \n", + " \"name\": \"Pervez Musharraf\", \n", + " \"promoted_content\": null, \n", + " \"events\": null\n", + " }, \n", + " {\n", + " \"url\": \"http://twitter.com/search?q=OKC\", \n", + " \"query\": \"OKC\", \n", + " \"name\": \"OKC\", \n", + " \"promoted_content\": null, \n", + " \"events\": null\n", + " }, \n", + " {\n", + " \"url\": \"http://twitter.com/search?q=Spurs\", \n", + " \"query\": \"Spurs\", \n", + " \"name\": \"Spurs\", \n", + " \"promoted_content\": null, \n", + " \"events\": null\n", + " }, \n", + " {\n", + " \"url\": \"http://twitter.com/search?q=Kobe\", \n", + " \"query\": \"Kobe\", \n", + " \"name\": \"Kobe\", \n", + " \"promoted_content\": null, \n", + " \"events\": null\n", + " }\n", + " ], \n", + " \"as_of\": \"2013-04-18T06:05:03Z\", \n", + " \"locations\": [\n", + " {\n", + " \"woeid\": 1, \n", + " \"name\": \"Worldwide\"\n", + " }\n", + " ]\n", + " }\n", + "]\n" + ] + } + ], + "prompt_number": 3 }, { "cell_type": "markdown", @@ -176,7 +278,8 @@ ], "language": "python", "metadata": {}, - "outputs": [] + "outputs": [], + "prompt_number": 4 }, { "cell_type": "markdown", @@ -194,7 +297,265 @@ ], "language": "python", "metadata": {}, - "outputs": [] + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[\n", + " {\n", + " \"contributors\": null, \n", + " \"truncated\": false, \n", + " \"text\": \"Daft Punk Pharrell \\\"Get Lucky\\\" SNL Ad: http://t.co/w8tzDd4s64 via @youtube\", \n", + " \"in_reply_to_status_id\": null, \n", + " \"id\": 324765383779299328, \n", + " \"favorite_count\": 0, \n", + " \"source\": \"Tweet Button\", \n", + " \"retweeted\": false, \n", + " \"coordinates\": null, \n", + " \"entities\": {\n", + " \"user_mentions\": [\n", + " {\n", + " \"id\": 10228272, \n", + " \"indices\": [\n", + " 66, \n", + " 74\n", + " ], \n", + " \"id_str\": \"10228272\", \n", + " \"screen_name\": \"YouTube\", \n", + " \"name\": \"YouTube\"\n", + " }\n", + " ], \n", + " \"hashtags\": [], \n", + " \"urls\": [\n", + " {\n", + " \"url\": \"http://t.co/w8tzDd4s64\", \n", + " \"indices\": [\n", + " 39, \n", + " 61\n", + " ], \n", + " \"expanded_url\": \"http://youtu.be/JMJwcOiBoZE\", \n", + " \"display_url\": \"youtu.be/JMJwcOiBoZE\"\n", + " }\n", + " ]\n", + " }, \n", + " \"in_reply_to_screen_name\": null, \n", + " \"in_reply_to_user_id\": null, \n", + " \"retweet_count\": 0, \n", + " \"id_str\": \"324765383779299328\", \n", + " \"favorited\": false, \n", + " \"user\": {\n", + " \"follow_request_sent\": null, \n", + " \"profile_use_background_image\": true, \n", + " \"default_profile_image\": false, \n", + " \"id\": 247112705, \n", + " \"verified\": false, \n", + " \"profile_text_color\": \"BABABA\", \n", + " \"profile_image_url_https\": \"https://si0.twimg.com/profile_images/3486656710/014e657cba09cee8400dcc353a332630_normal.jpeg\", \n", + " \"profile_sidebar_fill_color\": \"BABABA\", \n", + " \"entities\": {\n", + " \"url\": {\n", + " \"urls\": [\n", + " {\n", + " \"url\": \"http://www.youtube.com/user/AlbrtoEntertainment?feature=mhee\", \n", + " \"indices\": [\n", + " 0, \n", + " 60\n", + " ], \n", + " \"expanded_url\": null\n", + " }\n", + " ]\n", + " }, \n", + " \"description\": {\n", + " \"urls\": [\n", + " {\n", + " \"url\": \"http://t.co/3dfi3KyA\", \n", + " \"indices\": [\n", + " 119, \n", + " 139\n", + " ], \n", + " \"expanded_url\": \"http://www.facebook.com/pages/AlbertoEntertainment/129835393733330\", \n", + " \"display_url\": \"facebook.com/pages/AlbertoE\\u2026\"\n", + " }\n", + " ]\n", + " }\n", + " }, \n", + " \"followers_count\": 321, \n", + " \"profile_sidebar_border_color\": \"6B6B6B\", \n", + " \"id_str\": \"247112705\", \n", + " \"profile_background_color\": \"000000\", \n", + " \"listed_count\": 2, \n", + " \"profile_background_image_url_https\": \"https://si0.twimg.com/profile_background_images/201180770/Twitter.jpg\", \n", + " \"utc_offset\": -28800, \n", + " \"statuses_count\": 8899, \n", + " \"description\": \"Professional video editor for AlbrtoentEntertainment, BallislifeEnt, and The Professor from AND1/Ball up CHECK ME OUT\\r\\nhttp://t.co/3dfi3KyA\", \n", + " \"friends_count\": 155, \n", + " \"location\": \"San Diego California\", \n", + " \"profile_link_color\": \"BABABA\", \n", + " \"profile_image_url\": \"http://a0.twimg.com/profile_images/3486656710/014e657cba09cee8400dcc353a332630_normal.jpeg\", \n", + " \"following\": null, \n", + " \"geo_enabled\": true, \n", + " \"profile_banner_url\": \"https://si0.twimg.com/profile_banners/247112705/1365295843\", \n", + " \"profile_background_image_url\": \"http://a0.twimg.com/profile_background_images/201180770/Twitter.jpg\", \n", + " \"screen_name\": \"AlbrtoEnt\", \n", + " \"lang\": \"en\", \n", + " \"profile_background_tile\": false, \n", + " \"favourites_count\": 10, \n", + " \"name\": \"AlbertoEntertainment\", \n", + " \"notifications\": null, \n", + " \"url\": \"http://www.youtube.com/user/AlbrtoEntertainment?feature=mhee\", \n", + " \"created_at\": \"Fri Feb 04 03:23:02 +0000 2011\", \n", + " \"contributors_enabled\": false, \n", + " \"time_zone\": \"Pacific Time (US & Canada)\", \n", + " \"protected\": false, \n", + " \"default_profile\": false, \n", + " \"is_translator\": false\n", + " }, \n", + " \"geo\": null, \n", + " \"in_reply_to_user_id_str\": null, \n", + " \"possibly_sensitive\": false, \n", + " \"lang\": \"en\", \n", + " \"created_at\": \"Thu Apr 18 06:04:35 +0000 2013\", \n", + " \"in_reply_to_status_id_str\": null, \n", + " \"place\": null, \n", + " \"metadata\": {\n", + " \"iso_language_code\": \"en\", \n", + " \"result_type\": \"recent\"\n", + " }\n", + " }, \n", + " {\n", + " \"contributors\": null, \n", + " \"truncated\": false, \n", + " \"text\": \"Where is this from?? RT\\u201c@puckjane: \\ubbf8\\uc81c \\uc55e\\uc7a1\\uc774 \\ubc15\\uc7ac\\ubc94 \\ub3d9\\ubb34 \\ubd81\\uc870\\uc120SNL\\ubc34\\ub4dc\\ub97c \\uc870\\uc2ec \\ud558\\ub77c\\uc6b0! \\uc774\\ubc88\\uc8fc \\uc544\\uc8fc \\uac1c\\ubc15\\uc0b4\\uc744 \\ub0b4\\uc8fc\\uac13\\uc368! http://t.co/cl8Y6Kgvpt\\u201d\", \n", + " \"in_reply_to_status_id\": 324741268355837953, \n", + " \"id\": 324765266200367104, \n", + " \"favorite_count\": 0, \n", + " \"source\": \"Twitter for iPhone\", \n", + " \"retweeted\": false, \n", + " \"coordinates\": null, \n", + " \"entities\": {\n", + " \"user_mentions\": [\n", + " {\n", + " \"id\": 129722206, \n", + " \"indices\": [\n", + " 24, \n", + " 33\n", + " ], \n", + " \"id_str\": \"129722206\", \n", + " \"screen_name\": \"puckjane\", \n", + " \"name\": \"Jane_Yang\"\n", + " }\n", + " ], \n", + " \"media\": [\n", + " {\n", + " \"source_status_id_str\": \"324741268355837953\", \n", + " \"expanded_url\": \"http://twitter.com/puckjane/status/324741268355837953/photo/1\", \n", + " \"display_url\": \"pic.twitter.com/cl8Y6Kgvpt\", \n", + " \"url\": \"http://t.co/cl8Y6Kgvpt\", \n", + " \"media_url_https\": \"https://pbs.twimg.com/media/BIG2dojCcAI342V.jpg\", \n", + " \"source_status_id\": 324741268355837953, \n", + " \"id_str\": \"324741268364226562\", \n", + " \"sizes\": {\n", + " \"small\": {\n", + " \"h\": 455, \n", + " \"resize\": \"fit\", \n", + " \"w\": 340\n", + " }, \n", + " \"large\": {\n", + " \"h\": 1024, \n", + " \"resize\": \"fit\", \n", + " \"w\": 765\n", + " }, \n", + " \"medium\": {\n", + " \"h\": 803, \n", + " \"resize\": \"fit\", \n", + " \"w\": 600\n", + " }, \n", + " \"thumb\": {\n", + " \"h\": 150, \n", + " \"resize\": \"crop\", \n", + " \"w\": 150\n", + " }\n", + " }, \n", + " \"indices\": [\n", + " 85, \n", + " 107\n", + " ], \n", + " \"type\": \"photo\", \n", + " \"id\": 324741268364226562, \n", + " \"media_url\": \"http://pbs.twimg.com/media/BIG2dojCcAI342V.jpg\"\n", + " }\n", + " ], \n", + " \"hashtags\": [], \n", + " \"urls\": []\n", + " }, \n", + " \"in_reply_to_screen_name\": \"puckjane\", \n", + " \"in_reply_to_user_id\": 129722206, \n", + " \"retweet_count\": 0, \n", + " \"id_str\": \"324765266200367104\", \n", + " \"favorited\": false, \n", + " \"user\": {\n", + " \"follow_request_sent\": null, \n", + " \"profile_use_background_image\": true, \n", + " \"default_profile_image\": false, \n", + " \"id\": 580855814, \n", + " \"verified\": false, \n", + " \"profile_text_color\": \"333333\", \n", + " \"profile_image_url_https\": \"https://si0.twimg.com/profile_images/3519989811/11a3c03d6af2a52804568a92c5096139_normal.jpeg\", \n", + " \"profile_sidebar_fill_color\": \"DDEEF6\", \n", + " \"entities\": {\n", + " \"description\": {\n", + " \"urls\": []\n", + " }\n", + " }, \n", + " \"followers_count\": 240, \n", + " \"profile_sidebar_border_color\": \"C0DEED\", \n", + " \"id_str\": \"580855814\", \n", + " \"profile_background_color\": \"C0DEED\", \n", + " \"listed_count\": 6, \n", + " \"profile_background_image_url_https\": \"https://si0.twimg.com/profile_background_images/588713875/6h7jfqrh0suj4i5ylyz0.jpeg\", \n", + " \"utc_offset\": 36000, \n", + " \"statuses_count\": 13603, \n", + " \"description\": \"2013 = Era of Jay Park\\nIf you work hard and be patient good things will happen to you. :) \\nI have no respect or like for those who knew Jay but ignore him now. \", \n", + " \"friends_count\": 256, \n", + " \"location\": \"\", \n", + " \"profile_link_color\": \"0084B4\", \n", + " \"profile_image_url\": \"http://a0.twimg.com/profile_images/3519989811/11a3c03d6af2a52804568a92c5096139_normal.jpeg\", \n", + " \"following\": null, \n", + " \"geo_enabled\": false, \n", + " \"profile_banner_url\": \"https://si0.twimg.com/profile_banners/580855814/1365946473\", \n", + " \"profile_background_image_url\": \"http://a0.twimg.com/profile_background_images/588713875/6h7jfqrh0suj4i5ylyz0.jpeg\", \n", + " \"screen_name\": \"JwalkerParker\", \n", + " \"lang\": \"en\", \n", + " \"profile_background_tile\": true, \n", + " \"favourites_count\": 4057, \n", + " \"name\": \"B :) JIS\", \n", + " \"notifications\": null, \n", + " \"url\": null, \n", + " \"created_at\": \"Tue May 15 12:45:00 +0000 2012\", \n", + " \"contributors_enabled\": false, \n", + " \"time_zone\": \"Sydney\", \n", + " \"protected\": false, \n", + " \"default_profile\": false, \n", + " \"is_translator\": false\n", + " }, \n", + " \"geo\": null, \n", + " \"in_reply_to_user_id_str\": \"129722206\", \n", + " \"possibly_sensitive\": false, \n", + " \"lang\": \"ko\", \n", + " \"created_at\": \"Thu Apr 18 06:04:07 +0000 2013\", \n", + " \"in_reply_to_status_id_str\": \"324741268355837953\", \n", + " \"place\": null, \n", + " \"metadata\": {\n", + " \"iso_language_code\": \"ko\", \n", + " \"result_type\": \"recent\"\n", + " }\n", + " }\n", + "]\n" + ] + } + ], + "prompt_number": 5 }, { "cell_type": "markdown", @@ -227,7 +588,16 @@ ], "language": "python", "metadata": {}, - "outputs": [] + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Daft Punk Pharrell \"Get Lucky\" SNL Ad: http://t.co/w8tzDd4s64 via @youtube\n" + ] + } + ], + "prompt_number": 6 }, { "cell_type": "markdown", @@ -252,20 +622,32 @@ " words += [ w for w in t.split() ]\n", "\n", "# total words\n", - "print len(words) \n", + "print \"Total words = \", len(words) \n", "\n", "# unique words\n", - "print len(set(words)) \n", + "print \"Unique words = \", len(set(words)) \n", "\n", "# lexical diversity\n", - "print 1.0*len(set(words))/len(words) \n", + "print \"Lexical diversity = \", 1.0*len(set(words))/len(words) \n", "\n", "# avg words per tweet\n", - "print 1.0*sum([ len(t.split()) for t in tweets ])/len(tweets) " + "print \"Average words per tweet = \", 1.0*sum([ len(t.split()) for t in tweets ])/len(tweets) " ], "language": "python", "metadata": {}, - "outputs": [] + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total words = 8226\n", + "Unique words = 2824\n", + "Lexical diversity = 0.343301726234\n", + "Average words per tweet = 13.8020134228\n" + ] + } + ], + "prompt_number": 7 }, { "cell_type": "markdown", @@ -298,7 +680,17 @@ ], "language": "python", "metadata": {}, - "outputs": [] + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[u'RT', u'SNL', u'the', u'I', u'\\ubbf8\\uc81c', u'\\uc544\\uc8fc', u'\\ub3d9\\ubb34', u'\\ubc15\\uc7ac\\ubc94', u'\\ubd81\\uc870\\uc120SNL\\ubc34\\ub4dc\\ub97c', u'\\uc55e\\uc7a1\\uc774', u'\\uc774\\ubc88\\uc8fc', u'\\uc870\\uc2ec', u'\\ud558\\ub77c\\uc6b0!', u'\\uac1c\\ubc15\\uc0b4\\uc744', u'\\ub0b4\\uc8fc\\uac13\\uc368!', u'to', u'@puckjane:', u'-', u'http://t.co/eRy5Yl2xbc', u'on', u'of', u'a', u'and', u'is', u'for', u'...', u'in', u'my', u'via', u'you', u'was', u'snl', u'host', u'Daft', u'Punk', u'so', u'Pharrell', u'all', u'episode', u'May', u'Shinhwa', u'just', u'this', u'with', u'\\u2018SNL', u'4th', u'Korea\\u2019', u'like', u'u', u'@puckjane']\n", + "[u'\\uc774\\ubc88\\ub2ec', u'\\uc774\\uc0c1\\ud6c8', u'\\uc774\\uc81c', u'\\uc77c\\uc5b4\\ub0ac\\ub2c8', u'\\uc787\\uac13\\uc368!\"@puckjane:', u'\\uc788\\uc2b5\\ub2c8\\ub2e4.', u'\\uc788\\uc5b4\\uc11c', u'\\uc798', u'\\uc7a1\\uc9c0', u'\\uc800\\ub294', u'\\uc804\\ub098\\uc6c3\\uacc0\\u314b\\u314b\\u314b\\u314b\\u314b\\u314b\\u314b\\u314b(\\ub204\\uc6cc\\uc11c', u'\\uc81c\\ubaab\\uae4c\\uc9c0', u'\\uc81c\\uc8fc', u'\\uc81c\\uc8fc\\ub3c4', u'\\uc885\\uac13\\ub098...', u'\\uc88b\\uaca0\\ub124\\uc694', u'\\uc88b\\uaca0\\ub2f9\\u2665', u'\\uc88b\\uc544', u'\\uc8fc\\uc168\\ub2e4!!', u'\\uc8fc\\uc2e0\\ub2e4\\uace0^^', u'\\uc9c0\\uae08', u'\\uc9c0\\uc544', u'\\uc9f9', u'\\ucc98\\uc74c\\uc774\\ub124\\uc694..\\uc81c\\uac00\\uc88b\\uc544\\ud558\\ub294\\uac70\\ubcf4\\ub7ec...20\\uc77c\\ub3c4\\ubabb\\uac00\\uace0', u'\\uce5c\\uad6c\\uac00', u'\\uce90\\uc2a4\\ud305\\uc774', u'\\ucee4\\uba3c.\\uadf8\\ub77c\\uc6b4\\ub4dc', u'\\uceec\\ud22c\\ud3b8!!', u'\\ud130\\uc9c0\\ub124', u'\\ud2b8\\uce5c\\ub2d8\\ub4e4', u'\\ud328\\ub7ec\\ub514', u'\\ud32c\\uc774\\ub77c\\uace0~\\ucd9c\\uc5f0\\ud55c', u'\\ud3ec\\uae30\\ud588\\uc5b4\\uc694', u'\\ud3ec\\uc2a4\\ud130\\uc640', u'\\ud558\\ub2c8', u'\\ud558\\ub358', u'\\ud558\\uc2ed\\ub2c8\\ub2e4.', u'\\ud55c\\ub2e4\\ub294...\\u314e\\u314e', u'\\ud654\\ub098\\uac00\\uc9c0\\uace0', u'\\ud751', u'\\ud765', u'\\U0001f44c', u'\\U0001f44d', u'\\U0001f44e', u'\\U0001f606', u'\\U0001f60a', u'\\U0001f618', u'\\U0001f62d', u'\\U0001f64c\\U0001f64c\\U0001f64c', u'\\U0001f64f\\U0001f64f']\n" + ] + } + ], + "prompt_number": 8 }, { "cell_type": "markdown", @@ -319,7 +711,17 @@ ], "language": "python", "metadata": {}, - "outputs": [] + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[(u'RT', 241), (u'SNL', 193), (u'the', 118), (u'I', 103), (u'\\uc544\\uc8fc', 102), (u'\\ubbf8\\uc81c', 102), (u'\\uc55e\\uc7a1\\uc774', 100), (u'\\ubc15\\uc7ac\\ubc94', 100), (u'\\ub3d9\\ubb34', 100), (u'\\ud558\\ub77c\\uc6b0!', 100), (u'\\uc774\\ubc88\\uc8fc', 100), (u'\\ubd81\\uc870\\uc120SNL\\ubc34\\ub4dc\\ub97c', 100), (u'\\uc870\\uc2ec', 100), (u'\\uac1c\\ubc15\\uc0b4\\uc744', 98), (u'\\ub0b4\\uc8fc\\uac13\\uc368!', 98), (u'to', 83), (u'@puckjane:', 81), (u'-', 78), (u'on', 72), (u'http://t.co/eRy5Yl2xbc', 72), (u'of', 67), (u'a', 61), (u'and', 51), (u'is', 48), (u'for', 47), (u'...', 40), (u'in', 39), (u'my', 38), (u'you', 36), (u'via', 36), (u'was', 35), (u'snl', 33), (u'host', 29), (u'Daft', 28), (u'so', 28), (u'Punk', 28), (u'episode', 26), (u'Pharrell', 26), (u'all', 26), (u'just', 25), (u'May', 25), (u'Shinhwa', 25), (u'with', 24), (u'\\u2018SNL', 24), (u'this', 24), (u'Korea\\u2019', 23), (u'4th', 23), (u'u', 23), (u'like', 23), (u'@puckjane', 21)]\n", + "[(u'van', 1), (u'http://t.co/YDYeHdDFbz', 1), (u'Lawrence', 1), (u'*', 1), (u'DeMarte', 1), (u'ricin', 1), (u'\\u0e40\\u0e2d\\u0e32\\u0e14\\u0e35\\u0e14\\u0e35', 1), (u'ht', 1), (u'reminds', 1), (u'Company,', 1), (u'buo', 1), (u'Consumer', 1), (u'beeennneettttt.', 1), (u'places', 1), (u'wish', 1), (u'hosting', 1), (u'yapa', 1), (u'lve', 1), (u'record', 1), (u'@nprnews', 1), (u'problem', 1), (u'eyes,', 1), (u'trying,', 1), (u'o...', 1), (u'http://t.co/HPPMztOVWu', 1), (u'\\uba85\\ubc30\\uc6b0', 1), (u'is...', 1), (u'12-TIJ,', 1), (u'stylist:', 1), (u'mejor', 1), (u'\\uc2e0\\uc740?', 1), (u\"Frajo's\", 1), (u'Never', 1), (u'sick', 1), (u'http://t.co/imKxolojNn\"', 1), (u'Sleep', 1), (u'Kutcher,', 1), (u'stay', 1), (u'http://t.co/Ny4maenC3I', 1), (u'ba', 1), (u'\\ud130\\uc9c0\\ub124', 1), (u'Armisen', 1), (u'friends', 1), (u'Stewart', 1), (u'draft.', 1), (u'Monteur:', 1), (u'Friday,', 1), (u'11-QRO,', 1), (u'(Wouter', 1), (u'http://t.co/Wj6lrGlDiF', 1)]\n" + ] + } + ], + "prompt_number": 9 }, { "cell_type": "markdown", @@ -348,7 +750,17 @@ ], "language": "python", "metadata": {}, - "outputs": [] + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[('RT', ' @SocialWebMining')]\n", + "[('via', ' @SocialWebMining')]\n" + ] + } + ], + "prompt_number": 10 }, { "cell_type": "markdown", @@ -392,7 +804,24 @@ ], "language": "python", "metadata": {}, - "outputs": [] + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: \n", + "Type: DiGraph\n", + "Number of nodes: 300\n", + "Number of edges: 270\n", + "Average in degree: 0.9000\n", + "Average out degree: 0.9000\n", + "(u'@VEVO', u'martymal1', {'tweet_id': 324760640516395008})\n", + "52\n", + "[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 5, 6, 6, 8, 9, 10, 12, 12, 14, 19, 94]\n" + ] + } + ], + "prompt_number": 11 }, { "cell_type": "markdown", @@ -400,11 +829,11 @@ "source": [ "In the _Mining the Social Web_'s GitHub repository, there a thorough sample file that takes all of the concepts that have been presented and weaves them into a more comprehensive turn-key example and visualization. Visit https://github.com/ptwobrussell/Mining-the-Social-Web and, in particular, run the sample file located at https://github.com/ptwobrussell/Mining-the-Social-Web/blob/master/python_code/introduction__retweet_visualization.py which should automatically launch your web browser and provide you with an interactive visualization similar to the following:\n", "\n", - "" + "" ] } ], "metadata": {} } ] -} +} \ No newline at end of file