A spaCy custom component that extracts and normalizes dates and other temporal expressions
Project description
Timexy 🕙 📅
A spaCy custom component that extracts and normalizes dates and other temporal expressions.
Features
- :boom: Extract dates and durations for various languages. See here a list of currently supported languages
- :boom: Normalize dates to timestamps or normalize dates and durations to the TimeML TIMEX3 standard
Supported Languages
- 🇩🇪 German
- :uk: English
- 🇫🇷 French
Installation
pip install timexy
Usage
After installation, simply integrate the timexy component in any of your spaCy pipelines to extract and normalize dates and other temporal expressions:
import spacy
from timexy import Timexy
nlp = spacy.load("en_core_web_sm")
# Optionally add config if varying from default values
config = {
kb_id_type: "timex3", # possible values: 'timex3'(default), 'timestamp'
label: "timexy", # default: 'time'
overwrite: False # default: False
}
nlp.add_pipe("timexy" config=config)
doc = nlp("Today is the 10.10.2010. I was in Paris for six years.")
for e in doc.ents:
print(f"{e.text}\t{e.label_}\t{e.kb_id_}")
>>> 10.10.2010 timexy TIMEX3 type="DATE" value="2010-10-10T00:00:00"
>>> six years timexy TIMEX3 type="DURATION" value="P6Y"
Contributing
Please refer to the contributing guidelines here.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
timexy-0.1.0.tar.gz
(9.5 kB
view hashes)
Built Distribution
timexy-0.1.0-py3-none-any.whl
(10.1 kB
view hashes)