<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Lateral Blog - Medium]]></title>
        <description><![CDATA[Machine learning | Productivity | Knowledge Management - Medium]]></description>
        <link>https://medium.com/lateral-blog?source=rss----c2ea31a652b---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Lateral Blog - Medium</title>
            <link>https://medium.com/lateral-blog?source=rss----c2ea31a652b---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 12:52:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/lateral-blog" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A fastText-based hybrid recommender]]></title>
            <link>https://medium.com/lateral-blog/a-fasttext-based-hybrid-recommender-d9340f2e7b1?source=rss----c2ea31a652b---4</link>
            <guid isPermaLink="false">https://medium.com/p/d9340f2e7b1</guid>
            <category><![CDATA[fasttext]]></category>
            <category><![CDATA[recommender-systems]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[facebook]]></category>
            <category><![CDATA[supervised-learning]]></category>
            <dc:creator><![CDATA[Lateral]]></dc:creator>
            <pubDate>Mon, 07 Aug 2017 09:47:49 GMT</pubDate>
            <atom:updated>2017-08-07T10:01:45.344Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aXz4GzhyxrU2XkN-VEbsEg.jpeg" /></figure><p>Using Facebook Research’s new <a href="https://github.com/facebookresearch/fastText">fastText library</a> in supervised mode, I trained a hybrid recommender system, to recommend articles to users, given as training data both the text in the articles and the user/article interaction matrix. The labels attached to a document were both its id, and the ids of all users who viewed it. I’ve not finished testing it, but early signs are that it learns quite well. This post is a short progress report, perhaps of interest to others building hybrid recommenders.</p><h3>About fastText</h3><h4>What is it?</h4><p>Recently, Facebook Research released the C++ <a href="https://github.com/facebookresearch/fastText">source code</a> for fastText, a software library for learning word embeddings using a shallow neural network. It can learn either unsupervised, training on unstructured text, or in a supervised manner, from a series of labelled documents. The code is accompanied by two research preprints:</p><ol><li><a href="https://arxiv.org/pdf/1607.04606v1.pdf">Enriching Word Vectors with Subword Information</a> (unsupervised)</li><li><a href="https://arxiv.org/pdf/1607.01759v2.pdf">Bag of Tricks for Efficient Text Classification</a> (supervised),</li></ol><p>explaining fastText’s workings and performance on benchmark datasets in each case. The authors state its performance is comparable with much more complex “deep learning” algorithms, but the training time is significantly lower.</p><h4>How does it work?</h4><p>In unsupervised mode, fastText trains by sliding a window over the input text and either learning the centre word from the remaining context (“continuous bag of words” or “CBOW”), or all the context words from the centre word (“Skipgram”), and learning can be viewed as a series of updates to a neural network with two layers of weights and three tiers of neurons, in which the two outer tiers each have one neuron for each word in the vocabulary, and the middle tier has as many neurons as there are dimensions in the embedding space. In this way, it is similar to word2vec (in fact, one of the fastText coauthors, Tomas Mikolov, is the creator of word2vec). Unlike word2vec, however, fastText can also learn vectors for sub-parts of words — so-called character n-grams — ensuring e.g. that the words “supervised”, “supervise” and “supervisor” all have similar vectorisations, even if they tend to appear in different contexts. This feature enhances learning on heavily inflected languages, according to the authors.</p><p>In supervised mode, the first two neuron tiers of the network are the same, but the neurons in the output tier are in bijection with the labels, rather than the words in the vocabulary. The learning task on a given window is to predict the labels attached to the current document, given the words in the window.</p><h3>Training a hybrid recommender</h3><h4>Defining the model</h4><p>Supervised fastText trains on a text file in which each line is a series of space-separated labels, followed by the text of single document. The labels are prepended by a crib, by default “__label__”, so they can be differentiated from words in the text.</p><p>In my case, each line of the training file contained one document, with no repetitions. The labels attached to a document were its document id, and the ids of all users who had interacted with it. Here’s a fictitious example:</p><p>__label__doc_id_21231 __label__user_id_aadsf89asdf __label__user_id_87sdfsdf __label__user_id_45jfkasf novak djokovic won yet another tennis match last friday ...</p><p>After training, the <em>score</em> associated to a user/document pair is the cosine similarity of their associated vectors. (Note that the vectors learned by fastText are not of unit length, so computing cosine similarity means normalising.) The document yielding the highest score is defined to be the recommendation.</p><h4>Data preparation and hyperparameters</h4><p>After throwing out users and documents with too few interactions, my training set consisted of around 22k documents and 85k users, with 1 million interactions, and my test set consisted of 30,000 user/document interaction pairs. The training set was 56MB in size. Here are the hyperparameters I specified for the best-performing model (all others were default):</p><p>-dim 100<br>-loss ns<br>-thread 32<br>-minCount 5<br>-neg 10<br>-ws 20<br>-epoch 100000<br>-lr 0.075</p><p>The training took around 5 hours on a 32-core, 120 GB AWS instance. Varying the window size, dimension and minCount made little difference to model quality. Increasing “neg” — the number of negative samples — improved the quality of the model uniformly in the range I checked: values from 5 to 50 in intervals of 5. (The downside is that more negative samples means training takes longer.) Varying learning rate affected the model unpredictably: larger values seemed better when the number of epochs was small, but I can’t see a consistent pattern. Using a very large learning rate with very many epochs lead to segfault errors, perhaps because of arithmetic overflow. Increasing the number of epochs steadily improved model quality. I stopped at 100,000 epochs because the improvements were becoming marginal, and my patience ran out.</p><h4>A small “gotcha”</h4><p>In the version of the code I downloaded in late August, the documentation stated the default value for the “loss” hyperparameter was “ns”, meaning negative sampling. However, this was not true at the time: reading the code revealed the true default value was “softmax”, which perhaps leads to a better model, but is <em>much</em> slower to train. This meant that my first attempts to train a model were unsuccessful, because fixing a large enough value of “epoch” to ensure the model learned something would’ve meant waiting days or weeks for the model to train. After a few days’ frustration, I read the code and noticed the error in the documentation. Happily, fastText coauthor Edouard Grave was extremely helpful, responding immediately to my bug report, and fixing the problem within a day. He was also kind enough to suggest I use hierarchical softmax instead of negative sampling for the “loss” parameter, since it is, apparently, faster still to train. I haven’t yet experimented with hierarchical softmax systematically. A big thank you to Edouard for his help!</p><h4>Rationale: why should this work?</h4><p>The first layer of weights in the network encodes the word vectors; the second layer the label vectors. During training, at any given text window, each word vector is moved closer to a randomly chosen label vector for the current document. Each document id label is seen only once per training epoch, but if we train over many epochs, then:</p><ol><li>We expect the label vector associated to a document id to be pushed closer to the average of the word vectors this document contains, and</li><li>We expect the vector associated to a user id to be pushed closer to the average of the vectors of all words mentioned in each document seen by that user.</li></ol><p>If both the above hold, then label vectors of document ids and label vectors of user ids will be tend to be moved closer to one another, provided the given document has been seen by the given user. For the same reason, it will also be the case that any two users with similar reading tastes, and any two documents attracting users with similar reading tastes, will have similar vectorisations.</p><h4>Results</h4><p>We measured the performance of the model as follows:</p><ol><li>For each user_id/doc_id pair(u, d) in the test set, compute the cosine similarity of vec(u) with vec(d’), where d’ varies across all documents in the test set; this is by definition the score s(u, d’) of (u, d’).</li><li>Write these scores s(u, d’) in descending order in a list L, and record the position in which s(u, d) occurs.</li><li>Now compute the “decimal percentile” of s(u, d) in L: if it is in first place, assign it a score of 0.0, if it is in last place, give it 1.0; in the middle is 0.5. Call this number the “percentile rank” pr(u, d) of the pair (u, d).</li><li>We measure the performance of the model as the mean of pr(u, d) across all 30,000 pairs (u, d).</li></ol><p>The best model trained in this way achieved a score of around 0.093. A model that understood nothing would achieve a score of 0.5 — meaning that the score s(u, d) would be half-way down the list of test scores on average — so this is significantly better than random. However, this result is not as good as our current state-of-the-art model (CSOA), which achieves a score of less than 0.01. However, the CSOA is also trained on around 100 times more data. The next step is to train a fastText model on this larger data set. The experiment continues!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/140/1*5szAtYHlSZLHgyb_Vk2PdA.jpeg" /><figcaption>Author: Dr. Stephen Enright-Ward, Data Scientist @ <a href="https://medium.com/u/2bee51f32ea6">Lateral</a></figcaption></figure><p>Latest on Lateral: <a href="https://twitter.com/uselateral">Twitter</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9340f2e7b1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lateral-blog/a-fasttext-based-hybrid-recommender-d9340f2e7b1">A fastText-based hybrid recommender</a> was originally published in <a href="https://medium.com/lateral-blog">Lateral Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Similar Pages for Wikipedia]]></title>
            <link>https://medium.com/lateral-blog/similar-pages-for-wikipedia-4d473c9b5b41?source=rss----c2ea31a652b---4</link>
            <guid isPermaLink="false">https://medium.com/p/4d473c9b5b41</guid>
            <category><![CDATA[chrome-extension]]></category>
            <category><![CDATA[wikipedia]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Lateral]]></dc:creator>
            <pubDate>Fri, 10 Jun 2016 09:50:10 GMT</pubDate>
            <atom:updated>2016-06-10T09:53:52.514Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tlGQhh_su9E4jKWYTg8B5w.jpeg" /></figure><p><em>We have built a </em><a href="https://chrome.google.com/webstore/detail/similar-pages-for-wikiped/ibabphmjpolljfillmhiikhdohbolado"><em>Chrome Extension</em></a><em> for Wikipedia, which displays similar pages on any Wikipedia page and makes it easy to find related content to read.</em></p><p>Wikipedia is one of the <a href="http://www.alexa.com/topsites">top 10</a> most widely used websites globally and a rich source of information. There are pages for every conceivable topic; the English version alone has over 5 million. Using Wikipedia it is both possible to rapidly get information about a topic and then to also delve deeper into the details.</p><p>However, often it can also be useful to quickly see other pages that are related to the one you are reading. This provides broader context or a more lateral view of a topic and also means that you can quickly find the most relevant other pages to read, without having to sift through all the links on a page.</p><p>With that in mind we created the Chrome Extension <a href="http://bit.ly/similarwiki"><strong>Similar Pages for Wikipedia</strong></a> — a simple extension to Wikipedia that displays similar pages at the top of every Wikipedia page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*apQAMujTnjIQso8ZGKlIzg.gif" /></figure><p><a href="https://chrome.google.com/webstore/detail/similar-pages-for-wikiped/ibabphmjpolljfillmhiikhdohbolado"><strong>Install extension</strong></a></p><p>If you enjoy using the extension or if there are things you feel could be improved, it would be great to get <a href="https://lateral.typeform.com/to/gOD93H"><strong>your feedback</strong></a>!</p><h3>Comparing recommendations</h3><p>So far a lot of feedback we have gotten has centred around how our recommendations compare to those offered by Wikipedia’s related pages beta feature and building an integration for <a href="http://www.wikiwand.com/"><strong>Wikiwand</strong></a> — a popular Wikipedia reader.</p><p>Wikiwand actually also offers related content at the bottom of Wikipedia pages, so below is an example of how the three compare:</p><ul><li><strong>Dinosaur — Similar Pages for Wikipedia (Lateral)</strong><br>1. Origin of birds<br>2. Coelurosauria<br>3. Theropoda<br>4. Herrerasaurus<br>5. Compsognathus</li><li><strong>Dinosaur — Wikipedia Related Pages beta</strong><br>1. Bird<br>2. Tyrannosaurus<br>3. Cretaceous-Paleogene extinction event</li><li><strong>Dinosaur — Wikiwand Related Pages</strong><br>1. Feathered dinosaur<br>2. Clade<br>3. Theropoda</li></ul><p>and here’s another:</p><ul><li><strong>Artificial intelligence — Similar Pages for Wikipedia (Lateral)</strong><br>1. History of artificial intelligence<br>2. Strong AI<br>3. Intelligence amplification<br>4. Jürgen Schmidhuber<br>5. Fluid Concepts and Creative Analogies</li><li><strong>Artificial intelligence — Wikipedia Related Pages beta</strong><br>1. Artificial general intelligence<br>2. History of artificial intelligence<br>3. Philosophy of artificial intelligence</li><li><strong>Artificial intelligence — Wikiwand Related Pages</strong><br>1. Computer Science<br>2. Perception<br>3. Intelligent agent</li></ul><h3>Differences</h3><p>As you can see all three perform very well. We currently use only the content of the Wikipedia page to show similar pages, but will begin using our hybrid recommender to incorporate user behaviour, which is likely what Wikipedia is currently using to power their related content recommendations.</p><p>What differentiates what we currently offer from the other two is that we place the recommendations at the top of every Wikipedia page and that you can choose to see up to 10 similar pages.</p><h3>v2 — Potential features</h3><p>Our technology can also be used to provide similar Wikipedia pages for any webpage or text on a webpage. Using comparable functionality to our <a href="https://chrome.google.com/webstore/detail/newsbot-give-me-5/gahbhdbjjomehdmbjielhoflcmnecief"><strong>NewsBot Chrome extension</strong></a>, v2 could display similar Wikipedia pages as desktop notifications:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*E39ESU-QK-MZR0kIYmiCzA.gif" /></figure><p>Additionally, we can also provide the option of displaying similar news or academic articles at the top of every Wikipedia page, as an alternative to showing similar Wikipedia pages.</p><p>Please <a href="https://lateral.typeform.com/to/gOD93H"><strong>let us know</strong></a> of any features you would like to see in v2 and we hope you enjoy the extension!</p><p><a href="https://chrome.google.com/webstore/detail/similar-pages-for-wikiped/ibabphmjpolljfillmhiikhdohbolado"><strong>Install extension</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d473c9b5b41" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lateral-blog/similar-pages-for-wikipedia-4d473c9b5b41">Similar Pages for Wikipedia</a> was originally published in <a href="https://medium.com/lateral-blog">Lateral Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Fastest Way to Find Related Articles]]></title>
            <link>https://medium.com/lateral-blog/the-fastest-way-to-find-related-articles-9c9369d19872?source=rss----c2ea31a652b---4</link>
            <guid isPermaLink="false">https://medium.com/p/9c9369d19872</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[news]]></category>
            <category><![CDATA[chrome-extension]]></category>
            <dc:creator><![CDATA[Lateral]]></dc:creator>
            <pubDate>Fri, 03 Jun 2016 15:29:58 GMT</pubDate>
            <atom:updated>2016-06-03T15:25:26.401Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aSqhzUQIlxopke-fk4B70g.jpeg" /></figure><p><em>NewsBot is a Chrome Extension and is one of our interfaces to demonstrate how our Lateral API can be used to personalise content. It is currently in Beta and any feedback would be much appreciated.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FnbD2I7oYKaE%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DnbD2I7oYKaE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FnbD2I7oYKaE%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/cc50282e1db9562649a81e59c3fbc7e3/href">https://medium.com/media/cc50282e1db9562649a81e59c3fbc7e3/href</a></iframe><p>We are extremely excited to introduce you to <a href="http://getnewsbot.com/">NewsBot</a>, the fastest way to find related articles and to stay up-to-date on the news that matters to you!</p><p>Nowadays, a lot of great content is being created and yet at the same time finding that content can be a time consuming endeavour. Drowned out by the noise we are overwhelmed by the amount of information that is available and even when we find good articles, finding more like them can be a challenge.</p><p>We wanted to create a tailored experience that puts related articles from great sources a keypress away.</p><h3>Introducing NewsBot</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/110/1*6pxpJX-45So8aLpkQzMIDQ.png" /></figure><p>NewsBot is a <a href="https://chrome.google.com/webstore/detail/newsbot/gahbhdbjjomehdmbjielhoflcmnecief">Google Chrome Extension</a> and super easy to install. Once installed there are three great ways to find related content:</p><p><strong>“Give me 5”</strong><br>Instantly get five related articles for any article or website.</p><p><strong>“Follow”</strong><br>Get related articles sent straight to your email inbox as soon as they are published.</p><p><strong>“Highlight”</strong><br>Get related articles for any highlighted text in the browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/268/0*bXbo3drT1QuaHyTt.png" /></figure><p>So whether you quickly want to find articles related to anything your reading online or whether you are busy but still want to stay informed on specific topics, NewsBot has you covered.</p><p><strong>Here are some examples:</strong></p><p>NewsBot related articles for: <a href="http://qz.com/426718/japan-is-building-huge-solar-power-plants-that-float-on-water/">Japan is building huge solar power plants that float on water — Quartz</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/0*SXBvmFfiavsAZ0kf.png" /></figure><p>NewsBot related articles for: <a href="http://getnewsbot.com/">getnewsbot.com</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/0*ZHAIPfe4mEiln1uE.jpg" /></figure><p>The way it works is that NewsBot monitors a curated list of high quality news and blog streams and leverages <a href="http://lateral.io/tech">Lateral’s conceptual text-matching API </a>to provide recommendations that are not only very relevant but also offer a breadth of perspectives. Instead of just keywords and tags, the machine learning algorithm understands full text content and therefore looks at the entirety of each article to decide which content is similar.</p><p>To ensure the quality of the results we only serve articles from the best, handpicked news publications and blogs. With new content being added every day we already serve well over 800,000+ articles. Nonetheless, we may not yet have recommendations for everything and so please let us know if there are any high quality sources that we should add.</p><p>We hope you enjoy NewsBot as much as we do and look forward to hearing your feedback!</p><p><a href="https://chrome.google.com/webstore/detail/newsbot-give-me-5/gahbhdbjjomehdmbjielhoflcmnecief"><strong>Install Chrome Extension</strong></a></p><p>Connect with us on twitter <a href="http://twitter.com/getnewsbot">@getnewsbot</a> and <a href="http://twitter.com/uselateral">@uselateral</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/0*xgO_VSialegfWH1F.png" /></figure><p><em>Originally published at </em><a href="https://blog.lateral.io/2015/06/newsbot-instant-news-recommendations-at-a-click-of-a-button/"><em>blog.lateral.io</em></a><em> on June 12, 2015.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c9369d19872" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lateral-blog/the-fastest-way-to-find-related-articles-9c9369d19872">The Fastest Way to Find Related Articles</a> was originally published in <a href="https://medium.com/lateral-blog">Lateral Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create a Chrome extension to modify a website’s HTML or CSS]]></title>
            <link>https://medium.com/lateral-blog/create-a-chrome-extension-to-modify-a-websites-html-or-css-e76a102d1b2a?source=rss----c2ea31a652b---4</link>
            <guid isPermaLink="false">https://medium.com/p/e76a102d1b2a</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[chrome-extension]]></category>
            <dc:creator><![CDATA[Lateral]]></dc:creator>
            <pubDate>Fri, 03 Jun 2016 15:08:20 GMT</pubDate>
            <atom:updated>2016-06-03T15:07:45.402Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jZ561ervPmqQgQLYx2jtgg.png" /></figure><p>A technique we use to visualise how Lateral recommendations would look and work on a website is to create a Chrome extension that inserts the recommendations at load time. This is useful because:</p><ul><li>No access is required to the websites source files</li><li>The extension shares assets with the page, so matching styling is easy</li><li>It allows one to visualise a demo or feature as if it were in production</li></ul><p>We often use extensions to insert recommendations into websites that don’t currently benefit from Lateral recommendations. An example is our<br> <a href="https://chrome.google.com/webstore/detail/wikipedia-recommendations/ibabphmjpolljfillmhiikhdohbolado">Wikipedia similar page Chrome extension</a>. There are, however, many other applications for this type of extension, such as modifying the styling of a website, hiding an annoying element, auto-populating a form, or clicking something on page load.</p><p>In this blog post, I will create a Chrome extension that modifies this blog to set a custom background and to modify the HTML.</p><p>Side note: You may be thinking “Why not just use Userscripts?” which is a good question. The main reasons for using a Chrome extension are ease of installation and ease of updating. With Userscripts you’d first need to get the user to install a userscript manager. Then you’d need to get them to install the userscript. With Chrome, it’s as simple as clicking a button. Cross-browser compatibility is a valid concern which Userscripts solve (<a href="http://wiki.greasespot.net/Cross-browser_userscripting">kind of</a>) but so far, as we are primarily creating demos, targeting only Chrome has not been an issue for us.</p><p>So, the first thing to do is to create a folder to hold the chrome extension. This folder needs to contain a few files.</p><p><strong>The manifest</strong><br>Chrome extensions require a file called the <a href="https://developer.chrome.com/extensions/manifest">manifest</a>. It’s a simple JSON file (named manifest.json) and is read by Chrome to understand what permissions the extension requires, which pages it should load on and things like the name and icons. Here’s a simple example for this application:</p><pre>{ &quot;manifest_version&quot;: 2, &quot;name&quot;: &quot;Modify CSS and HTML&quot;, &quot;version&quot;: &quot;0.1.0&quot;, &quot;description&quot;: &quot;Lateral blog post demo extension&quot;, &quot;content_scripts&quot;: [{ &quot;css&quot;: [&quot;styles.css&quot;], &quot;js&quot;: [&quot;content.js&quot;], &quot;matches&quot;: [&quot;https://blog.lateral.io/*&quot;] }] }</pre><p>At the top you can see the standard <a href="https://developer.chrome.com/extensions/manifest/name#name">name</a>, <a href="https://developer.chrome.com/extensions/manifest/version">version</a> and <a href="https://developer.chrome.com/extensions/manifest/description">description</a> fields. The important part is the <a href="https://developer.chrome.com/extensions/content_scripts">content_scripts</a> field. This tells Chrome that whenever we are on a page that matches the matches field, load the CSS file(s) in css and the Javascript file(s) in js.</p><p><strong>styles.css</strong><br>This is the stylesheet referenced by the manifest. All I want to do is to change the background of the blog to a simple pattern so my styles.css contains the following:</p><pre>body { background: url(https://medium.com/&#39;https://media.giphy.com/media/3o7WTDJQVuYwhhuLhC/giphy.gif&#39;) !important; } #masthead, #primary { -webkit-filter: invert(100%); filter: invert(100%); background-color: #fff; padding: 20px !important; } #masthead { background: none; } #masthead img, #primary img { -webkit-filter: invert(100%); filter: invert(100%); }</pre><p>I changed the background to a GIF of a unicorn floating through space. Since the GIF has a dark background, I set a background colour and inverted the main content areas.</p><p>Note: Here I am loading the background image from giphy, but it’s entirely possible to load from the extension itself using the <a href="https://developer.chrome.com/extensions/manifest/web_accessible_resources">web_accessible_resources</a> field of the manifest and this <a href="http://stackoverflow.com/a/8864212">tip from StackOverflow</a>.</p><p>Note #2: I’m using !important here to override the existing pages CSS. You could probably get around this using a more specific selector, but for demonstration purposes I’ll leave it at that.</p><p><strong>content.js</strong><br>Now for the javascript file that gets loaded on the blog. Since this demo extension is already kind of ridiculous, I’m going to replace all the images on the blog with cats.</p><pre>var images = document.getElementsByTagName(&#39;img&#39;); for (var i = 0, l = images.length; i &lt; l; i++) { images[i].src = &#39;http://placekitten.com/&#39; + images[i].width + &#39;/&#39; + images[i].height; }</pre><p>Now we have everything in place, the extension folder should look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/0*U0bnIePfiz7T0hwL.png" /></figure><p>I put the code on GitHub at <a href="https://github.com/lateral/chrome-extension-blogpost">lateral/chrome-extension-blogpost</a> and if you want to download the extension you can get a <a href="https://github.com/lateral/chrome-extension-blogpost/archive/master.zip">zip of it here</a>.</p><p>To install the extension, visit chrome://extensions in Chrome and drag the folder containing the above files into the window:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*nlHXPsUilm4BpAlOprHvww.gif" /></figure><p>And now the Lateral blog looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jZ561ervPmqQgQLYx2jtgg.png" /></figure><p>Hopefully the extension you make will be a bit more meaningful. ¯\_(ツ)_/¯</p><p><em>Originally published at </em><a href="https://blog.lateral.io/2016/04/create-chrome-extension-modify-websites-html-css/"><em>blog.lateral.io</em></a><em> on April 14, 2016.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e76a102d1b2a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lateral-blog/create-a-chrome-extension-to-modify-a-websites-html-or-css-e76a102d1b2a">Create a Chrome extension to modify a website’s HTML or CSS</a> was originally published in <a href="https://medium.com/lateral-blog">Lateral Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Give me five]]></title>
            <link>https://medium.com/lateral-blog/give-me-five-813fd99a8e6d?source=rss----c2ea31a652b---4</link>
            <guid isPermaLink="false">https://medium.com/p/813fd99a8e6d</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[chrome]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Lateral]]></dc:creator>
            <pubDate>Fri, 03 Jun 2016 14:52:39 GMT</pubDate>
            <atom:updated>2016-06-03T15:09:05.317Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*DUrNns6YOKhEEZmnZmy7TQ.gif" /></figure><p><a href="https://github.com/lateral/give-me-five">Give me five</a> is an open source Chrome extension that allows you to recommend the content you <a href="https://lateral.io/docs/api#adding-documents">push to Lateral</a> based on the content of the page you’re currently visiting. It’s the same code base that the <a href="https://getnewsbot.com/">NewsBot Chrome extension</a> is built upon. The screencast above shows the extension in action.</p><p>You can find the source code to Give me five on <a href="https://github.com/lateral/give-me-five">GitHub</a>. You can use it to create your own extension that recommends your content. If you have a Lateral API key then trying it out is as simple as <a href="https://github.com/lateral/give-me-five#configuration">putting your key into</a> the extension that <a href="https://github.com/lateral/give-me-five/blob/master/give-me-five.crx?raw=true">we have pre-compiled</a>. Or, if you want to create an extension to give away you can enter your key <a href="https://github.com/lateral/give-me-five#to-bake-your-own-key-in-to-the-extension">into the source</a> and <a href="https://github.com/lateral/give-me-five#to-create-a-crx">compile that</a>.</p><p>We use it (through <a href="https://medium.com/@getnewsbot"><strong>@NewsBot</strong></a>) to find related news to articles whose topic we want to learn more about, but there are many other applications that could be tried.</p><ul><li><strong>Personal Work/Research:</strong> Push notes or documents to Lateral (for example from Dropbox, Evernote or Google Drive) and use the extension to quickly find or remind yourself of previous related work you have done.</li><li><strong>Company research</strong>: Push your notes to Lateral and use the extension to quickly surface any related work you or your team has done to a topic covered in an article.</li><li><strong>Journalists:</strong> Push your publication’s content to Lateral and allow your journalists and editors to quickly know whether the publication has covered the story and who has written similar stories.</li><li><strong>Readers:</strong> Allow your readers to surface similar content from your specific publication.</li><li><strong>Academic:</strong> Push academic papers to Lateral and use the extension to quickly find related papers to an article or abstract you are reading.</li></ul><p>Currently it will involve some coding skills to set up, but we will be adding the ability to add content without coding soon, so watch this space.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=813fd99a8e6d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lateral-blog/give-me-five-813fd99a8e6d">Give me five</a> was originally published in <a href="https://medium.com/lateral-blog">Lateral Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Make your favourite apps smarter]]></title>
            <link>https://medium.com/lateral-blog/make-your-favourite-apps-smarter-54e483727cf?source=rss----c2ea31a652b---4</link>
            <guid isPermaLink="false">https://medium.com/p/54e483727cf</guid>
            <category><![CDATA[news]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[rss]]></category>
            <dc:creator><![CDATA[Lateral]]></dc:creator>
            <pubDate>Fri, 03 Jun 2016 14:49:28 GMT</pubDate>
            <atom:updated>2016-06-03T14:49:15.951Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wB6TaVXnAJeTnJ_5vYJ3pA.jpeg" /></figure><h2>Make your favourite apps smarter*</h2><h4>By using NewsBot’s handy RSS Feed</h4><p>Lateral’s <a href="http://getnewsbot.com/"><strong>NewsBot</strong></a> allows you to create your own news streams tailored to you. Simply give your Bot an article you really like, by following a story, for example a great article on IoT or the future of artificial intelligence, and it will monitor high quality news sources to email you the latest, most relevant and interesting content.</p><p>But wait there’s more! We want your NewsBot to compliment your day as much as possible. That’s why we also every story you follow an <a href="http://en.wikipedia.org/wiki/RSS"><strong>RSS feed</strong></a> so that you can integrate your Bots’ highly relevant news streams with just about any app that supports RSS, and there are a lot.</p><p>Below we have gone through and explained step-by-step how to add NewsBot’s RSS to a few of our favourite apps and added comments on the awesomeness this can provide. If you think of any good ones we should add, please <a href="/service/mailto:hello+medium@lateral.io"><strong>get in touch</strong></a>.</p><p><a href="https://bufferapp.com/"><strong>Buffer</strong></a></p><figure><a href="https://bufferapp.com/"><img alt="" src="https://cdn-images-1.medium.com/max/52/1*b3U4kW1Q2LEliNAy1w7DsQ.png" /></a></figure><p>Buffer is a great way of posting to different social media accounts and scheduling those posts throughout the day. However sometimes you may ask yourself “what should I post?”. By connecting your Bots to Buffer you will receive their recommendations directly in the app’s feed section, so you can always have something insightful to share to start great conversations with your network. Here is how it’s done (we recommend using Buffer’s website to add your Bot’s feed).</p><p>1. Install NewsBot (<a href="http://getnewsbot.com/"><strong>getnewsbot.com</strong></a>)</p><p>2. Follow a story (<a href="https://www.youtube.com/watch?v=nbD2I7oYKaE"><strong>find out how</strong></a>)</p><p>3. Copy RSS from the “Following” section of the extension</p><p>4. Sign into <a href="https://bufferapp.com/"><strong>bufferapp.com</strong></a></p><p>5. Click on the “Content” section</p><p>6. Click on the “Feeds” section</p><p>7. Click “Add &amp; Remove Feeds”</p><p>8. Paste your Bot’s RSS into in the form provided</p><p>9. When the feed title appears below click it</p><p>10. Done! (you should get a confirmation message)</p><p>If you want to cover more subjects just make more Bots and add their feeds as well!</p><p><a href="http://feedly.com/i/welcome"><strong>Feedly</strong></a></p><figure><a href="http://feedly.com/i/welcome"><img alt="" src="https://cdn-images-1.medium.com/max/52/1*mcFrDYgMYFa6Z_zgu_ibQQ.png" /></a></figure><p>Feedly lets you keep on top of your all your RSS feeds. If you use Feedly, it makes sense to add your Lateral Bot for a more immersive experience!</p><p>1. Install NewsBot (<a href="http://getnewsbot.com/"><strong>getnewsbot.com</strong></a>)</p><p>2. Follow a story (<a href="https://www.youtube.com/watch?v=nbD2I7oYKaE"><strong>find out how</strong></a>)</p><p>3. Copy RSS from the “Following” section of the extension</p><p>4. Open the Feedly app</p><p>5. Tap the menu icon (top left)</p><p>6. Go to “Add website”</p><p>7. Paste your Bot’s RSS into the search box (at the top)</p><p>8. Press the “+” symbol (next to your Bot’s name)</p><p>9. Select or create a collection</p><p>10. Done!</p><p><a href="https://about.flipboard.com/"><strong>Flipboard</strong></a></p><figure><a href="https://about.flipboard.com/"><img alt="" src="https://cdn-images-1.medium.com/max/52/1*z5DLJ_qAc7KbrV6q1fK4ww.png" /></a></figure><p>The renowned news aggregator app allows you to follow your favourite news streams and add articles to “magazines” that you can share with others. The slick design and navigation makes for a great experience and with Lateral Bots finding compelling articles that reflect your specific interests it has never been easier to stay informed in style.</p><p>1. Install NewsBot (<a href="http://getnewsbot.com/"><strong>getnewsbot.com</strong></a>)</p><p>2. Follow a story (<a href="https://www.youtube.com/watch?v=nbD2I7oYKaE"><strong>find out how</strong></a>)</p><p>3. Copy RSS from the “Following” section of the extension</p><p>4. Open the Flipboard app</p><p>5. Ignore the “You copied a link” message</p><p>6. Tap the search icon (bottom middle)</p><p>7. Paste your Bot’s RSS into the search box (at the top) &amp; tap search</p><p>8. Select your Bot from the list</p><p>9. Tap “follow” (top right)</p><p>10. Done!</p><p><a href="https://ifttt.com/"><strong>IFTTT</strong></a></p><figure><a href="https://ifttt.com/"><img alt="" src="https://cdn-images-1.medium.com/max/52/1*uPBQvdxLJpibIv4Dak4MGg.png" /></a></figure><p>IFTTT is great as it allows you to automate processes in your daily life using a simple two step recipe: if this, then that. By adding your Bot’s feed you can for example automatically add new articles to Evernote, save them to Instapaper or Pocket to read later, get SMS alerts for new articles and even create a <a href="https://medium.com/@uselateral/make-your-favourite-apps-smarter-54e483727cf#c847"><strong>Twitter Bot</strong></a>!</p><p>1. Install NewsBot (<a href="http://getnewsbot.com/"><strong>getnewsbot.com</strong></a>)</p><p>2. Follow a story (<a href="https://www.youtube.com/watch?v=nbD2I7oYKaE"><strong>find out how</strong></a>)</p><p>3. Copy RSS from the “Following” section of the extension</p><p>4. Open the IFTTT app</p><p>5. Tap the “recipe” symbol (top right)</p><p>6. Tap the “+” symbol (top right)</p><p>7. Tap the blue “+” icon</p><p>8. Select “Feed” as a trigger</p><p>9. Tap the blue “+” icon next to “new feed item”</p><p>10. Paste your Bot’s RSS into the “Feed URL” box</p><p>11. Tap “Next” (top right)</p><p>12. Tap the red “+” icon</p><p>13. Select an Action:</p><p>eg. Evernote — Create a note</p><p>eg. Instapaper— Save item</p><p>13. Done!</p><p><a href="https://slack.com/"><strong>Slack</strong></a></p><figure><a href="https://slack.com/"><img alt="" src="https://cdn-images-1.medium.com/max/52/1*F2xPsN5BDZ7Ptnq_VRy0Mw.png" /></a></figure><p>We all know Slack is awesome, though equally who knows why? Maybe it has to do with the incredible ways it lets you integrate services, and our Bots are no exception. Slack makes it ridiculously easy to integrate RSS feeds and we for example have created a channel where our Bots keep our team informed about the latest news in artificial intelligence.</p><p>1. Install NewsBot (<a href="http://getnewsbot.com/"><strong>getnewsbot.com</strong></a>)</p><p>2. Follow a story (<a href="https://www.youtube.com/watch?v=nbD2I7oYKaE"><strong>find out how</strong></a>)</p><p>3. Copy RSS from the “Following” section of the extension</p><p>4. Open Slack</p><p>5. Create a new channel or go to an existing one</p><p>6. Type: <strong>/feed subscribe</strong> and paste your Bot’s RSS</p><p>7. Tap / press Enter</p><p>8. Done!</p><p><a href="https://twitter.com/?lang=en"><strong>Twitter</strong></a><strong> (using IFTTT)</strong></p><figure><a href="https://twitter.com/?lang=en"><img alt="" src="https://cdn-images-1.medium.com/max/122/1*Gy9OgdLQ6dVIrQV-TpOvzQ.png" /></a></figure><p>If you like <a href="https://twitter.com/uselateral/lists/lateral-twitter-bots"><strong>our Twitter Bots</strong></a>, which automatically tweet the latest news on subjects like the future of news and artificial intelligence, why not create your own?! There are several complicated ways to go about this but thankfully IFTTT has got your back:</p><p>1. Create a Twitter account (<a href="http://twitter.com/"><strong>twitter.com</strong></a>)</p><p>2. Install NewsBot (<a href="http://getnewsbot.com/"><strong>getnewsbot.com</strong></a>)</p><p>3. Follow a story (<a href="https://www.youtube.com/watch?v=nbD2I7oYKaE"><strong>find out how</strong></a>)</p><p>4. Copy RSS from the “Following” section of the extension</p><p>5. Open the IFTTT app</p><p>6. Tap the “recipe” symbol (top right)</p><p>7. Tap the “+” symbol (top right)</p><p>8. Tap the blue “+” icon</p><p>9. Select “Feed” as a trigger</p><p>10. Tap the blue “+” icon next to “New feed item”</p><p>11. Paste your Bot’s RSS into the “Feed URL” box</p><p>12. Tap “Next” (top right)</p><p>13. Tap the red “+” icon</p><p>14. Select “Twitter” as an action</p><p>15. Tap the blue “+” icon next to “Post a tweet”</p><p>16. Done!</p><p>Hopefully you have found this guide helpful and are already receiving thought provoking articles from your NewsBot where it suits you best!</p><p>Should you have any further questions or comments please<strong> </strong><a href="/service/mailto:hello+medium@lateral.io"><strong>get in touch</strong></a> or to find out more about Lateral and NewsBot please visit <a href="http://lateral.io/"><strong>lateral.io</strong></a><strong> </strong>or<strong> getnewsbot.com</strong>.</p><p>To stay up to date <a href="http://twitter.com/uselateral"><strong>follow us</strong></a> or <a href="https://twitter.com/uselateral/lists/lateral-twitter-bots"><strong>our Bots</strong></a> on Twitter.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54e483727cf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lateral-blog/make-your-favourite-apps-smarter-54e483727cf">Make your favourite apps smarter</a> was originally published in <a href="https://medium.com/lateral-blog">Lateral Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>