Showing posts with label news. Show all posts
Showing posts with label news. Show all posts

Friday, February 24, 2017

POS News Update: Best of 2016

In a previous post, I described an experiment with automating Twitter posts using news headlines with the nouns switched around.  I have been auto-Tweeting these posts since July 2015.  I did a previous "best of" post for 2015.  Now here are my 10 favorites from 2016 out of the close to 250 that were auto-Tweeted last year:

10. 'RARE NEWBORN REPORT MAY BE THE YOUNGEST EVER DETECTED'
  • It is a newborn report on newborns.
9.  'POOL IS ENDING PARENT END BREEDING'
  • Sorry parents, but no more breeding at your end of the pool.
8. 'CINCINNATI MAY PROLONG CHRONIC PAIN, CLINTON SUGGESTS'
  • If the science is sound and you have chronic pain, you probably want to avoid Cincinnati in the future.
7. 'SPUDS GROW HUMAN SPIES OUTSIDE OF CHINA FOR 13 DAYS'
  • For a long time humans have been growing potatoes.  Now potatoes are growing humans.  And not just any humans...
6. 'NORTH CHINA FIRES BALLISTIC PRESSURE INTO EATING'
  • Speaking of China, its efforts to push eating are akin to warfare.
5. 'NEW YORK GHOSTBUSTER CAN ENFORCE PUMP FEARS ON MENUS, U SAYS'
  • If you are a New York restaurant owner and your customers are feeling overly optimistic about the price of gasoline, who're you gonna call?
4. 'TWELVE MEAT RECOUNT PODS SHARE $43 MILLION IN [...] DENTAL JOB.'
  • As many as twelve groups responsible for counting meat products profited from some very expensive dental work.
3. 'MOST NEW GIRLS SAY THEY'LL VOTE TO RE-ELECT THEIR MAGIC WILDFIRES'
  • Despite what previous women have done, the younger generation is voting for mystical forest burning.
2. 'MICROSOFT'S 2016: DIPLOMATS 10 PRECAUTIONS AND INDIANS ARE THE BIG FEARS'
  • Microsoft's biggest worries in 2016? What foreign representatives are saying, and Indians.
1.  'GET YOUR CANADA MANIPULATION WITH FITBIT 'SLEEP SCHEDULE''
  • Finally, you can control Canada with a simple electronic device disguised as a sleeping aid.

Well, that was fun, but I am moving on to other kinds of coding experiments and automated Tweets.  So I'll be discontinuing the #POSNewsUpdate going forward.

Still, you can follow me on Twitter at @philanalytics to get the latest updates from the blog.

Friday, March 4, 2016

POS News Update: Best of 2015

In a previous post, I described an experiment with automating Twitter posts using news headlines with the nouns switched around.  I have been auto-Tweeting these posts since July 2015.  Here are 5 of my favorites from 2015, along with my best interpretation of what news items they came from and my take on them:

1. 'EARLY LABOR OF OVARIAN PUTIN MAY BECOME POSSIBLE'
Ovarian cancer screeningan announcement from the labor department, and a Putin endorsement of Donald Trump.
I didn't know Putin had ovaries, much less that he was pregnant.  Still, I hope he doesn't deliver before the baby is ready, even if it is possible.
2. 'HUCKABEE[,] MUSK, STEPHEN HAWKING WANT TO SAVE THE WEBSITE FROM LETTUCE CONCERNS'
Musk and Hawking wanting to "save the world from killer robots", Huckabee's use of the word "holocaust", and lettuce causing food poisoning.
 You've heard of the attack of killer tomatoes.  Now, lettuce is going after the internet.  Who will save us?  An unlikely alliance of a conservative politician, a tech entrepreneur, and a theoretical physicist.
3. 'REVIEW: OBAMACARE GOES 'ROGUE' IN NEW 'MISSION''
A combination of Tom Cruise's "Rogue Nation" Mission Impossible and articles relating to Obamacare and efforts to repeal it.
Republicans say the President has "gone rogue" and overstepped his authority by implementing the Affordable Care Act with the mission to cover every American with health insurance.  Will he accomplish his task?  Tune in next open enrollment.
4. 'FOOTBALL PRICES PROBABLY WON'T HELP YOUR LOWER BACK CHINA'
Oil prices, football games, steroid injections that don't help lower back pain, the China stock crash, and Biden probably won't beat Clinton in a presidential nomination contest.   
As for your back pain China, better let go of relying on football sales to ease your suffering.  It's not going to help.
5. 'POLL: CLINTON [...] RELEASES LIVE CONFEDERATE NETFLIX PREACHER'
A poll about Biden versus Clinton running, the Confederate flag controversy, Netflix announcing parental leave changes, and the arrest of an Islamic preacher for supporting ISIS.   
I am glad that Clinton released this man alive.  Even if he is a Confederate, we all still need to hear the good news of movies mailed to our door and streamed over the internet.

Want more? Follow me on Twitter at @philanalytics to get the latest #POSNewsUpdate.

Monday, July 27, 2015

POS News Update: Automatically Tweeting Using R

Introduction

I am fond of automation.  Why?  Because if I can automate something, then I don't have to do it manually, and that saves me time.  It also saves me emotional energy if it does a task that I really don't want to do. So automation can save me time and energy, particularly for unpleasant tasks.

One unpleasant task (at least for me) is that of self-promotion.  Nowadays it is a wise career move to continually post links and comment through Twitter, LinkedIn, Yammer, and various other job-related social media.  It is to one's advantage to remain engaged in hot topics in one's field and to demonstrate knowledge by posting insightful comments.  By doing so, one demonstrates that one is a leader in the field (and worthy of pursuit in hiring and career advancement).

But we know that such self-promotion can be very time consuming, and perhaps unpleasant for us, even though it is beneficial for our careers.  How can we have our cake and eat it too?  Enter in automation. I thought, if I could automate some of this "self-promotion", I could be more actively engaged in the community AND also free up some time for myself.  Plus, it would be a fun avenue of personal research for advancing my skills.

Automating Twitter "News" Updates

I am not very active in Twitter (at all), so I thought this would be a good place to start with an automation experiment.  What would I Tweet?  I wanted to explore Natural Language Processing a bit, so I eventually settled on doing the following:

1. Gather the latest Google News headlines.
2. Use Parts of Speech tagging to break down each headline into parts of speech.
3.  Swap out words in each headline for another word with the same parts of speech tag (e.g, swap a noun for a different noun).
4. Pick a headline that reads the most like a sentence
5. Post the headline to Twitter automatically on a regular schedule

R packages Used

For those that are interested, I used the following packages:
  • httr - used to authenticate the twitter api and create my twitter token.  Follow the code here to replicate.  Used the POST() function to send my update to Twitter.  See here for code.
  • rvest - used to get the Google News headlines.
  • openNLP - used to do the POS tagging for the headlines and sentence evaluation.
I used Task Scheduler to run a batch file that ran the R file I created.  See here for the process to automate this.

Results

The results are mixed.  Sometimes the headlines make sense and sometimes they don't.  I suppose this isn't very surprising.  Headlines are difficult to analyze because they are not complete sentences.  As such, the POS tags are often wrong.  Additional work is needed to have better swaps, and consequently, more readable headlines.  However, my larger goal of being able to automatically post Tweets was successful, and may prove useful in the future for other projects of mine.

Here is my favorite post so far:

POS News Update: 'HUCKABEE MUSK, STEPHEN HAWKING WANT TO SAVE THE WEBSITE FROM LETTUCE CONCERNS'

You can see these for yourself by following me on Twitter at @philanalytics