|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgate.creole.morph.Interpret
public class 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.
| Nested Class Summary | |
|---|---|
(package private) class |
Interpret.CharClass
|
| 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 |
protected boolean |
foundRule
|
(package private) ArrayList |
fsms
|
protected FSMState |
initialState
The initial state of the FSM that backs this morpher |
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 |
protected HashSet |
lastStates
|
private Method[] |
methods
This variables keeps the record of available methods for the morphing |
(package private) MorphFunctions |
morphInst
|
private Pattern |
nPat
|
protected int |
patternIndex
|
(package private) ArrayList |
patterns
|
private Storage |
variables
Instance of Storage class, which is used store all the variables details |
private Pattern |
vPat
|
| Constructor Summary | |
|---|---|
Interpret()
|
|
| Method Summary | |
|---|---|
void |
addState(char ch,
FSMState fsm,
int index)
|
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 void |
drawFSM()
|
private void |
drawFSM(FSMState st,
String space)
|
protected String |
executeRHS(String word,
String category,
RHS rhs)
|
protected String |
executeRHSes(TreeSet rhses,
String word,
String category)
|
private String |
executeRule(String word,
RHS rhs)
|
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 |
FSMState |
getInitialState()
|
int |
getPatternIndex()
|
FSMState |
getState(char ch,
int index)
|
private HashSet |
getStates(char ch,
HashSet states)
|
void |
init(URL ruleFileURL)
It starts the actual program |
private void |
interpretProgram()
This method reads each line of the program and interpret them |
private HashSet |
intersect(HashSet a,
HashSet b)
|
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)
lookup |
private boolean |
validCategory(String category)
|
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 String affix
private Pattern vPat
private Pattern nPat
MorphFunctions morphInst
ArrayList patterns
ArrayList fsms
protected FSMState initialState
protected HashSet lastStates
protected int patternIndex
protected boolean foundRule
| Constructor Detail |
|---|
public Interpret()
| Method Detail |
|---|
public void init(URL ruleFileURL)
throws ResourceInstantiationException
ruleFileName -
ResourceInstantiationException
public void addState(char ch,
FSMState fsm,
int index)
public FSMState getState(char ch,
int index)
private HashSet getStates(char ch,
HashSet states)
private boolean validCategory(String category)
public String runMorpher(String word,
String category)
singleItem - a single string to be looked up by the gazetteer
public int getPatternIndex()
protected String executeRHSes(TreeSet rhses,
String word,
String category)
protected String executeRHS(String word,
String category,
RHS rhs)
private String executeRule(String word,
RHS rhs)
private void prepareListOfMorphMethods()
throws ResourceInstantiationException
ResourceInstantiationException
private void readProgram()
throws ResourceInstantiationException
ResourceInstantiationException
private void interpretProgram()
throws ResourceInstantiationException
ResourceInstantiationExceptionprivate 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 HashSet intersect(HashSet a,
HashSet b)
private void drawFSM()
private void drawFSM(FSMState st,
String space)
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 -
ResourceInstantiationExceptionpublic String getAffix()
public FSMState getInitialState()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||