Skip to content
Discussion options

You must be logged in to vote

Hi @Rayan-Allali

I reproduced your issue here using the nlp.tokenizer.explain method which helps us a bit:

import spacy

nlp = spacy.load("en_core_web_sm")

text = "Today is 06/24/2025. Why can't this work?"
doc = nlp(text)

# the last expression is to check if infixes are added
infixes = nlp.Defaults.infixes + [r"'",]  + [r'(?<=[0-9]{2})(?:/)(?=[0-9]{2,4})']
infixe_regex = spacy.util.compile_infix_regex(infixes)  
nlp.tokenizer.infix_finditer = infixe_regex.finditer

nlp.tokenizer.explain(text)

Output:

[('TOKEN', 'Today'),
 ('TOKEN', 'is'),
 ('TOKEN', '06'),
 ('INFIX', '/'),
 ('TOKEN', '24'),
 ('INFIX', '/'),
 ('TOKEN', '2025'),
 ('SUFFIX', '.'),
 ('TOKEN', 'Why'),
 ('SPECIAL-1', 'ca'),
 (

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Rayan-Allali
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants