ctparse
Parse natural language time expressions in python
What it is and what it does
ctparse is a pure Python library that interprets time expressions written in natural language—phrases like "next Tuesday" or "in 3 weeks"—and converts them to structured datetime objects. It works by combining rule-based production rules with probabilistic context-free grammar (PCFG) scoring to resolve ambiguous expressions. The package assumes all expressions are relative to a reference time you provide, and by default resolves ambiguous dates into the near future unless an explicit year or past context is given. It supports English and German text and is designed for use cases like booking systems where time expressions typically refer to dates within the next few weeks.
The library depends on python-dateutil, regex, and tqdm for its core functionality. It uses a corpus-based model to rank candidate resolutions, applying rules in order of likelihood rather than exhaustively trying all possibilities. However, the package is archived and no longer maintained, with the last release on 2022-11-28.
Use it for:
- Extract and resolve time expressions from booking or scheduling requests written in natural language
- Parse German and English date phrases in customer messages or form submissions to standardize datetime values
- Anchor relative time expressions like "next Friday" or "in two weeks" to a reference point for calendar applications
- Detect and interpret time-of-day expressions embedded in longer text for event scheduling systems
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses natural language time expressions (like "May 5th 2:30 in the afternoon") into structured datetime objects, supporting English and German text relative to a reference time.
Yes, if you need to parse English or German natural language time expressions and can accept that the package is no longer maintained. The low install friction and permissive license make it reasonable for existing projects, but do not adopt it for new systems where you cannot maintain a fork or where you need active bug fixes.
Install
ctparse on PyPI
pip
pip install ctparseuv
uv add ctparsepoetry
poetry add ctparseInstalling ctparse
Before you install
Low install friction with only three runtime dependencies. However, the package is archived and abandoned, with the last release on 2022-11-28 and no updates since. Use only if existing functionality meets your needs and you can maintain a fork if required.
License in practice
MIT license is permissive and imposes no significant restrictions on use, modification, or distribution.
Quickstart
from ctparse import ctparse
from datetime import datetime
ts = datetime(2018, 3, 12, 14, 30)
result = ctparse('May 5th 2:30 in the afternoon', ts=ts)
Verify before relying
- Whether the package handles edge cases or ambiguous expressions beyond what the corpus covers
- Performance characteristics when parsing large volumes of text or complex expressions
- Stability of the PCFG model calibration across different input distributions
Package facts
| License | MIT license (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — python-dateutil, regex, tqdm |
| Maintenance | abandoned — 1,355 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 143,947/month — #11,164 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ctparse-0.3.6-py2.py3-none-any.whl
Keywords: ctparse, time, parsing, natural, language
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
dateparserParses dates from text in multiple languages…
permissive · top 1,000 on PyPI
datefinderDatefinder extracts date and time expressions…
permissive · top 5,000 on PyPI
deltaParses human-readable duration strings like '1…
permissive · top 15,000 on PyPI
dateformatParses strings into datetime objects and…
permissive · top 15,000 on PyPI
aniso8601Parses ISO 8601 date, time, datetime, duration,…
permissive · top 5,000 on PyPI
commonregexExtracts dates, times, emails, phone numbers,…
permissive · top 15,000 on PyPI
pytimeparseParses human-readable time expressions (like…
permissive · top 1,000 on PyPI
parseParse strings using format-string-like patterns…
permissive · top 5,000 on PyPI
pytimeparse2Parses human-readable time expressions (like…
permissive · top 5,000 on PyPI
isodurationParses and manipulates ISO 8601 duration…
permissive · top 1,000 on PyPI