State leftAbbreviatePState = new NamedState("LEFT_P");
State rightAbbreviatePVState = new NamedState("RIGHT_PV");
State firstDotPState = new NamedState("FIRSTDOTP");
//Condition secondPVDotCondition = new PunctuationValueCondition('.');
Condition firstDashCondition = new PunctuationValueCondition('-');
Condition secondDashCondition = new PunctuationValueCondition('-');
Condition rangeCombineCondition = new DisjoinCondition(
new RangeCondition(),
new RangeStrengthCondition()
);
Condition initialMiddleTextCondition = new WordSetCondition(
iv_middleTermSet, true);
Condition firstMiddleTextCondition = new WordSetCondition(
iv_middleTermSet, true);
Condition secondMiddleTextCondition = new WordSetCondition(
iv_middleTermSet, true);
Condition thirdMiddleTextCondition = new WordSetCondition(
iv_middleTermSet, true);
Condition fourthMiddleTextCondition = new WordSetCondition(
iv_middleTermSet, true);
Condition soloCondition = new WordSetCondition(iv_singleTopicalWordSet, true);
startState.addTransition(new TextValueCondition("a", true),
leftAbbreviateState);
startState.addTransition(new TextValueCondition("p", true),
leftAbbreviatePState);
startState.addTransition(initialMiddleTextCondition, leftAbbreviateState);
startState.addTransition(rangeCombineCondition, leftDosagesState);
startState.addTransition(soloCondition, endState);
startState.addTransition(new AnyCondition(), startState);
leftAbbreviatePState.addTransition(new PunctuationValueCondition('.'), firstDotPState);
leftAbbreviatePState.addTransition(new AnyCondition(), startState);
firstDotPState.addTransition(soloCondition, endState);
firstDotPState.addTransition(new TextValueCondition("v", true),
rightAbbreviatePVState);
firstDotPState.addTransition(new AnyCondition(), startState);
leftAbbreviateState.addTransition(firstMiddleTextCondition,
middleATextState);
leftAbbreviateState.addTransition(firstDashCondition, firstDashState);
leftAbbreviateState.addTransition(soloCondition, endState);
leftAbbreviateState.addTransition(new AnyCondition(), startState);
firstDashState
.addTransition(thirdMiddleTextCondition, middleATextState);
firstDashState.addTransition(new AnyCondition(), startState);
middleATextState
.addTransition(secondMiddleTextCondition, lastTextState);
middleATextState.addTransition(secondDashCondition, secondDashState);
middleATextState.addTransition(new AnyCondition(), startState);
secondDashState.addTransition(fourthMiddleTextCondition, lastTextState);
secondDashState.addTransition(new AnyCondition(), startState);
lastTextState.addTransition(new AnyCondition(), startState);
rightAbbreviatePVState.addTransition(new PunctuationValueCondition('.'), endState);
rightAbbreviatePVState.addTransition(new AnyCondition(), startState);
endState.addTransition(new AnyCondition(), startState);
return m;