My Profile Photo

Jason Pawlak


Husband, Dad, Navy Officer, Coder, and Tinkerer. I have many interests and am always looking to learn something new. This site is a launching point to the many areas of the Internet that represent me.


Wikify your paragraph

Recently I started a US Navy History blog that is (so far) doing nothing except re-posting what is found on the “this day in history” page of navy.mil.  I did this for a couple reasons.  The first reason was that they don’t have an RSS feed over there that I can subscribe to.  The second reason is that I wanted to add to the usability of the article.  To do this, I wanted to insert links to Wikipedia for quick and easy reference to topics covered in the paragraphs.

First I found wikify@appointment.at.  This was pretty good … except 1) they request that you put 1 second between each query and 2) they only support single words.  I wanted to “read” through the article and smartly insert hyperlinks.

Here’s what I came up with:

example:

[1898 ](http://en.wikipedia.org/wiki/1898_ )- [USS Oregon](http://en.wikipedia.org/wiki/USS_Oregon) departs [San Francisco](http://en.wikipedia.org/wiki/San_Francisco) for [a 14](http://en.wikipedia.org/wiki/a_14)[,](http://en.wikipedia.org/wiki/,)[000](http://en.wikipedia.org/wiki/000)-mile [trip](http://en.wikipedia.org/wiki/trip) [around](http://en.wikipedia.org/wiki/around) [South America](http://en.wikipedia.org/wiki/South_America) to [join](http://en.wikipedia.org/wiki/join) [the U.S. ](http://en.wikipedia.org/wiki/the_U.S. )[Squadron](http://en.wikipedia.org/wiki/Squadron) off [Cuba](http://en.wikipedia.org/wiki/Cuba). [1917 ](http://en.wikipedia.org/wiki/1917_ )- [The Navy](http://en.wikipedia.org/wiki/The_Navy) [Department](http://en.wikipedia.org/wiki/Department) authorizes [enrollment](http://en.wikipedia.org/wiki/enrollment) of [women](http://en.wikipedia.org/wiki/women) in the [Naval Reserve](http://en.wikipedia.org/wiki/Naval_Reserve) with [ratings](http://en.wikipedia.org/wiki/ratings) of [yeoman](http://en.wikipedia.org/wiki/yeoman)[,](http://en.wikipedia.org/wiki/,) [radio](http://en.wikipedia.org/wiki/radio) [electrician](http://en.wikipedia.org/wiki/electrician) or other [essential](http://en.wikipedia.org/wiki/essential) [ratings](http://en.wikipedia.org/wiki/ratings). [1942 ](http://en.wikipedia.org/wiki/1942_ )- [The Secretary](http://en.wikipedia.org/wiki/The_Secretary) of [the Navy](http://en.wikipedia.org/wiki/the_Navy) gives the [Civil Engineering](http://en.wikipedia.org/wiki/Civil_Engineering) [Corps](http://en.wikipedia.org/wiki/Corps) [command](http://en.wikipedia.org/wiki/command) of the [Seabees](http://en.wikipedia.org/wiki/Seabees). For more [information](http://en.wikipedia.org/wiki/information) about [naval history](http://en.wikipedia.org/wiki/naval_history)[,](http://en.wikipedia.org/wiki/,) [visit](http://en.wikipedia.org/wiki/visit) the [Naval Historical Center](http://en.wikipedia.org/wiki/Naval_Historical_Center) [Web site](http://en.wikipedia.org/wiki/Web_site) at [[www.](http://en.wikipedia.org/wiki/www.)[history](http://en.wikipedia.org/wiki/history).[navy.mil](http://en.wikipedia.org/wiki/navy.mil)](http://www.history.navy.mil). > > > > (via [http://www.navy.mil/search/history_today.asp](http://www.navy.mil/search/history_today.asp)) > >

This code works well for me. It is a little messy with some checks I put in to only give me words that I care about, but as I said, it gets the job done.

comments powered by Disqus