I was wondering if anybody could point me in the right direction to solve the following problem. I need to extract a node word with 5 words to the left and right of it and dump it into a database.

How can I go about developing a program to do this or does anyone know of any existing code?