Christopher Higginbotham
CSCI 322
23 November 1999
Lab Report #3
1.0 Purpose:
The purpose of the lab was to learn about natural language processing and Java. Having no prior Java experience this lab proved to be somewhat difficult. The main part of this lab exercise dealt with understanding what Mark Watson's NLP code did while removing all the deprecation errors. The Java API proved to be an enormous help by explaining how to replace the deprecated code. I also used information off of your web site that described how listeners worked.
2.0 Chapter 2 GUI:
2.1 Deprecation Fixes:
File Affected: GUI.java
Fix #1:
Run and Reset button were deprecated so they were updated to Buttons with action listeners. The buttons are only created if their respective flag is set to true.
Fix #2:
Replaced canvas.resize() with canvas.setSize().
Fix #3:
Replaced outputText.replaceText() with outputText.replaceRange().
Fix #4:
Replaced two instances of outputText.appendText() with outputText.append().
Fix #5:
Replaced method mouseDrag() in the GUICanvas with a MouseMotionListener().
2.2 Compilation and Execution Instructions:
Compile:
javac –d <source directory> GUI.java –deprecation
javac –d <source directory> testGUI.java –deprecation
Run:
appletviewer testGUI.html
2.3 Issues:
There were no big issues I had with this class. Most of these deprecation errors were straight forward. I mainly had to learn about the action and mouse listeners that needed to be added to these classes. I used the test program that was provided to verify that my changes worked correctly.
3.0 Chapter 6 NLP:
3.1 Deprecation Fixes:
File Affected: None
3.2 Compilation and Execution Instructions:
Compile:
javac –d <source directory> AIframedata.java -deprecation
javac –d <source directory> AIframe.java –deprecation
javac –d <source directory> ParseObject.java -deprecation
javac –d <source directory> Parser.java -deprecation
javac –d <source directory> testNLP.java -deprecation
javac –d <source directory> testNLP2.java -deprecation
Run:
appletviewer testNLP.html
appletviewer.testNLP2.html
3.3 Issues:
There were no deprecation errors in the code above. Basically I used testNLP and testNLP2 to run the programs. I learned about how a simple version of NLP worked. This program gave a very limited vocabulary. If this were to become a full blown NLP I believe the use of a dictionary and thesaurus would need to be used in order to solve for the basic semantics of a sentence. The integration of more words into Mark Watson's code would not be efficient since all he does is append new comparisons to existing lists. A better way of doing this would be storing words in a more organized structure for searching. Of course all of this complexity would require a larger list of semantic primitives that would be used to capture what a sentence is trying to explain.
4.0 Chapter 13 Distributed NLP:
4.1 Deprecation Fixes:
File Affected: Client.java
Fix #1:
Replaced DataInputStream with BufferedReader.
Fix #2:
Replaced PrintStream with PrintWriter.
File Affected: Server.java
Fix #1:
Replaced DataInputStream with BufferedReader.
Fix #2:
Replaced PrintStream with PrintWriter.
4.2 Compilation and Execution Instructions:
Compile:
javac –d <source directory> Server.java –deprecation
javac –d <source directory> Client.java –deprecation
javac –d <source directory< testAIframeServer.java - deprecation
javac -d <source directory> HistoryAIframeServer.java –deprecation
javac -d <source directory> History.java –deprecation
Run:
appletviewer testClientServer.html
appletviewer History.html
4.3 Issues:
There were two issues that came up when using the code from Chapter 2. First there were the deprecation errors and second there was the port issue. The deprecation errors were very straight forward. I only had a problem trying to figure out why data wasn't being passed between the client and server. It turned out that I needed to flush the buffer every time I did a read line. I ended up finding that there is a flag that I can set with the BufferedReader that will automatically flush the buffer any time it is filled. The port issue was an easy fix because all I needed to do was change the value.
All the History.java class did was extend the client/server model and the chapter 6 programs. I didn't see much of an improvement in the way data was added to the server for access later. Again, using a better organization to store the historical data.
5.0 Conclusion:
In conclusion I found this lab to be very educational. I learned a lot on how Java works. I found having a firm C++ background very helpful in figuring out how Java works. I found the natural language processing and how parsers are used to extract meaningful information.