@@ -49,7 +49,7 @@ public Map<String, Object> getWordTree(List<String> reportIDList, String rootWor
4949 List <Map <String , Object >> rightList = new ArrayList <>();
5050
5151// Pattern sentencePattern = Pattern.compile("([^.:]*?" + rootWord + "[^.\n]*\\.)");
52- Pattern sentencePattern = Pattern .compile (" ([^.:]*?\\ b" + rootWord + "\\ b[^\n .?!]*)" );
52+ Pattern sentencePattern = Pattern .compile (" ([^.:]*?\\ b" + rootWord + "\\ b[^\n .?!]*)" , Pattern . CASE_INSENSITIVE );
5353 Pattern tokenPattern = Pattern .compile ("[\\ w']+|[.,!?;]" );
5454
5555
@@ -118,6 +118,8 @@ protected int parseWordTree(String reportText, Pattern sentencePattern,
118118 // preprocess
119119 reportText = reportText .replaceAll ("\r \n " , "\n " );
120120 sentenceMatch = sentencePattern .matcher (reportText );
121+ rootWord = rootWord .toLowerCase ();
122+
121123 while (sentenceMatch .find ()) {
122124 matchCount ++;
123125 matchedSentence = sentenceMatch .group ();
@@ -130,8 +132,12 @@ protected int parseWordTree(String reportText, Pattern sentencePattern,
130132 matchedSentence .length () - 1 );
131133 }
132134
135+ matchedSentence = matchedSentence .toLowerCase ();
136+ //System.out.println(matchedSentence);
137+
133138 // left branch
134139 tokenList = new ArrayList <>();
140+
135141 branchMatch = tokenPattern .matcher (matchedSentence .substring (0 ,
136142 matchedSentence .indexOf (rootWord )).trim ());
137143 while (branchMatch .find ()) {
0 commit comments