Small NER model for dates?
I’m looking for a small NER model that’s specialized in recognizing dates, in English.If necessary, the model may not need to know to recognize other entities besides dates.
2022-05-04T10:57:54Z
HelloThis rule-based library from Meta calledducklingworks like a charm. You will write “last monday” and it will even parse it and you can use it to send the date to backend and automate calendar actions (just one of couple of stuff you can do with it).
2022-05-04T19:49:36Z
Hi Merve, I’m not sure I understood how duckling works… I’m still learning a lot of stuff. From the link, it seems to be a library in Haskell. I forgot to say that I’m using python… The wrappers I’ve seen for this, haven’t been updated in a while (4years at least). Do you know of something in python?
2022-05-05T10:19:41Z
Actually you can use thespacymodels for this. There are few dozens of them for different languages.You can seespacy/en_core_web_sm · Hugging Facefor example. If you expand label scheme, you can see it has a date label.!pip install https://huggingface.co/spacy/en_core_web_sm/resolve/main/en_core_web_sm-any-py3-none-any.whlimport spacy
nlp = spacy.load("en_core_web_sm")
doc = nlp("Last monday was the first of July")
for ent in doc.ents:
  print(ent, ent.label_)Gives meLast monday DATE
the first of DATE
July DATE