Fix spacing in the sentence. #10947
-
Hi! I'm trying to code some simple preprocessing for my data and here is the use case: Is it possible to do with spacy? I mean, to add additional spaces between the punctuation tokens? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This isn't possible directly with spaCy, but you could use something like symspell to help. For example, when I pass your string into the basic usage example, it returns: That might also be overkill if this only happens with punctuation. If that's the case, there is probably a regular expression you can create to add spaces when that punctuation appears in the middle of two words. |
Beta Was this translation helpful? Give feedback.
This isn't possible directly with spaCy, but you could use something like symspell to help. For example, when I pass your string into the basic usage example, it returns:
i know you re here and me too
, so it's close but with the punctuation removed. There may be a way to keep the punctuation and casing - check out this open issue for more details.That might also be overkill if this only happens with punctuation. If that's the case, there is probably a regular expression you can create to add spaces when that punctuation appears in the middle of two words.