The best way is if you dig deep in anaphora resolution literature because something tells me that you will need that, and it could be the most related field of your research. A bit of advice: use centering theory (if confidence drops topic is changed), or our approach (see my publist: Context Identification: A relational database approach).