|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgate.creole.morph.Interpret
Title: Interpret.java
Description: This is the main class which which should be invoked to load the rule file in the system and then to execute the program to find the root word and the affix to it.
Field Summary | |
private String |
affix
This variables holds the affix |
private ReadFile |
file
instance of the ReadFile class which reads the file and stores each line of the given program in the arraylist which can be read using different methods of the ReadFile class |
private boolean |
isDefineRulesSession
Boolean variables to keep track on which section is being read |
private boolean |
isDefineVarSession
Boolean variables to keep track on which section is being read |
private Method[] |
methods
This variables keeps the record of available methods for the morphing |
private CompiledRules |
rules
This varilable stores the compiles versions of rules |
private Storage |
variables
Instance of Storage class, which is used store all the variables details |
Constructor Summary | |
Interpret()
Constructor |
Method Summary | |
private void |
defineRulesCommand()
This method processes the command to define the rule section |
private void |
defineVarsCommand()
This method processes the command to define the variable section |
private int |
findCommandType(String line)
This method interprets the line and finds out the type of command and returns the integer indicating the type of the command |
private void |
generateError(String mess)
Generates the error and stop the execution |
String |
getAffix()
This method tells what was the affix to the provided word |
private String |
getMethodName(String method)
This method is used to find the method definition But it can recognize only String, boolean and int types for Example: stem(2,"ed","d") ==> stem(int,java.lang.String,java.lang.String); |
private String[] |
getParameterValues(String method)
This method finds the actual parameter values |
void |
init(URL ruleFileURL)
It starts the actual program |
private void |
interpretProgram()
This method reads each line of the program and interpret them |
private boolean |
isMethodAvailable(String method)
This method takes a method signature and searches if the method |
static void |
main(String[] args)
Main method |
private void |
prepareListOfMorphMethods()
This method prepares the list of available methods in the MorphFunctions class |
private void |
readProgram()
read the program file |
private void |
ruleDeclarationCommand(String line)
This method processes the command to declare the rule |
String |
runMorpher(String word,
String category)
Once all the rules have been loaded in the system, now its time to start the morpher, which will find out the base word rule |
private void |
variableDeclarationCommand(String line)
This method processes the command to declare the variable |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private ReadFile file
private boolean isDefineVarSession
private boolean isDefineRulesSession
private Storage variables
private Method[] methods
private CompiledRules rules
private String affix
Constructor Detail |
public Interpret()
Method Detail |
public void init(URL ruleFileURL) throws ResourceInstantiationException
ResourceInstantiationException
public String runMorpher(String word, String category)
word
- input to the program
private String getMethodName(String method)
method
-
private String[] getParameterValues(String method)
method
- from which parameters are required to be found
private void prepareListOfMorphMethods() throws ResourceInstantiationException
ResourceInstantiationException
private void readProgram() throws ResourceInstantiationException
ResourceInstantiationException
private void interpretProgram() throws ResourceInstantiationException
ResourceInstantiationException
private int findCommandType(String line)
line
- The program command to be interpreted
private void defineVarsCommand() throws ResourceInstantiationException
ResourceInstantiationException
private void defineRulesCommand() throws ResourceInstantiationException
ResourceInstantiationException
private void variableDeclarationCommand(String line) throws ResourceInstantiationException
line
-
ResourceInstantiationException
private void ruleDeclarationCommand(String line) throws ResourceInstantiationException
line
-
ResourceInstantiationException
private boolean isMethodAvailable(String method)
method
-
private void generateError(String mess) throws ResourceInstantiationException
mess
- - message to be displayed as an error on the standard output
ResourceInstantiationException
public static void main(String[] args) throws ResourceInstantiationException
args
-
ResourceInstantiationException
public String getAffix()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |