Sunday, May 13, 2012

Code Mining?


As computer programming professionals we are often looking for code samples that illustrate how to use that new API or that library that we have not yet had experience with.  As such it got me wondering about whether or not such tasks could be automated in some way, which led to the publication of the following article on CodeGuru: Creating Your Own Search Engine for C/C++ Code Samples

In the article I discuss how to make use of the Bing API to retrieve keyword results that pertain to the programming topic of interest.  After making use of the Bing API, the example script downloads the Web page associated with each result link and uses regular expression based pattern matching to attempt to extract the snippets of C\C++ code contained in the Web page.  I wonder how hard this would be to do for Perl :)

No comments: