moved pronoun-entity matching into a separate function