I would like to repalce specific token with their pos tag using spacy but I am encpountering this error, is there a way to overcome it.
lemma_token = [sent_doc.replace(w, w.pos_) for w in sent_doc if w.pos_ in list_postag]
AttributeError: 'spacy.tokens.doc.Doc' object has no attribute 'replace'
Script
list_postag = ["ADP","NUM","INTJ","DET","PREP","CCONJ","SCONJ"]
sent_clean = ["je mange bien"; "je l'aime bien", "il est trop beau"]
sent_doc = nlp(sent_clean)
mytokens = [w.lemma_.strip() for w in sent_doc if w.pos_ != "SPACE" and w.pos_ != "PUNCT"]
sentences_final.append(" ".join(mytokens))
lemma_token = [sent_doc.replace(w, w.pos_) for w in sent_doc if w.pos_ in list_postag]
sentences_final.append(" ".join(lemma_token))
expecting
lemma_token = ["PRON mange bien"; "PRON PRON aime bien", "PRON est trop beau"]