What is the single quota meaning in regular expression 's|'t|'re|'ve|'m|'ll|'d?
Python code:
self.pat = re.compile(r"""<\|startoftext\|>|<\|endoftext\|>|'s|'t|'re|'ve|'m|'ll|'d|[\p{L}]+|[\p{N}]|[^\s\p{L}\p{N}]+""", re.IGNORECASE)
>Solution :
Single quote has no special meaning in regex.
's|'t means 's or 't.
It looks like the code is looking for words like:
- Someone’s,
- isn’t,
- you’re,
- we’ve,
- I’m,
- he’ll, etc.