正如标题所示我试图在一个字符串中寻找代词并用它的前身代替它:
[in]: "the princess looked from the palace, she was happy".
[out]: "the princess looked from the palace, the princess was happy".
Run Code Online (Sandbox Code Playgroud)
我使用pos标签来返回代词和名词.我需要知道如何在不知道句子的情况下进行替换,这意味着如何在句子中指定主语以用它代替代词.有什么建议?