Text Entity Tagging with Stanford NER

Configuration for IntelliJ development with stanford Named Entity Recognizer (Stanford NER requires Java v1.8+)

● First need to download the stanford-ner zipped file.

(mainly consisting of classifier data objects). https://nlp.stanford.edu/software/CRF-NER.shtml

● I selected stanford-ner 3.3.1 2014.01.04 Bugfixed release

● After downloading, Need to unpack and inside the folder

I added the Executable Jar File (stanford-ner-2014–01–04.jar) into the project as 
External Libraries. 
● You can add it through File-> Project Structure ->

After adding library files,

I created EntityReader Class for read the chat Conversation and identifyNER (String text,String model) for identify LOCATION,ORGANIZATION, DATE, MONEY, PERSON, PERCENT, TIME

LinkedHashMap TextEntities = identifyNER(sample, 
“C:​\\Users​\\sandeepa​\\Desktop​\\stanford-ner-2014–01–04​\\stanford-ner-2014–01–04​\\classifiers​\\english.muc.7class.distsim.crf.ser.gz”​); 
EntityWriter.writeToFile(TextEntities, sample);

  • To identify the all the details I used english.muc.7class.distsim.crf.ser.gz ​classifier and it gives LinkHashMap type details collection including LOCATION, ORGANIZATION, DATE, MONEY, PERSON, PERCENT, TIME entities
  • Therefore I have to re-write the data on separate file according to data it’s captured from the conversation
  • For that I created EntityWriter Class

writeToFile(LinkedHashMap data,String text) method choose the category of the data PERSON, MONEY, DATE, LOCATION, ORGANIZATION

If the category of the data is PERSON then personsWriter(String persons, String txt) method will collect the details and store as ArrayList

static ArrayList<String> personList = new ArrayList<String>();

After reading all the files, 
● All the list personList ,locationList ,moneyList , organizationList , dateList are write into separate file as json

FileWriter fileWriter = new FileWriter(“EntityWriter/Person.json”​)){ 
 String persons = personList.toString(); 
 persons.split(“ “​); 
 gson.toJson(personList, fileWriter);

JSON example of person.json:-
Person: Hannighan”, 
Text: Hotel: Good afternoon. Welcome to the Grand Woodward Hotel. How may I help you? Guest: I have a reservation for today. It\u0027s under the name of Hannighan. Hotel: Can you please spell that for me, sir?Guest: Sure. H-A-N-N-I-G-H-A-N.Hotel: Yes, Mr. Hannighan, we\u0027ve reserved a double room for you with a view of the ocean for two nights. Is that 
correct?Guest: Yes, it is.Hotel: Excellent. We already have your credit card information on file.

JSON example of location.json:- 
Location: California”, 
Text: Hotel: Good evening sir. Can I help you?Guest: Good evening. What the name of this hotel?Hotel: The name of this hotel is Rose Hotel.Guest: I think Rose hotel is beautiful name.Hotel: Thank youGuest: You are welcome. Is there any room vacant? Hotel: Yes there is. 
Guest: I want to reserve a room. May I see the room, first? Hotel: Of course.Guest: I would like room with a bath. By the way, Have you a room looking on the garden ?Hotel: Yes, I have. Excuse me sir, May I know your name?Guest: Yes, I will introduce my self. My name is Mr.Justin Dale. I come from California. I am a Vice President.Hotel: May I write your telephone?