{"id":227,"date":"2016-05-28T03:26:29","date_gmt":"2016-05-28T03:26:29","guid":{"rendered":"http:\/\/intelligentonlinetools.com\/blog\/?p=227"},"modified":"2016-06-05T13:17:36","modified_gmt":"2016-06-05T13:17:36","slug":"using-python-for-mining-data-from-twitter","status":"publish","type":"post","link":"http:\/\/intelligentonlinetools.com\/blog\/2016\/05\/28\/using-python-for-mining-data-from-twitter\/","title":{"rendered":"Using Python for Mining Data From Twitter"},"content":{"rendered":"<p>Twitter is increasingly being used for business or personal purposes. With Twitter API there is also an opportunity to do data mining of data (tweets) and find interesting information. In this post we will take a look how to get data from Twitter, prepare data for analysis and then do clustering of tweets using python programming language. <\/p>\n<p>In our example of python script we will extract tweets that contain hashtag &#8220;deep learning&#8221;.  The data obtained in this search then will be used for further processing and data mining.<\/p>\n<p>The script can be divided in the following 3 sections briefly described below. <\/p>\n<p>1. <strong>Accessing Twitter API<\/strong><\/p>\n<p>First the script is establishing connection to Twitter and credentials are being checked by Twitter service. This requires to provide access tokens such as CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET. Refer to [1] how to obtain this information from Twitter account.<\/p>\n<p>2. <strong>Searching for Tweets<\/strong><\/p>\n<p>Once access token information verified then the search for tweets related to a\tparticular hashtag &#8220;deep learning&#8221; in our example is performed and if it is successful we are getting data. The python script then iterates through 5 more batches of results by following the cursor. All results are saved in json data structure <em>statuses<\/em>.<\/p>\n<p>Now we are extracting data such as hashtags, urls, texts and created at date. The date is useful if we need do trending over the time.<\/p>\n<p>In the next step we are preparing data for trending in the format: date word. This allows to view how the usage of specific word in the tweets is changing over the time.<br \/>\nHere is code example of getting urls and date data:<\/p>\n<pre><code>urls = [ urls['url']\r\n    for status in statuses\r\n       for urls in status['entities']['urls'] ]\r\n\r\n\r\ncreated_ats = [ status['created_at']\r\n    for status in statuses\r\n        ]\r\n<\/code><\/pre>\n<p>3. <strong>Clustering Tweets<\/strong><\/p>\n<p>Now we are preparing tweets data for data clustering. We are converting text data into bag of words data representation. This is called vectorization which is the general process of turning a collection of text documents into numerical feature vectors. [2]<\/p>\n<pre><code>\r\nmodelvectorizer = CountVectorizer(analyzer = \"word\", \\\r\n                             tokenizer = None,       \\\r\n                             preprocessor = None,    \\ \r\n                             stop_words='english',   \\\r\n                             max_features = 5000) \r\n\r\ntrain_data_features = vectorizer.fit_transform(texts)\r\ntrain_data_features = train_data_features.toarray()\r\nprint (train_data_features.shape)\r\nprint (train_data_features)\r\n'''\r\nThis will print like this:    \r\n[[0 0 0 ..., 0 1 1]\r\n [0 0 1 ..., 0 0 0]\r\n [0 0 0 ..., 0 1 1]\r\n ..., \r\n [0 0 0 ..., 0 0 0]\r\n [0 0 0 ..., 0 0 0]\r\n [0 0 0 ..., 0 0 0]]\r\n'''\r\n\r\nvocab = vectorizer.get_feature_names()\r\nprint (vocab)\r\ndist = np.sum(train_data_features, axis=0)\r\n\r\n#For each, print the vocabulary word and the number of times it appears in the training set\r\n\r\nfor tag, count in zip(vocab, dist):\r\n    print (count, tag)\r\n\r\n'''\r\nThis will print something like this\r\n3 ai\r\n1 alexandria\r\n2 algorithms\r\n1 amp\r\n2 analytics\r\n1 applications\r\n1 applied\r\n''''\r\n\r\nNow we are ready to do clustering.  We select to use Birch clustering algorithm. [3]  Below is the code snippet for this. We specify the number of clusters 6.\r\n\r\nbrc = Birch(branching_factor=50, n_clusters=6, threshold=0.5,  compute_labels=True)\r\nbrc.fit(train_data_features)\r\n\r\nclustering_result=brc.predict(train_data_features)\r\nprint (\"\\nClustering_result:\\n\")\r\nprint (clustering_result)\r\n\r\n'''\r\nBelow is the example of printout (each tweet got the number, this number represents the number of cluster associated with this tweet, number of clusters is 6 ):\r\nClustering_result:\r\n\r\n[0 0 0 0 0 4 0 0 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 0 0 1 4 1 1 1\r\n 2 2]\r\n'''\r\n<\/code><\/pre>\n<p>In the next step we output some data and build plot of frequency for hashtags.<\/p>\n<p><img data-attachment-id=\"248\" data-permalink=\"http:\/\/intelligentonlinetools.com\/blog\/2016\/05\/28\/using-python-for-mining-data-from-twitter\/frequency-of-hashtags\/#main\" data-orig-file=\"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2016\/05\/Frequency-of-Hashtags.png\" data-orig-size=\"1554,887\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Frequency of Hashtags\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2016\/05\/Frequency-of-Hashtags-300x171.png\" data-large-file=\"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2016\/05\/Frequency-of-Hashtags-1024x584.png\" decoding=\"async\" loading=\"lazy\" src=\"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2016\/05\/Frequency-of-Hashtags-300x171.png\" alt=\"Frequency of Hashtags\" width=\"1050\" height=\"610\" class=\"alignnone size-medium wp-image-248\" \/><\/p>\n<p><strong>Source Code<\/strong><br \/>\nThus we explored python coding of data mining for Twitter. We looked at different tasks such as searching tweets, extracting different data from search results, preparing data for trending, converting text results into numerical form, clustering and printing plot of frequency of hashtags.<br \/>\nBelow is the source code for all of this. In the future we plan add more functionality. There many possible ways how to data mine Twitter data. Some interesting ideas on the web can be found in [4]. <\/p>\n<pre><code>\r\nimport twitter\r\nimport json\r\n\r\n\r\n\r\n\r\nimport matplotlib.pyplot as plt\r\nimport numpy as np\r\n\r\n\r\n\r\nfrom sklearn.feature_extraction.text import CountVectorizer\r\nfrom sklearn.cluster import Birch\r\n\r\nCONSUMER_KEY =\"xxxxxxxxxxxxxxx\"\r\nCONSUMER_SECRET =\"xxxxxxxxxxxx\"\r\nOAUTH_TOKEN = \"xxxxxxxxxxxxxx\"\r\nOAUTH_TOKEN_SECRET = \"xxxxxxxxxx\"\r\n\r\n\r\nauth = twitter.oauth.OAuth (OAUTH_TOKEN, OAUTH_TOKEN_SECRET, CONSUMER_KEY, CONSUMER_SECRET)\r\n\r\ntwitter_api= twitter.Twitter(auth=auth)\r\nq='#deep learning'\r\ncount=100\r\n\r\n# Do search for tweets containing '#deep learning'\r\nsearch_results = twitter_api.search.tweets (q=q, count=count)\r\n\r\nstatuses=search_results['statuses']\r\n\r\n# Iterate through 5 more batches of results by following the cursor\r\nfor _ in range(5):\r\n   print (\"Length of statuses\", len(statuses))\r\n   try:\r\n        next_results = search_results['search_metadata']['next_results']\r\n   except KeyError:   \r\n       break\r\n   # Create a dictionary from next_results\r\n   kwargs=dict( [kv.split('=') for kv in next_results[1:].split(\"&\") ])\r\n\r\n   search_results = twitter_api.search.tweets(**kwargs)\r\n   statuses += search_results['statuses']\r\n\r\n# Show one sample search result by slicing the list\r\nprint (json.dumps(statuses[0], indent=10))\r\n\r\n\r\n\r\n# Extracting data such as hashtags, urls, texts and created at date\r\nhashtags = [ hashtag['text'].lower()\r\n    for status in statuses\r\n       for hashtag in status['entities']['hashtags'] ]\r\n\r\n\r\nurls = [ urls['url']\r\n    for status in statuses\r\n       for urls in status['entities']['urls'] ]\r\n\r\n\r\ntexts = [ status['text']\r\n    for status in statuses\r\n        ]\r\n\r\ncreated_ats = [ status['created_at']\r\n    for status in statuses\r\n        ]\r\n\r\n# Preparing data for trending in the format: date word\r\n# Note: in the below loop w is not cleaned from #,? characters\r\ni=0\r\nprint (\"===============================\\n\")\r\nfor x in created_ats:\r\n     for w in texts[i].split(\" \"):\r\n        if len(w)>=2:\r\n              print (x[4:10], x[26:31] ,\" \", w)\r\n     i=i+1\r\n\r\n\r\n\r\n\r\n# Prepare tweets data for clustering\r\n# Converting text data into bag of words model\r\n\r\nvectorizer = CountVectorizer(analyzer = \"word\", \\\r\n                             tokenizer = None,  \\\r\n                             preprocessor = None,  \\\r\n                             stop_words='english', \\\r\n                             max_features = 5000) \r\n\r\ntrain_data_features = vectorizer.fit_transform(texts)\r\n\r\ntrain_data_features = train_data_features.toarray()\r\n\r\nprint (train_data_features.shape)\r\n\r\nprint (train_data_features)\r\n\r\nvocab = vectorizer.get_feature_names()\r\nprint (vocab)\r\n\r\ndist = np.sum(train_data_features, axis=0)\r\n\r\n# For each, print the vocabulary word and the number of times it \r\n# appears in the training set\r\nfor tag, count in zip(vocab, dist):\r\n    print (count, tag)\r\n\r\n\r\n# Clustering data\r\n\r\nbrc = Birch(branching_factor=50, n_clusters=6, threshold=0.5,  compute_labels=True)\r\nbrc.fit(train_data_features)\r\n\r\nclustering_result=brc.predict(train_data_features)\r\nprint (\"\\nClustering_result:\\n\")\r\nprint (clustering_result)\r\n\r\n\r\n\r\n\r\n\r\n# Outputting some data\r\nprint (json.dumps(hashtags[0:50], indent=1))\r\nprint (json.dumps(urls[0:50], indent=1))\r\nprint (json.dumps(texts[0:50], indent=1))\r\nprint (json.dumps(created_ats[0:50], indent=1))\r\n\r\n\r\nwith open(\"data.txt\", \"a\") as myfile:\r\n     for w in hashtags: \r\n           myfile.write(str(w.encode('ascii', 'ignore')))\r\n           myfile.write(\"\\n\")\r\n\r\n\r\n\r\n# count of word frequencies\r\nwordcounts = {}\r\nfor term in hashtags:\r\n    wordcounts[term] = wordcounts.get(term, 0) + 1\r\n\r\n\r\nitems = [(v, k) for k, v in wordcounts.items()]\r\n\r\n\r\n\r\nprint (len(items))\r\n\r\nxnum=[i for i in range(len(items))]\r\nfor count, word in sorted(items, reverse=True):\r\n    print(\"%5d %s\" % (count, word))\r\n   \r\n\r\n\r\n\r\nfor x in created_ats:\r\n  print (x)\r\n  print (x[4:10])\r\n  print (x[26:31])\r\n  print (x[4:7])\r\n\r\n\r\n\r\nplt.figure()\r\nplt.title(\"Frequency of Hashtags\")\r\n\r\nmyarray = np.array(sorted(items, reverse=True))\r\n\r\n\r\nprint (myarray[:,0])\r\n\r\nprint (myarray[:,1])\r\n\r\nplt.xticks(xnum, myarray[:,1],rotation='vertical')\r\nplt.plot (xnum, myarray[:,0])\r\nplt.show()\r\n\r\n<\/code><\/pre>\n<p><strong>References<\/strong><br \/>\n1. <a href=http:\/\/www-scf.usc.edu\/~aupadhya\/Mining.pdf target=\"_blank\">MINING DATA FROM TWITTER<\/a><br \/>\nAbhishanga Upadhyay, Luis Mao, Malavika\tGoda Krishna<\/p>\n<p>2. <a href=http:\/\/scikit-learn.org\/stable\/modules\/feature_extraction.html target=\"_blank\"> Feature extraction<\/a> scikit-learn Documentation, Machine Learning in Python<\/p>\n<p>3. <a href=http:\/\/scikit-learn.org\/stable\/modules\/clustering.html#birch  target=\"_blank\">Clustering &#8211; Birch<\/a> scikit-learn Documentation, Machine Learning in Python<\/p>\n<p>4. <a href=https:\/\/www.linkedin.com\/pulse\/twitter-data-mining-python-gephi-case-synthetic-biology-mikko-dufva>Twitter data mining with Python and Gephi: Case synthetic biology<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Twitter is increasingly being used for business or personal purposes. With Twitter API there is also an opportunity to do data mining of data (tweets) and find interesting information. In this post we will take a look how to get data from Twitter, prepare data for analysis and then do clustering of tweets using python &#8230; <a title=\"Using Python for Mining Data From Twitter\" class=\"read-more\" href=\"http:\/\/intelligentonlinetools.com\/blog\/2016\/05\/28\/using-python-for-mining-data-from-twitter\/\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":[]},"categories":[5,2,9],"tags":[],"jetpack_publicize_connections":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using Python for Mining Data From Twitter - Machine Learning Applications<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/intelligentonlinetools.com\/blog\/2016\/05\/28\/using-python-for-mining-data-from-twitter\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Python for Mining Data From Twitter - Machine Learning Applications\" \/>\n<meta property=\"og:description\" content=\"Twitter is increasingly being used for business or personal purposes. With Twitter API there is also an opportunity to do data mining of data (tweets) and find interesting information. In this post we will take a look how to get data from Twitter, prepare data for analysis and then do clustering of tweets using python ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/intelligentonlinetools.com\/blog\/2016\/05\/28\/using-python-for-mining-data-from-twitter\/\" \/>\n<meta property=\"og:site_name\" content=\"Machine Learning Applications\" \/>\n<meta property=\"article:published_time\" content=\"2016-05-28T03:26:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-06-05T13:17:36+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2016\/05\/Frequency-of-Hashtags-300x171.png\" \/>\n<meta name=\"author\" content=\"owygs156\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"owygs156\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/intelligentonlinetools.com\/blog\/2016\/05\/28\/using-python-for-mining-data-from-twitter\/\",\"url\":\"https:\/\/intelligentonlinetools.com\/blog\/2016\/05\/28\/using-python-for-mining-data-from-twitter\/\",\"name\":\"Using Python for Mining Data From Twitter - Machine Learning Applications\",\"isPartOf\":{\"@id\":\"http:\/\/intelligentonlinetools.com\/blog\/#website\"},\"datePublished\":\"2016-05-28T03:26:29+00:00\",\"dateModified\":\"2016-06-05T13:17:36+00:00\",\"author\":{\"@id\":\"http:\/\/intelligentonlinetools.com\/blog\/#\/schema\/person\/7a886dc5eb9758369af2f6d2cb342478\"},\"breadcrumb\":{\"@id\":\"https:\/\/intelligentonlinetools.com\/blog\/2016\/05\/28\/using-python-for-mining-data-from-twitter\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/intelligentonlinetools.com\/blog\/2016\/05\/28\/using-python-for-mining-data-from-twitter\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/intelligentonlinetools.com\/blog\/2016\/05\/28\/using-python-for-mining-data-from-twitter\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/intelligentonlinetools.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using Python for Mining Data From Twitter\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/intelligentonlinetools.com\/blog\/#website\",\"url\":\"http:\/\/intelligentonlinetools.com\/blog\/\",\"name\":\"Machine Learning Applications\",\"description\":\"Artificial intelligence, data mining and machine learning for building web based tools and services.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/intelligentonlinetools.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"http:\/\/intelligentonlinetools.com\/blog\/#\/schema\/person\/7a886dc5eb9758369af2f6d2cb342478\",\"name\":\"owygs156\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/intelligentonlinetools.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/2.gravatar.com\/avatar\/b351def598609cb4c0b5bca26497c7e5?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/2.gravatar.com\/avatar\/b351def598609cb4c0b5bca26497c7e5?s=96&d=mm&r=g\",\"caption\":\"owygs156\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using Python for Mining Data From Twitter - Machine Learning Applications","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/intelligentonlinetools.com\/blog\/2016\/05\/28\/using-python-for-mining-data-from-twitter\/","og_locale":"en_US","og_type":"article","og_title":"Using Python for Mining Data From Twitter - Machine Learning Applications","og_description":"Twitter is increasingly being used for business or personal purposes. With Twitter API there is also an opportunity to do data mining of data (tweets) and find interesting information. In this post we will take a look how to get data from Twitter, prepare data for analysis and then do clustering of tweets using python ... Read more","og_url":"https:\/\/intelligentonlinetools.com\/blog\/2016\/05\/28\/using-python-for-mining-data-from-twitter\/","og_site_name":"Machine Learning Applications","article_published_time":"2016-05-28T03:26:29+00:00","article_modified_time":"2016-06-05T13:17:36+00:00","og_image":[{"url":"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2016\/05\/Frequency-of-Hashtags-300x171.png"}],"author":"owygs156","twitter_card":"summary_large_image","twitter_misc":{"Written by":"owygs156","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/intelligentonlinetools.com\/blog\/2016\/05\/28\/using-python-for-mining-data-from-twitter\/","url":"https:\/\/intelligentonlinetools.com\/blog\/2016\/05\/28\/using-python-for-mining-data-from-twitter\/","name":"Using Python for Mining Data From Twitter - Machine Learning Applications","isPartOf":{"@id":"http:\/\/intelligentonlinetools.com\/blog\/#website"},"datePublished":"2016-05-28T03:26:29+00:00","dateModified":"2016-06-05T13:17:36+00:00","author":{"@id":"http:\/\/intelligentonlinetools.com\/blog\/#\/schema\/person\/7a886dc5eb9758369af2f6d2cb342478"},"breadcrumb":{"@id":"https:\/\/intelligentonlinetools.com\/blog\/2016\/05\/28\/using-python-for-mining-data-from-twitter\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/intelligentonlinetools.com\/blog\/2016\/05\/28\/using-python-for-mining-data-from-twitter\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/intelligentonlinetools.com\/blog\/2016\/05\/28\/using-python-for-mining-data-from-twitter\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/intelligentonlinetools.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Using Python for Mining Data From Twitter"}]},{"@type":"WebSite","@id":"http:\/\/intelligentonlinetools.com\/blog\/#website","url":"http:\/\/intelligentonlinetools.com\/blog\/","name":"Machine Learning Applications","description":"Artificial intelligence, data mining and machine learning for building web based tools and services.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/intelligentonlinetools.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"http:\/\/intelligentonlinetools.com\/blog\/#\/schema\/person\/7a886dc5eb9758369af2f6d2cb342478","name":"owygs156","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/intelligentonlinetools.com\/blog\/#\/schema\/person\/image\/","url":"http:\/\/2.gravatar.com\/avatar\/b351def598609cb4c0b5bca26497c7e5?s=96&d=mm&r=g","contentUrl":"http:\/\/2.gravatar.com\/avatar\/b351def598609cb4c0b5bca26497c7e5?s=96&d=mm&r=g","caption":"owygs156"}}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7h1IJ-3F","jetpack-related-posts":[{"id":827,"url":"http:\/\/intelligentonlinetools.com\/blog\/2017\/01\/11\/apis\/","url_meta":{"origin":227,"position":0},"title":"Useful APIs for Your Web Site","date":"January 11, 2017","format":false,"excerpt":"Here\u2019s a useful list of resources on how to create an API, compiled from posts that were published recently on this blog. The included APIs can provide a fantastic ways to enhance websites. 1. The WordPress(WP) API exposes a simple yet powerful interface to WP Query, the posts API, post\u2026","rel":"","context":"In &quot;API Programming&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1446,"url":"http:\/\/intelligentonlinetools.com\/blog\/2017\/11\/06\/10-new-top-resources-on-machine-learning-from-around-the-web\/","url_meta":{"origin":227,"position":1},"title":"10 New Top Resources on Machine Learning from Around the Web","date":"November 6, 2017","format":false,"excerpt":"For this post I put new and most interesting machine learning resources that I recently found on the web. This is the list of useful resources in such areas like stock market forecasting, text mining, deep learning, neural networks and getting data from Twitter. Hope you enjoy the reading. 1.\u2026","rel":"","context":"In &quot;Machine Learning&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":18,"url":"http:\/\/intelligentonlinetools.com\/blog\/2016\/03\/31\/data-mining-twitter-with-python\/","url_meta":{"origin":227,"position":2},"title":"Data Mining Twitter Data with Python","date":"March 31, 2016","format":false,"excerpt":"Twitter is an online social networking service that enables users to send and read short 140-character messages called \"tweets\". [1] Twitter users are tweeting about different topics based on their interests and goals. A word, phrase or topic that is mentioned at a greater rate than others is said to\u2026","rel":"","context":"In &quot;Data Mining&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":256,"url":"http:\/\/intelligentonlinetools.com\/blog\/2016\/06\/05\/using-python-for-mining-data-from-twitter-visualization-and-other-enchancements\/","url_meta":{"origin":227,"position":3},"title":"Using Python for Data Visualization of Clustering Results","date":"June 5, 2016","format":false,"excerpt":"In one of the previous post http:\/\/intelligentonlinetools.com\/blog\/2016\/05\/28\/using-python-for-mining-data-from-twitter\/ python source code for mining Twitter data was implemented. Clustering was applied to put tweets in different groups using bag of words representation for the text. The results of clustering were obtained via numerical matrix. Now we will look at visualization of clustering\u2026","rel":"","context":"In &quot;Artificial Intelligence&quot;","img":{"alt_text":"Data Visualization for Clustering Results","src":"https:\/\/i0.wp.com\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2016\/06\/data-visualization1-300x220.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":510,"url":"http:\/\/intelligentonlinetools.com\/blog\/2016\/08\/19\/getting-data-from-wikipedia-using-python\/","url_meta":{"origin":227,"position":4},"title":"Getting Data From Wikipedia Using Python","date":"August 19, 2016","format":false,"excerpt":"Recently I come across python package Wikipedia which is a Python library that makes it easy to access and parse data from Wikipedia. Using this library you can search Wikipedia, get article summaries, get data like links and images from a page, and more. Wikipedia wraps the MediaWiki API so\u2026","rel":"","context":"In &quot;API Programming&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":766,"url":"http:\/\/intelligentonlinetools.com\/blog\/2016\/12\/31\/retrieving-post-data-using-the-wordpress-api-with-python-script\/","url_meta":{"origin":227,"position":5},"title":"Retrieving Post Data Using the WordPress API with Python Script","date":"December 31, 2016","format":false,"excerpt":"In this post we will create python script that is able to get data from WordPress (WP) blog using WP API. This script will save downloaded data into csv file for further analysis or other purposes. WP API is returning data in json format and is accessible through link http:\/\/hostname.com\/wp-json\/wp\/v2\/posts.\u2026","rel":"","context":"In &quot;API Programming&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/posts\/227"}],"collection":[{"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/comments?post=227"}],"version-history":[{"count":25,"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/posts\/227\/revisions"}],"predecessor-version":[{"id":260,"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/posts\/227\/revisions\/260"}],"wp:attachment":[{"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/media?parent=227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/categories?post=227"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/tags?post=227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}