# Extracting Part of Speech (Source and Destinations) using text mining/NLP?

I need to extract the source and destination terms from the text documents using text mining / NLP / Information Retrieval ?

Example input:

1. I am travelling from New York to London.
2. I am heading towards playground from home.
3. I will be going to Sweden from Boston.
4. I was flying from School to Home.

The output can be as follows :

S. No. |  source    | Destination
------ |  ----------|------------
1| New York   | London
2| playground | home
3| Sweden     | Boston
4| School     | Home


Named Entity Recognition is technique which can be used here. Location is one of the 3 most studied classes (with Person and Organization). Stanford NLP has an open source Java implementation that is extremely powerful.

For Example let say sentence is "i will be going to Sweden from Boston."

Now here you can use regular expression to detect these LOCATION tags.