Skip to content

Instantly share code, notes, and snippets.

@piyushrj
piyushrj / date_identification.py
Created June 12, 2018 12:44
Adding custom Matcher rules to identify date patterns along with the ones identified with spacy's NER
import spacy, re, dateparser
from spacy.matcher import Matcher
from spacy.tokenizer import Tokenizer
from spacy import displacy
def custom_tokenizer(nlp, infix_reg):
"""
Function to return a customized tokenizer based on the infix regex