Solving Crossword Puzzles Using Image Acquisition And Data Scraping (Part 1)

Crossword puzzles are a very popular pastime in most parts of the western world, and provide a quick means of escape for those on the commute or on break from regular work. The solution to the more interesting puzzles require a fairly good vocabulary and the ability to spot patterns and word arrangements. I recently saw an article on using MATLAB to solve a Sudoku puzzle using image acquisition toolbox and a Sudoku solver algorithm. This series of articles will take a slightly different approach, we will still use the image acquisition toolbox; however, instead of an algorithm to solve the puzzle we will use data scraping form a puzzle website to get the most suitable word for a particular place in the crossword.

The website we will be using to get solutions is  One Across

Note:
MATLAB is built on the java platform and is able to execute java code written at the command line or inserted in .m files. This feature will be exploited in future articles for doing tasks more suitable to the java toolset.

Example Java and MATLAB code in one .m file

%%
import java.net.*;
import java.io.*;

data = URLEncoder.encode('http://www.oneacross.com/cgi-bin/search_banner.cgi?c0=&p0=r%3Foogle&s=+Go%21+');
url  = URL('http://www.oneacross.com/');
con  = url.openConnection(); con.setDoOutput(true);
wr   = OutputStreamWriter(con.getOutputStream());

wr.write(data);
rd   = BufferedReader(InputStreamReader(con.getInputStream()));

while rd.readLine() ~= '' %MATLAB CODE
    line = ans;
end

In part two of this series we will look at using image acquisition to capture a live video feed for the puzzle we want to solve and overlaying the possible solution unto the video feed, stay tuned.

About these ads

3 thoughts on “Solving Crossword Puzzles Using Image Acquisition And Data Scraping (Part 1)

  1. Hello there! This blog post could not be written much better!
    Looking at this post reminds me of my previous roommate!
    He always kept talking about this. I’ll forward this information to him. Fairly certain he’ll have a
    good read. I appreciate you for sharing!

  2. Oh look who intersante, now I can continue solving more puzzles;). The truth is that Matlab is a powerful program and is very diversified use, I hope to know where to find the code on the crossword. Thank you.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s