skillfed

ctparse

Parse natural language time expressions in python

ctparse v0.3.6 143.9K downloads/30d#11,164 on PyPI130
Permissive license MIT license Abandoned released

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 ctparse

uv

uv add ctparse

poetry

poetry add ctparse

Installing 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

Development Status :: 3 - AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishProgramming Language :: Python :: 3Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTopic :: Text Processing :: Linguistic

Tags

natural language time parsingparse date expressions from textconvert text to datetimetime expression recognitionenglish german date parsingrelative time resolution
nlpdatetime-parsingarchived

More Python Modules packages