You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by tm...@apache.org on 2014/02/06 22:25:46 UTC

svn commit: r1565443 - in /ctakes/trunk: ctakes-assertion-res/src/main/resources/org/apache/ctakes/assertion/cue_words.txt ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/AlternateCuePhraseAnnotator.java

Author: tmill
Date: Thu Feb  6 21:25:46 2014
New Revision: 1565443

URL: http://svn.apache.org/r1565443
Log:
Fix annotator to use input streams as in ctakes-210. Also checks in resource file it uses.

Added:
    ctakes/trunk/ctakes-assertion-res/src/main/resources/org/apache/ctakes/assertion/cue_words.txt
Modified:
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/AlternateCuePhraseAnnotator.java

Added: ctakes/trunk/ctakes-assertion-res/src/main/resources/org/apache/ctakes/assertion/cue_words.txt
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion-res/src/main/resources/org/apache/ctakes/assertion/cue_words.txt?rev=1565443&view=auto
==============================================================================
--- ctakes/trunk/ctakes-assertion-res/src/main/resources/org/apache/ctakes/assertion/cue_words.txt (added)
+++ ctakes/trunk/ctakes-assertion-res/src/main/resources/org/apache/ctakes/assertion/cue_words.txt Thu Feb  6 21:25:46 2014
@@ -0,0 +1,454 @@
+on exertion|conditional|conditional
+on exercise|conditional|conditional
+with exertion|conditional|conditional
+with exercise|conditional|conditional
+exertional|conditional|conditional
+intolerance|conditional|conditional
+after|conditional|conditional
+post|conditional|conditional
+while|conditional|conditional
+when|conditional|conditional
+planned|conditional|conditional
+in the event|conditional|conditional
+if|conditional|conditional
+awaiting|conditional|conditional
+continued|conditional|conditional
+proceed|conditional|conditional
+plan|conditional|conditional
+scheduled|conditional|conditionalavoid|hypothetical|hypothetical
+avoiding|hypothetical|hypothetical
+avoidance|hypothetical|hypothetical
+if|hypothetical|hypothetical
+unless|hypothetical|hypothetical
+monitor for|hypothetical|hypothetical
+monitors for|hypothetical|hypothetical
+monitored for|hypothetical|hypothetical
+monitoring for|hypothetical|hypothetical
+prn|hypothetical|hypothetical
+PRN|hypothetical|hypothetical
+p.r.n.|hypothetical|hypothetical
+P.R.N.|hypothetical|hypothetical
+as needed for|hypothetical|hypothetical
+as necessary for |hypothetical|hypothetical
+call for|hypothetical|hypothetical
+call with|hypothetical|hypothetical
+return for|hypothetical|hypothetical
+return with|hypothetical|hypothetical
+return|hypothetical|hypothetical
+watch for|hypothetical|hypothetical
+report new|hypothetical|hypothetical
+potential|hypothetical|hypothetical
+potentially|hypothetical|hypothetical
+instructions for|hypothetical|hypothetical
+prevent|hypothetical|hypothetical
+preventing|hypothetical|hypothetical
+prevention|hypothetical|hypothetical
+risk|hypothetical|hypothetical
+risk stratification for|hypothetical|hypothetical
+future|hypothetical|hypothetical
+immunization against|hypothetical|hypothetical
+should|hypothetical|hypothetical
+should he experience|hypothetical|hypothetical
+should she experience|hypothetical|hypothetical
+should the patient experience|hypothetical|hypothetical
+prophylaxis|hypothetical|hypothetical
+prophylactic|hypothetical|hypothetical
+not|not|negation
+n't|not|negation
+'t|not|negation
+didn't|not|negation
+doesn't|not|negation
+don't|not|negation
+isn't|not|negation
+aren't|not|negation
+wasn't|not|negation
+weren't|not|negation
+hadn't|not|negation
+hasn't|not|negation
+haven't|not|negation
+won't|not|negation
+wouldn't|not|negation
+never|not|negation
+no longer|not|negation
+in no way|not|negation
+neither|neither|negation
+nor|neither|negation
+none|none|negation
+nobody|none|negation
+no one|none|negation
+nowhere|none|negation
+no place|none|negation
+no|no|negation
+without|no|negation
+absence of|no|negation
+free of|no|negation
+clear of|no|negation
+clear to|no|negation
+negative for|no|negation
+neg for|no|negation
+negative for|no|negation
+unremarkable for|no|negation
+unassociated with|no|negation
+( - )|no|negation
+non|no|negation
+lack of|no|negation
+lack|no|negation
+lacked|no|negation
+lacks|no|negation
+lacking|no|negation
+impossible|fail|negation
+cannot|fail|negation
+can't|fail|negation
+couldn't|fail|negation
+inability|fail|negation
+unable|fail|negation
+forget|fail|negation
+forgets|fail|negation
+forgetting|fail|negation
+forgot|fail|negation
+forgotten|fail|negation
+fail|fail|negation
+failed|fail|negation
+failing|fail|negation
+fails|fail|negation
+failure|fail|negation
+free of|absent|negation
+free|absent|negation
+absent|absent|negation
+immune to|absent|negation
+denied|deny|negation
+denies|deny|negation
+deny|deny|negation
+denying|deny|negation
+avoided|avoid|negation
+avoids|avoid|negation
+prevented|avoid|negation
+prevents|avoid|negation
+prophylaxis against|avoid|negation
+shouldn't|avoid|negation
+mustn't|avoid|negation
+unwilling|decline|negation
+unwillingness|decline|negation
+reluctance|decline|negation
+reluctant|decline|negation
+decline|decline|negation
+declined|decline|negation
+declines|decline|negation
+declining|decline|negation
+refusal|decline|negation
+refuse|decline|negation
+refused|decline|negation
+refuses|decline|negation
+refusing|decline|negation
+excluded|ruleout|negation
+excludes|ruleout|negation
+ruled out|ruleout|negation
+rules out|ruleout|negation
+discontinuance|stop|negation
+discontinuation|stop|negation
+discontinue|stop|negation
+discontinued|stop|negation
+discontinues|stop|negation
+discontinuing|stop|negation
+quit|stop|negation
+quits|stop|negation
+quitting|stop|negation
+stop|stop|negation
+stopped|stop|negation
+stopping|stop|negation
+stops|stop|negation
+used to|stop|negation
+held|stop|negation
+hold|stop|negation
+holding|stop|negation
+holds|stop|negation
+on hold|stop|negation
+off|stop|negation
+elimination|stop|negation
+eliminate|stop|negation
+eliminated|stop|negation
+eliminates|stop|negation
+eliminating|stop|negation
+eradication|stop|negation
+eradicate|stop|negation
+eradicated|stop|negation
+eradicates|stop|negation
+eradicating|stop|negation
+removal|stop|negation
+remove|stop|negation
+removed|stop|negation
+removes|stop|negation
+removing|stop|negation
+purge|stop|negation
+purged|stop|negation
+purges|stop|negation
+purging|stop|negation
+wipe out|stop|negation
+wiped out|stop|negation
+wipes out|stop|negation
+wiping out|stop|negation
+rid|stop|negation
+interrupt|stop|negation
+interruption|stop|negation
+interruptions|stop|negation
+resolved|disappear|negation
+resolution|disappear|negation
+disappeared|disappear|negation
+disappearance|disappear|negation
+rather than|exception|negation
+instead of|exception|negation
+except|exception|negation
+exception|exception|negation
+besides|exception|negation
+aside from|exception|negation
+other than|exception|negation
+mother|not_patient|not_patient
+father|not_patient|not_patient
+parent|not_patient|not_patient
+parents|not_patient|not_patient
+sister|not_patient|not_patient
+sisters|not_patient|not_patient
+brother|not_patient|not_patient
+brothers|not_patient|not_patient
+sibling|not_patient|not_patient
+siblings|not_patient|not_patient
+grandfather|not_patient|not_patient
+grandfathers|not_patient|not_patient
+grandmother|not_patient|not_patient
+grandmothers|not_patient|not_patient
+cousin|not_patient|not_patient
+cousins|not_patient|not_patient
+aunt|not_patient|not_patient
+aunts|not_patient|not_patient
+uncle|not_patient|not_patient
+uncles|not_patient|not_patient
+stepfather|not_patient|not_patient
+stepmother|not_patient|not_patient
+cousin|not_patient|not_patient
+cousins|not_patient|not_patient
+niece|not_patient|not_patient
+nieces|not_patient|not_patient
+nephew|not_patient|not_patient
+nephews|not_patient|not_patient
+wife|not_patient|not_patient
+husband|not_patient|not_patient
+spouse|not_patient|not_patient
+partner|not_patient|not_patient
+partners|not_patient|not_patient
+roommate|not_patient|not_patient
+roommates|not_patient|not_patient
+classmate|not_patient|not_patient
+classmates|not_patient|not_patient
+friend|not_patient|not_patient
+friends|not_patient|not_patient
+acquaintance|not_patient|not_patient
+acquaintances|not_patient|not_patient
+individual|not_patient|not_patient
+individuals|not_patient|not_patient
+person|not_patient|not_patient
+persons|not_patient|not_patient
+relative|not_patient|not_patient
+relatives|not_patient|not_patient
+family|not_patient|not_patient
+family member|not_patient|not_patient
+family members|not_patient|not_patient
+familiy history of |not_patient|not_patient
+fhx of|not_patient|not_patient
+fam hx of|not_patient|not_patient
+family hx|not_patient|not_patient
+twin|not_patient|not_patient
+familial|not_patient|not_patient
+uncertain|speculation_mid|speculation
+unsure|speculation_mid|speculation
+improbable|speculation_low|speculation
+unlikely|speculation_low|speculation
+doubtful|speculation_low|speculation
+doubt|speculation_low|speculation
+doubted|speculation_low|speculation
+doubting|speculation_low|speculation
+doubts|speculation_low|speculation
+possible|speculation_mid|speculation
+poss|speculation_mid|speculation
+hypothetical|speculation_mid|speculation
+questionable|speculation_mid|speculation
+consistent with|speculation_mid|speculation
+compatible with|speculation_mid|speculation
+equivocal for|speculation_mid|speculation
+suspicious for|speculation_mid|speculation
+potential|speculation_mid|speculation
+concerned for|speculation_mid|speculation
+concerning for|speculation_mid|speculation
+worrisome for|speculation_mid|speculation
+unclear|speculation_mid|speculation
+unknown|speculation_mid|speculation
+possibly|speculation_mid|speculation
+potentially|speculation_mid|speculation
+maybe|speculation_mid|speculation
+perhaps|speculation_mid|speculation
+possibilities|speculation_mid|speculation
+possibility|speculation_mid|speculation
+evidence for|speculation_mid|speculation
+evidence of|speculation_mid|speculation
+speculation|speculation_mid|speculation
+consideration|speculation_mid|speculation
+?|speculation_mid|speculation
+ddx|speculation_mid|speculation
+differential diagnosis|speculation_mid|speculation
+differential diagnoses|speculation_mid|speculation
+believe|speculation_high|speculation
+believed|speculation_high|speculation
+believes|speculation_high|speculation
+believing|speculation_high|speculation
+consider|speculation_mid|speculation
+considered|speculation_mid|speculation
+considering|speculation_mid|speculation
+considers|speculation_mid|speculation
+t/c|speculation_mid|speculation
+entertain|speculation_mid|speculation
+entertained|speculation_mid|speculation
+entertaining|speculation_mid|speculation
+entertains|speculation_mid|speculation
+question|speculation_mid|speculation
+questioned|speculation_mid|speculation
+questioning|speculation_mid|speculation
+questions|speculation_mid|speculation
+speculate|speculation_high|speculation
+speculated|speculation_high|speculation
+speculates|speculation_high|speculation
+speculating|speculation_high|speculation
+can|speculation_mid|speculation
+could|speculation_mid|speculation
+may|speculation_mid|speculation
+might|speculation_mid|speculation
+whether or not|speculation_mid|speculation
+whether|speculation_mid|speculation
+either|speculation_mid|speculation
+or|speculation_mid|speculation
+if|speculation_mid|speculation
+unless|speculation_low|speculation
+probable	prob_adj
+likely|speculation_high|speculation
+presumed|speculation_high|speculation
+presumptive|speculation_high|speculation
+apparent|speculation_high|speculation
+preliminary|speculation_high|speculation
+putative|speculation_high|speculation
+indicative of|speculation_high|speculation
+suggestive of|speculation_high|speculation
+typical of|speculation_high|speculation
+probably|speculation_high|speculation
+likely|speculation_high|speculation
+presumably|speculation_high|speculation
+apparently|speculation_high|speculation
+reportedly|speculation_high|speculation
+seemingly|speculation_high|speculation
+supposedly|speculation_high|speculation
+must|speculation_high|speculation
+appear|speculation_high|speculation
+appeared|speculation_high|speculation
+appearing|speculation_high|speculation
+appears|speculation_high|speculation
+seem|speculation_high|speculation
+seemed|speculation_high|speculation
+seems|speculation_high|speculation
+seeming|speculation_high|speculation
+estimate|speculation_high|speculation
+estimated|speculation_high|speculation
+estimates|speculation_high|speculation
+estimating|speculation_high|speculation
+feel that|speculation_high|speculation
+feeling that|speculation_high|speculation
+feels that|speculation_high|speculation
+felt that|speculation_high|speculation
+hypothesize|speculation_high|speculation
+hypothesized|speculation_high|speculation
+hypothesizes|speculation_high|speculation
+hypothesizing|speculation_high|speculation
+implied|speculation_high|speculation
+implies|speculation_high|speculation
+imply|speculation_high|speculation
+implying|speculation_high|speculation
+indicate|speculation_high|speculation
+indicated|speculation_high|speculation
+indicates|speculation_high|speculation
+indicating|speculation_high|speculation
+postulate|speculation_high|speculation
+postulated|speculation_high|speculation
+postulating|speculation_high|speculation
+postulates|speculation_high|speculation
+propose|speculation_high|speculation
+proposed|speculation_high|speculation
+proposes|speculation_high|speculation
+proposing|speculation_high|speculation
+suggest|speculation_high|speculation
+suggested|speculation_high|speculation
+suggesting|speculation_high|speculation
+suggests|speculation_high|speculation
+support|speculation_high|speculation
+supported|speculation_high|speculation
+supporting|speculation_high|speculation
+supports|speculation_high|speculation
+suppose|speculation_high|speculation
+supposed|speculation_high|speculation
+supposes|speculation_high|speculation
+supposing|speculation_high|speculation
+suspect|speculation_high|speculation
+suspected|speculation_high|speculation
+suspecting|speculation_high|speculation
+suspects|speculation_high|speculation
+think|speculation_high|speculation
+thinks|speculation_high|speculation
+thinking|speculation_high|speculation
+thought|speculation_high|speculation
+concern for|speculation_high|speculation
+concerns for|speculation_high|speculation
+implication|speculation_high|speculation
+implications|speculation_high|speculation
+impression of|speculation_high|speculation
+indication of|speculation_high|speculation
+indications of|speculation_high|speculation
+suspicion|speculation_high|speculation
+suspicions|speculation_high|speculation
+suggestion|speculation_high|speculation
+suggestions|speculation_high|speculation
+hypothesis|speculation_high|speculation
+hypotheses|speculation_high|speculation
+probability|speculation_high|speculation
+probabilities|speculation_high|speculation
+sign of|speculation_high|speculation
+signs of|speculation_high|speculation
+v.s.|speculation_high|speculation
+versus|speculation_high|speculation
+vs.|speculation_high|speculation
+vs|speculation_high|speculation
+r / o|speculation_mid|speculation
+ro|speculation_mid|speculation
+r/o|speculation_mid|speculation
+rule out|speculation_mid|speculation
+ruling out|speculation_mid|speculation
+rule - out|speculation_mid|speculation
+ruling - out|speculation_mid|speculation
+test for|speculation_mid|speculation
+tested for|speculation_mid|speculation
+testing for|speculation_mid|speculation
+tests for|speculation_mid|speculation
+check for|speculation_mid|speculation
+checked for|speculation_mid|speculation
+checking for|speculation_mid|speculation
+checks for|speculation_mid|speculation
+evaluate for|speculation_mid|speculation
+eval for|speculation_mid|speculation
+evaluated for|speculation_mid|speculation
+evaluates for|speculation_mid|speculation
+evaluating for|speculation_mid|speculation
+evaluation for|speculation_mid|speculation
+assess for|speculation_mid|speculation
+assessment for|speculation_mid|speculation
+monitor for|speculation_mid|speculation
+monitored for|speculation_mid|speculation
+monitoring for|speculation_mid|speculation
+monitors for|speculation_mid|speculation
+seriologies for|speculation_mid|speculation
+seriology for|speculation_mid|speculation
+work up for|speculation_mid|speculation
+workup for|speculation_mid|speculation

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/AlternateCuePhraseAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/AlternateCuePhraseAnnotator.java?rev=1565443&r1=1565442&r2=1565443&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/AlternateCuePhraseAnnotator.java (original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/AlternateCuePhraseAnnotator.java Thu Feb  6 21:25:46 2014
@@ -4,6 +4,8 @@ import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.HashMap;
 
@@ -20,13 +22,13 @@ import org.uimafit.util.JCasUtil;
 
 public class AlternateCuePhraseAnnotator extends JCasAnnotator_ImplBase {
 
-	public static final String PARAM_INPUT_DIR = "INPUT_DIR";
+	public static final String PARAM_INPUT_FILE = "INPUT_FILE";
 	
 	@ConfigurationParameter(
-			name = PARAM_INPUT_DIR,
+			name = PARAM_INPUT_FILE,
 			description = "Directory containing cue phrase files",
 			mandatory = false
-	) private String inputDirName = "org/apache/ctakes/assertion/cue_words";
+	) private String inputFilename = "org/apache/ctakes/assertion/cue_words.txt";
 	
 	private HashMap<String,CuePhrase> cueWords = null;
 
@@ -37,49 +39,41 @@ public class AlternateCuePhraseAnnotator
 		int[] lenCounts = new int[10];
 		
 		cueWords = new HashMap<String,CuePhrase>();
-		File inputDir = null;
+		InputStream is = null;
 		try{
-			inputDir = FileLocator.locateFile(inputDirName);
-			File[] processFiles = inputDir.listFiles();
-			for (int i = 0; i < processFiles.length; i++) {
-				File nextFile = processFiles[i]; //new File(directoryOfDelimitedFiles + "/"
-				//					+ processFiles[i]);
-				System.out.println("Processing: " + processFiles[i].getName()
-						+ "...");
-
-				BufferedReader br = new BufferedReader(new FileReader(
-						nextFile));
-				String record = "";
-				while ((record = br.readLine()) != null) {
-					// System.out.println(" record so far out of " + record
-					// );
-
-					String splitRecord[] = record.split("\\|");
-					if (splitRecord.length == 0)
-					{ continue; }
-					String cuePhrase = splitRecord[0];
-					String cuePhraseCategory = "default_category";
-					String cuePhraseFamily = "default_family";
-					
-					
-					if (splitRecord.length >= 2)
-					{
-						cuePhraseCategory = splitRecord[1];
-						cuePhraseFamily   = splitRecord[2];
-						if (cuePhraseCategory == null || cuePhraseCategory.isEmpty())
-						{
-							cuePhraseCategory = "category__" + cuePhraseFamily;
-						}
-					}
-					String[] cueTokens = cuePhrase.split("\\s+");
-					if(cueTokens.length < 3){
-						cueWords.put(cuePhrase, new CuePhrase(cuePhrase, cuePhraseCategory, cuePhraseFamily));
-					}else{
-						// TODO build tree for multi-word phrases.
-					}
-					if(cueTokens.length < lenCounts.length) lenCounts[cueTokens.length]++;
-				}
-			}
+		  is = FileLocator.getAsStream(inputFilename);
+		  BufferedReader br = new BufferedReader(new InputStreamReader(is));
+		  String record = "";
+		  while ((record = br.readLine()) != null) {
+		    // System.out.println(" record so far out of " + record
+		    // );
+
+		    String splitRecord[] = record.split("\\|");
+		    if (splitRecord.length == 0)
+		    { continue; }
+		    String cuePhrase = splitRecord[0];
+		    String cuePhraseCategory = "default_category";
+		    String cuePhraseFamily = "default_family";
+
+
+		    if (splitRecord.length >= 2)
+		    {
+		      cuePhraseCategory = splitRecord[1];
+		      cuePhraseFamily   = splitRecord[2];
+		      if (cuePhraseCategory == null || cuePhraseCategory.isEmpty())
+		      {
+		        cuePhraseCategory = "category__" + cuePhraseFamily;
+		      }
+		    }
+		    String[] cueTokens = cuePhrase.split("\\s+");
+		    if(cueTokens.length < 3){
+		      cueWords.put(cuePhrase, new CuePhrase(cuePhrase, cuePhraseCategory, cuePhraseFamily));
+		    }else{
+		      // TODO build tree for multi-word phrases.
+		    }
+		    if(cueTokens.length < lenCounts.length) lenCounts[cueTokens.length]++;
+		  }
+		  is.close();
 		}catch(IOException e){
 			throw new ResourceInitializationException(e);
 		}