Text Entity Tagging with Apache OpenNLP

Configuration for IntelliJ development with pre-trained models of OpenNLP 1.5 series

● First need to add the dependencies of apache opennlp

Used opennlp models en-ner-location.bin, en-ner-person.bin, en-ner-date.bin,en-ner-money.bin, en-ner-organization.bin, en-token.bin

● We can download the models through http://opennlp.sourceforge.net/models-1.5/ link

● After downloading process, I added all the models to the folder name OpenNLP_models into project.

  1. Date finder model. — en-ner-date.bin
  2. Location finder model. — en-ner-location.bin
  3. Money finder model. — en-ner-money.bin
  4. Person finder model. — en-ner-person.bin
  5. Trained on opennlp training data — en-token.bin
  6. Organization finder model. — en-ner-organization.bin

Create DateFinder, PersonNameFinder,LocationFinder, MoneyFinder classes to load the models

● PersonNameFinder

● Also I created other classes for find Location,Date,Money…

Finally I Created Finder class to read the conversations, tokenizing, stop the common words and Identify the wording of conversations.

stopWords () — Read the Stop words from stop_words.txt and load it into String[] stopWords= null;

readingFiles () — Read Reservations conversation txt files from the Reservations_Conversation folder

find ( String [] sentence) — Load the classes to identify the PersonName, Location, Money, Date

JSON example of location.json:-

JSON: {“Locations”: London , Orange , Sydney , Sydney , ,”Money”:, ”PersonName”: Swift , Hotel,Could, Swift, Swift, Guest, Swift, Swift, Guest, Swift, Swift, Swift, Swift, Guest, Swift, Guest,Swift, Swift,Swift, Swift, Guest, Perfect, Hotel, Swift, Guest, Great, Swift , ,”Date”: May, October,October, 2014, May, May, 2014, October, }

“TEXT”: Hotel: Good morning, EDotel Hotel reservation Vanny􁢾s speaking, how may I assistyou?Guest: Hello, good morning. I’d like to make a reservation for the second weekend inOctober in your hotel.Hotel: Excuse me Mam, may I know who is speaking?Guest: I’m Taylor Swift .Hotel: Could you spell your name please?Guest: T-A-Y-L-OR S-W-I-F-T Hotel: Alright Mam, now I want to spell your name. Your name is Taylor Swift , T for Tango, A for Alpha, Y for Yellow, L for London , O for Orange , R for Roma. S for Sidney, W for Work, I for India, F for Fox, T for Tango. Am I right mam?Guest: Yes, you are right.Hotel: May I know who is the reservation for Miss. Swift ?Guest: The reservation is for me.Hotel: Alright Miss. Swift , may I know what type of room do you need?Guest: I need a suite room. What is the rate of the room?Hotel: Certainly Mam. The room price is Rp.450.000/night. What is the exact date of your arrival Mam?Guest: The 12nd of October 2014Hotel: How long will you be staying Miss. Swift ?Guest: I’ll be staying for three nights.Hotel: Your departure could be 15th of October 2014 , couldn􁢾t it Mam?Guest: Yes that’s right.Hotel: How many people is the reservation for Miss. Swift ?Guest: There will be two people.Hotel: Well Miss. Swift , wait a moment please,I would like to check the availability ofthe room on that period.Guest: Yes please. Hotel: hank you very much for your waiting Miss. Swift , we have several suite roomavailable on that particular weekend.Guest: Thanks.Hotel: And, is there a phone number where you can be contacted Miss. Swift ?Guest: My phone number is +33 161 626 77777Hotel: And your e-mail address please?Guest: swift .taylor@lawyer.co.auHotel: May I know your nationality Miss. Swift ?Guest: I􁢾m Australian. Hotel: And could you tell me where your current address is?Guest: Sure. It􁢾s 35 Sand Apparel ST, Sydney .Hotel: Thank you. Do you have any special request that could be prepared for yourarrival here? May Iknow, what type of credit card have you got?Guest: I have Visa.Hotel: Well Miss. Swift , for completing your reservation, please sends your consentwhich states that you give us authorization to take your deposit as much as theroom price for three nights. And also, please attach your copy of ID and creditcard. And the last, please put your signature bellow your consent. And couldyou please send it to our e-mail address to edotel.hotel@yahoo.com?Guest: May I know what is it for?Hotel: It is for guarantee of your reservation Miss. Swift , because, that period is on ahigh season, so we need a guarantee for your reservation.Guest: OK. I will send it soon.Hotel: Alright Miss. Swift , your reservation has been made for the 12nd until 15th ofOctober 2014 for a suite room. Your phone number is +33 161 626 77777. Andyour e-mail address is swift .taylor@lawyer.co.au.