RWET – Functions

This week I took my previous assignment and tried to get all the printing to work through a function. I got it all working in the end but I had a surprising amount of difficulty.

I call the function like this:

 

Here’s an example of the result, which hasn’t changed much.

 

Ashwin’s dig: March 30 will be known as ‘World Apology Day’ – Times of India

thirtieth

Both Houses adjourned till 11 am on March 31

Does Science Advance One Funeral at a Time?

 

Both Houses adjourned till 11 am on March 31

thirtieth

Supreme Court refers triple talaq case to 5-judge constitutional bench; hearing to begin May 11 – Times of India

No stamping of flyers’ handbags at 7 airports from April 1 – Times of India

I tried to set this aside as a module but It required a lot of libraries and variables from my main script. I guess I could have passed all those through as parameters but it felt kinda hacky so I left it all as one file.

Read More

RWET – Poetic Form

I  once again continued working with news headlines this week. However this time I think I have a more robust collection of headlines. I found a news api that lets me pull in over 550+ headlines from 60 different news sources. The code I wrote basically gets the list of sources from the API and then uses that list to request 10 headlines from each source. These headlines are then saved in a list together and then if any of them contain numbers (in either written or numerical form) they are sorted into another list based on the numbers they use. E.g “Five people discover volcano”   would be assigned to a list within the 5th slot of another list. I then got the real time and date and tried to have the program print the date and time using these headlines. Here are some results:

2:10:

Alan Shearer Names The Two Strikers Who Can Break His Premier League Goal Record | SPORTbible: This startup wants to send electric planes from London to Paris within 10 years

March 23, 2:39:

The best laptop deals in March 2017: cheap laptops for every budget, twenty-third,

Less than half of women breastfeed after two months, survey finds: thirty-nine

March 23, 3:01:

Obituary: Martin McGuinness died on March 21st, twenty-third

Germany 1-0 England: Three Lions stars rated and slated: Germany 1 England 0: Lukas Podolski bows out with signature thunderbolt to light up final match

3:02:

Police officer, three others killed in Wisconsin shooting: reports: Less than half of women breastfeed after two months, survey finds

3:03:

South Korean ferry in which hundreds died raised after three years: Police Officer, 3 Others Killed in a Shooting in Wisconsin

3:04:

Anti-terror police arrest three in Birmingham after Westminster attack: U.K. Parliament Attacker Leaves Four Dead, Including Police Officer

3:05:

Germany 1-0 England: Three Lions stars rated and slated: Terror Attack Near British Parliament Leaves 5 Dead

[More updates coming]

The last two I found particularly interesting because the headlines refer to the same event with different numbers. In this case it seems like the number of fatalities increased and the second was an updated headline. This is essentially what I was interested in by making a time based form that deals with news. I wanted to create something that relays time in terms of world events. This update underscores both how prevalent this event was in the news of that time but also the nature of the event itself. The juxtaposition of the two headlines about the London attacks with different death tolls actually makes the event seem realer, to me at least. As if that extra person passed away while you were reading about it.

The program also just writes the value of time if it can’t find. I thought this would create the effect of having “unburdened” numbers – or numbers that haven’t been implicated in any major news that day. Refreshing this list over and over shows how certain numbers become widely reported based on the days events while others don’t. I still haven’t nailed this news thing down to where I want it exactly (I think part of the problem is that it takes to long to read through a 24 hour clock) but I think this is the closest I’ve gotten so far in terms of making something interesting.

 

 

Read More

RWET – APIs

I continued to work with headlines and news. This time I used an API to grab the most popular headlines on NYTimes.com and pick a random word to replace with a definition from Oxford dictionary. Sometimes the results don’t make sense but every now an then an interesting replacement occurs. Here are some examples of the output (my favorites are in bold):

Old Headlines:

A Quiet Giant of Investing Weighs In on Trump

Mexico City, Parched and Sinking, Faces a Water Crisis

You May Want to Marry My Husband

Steve Bannon Carries Battles to Another Influential Hub: The Vatican

Lessons on Aging Well, From a 105-Year-Old Cyclist

What a Failed Trump Administration Looks Like

Why Nobody Cares the President Is Lying

A Crack in an Antarctic Ice Shelf Grew 17 Miles in the Last Two Months

Lower Back Ache? Be Active and Wait It Out, New Guidelines Say

36 Hours in San Diego

How New York City Gets Its Electricity

7 Earth-Size Planets Orbit Dwarf Star, NASA and European Astronomers Say

Trump Campaign Aides Had Repeated Contacts With Russian Intelligence

Mental Health Professionals Warn About Trump

Ignorance Is Strength

Keep or Replace Obamacare? It Might Be Up to the States.

How Uber Deceives the Authorities Worldwide

New Headlines:

A Quiet Giant of Investing Weighs In on a trumpet or a trumpet blast

Mexico City, Parched a Boolean operator which gives the value one if and only if all the operands are one, and otherwise has a value of zero Sinking, Faces a Water Crisis

used to refer to the person or people that the speaker is addressing May Want to Marry My Husband

Steve Bannon Carries Battles to Another having great influence on someone or something Hub: The Vatican

Lessons on Aging Well, From used when mentioning someone or something for the first time in a text or conversation 105-Yeused when mentioning someone or something for the first time in a text or conversationr-Old Cyclist

What a Failed Trump the process or activity of running a business, organization, etc. Looks Like

a reason or explanation Nobody Cares the President Is Lying

A very good or skilful in an Antarctic Ice Shelf Grew 17 Miles in the Last Two Months

Lower Back Ache? Be engaging or ready to engage in physically energetic pursuits and Wait It Out, New Guidelines Say

36 Hours in relating to the San or their languages Diego

How New York a large town Gets Its Electricity

7 Earth-Size Planets Orbit Dwarf Star, NASA and relating to or characteristic of Europe or its inhabitants Astronomers Say

Trump Campaign Aides Had Repeated Contacts accompanied by (another person or thing) Russian Intelligence

Mental Health Professionals Warn on the subject of; concerning Trump

Ignorance Iceland (international vehicle registration) Strength

Keep or Replace Obamacare? It Might Be Up used with the base form of a verb to indicate that the verb is in the infinitive, in particular the States.

How Uber Deceives denoting one or more people or things already mentioned or assumed to be common knowledge Authorities Worldwide

If I run it again, It will often yield different results with the same headlines:

 

New Headlines:

A making little or no noise Giant of Investing Weighs In on Trump

Mexico City, Parched and Sinking, Faces a pour or sprinkle water over (a plant or area) in order to encourage plant growth Crisis

You May Want to join in marriage My Husband

What a Failed Trump the process or activity of running a business, organization, etc. Looks Like

Why Nobody Cares the the elected head of a republican state Is Lying

A Crack in the form of the indefinite article (see a) used before words beginning with a vowel sound Antarctic Ice Shelf Grew 17 Miles in the Last Two Months

in what way or manner; by what means New York City Gets Its Electricity

36 Hours in a borough of New York City, at the south-western corner of Long Island. The Brooklyn Bridge (1869\u201383) links Long Island with lower Manhattan

7 Earth-Size Planets Orbit cause to seem small or insignificant in comparison Star, NASA and European Astronomers Say

Trump Campaign Aides Had Repeated Contacts With Russian the ability to acquire and apply knowledge and skills

Mental Health Professionals inform someone in advance of a possible danger, problem, or other unpleasant situation About Trump

lack of knowledge or information Is Strength

Keep or Replace Obamacare? used to refer to a thing previously mentioned or easily identified Might Be Up to the States.

How Uber Deceives denoting one or more people or things already mentioned or assumed to be common knowledge Authorities Worldwide

 

Read More

RWET – Cut up 2: Sets and dictionaries

This week I continued to work with news and tried to make some lightly cut up headlines. What I ended up with is a script that reads in a whole article, splits it into headlines and body (kind of hacky), finds words unique to each article and then randomly replaces words in the headlines with these unique words. Here are some results:

I had to run this a bunch of times to get good results but I was happy with the way it created this news blending effect. I could see working more on distorting news articles.

The code is a bit sloppy this time but I was able to to make some light usage of dictionaries and sets. I found myself relying on lists a lot out of familiarity but could begin to see how other structures would be useful.

 

Read More