private void initRegexes()

in ctakes-assertion/src/main/java/org/apache/ctakes/assertion/util/NegationDepRegex.java [294:524]


	private void initRegexes() {
		// Recognizes phrases like "<disease1>, <disease2>, or FOCUS".  For appending for any FOCUS.
		DEPNode[] regnodes_NN_CONJ_NN = new DEPNode[1];
		regnodes_NN_CONJ_NN[0]		= new DEPNode(DEPLib.NULL_ID, ANY_TOKEN);
		regnodes_NN_CONJ_NN[0].setLabel(DependencyRegex.fromSet(rel_conjunctSet));
		//regnodes_NN_CONJ_NN[1]        = new DEPNode();
		//regnodes_NN_CONJ_NN[1].deprel = DependencyRegex.fromSet(rel_conjunctSet);

		// Recognizes phrases like "denies <symptom1>"
		DEPNode[] regnodes_VBNEG_OBJ = new DEPNode[2];
		regnodes_VBNEG_OBJ[0]        = new DEPNode(DEPLib.NULL_ID, fromSet(iv_negVerbsSet));
//		regnodes_VBNEG_OBJ[0].form   = DependencyRegex.fromSet(iv_negVerbsSet);
		regnodes_VBNEG_OBJ[1]		 = new DEPNode(DEPLib.NULL_ID, ANY_TOKEN);
		regnodes_VBNEG_OBJ[1].setLabel(DEPLibEn.DEP_DOBJ);  /* was "OBJ" in clearparser */
		int cVBNEG_OBJ = 0;
		
		// Recognizes phrases like "was not FOCUS" -- in dependency order: not was 
		DEPNode[] regnodes_PRT_VB_PRD = new DEPNode[3];
		regnodes_PRT_VB_PRD[0]          = new DEPNode(DEPLib.NULL_ID, fromSet(iv_negParticlesSet));
//		regnodes_PRT_VB_PRD[0].form     = DependencyRegex.fromSet(iv_negParticlesSet);
		regnodes_PRT_VB_PRD[0].setLabel(DEPLibEn.DEP_NEG); // was: ("ADV");
		regnodes_PRT_VB_PRD[1]          = new DEPNode(DEPLib.NULL_ID, fromSet(iv_copulaSet));
//		regnodes_PRT_VB_PRD[1].form     = DependencyRegex.fromSet(iv_copulaSet);
		regnodes_PRT_VB_PRD[2]          = new DEPNode(DEPLib.NULL_ID, ANY_TOKEN);
		regnodes_PRT_VB_PRD[2].setLabel(DEPLibEn.DEP_ACOMP); // was: ("PRD");
		regnodes_PRT_VB_PRD[2].pos      = DependencyRegex.ANY_ADJECTIVE;
		int cPRT_VB_PRD = 1;
		
		// Recognizes phrases like "did not find FOCUS"  (don't think the modal verb will be on the path?)
		DEPNode[] regnodes_PRT_MOD_VB_OBJ = new DEPNode[3];
		regnodes_PRT_MOD_VB_OBJ[0]          = new DEPNode(DEPLib.NULL_ID,fromSet(iv_negParticlesSet));
//		regnodes_PRT_MOD_VB_OBJ[0].form     = DependencyRegex.fromSet(iv_negParticlesSet);
		regnodes_PRT_MOD_VB_OBJ[0].setLabel(DEPLibEn.DEP_NEG); // was: ("ADV");
		regnodes_PRT_MOD_VB_OBJ[1]          = new DEPNode(DEPLib.NULL_ID, fromSet(iv_regVerbsSet));
		regnodes_PRT_MOD_VB_OBJ[1].pos      = ANY_VERB;
		regnodes_PRT_MOD_VB_OBJ[2]          = new DEPNode(DEPLib.NULL_ID,ANY_TOKEN);
		regnodes_PRT_MOD_VB_OBJ[2].setLabel(DEPLibEn.DEP_DOBJ);	
		// everything below here was replaced for this path:
/*		// 
		regnodes_PRT_MOD_VB_OBJ[1]          = new DEPNode(DEPLib.NULL_ID,fromSet(iv_modalVerbsSet));
//		regnodes_PRT_MOD_VB_OBJ[1].form     = DependencyRegex.fromSet(iv_modalVerbsSet);
		regnodes_PRT_MOD_VB_OBJ[2]          = new DEPNode(DEPLib.NULL_ID,fromSet(iv_regVerbsSet));
//		regnodes_PRT_MOD_VB_OBJ[2].form     = DependencyRegex.fromSet(iv_regVerbsSet);
//		regnodes_PRT_MOD_VB_OBJ[2].setLabel(DEPLibEn.DEP_CCOMP); // was: ("VC"); really a shot in the dark
		regnodes_PRT_MOD_VB_OBJ[2].pos      = ANY_VERB;
		regnodes_PRT_MOD_VB_OBJ[3]          = new DEPNode(DEPLib.NULL_ID,ANY_TOKEN);
		regnodes_PRT_MOD_VB_OBJ[3].setLabel(DEPLibEn.DEP_DOBJ);  // was:("OBJ"); */
		int cPRT_MOD_VB_OBJ = 1;
		
		// Recognizes phrases like "did not find evidence of FOCUS"
		DEPNode[] regnodes_PRT_MOD_VB_OBJ_IN_PMOD = new DEPNode[6];
		regnodes_PRT_MOD_VB_OBJ_IN_PMOD[0]          = new DEPNode(DEPLib.NULL_ID,fromSet(iv_negParticlesSet));
//		regnodes_PRT_MOD_VB_OBJ_IN_PMOD[0].form     = DependencyRegex.fromSet(iv_negParticlesSet);
		regnodes_PRT_MOD_VB_OBJ_IN_PMOD[0].setLabel(DEPLibEn.DEP_NEG); // was:("ADV");
		regnodes_PRT_MOD_VB_OBJ_IN_PMOD[1]          = new DEPNode(DEPLib.NULL_ID,fromSet(iv_modalVerbsSet));
//		regnodes_PRT_MOD_VB_OBJ_IN_PMOD[1].form     = DependencyRegex.fromSet(iv_modalVerbsSet);
		regnodes_PRT_MOD_VB_OBJ_IN_PMOD[1].setLabel(DEPLibEn.DEP_CCOMP); // was: ("VC");
		regnodes_PRT_MOD_VB_OBJ_IN_PMOD[2]          = new DEPNode(DEPLib.NULL_ID,fromSet(iv_regVerbsSet));
//		regnodes_PRT_MOD_VB_OBJ_IN_PMOD[2].form     = DependencyRegex.fromSet(iv_regVerbsSet);
		regnodes_PRT_MOD_VB_OBJ_IN_PMOD[3]          = new DEPNode(DEPLib.NULL_ID,fromSet(iv_regNounsSet));
//		regnodes_PRT_MOD_VB_OBJ_IN_PMOD[3].form     = DependencyRegex.fromSet(iv_regNounsSet);
		regnodes_PRT_MOD_VB_OBJ_IN_PMOD[3].setLabel(DEPLibEn.DEP_DOBJ); //("OBJ");
		regnodes_PRT_MOD_VB_OBJ_IN_PMOD[4]        = new DEPNode(DEPLib.NULL_ID,fromSet(iv_regPrepositionsSet));
//		regnodes_PRT_MOD_VB_OBJ_IN_PMOD[4].form   = DependencyRegex.fromSet(iv_regPrepositionsSet);
		regnodes_PRT_MOD_VB_OBJ_IN_PMOD[4].pos    = "IN";
		regnodes_PRT_MOD_VB_OBJ_IN_PMOD[5]        = new DEPNode(DEPLib.NULL_ID,ANY_TOKEN);
		regnodes_PRT_MOD_VB_OBJ_IN_PMOD[5].setLabel(DEPLibEn.DEP_POBJ); // was: ("PMOD");		
		int cPRT_MOD_VB_OBJ_IN_PMOD = 1;
		
		// Recognizes phrases like "excluding FOCUS"
		DEPNode[] regnodes_VBN_SBJ = new DEPNode[2];
		regnodes_VBN_SBJ[0]        = new DEPNode(DEPLib.NULL_ID, fromSet(iv_negVerbsSet));
//		regnodes_VBN_SBJ[0].form   = DependencyRegex.fromSet(iv_negVerbsSet);
		regnodes_VBN_SBJ[0].pos    = "VBG";  // was VBN
		regnodes_VBN_SBJ[1]		   = new DEPNode(DEPLib.NULL_ID, ANY_TOKEN);
		regnodes_VBN_SBJ[1].setLabel(DEPLibEn.DEP_DOBJ); // was: ("SBJ");
		int cVBN_SBJ = 0;
		
		// Recognizes phrases like "rules out FOCUS"
		DEPNode[] regnodes_PRT_rule_OBJ = new DEPNode[3];
		regnodes_PRT_rule_OBJ[0]          = new DEPNode(DEPLib.NULL_ID, fromSet(iv_negColPartSet));
//		regnodes_PRT_rule_OBJ[0].form     = DependencyRegex.fromSet(iv_negColPartSet);
		regnodes_PRT_rule_OBJ[0].setLabel(DEPLibEn.DEP_PRT); // was: ("PRT");
		regnodes_PRT_rule_OBJ[1]          = new DEPNode(DEPLib.NULL_ID, fromSet(iv_negCollocSet));
//		regnodes_PRT_rule_OBJ[1].form     = DependencyRegex.fromSet(iv_negCollocSet);
		regnodes_PRT_rule_OBJ[2]          = new DEPNode(DEPLib.NULL_ID, ANY_TOKEN);
		regnodes_PRT_rule_OBJ[2].setLabel(DEPLibEn.DEP_DOBJ); //("OBJ");
		int cPRT_rule_OBJ = 1;
		
		//// Noun-ish rules
		// Recognizes phrases like "no pain"
		DEPNode[] regnodes_DT_NMOD   = new DEPNode[2];
		regnodes_DT_NMOD[0]          = new DEPNode(NULL_ID, fromSet(iv_negDetPlusPrepSet));
//		regnodes_DT_NMOD[0].form     = DependencyRegex.fromSet(iv_negDetPlusPrepSet);
		regnodes_DT_NMOD[0].setLabel(DEP_DET); // was: ("NMOD");
		regnodes_DT_NMOD[1]          = new DEPNode(NULL_ID, ANY_TOKEN);
		regnodes_DT_NMOD[1].pos      = DependencyRegex.ANY_NOUN;
		int cDT_NMOD = 1;

		// Recognizes phrases like "without pain"
		DEPNode[] regnodes_IN_PMOD   = new DEPNode[2];
		regnodes_IN_PMOD[0]          = new DEPNode(NULL_ID, fromSet(iv_negDetPlusPrepSet));
//		regnodes_IN_PMOD[0].form     = DependencyRegex.fromSet(iv_negDetPlusPrepSet);
		regnodes_IN_PMOD[0].setLabel(DEP_PMOD); // was: ("PMOD");
		regnodes_IN_PMOD[1]          = new DEPNode(NULL_ID, ANY_TOKEN);
		regnodes_IN_PMOD[1].pos      = DependencyRegex.ANY_NOUN;
		int cIN_PMOD = 0;
		
		// Recognizes phrases like "no history of FOCUS"
		DEPNode[] regnodes_DT_NN_IN_PMOD = new DEPNode[4];
		regnodes_DT_NN_IN_PMOD[0]        = new DEPNode(NULL_ID, fromSet(iv_negDetPlusPrepSet));
//		regnodes_DT_NN_IN_PMOD[0].form   = DependencyRegex.fromSet(iv_negDetPlusPrepSet);
//		regnodes_DT_NN_IN_PMOD[0].setLabel(DEP_PMOD + "|" + DEP_NMOD); // was: ("[NP]MOD");  // no convincing evidence that this can be restricted among the set of words listed above. (no would be det i think)
		regnodes_DT_NN_IN_PMOD[1]        = new DEPNode(NULL_ID, fromSet(iv_regNounsSet));
//		regnodes_DT_NN_IN_PMOD[1].form   = DependencyRegex.fromSet(iv_regNounsSet);
		regnodes_DT_NN_IN_PMOD[2]        = new DEPNode(NULL_ID, fromSet(iv_regPrepositionsSet));
//		regnodes_DT_NN_IN_PMOD[2].form   = DependencyRegex.fromSet(iv_regPrepositionsSet);
		regnodes_DT_NN_IN_PMOD[2].pos    = "IN";
		regnodes_DT_NN_IN_PMOD[3]        = new DEPNode(NULL_ID, ANY_TOKEN);
		regnodes_DT_NN_IN_PMOD[3].setLabel(DEP_POBJ); // was: ("PMOD");
		int cDT_NN_IN_PMOD = 1;
		
//		// Recognizes negative-adjective phrases like "is negative for carcinoma"
//		DEPNode[] regnodes_JJNEG_COP_IN_PMOD = new DEPNode[4];
//		regnodes_JJNEG_COP_IN_PMOD[0]        = new DEPNode();
//		regnodes_JJNEG_COP_IN_PMOD[0].form   = DependencyRegex.fromSet(iv_negAdjectivesSet);
//		regnodes_JJNEG_COP_IN_PMOD[1]        = new DEPNode();
//		regnodes_JJNEG_COP_IN_PMOD[1].pos    = DependencyRegex.ANY_VERB; // banking that people don't use double negatives
//		regnodes_JJNEG_COP_IN_PMOD[2]        = new DEPNode();
//		regnodes_JJNEG_COP_IN_PMOD[2].form   = DependencyRegex.fromSet(iv_regPrepositionsSet);
//		regnodes_JJNEG_COP_IN_PMOD[2].pos    = "IN";
//		regnodes_JJNEG_COP_IN_PMOD[3]        = new DEPNode();
//		regnodes_JJNEG_COP_IN_PMOD[3].deprel = "PMOD";
//		int cJJNEG_COP_IN_PMOD = 1;

		// Recognizes negative-adjective phrases like "negative for carcinoma"
		DEPNode[] regnodes_JJNEG_AMOD_PMOD = new DEPNode[3];
		regnodes_JJNEG_AMOD_PMOD[0]        = new DEPNode(NULL_ID, fromSet(iv_negAdjectivesSet));
//		regnodes_JJNEG_AMOD_PMOD[0].form   = DependencyRegex.fromSet(iv_negAdjectivesSet);
		regnodes_JJNEG_AMOD_PMOD[1]        = new DEPNode(NULL_ID, fromSet(iv_regPrepositionsSet));
//		regnodes_JJNEG_AMOD_PMOD[1].form   = DependencyRegex.fromSet(iv_regPrepositionsSet);
		regnodes_JJNEG_AMOD_PMOD[1].pos    = "IN";
		regnodes_JJNEG_AMOD_PMOD[2]        = new DEPNode(NULL_ID, ANY_TOKEN);
		regnodes_JJNEG_AMOD_PMOD[2].setLabel(DEP_POBJ); // was: ("PMOD");
		int cJJNEG_AMOD_PMOD = 0;
		
		// Recognizes negative-adjective phrases like "unlikely to have carcinoma"
		// FIXME - not sure this one works correctly -- this example parses weirdly in CVD.
		DEPNode[] regnodes_JJNEG_AMOD_IM_OBJ = new DEPNode[4];
		regnodes_JJNEG_AMOD_IM_OBJ[0]        = new DEPNode(NULL_ID, fromSet(iv_negAdjectivesSet));
//		regnodes_JJNEG_AMOD_IM_OBJ[0].form   = DependencyRegex.fromSet(iv_negAdjectivesSet);
		regnodes_JJNEG_AMOD_IM_OBJ[1]        = new DEPNode(NULL_ID, ANY_TOKEN);
		regnodes_JJNEG_AMOD_IM_OBJ[1].setLabel(DEP_AMOD); // was: ("AMOD");
		regnodes_JJNEG_AMOD_IM_OBJ[2]        = new DEPNode(NULL_ID, ANY_TOKEN);
		regnodes_JJNEG_AMOD_IM_OBJ[2].setLabel(DEP_INFMOD); // was: ("IM");
		regnodes_JJNEG_AMOD_IM_OBJ[3]        = new DEPNode(NULL_ID, ANY_TOKEN);
		regnodes_JJNEG_AMOD_IM_OBJ[3].setLabel(DEP_DOBJ); // was: ("OBJ");
		int cJJNEG_AMOD_IM_OBJ = 0;
		
		// Recognizes negative-adjective phrases like "unlikely carcinoma"
		DEPNode[] regnodes_JJNEG_NN = new DEPNode[2];
		regnodes_JJNEG_NN[0]        = new DEPNode(NULL_ID, fromSet(iv_negAdjectivesSet));
//		regnodes_JJNEG_NN[0].form   = DependencyRegex.fromSet(iv_negAdjectivesSet);
		regnodes_JJNEG_NN[1]        = new DEPNode(NULL_ID, ANY_TOKEN);
		regnodes_JJNEG_NN[1].pos    = DependencyRegex.ANY_NOUN;
		int cJJNEG_NN = 1;
		
		
		// Add the verb-ish rules to the set of regexes to search
		DependencyRegex regex_VBNEG_OBJ = 
				(new DependencyRegex(regnodes_VBNEG_OBJ, cVBNEG_OBJ+1, "NegVerb->Dobj"))
					.appendOptional( regnodes_NN_CONJ_NN );
		regexSet.add(regex_VBNEG_OBJ);
		DependencyRegex regex_PRT_VB_PRD = 
				(new DependencyRegex(regnodes_PRT_VB_PRD, cPRT_VB_PRD+1, "PRT_VB_PRD"))
					.appendOptional( regnodes_NN_CONJ_NN );
		regexSet.add(regex_PRT_VB_PRD);
		DependencyRegex regex_PRT_MOD_VB_OBJ = 
				(new DependencyRegex(regnodes_PRT_MOD_VB_OBJ, cPRT_MOD_VB_OBJ+1, "PRT_MOD_VB_OBJ"))
					.appendOptional( regnodes_NN_CONJ_NN );
		regexSet.add(regex_PRT_MOD_VB_OBJ);
		DependencyRegex regex_PRT_MOD_VB_OBJ_IN_PMOD = 
				(new DependencyRegex(regnodes_PRT_MOD_VB_OBJ_IN_PMOD, cPRT_MOD_VB_OBJ_IN_PMOD+1, "cPRT_MOD_VB_OBJ_IN_PMOD"))
					.appendOptional( regnodes_NN_CONJ_NN );
		regexSet.add(regex_PRT_MOD_VB_OBJ_IN_PMOD);
		DependencyRegex regex_VBN_SBJ = 
				(new DependencyRegex(regnodes_VBN_SBJ, cVBN_SBJ+1, "VBN_SBJ"))
					.appendOptional( regnodes_NN_CONJ_NN );
		regexSet.add(regex_VBN_SBJ);
		
		DependencyRegex regex_PRT_rule_OBJ = 
				(new DependencyRegex(regnodes_PRT_rule_OBJ, cPRT_rule_OBJ+1, "PRT_rule_OBJ"))
					.appendOptional( regnodes_NN_CONJ_NN );
		regexSet.add(regex_PRT_rule_OBJ);

		// Add the noun-ish rules to the set of regexes to search
		DependencyRegex regex_DT_NMOD = 
				(new DependencyRegex(regnodes_DT_NMOD, cDT_NMOD+1, "DT_NMOD"))
					.appendOptional( regnodes_NN_CONJ_NN );
		regexSet.add(regex_DT_NMOD);
		DependencyRegex regex_IN_PMOD = 
				(new DependencyRegex(regnodes_IN_PMOD, cIN_PMOD+1, "IN_PMOD"))
					.appendOptional( regnodes_NN_CONJ_NN );
		regexSet.add(regex_IN_PMOD);
		DependencyRegex regex_DT_NN_IN_PMOD = 
				(new DependencyRegex(regnodes_DT_NN_IN_PMOD, cDT_NN_IN_PMOD+1, "DT_NN_IN_PMOD"))
					.appendOptional( regnodes_NN_CONJ_NN );
		regexSet.add(regex_DT_NN_IN_PMOD);
		DependencyRegex regex_JJNEG_AMOD_PMOD = 
				(new DependencyRegex(regnodes_JJNEG_AMOD_PMOD, cJJNEG_AMOD_PMOD+1, "JJNEG_AMOD_PMOD"))
					.appendOptional( regnodes_NN_CONJ_NN );
		regexSet.add(regex_JJNEG_AMOD_PMOD);
		DependencyRegex regex_JJNEG_AMOD_IM_OBJ = 
				(new DependencyRegex(regnodes_JJNEG_AMOD_IM_OBJ, cJJNEG_AMOD_IM_OBJ+1, "JJNEG_AMOD_IM_OBJ"))
					.appendOptional( regnodes_NN_CONJ_NN );
		regexSet.add(regex_JJNEG_AMOD_IM_OBJ);
		DependencyRegex regex_JJNEG_NN = 
				(new DependencyRegex(regnodes_JJNEG_NN, cJJNEG_NN+1, "JJNEG_NN"))
					.appendOptional( regnodes_NN_CONJ_NN );
		regexSet.add(regex_JJNEG_NN);
//		DependencyRegex regex_INNEG_NN = (
//				new DependencyRegex(regnodes_INNEG_NN, cINNEG_NN+1)).appendOptional( regnodes_NN_CONJ_NN );
//		regexSet.add(regex_INNEG_NN);
	
		// Print out the regexSet for the fun of it!
//		System.out.println("### here are the regexes");
//		for (DependencyRegex dreg : regexSet) {
//			System.out.println(dreg.getName() + " :: " + dreg.toString());
//		}
		
	}