As the title shows I am trying to look for pronouns in a string and replace it with it's antecedent like:

[in]: "the princess looked from the palace, she was happy".
[out]: "the princess looked from the palace, the princess was happy". 

I use pos tag to return pronouns and nouns. I need to know how to replace without knowing the sentence, meaning how to specify the subject in the sentence to replace the pronoun with it. Any suggestions?

Edit
Report