allenai / scispacy

A full spaCy pipeline and models for scientific/biomedical documents.
https://allenai.github.io/scispacy/
Apache License 2.0
1.68k stars 225 forks source link

Replacing Abbreviations with the long form #418

Closed nermeetadhillon closed 2 years ago

nermeetadhillon commented 2 years ago

Hi I am trying to go through my tokens and replace abbreviations like cvd, with cardiovascular disease, etc. However whenever I go to replace my tokens I get the following error 'spacy.tokens.doc.Doc' object has no attribute 'append' or 'spacy.tokens.doc.Doc' object has no attribute 'replace'

dakinggg commented 2 years ago

spacy Docs are not really editable. I think the simplest way is to convert to string, replace the part of the string you want to, and then reprocess to a spacy doc.