<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Teaching on Constantin Orasan&#39;s website</title>
		<link>https://dinel.org.uk/tags/teaching/</link>
		<description>Recent content in Teaching on Constantin Orasan&#39;s website</description>
		<generator>Hugo</generator>
		<language>en</language>
		
		
		
			<copyright>© 2026 CONSTANTIN ORASAN&lt;br&gt;Build:20260901</copyright>
		
		
			<lastBuildDate>Sun, 05 Apr 2026 13:09:05 +0100</lastBuildDate>
		
			<atom:link href="https://dinel.org.uk/tags/teaching/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Get the petrol prices from ASDA</title>
				<link>https://dinel.org.uk/2023/09/24/Get-the-petrol-prices-from-ASDA/</link>
				<pubDate>Sun, 24 Sep 2023 00:00:00 +0000</pubDate>
				<guid>https://dinel.org.uk/2023/09/24/Get-the-petrol-prices-from-ASDA/</guid>
				<description>&lt;p&gt;This year, &lt;a href=&#34;https://www.bbc.co.uk/news/business-66214934&#34; target=&#34;_blank&#34;&gt;the UK government encouraged supermarkets to display their fuel prices&lt;/a&gt;. The scheme is voluntary, and so far only ASDA has started displaying prices on its website. Since fuel prices vary from place to place, you must visit each supermarket&amp;rsquo;s website to find the best prices near you. To make this process easier, I wrote the following Python script:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# import the necessary modules&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#00f;font-weight:bold&#34;&gt;requests&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#00f;font-weight:bold&#34;&gt;bs4&lt;/span&gt; &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;import&lt;/span&gt; BeautifulSoup&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# specify the stores from which to retrieve the prices. &lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# For each store there is tuple (&amp;#34;Name&amp;#34;, &amp;#34;URL&amp;#34;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;urls &lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt; [&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        (&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;Sheerwater&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;https://storelocator.asda.com/south-east/woking/forsyth-road-sheerwater&amp;#34;&lt;/span&gt;),&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        (&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;Staines&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;https://storelocator.asda.com/south-east/staines/chertsey-lane-egham-hythe&amp;#34;&lt;/span&gt;),&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        (&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;Fareham&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;https://storelocator.asda.com/south-east/fareham/speedfields-park-newgate-lane&amp;#34;&lt;/span&gt;),&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;       ]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#080;font-style:italic&#34;&gt;# retrieve the prices for each place&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;for&lt;/span&gt; place, page_url &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;in&lt;/span&gt; urls:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    page &lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt; BeautifulSoup(requests&lt;span style=&#34;color:#666&#34;&gt;.&lt;/span&gt;get(page_url)&lt;span style=&#34;color:#666&#34;&gt;.&lt;/span&gt;text, &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;html.parser&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    postcode &lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt; page&lt;span style=&#34;color:#666&#34;&gt;.&lt;/span&gt;find(&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;span&amp;#34;&lt;/span&gt;, {&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;class&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;c-address-postal-code&amp;#34;&lt;/span&gt;})&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    petrol_prices &lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt; page&lt;span style=&#34;color:#666&#34;&gt;.&lt;/span&gt;find_all(&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;div&amp;#34;&lt;/span&gt;, {&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;class&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;Service-fuelCategory&amp;#34;&lt;/span&gt;})&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a2f&#34;&gt;print&lt;/span&gt;(&lt;span style=&#34;color:#b44&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#b68;font-weight:bold&#34;&gt;{&lt;/span&gt;place&lt;span style=&#34;color:#b68;font-weight:bold&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt; (Postcode: &lt;/span&gt;&lt;span style=&#34;color:#b68;font-weight:bold&#34;&gt;{&lt;/span&gt;postcode&lt;span style=&#34;color:#666&#34;&gt;.&lt;/span&gt;text&lt;span style=&#34;color:#b68;font-weight:bold&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;)&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;for&lt;/span&gt; petrol_price &lt;span style=&#34;color:#a2f;font-weight:bold&#34;&gt;in&lt;/span&gt; petrol_prices:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        divs_petrol_price &lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt; petrol_price&lt;span style=&#34;color:#666&#34;&gt;.&lt;/span&gt;find_all(&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;div&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a2f&#34;&gt;print&lt;/span&gt;(&lt;span style=&#34;color:#b44&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\t&lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b68;font-weight:bold&#34;&gt;{&lt;/span&gt;divs_petrol_price[&lt;span style=&#34;color:#666&#34;&gt;0&lt;/span&gt;]&lt;span style=&#34;color:#666&#34;&gt;.&lt;/span&gt;text&lt;span style=&#34;color:#b68;font-weight:bold&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#b68;font-weight:bold&#34;&gt;{&lt;/span&gt;divs_petrol_price[&lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;]&lt;span style=&#34;color:#666&#34;&gt;.&lt;/span&gt;text&lt;span style=&#34;color:#b68;font-weight:bold&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#b44&#34;&gt;&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a2f&#34;&gt;print&lt;/span&gt;()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Below is the output of the script on 24 Sept 2023:&lt;/p&gt;</description>
			</item>
			<item>
				<title>How to create word frequency lists in Python</title>
				<link>https://dinel.org.uk/2019/11/07/How-to-create-word-frequency-lists-in-Python/</link>
				<pubDate>Thu, 07 Nov 2019 00:00:00 +0000</pubDate>
				<guid>https://dinel.org.uk/2019/11/07/How-to-create-word-frequency-lists-in-Python/</guid>
				<description>&lt;p&gt;A few weeks ago I introduced my students to the notion of dictionaries in python. The obvious way of teaching them, especially in the context of my module, is to use dictionaries to create word frequency lists. In order to make the students understand better why dictionaries are useful, we discussed other ways to produce frequency lists which use only lists. This prompted me to try to think as many ways as possible to produce frequency lists. I also wanted to see how feasible is to use these methods.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Word embeddings for aggression identification</title>
				<link>https://dinel.org.uk/2018/09/25/Word-embeddings-for-aggression-identification/</link>
				<pubDate>Tue, 25 Sep 2018 00:00:00 +0000</pubDate>
				<guid>https://dinel.org.uk/2018/09/25/Word-embeddings-for-aggression-identification/</guid>
				<description>&lt;p&gt;The &lt;a href=&#34;https://sites.google.com/view/trac1/shared-task&#34;&gt;First Shared task on Aggression Identification&lt;/a&gt; was organised in conjunction with the &lt;a href=&#34;https://sites.google.com/view/trac1/home&#34;&gt;First Workshop on Trolling, Aggression and Cyberbullying&lt;/a&gt;. The idea of the shared task was fairly simple. Classify a text in one of the following three categories: &lt;em&gt;Overtly Aggressive&lt;/em&gt; (OAG), &lt;em&gt;Covertly Aggressive&lt;/em&gt; (CAG) and &lt;em&gt;Non-aggressive&lt;/em&gt; (NAG). This means that the task is essentially a standard text categorisation task and an approach based on bag-of-words is a good baseline to start with (neither me, nor the task organisers provided a baseline based on bag-of-words, so I don’t know what is the accuracy of the method).&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
