private boolean isTherePronoun ( final AnalyzedTokenReadings [ ] tokens , int i , Pattern lemma , Pattern postag ) { int j = 1 ; boolean keepCounting = true ; while ( i - j > 0 && keepCounting ) { if ( matchPostagRegexp ( tokens [ i - j ] , postag ) && matchLemmaRegexp ( tokens [ i - j ] , lemma ) ) return true ; keepCounting = matchPostagRegexp ( tokens [ i - j ] , PREP_VERB_PRONOM ) ; j ++ ; } j = 1 ; keepCounting = true ; while ( i + j < tokens . length && keepCounting ) { if ( matchPostagRegexp ( tokens [ i + j ] , postag ) && matchLemmaRegexp ( tokens [ i + j ] , lemma ) ) return true ; keepCounting = matchPostagRegexp ( tokens [ i + j ] , PREP_VERB_PRONOM ) ; j ++ ; } return false ; }
Checks if there is a desired pronoun near the verb