{"id":21085,"library":"ctparse","title":"ctparse - Parse natural language time expressions","description":"Ctparse is a Python library for parsing natural language time expressions (like 'next Tuesday at 3pm', 'in two weeks', '3rd of March'). Version 0.3.6 is the latest release, with no recent updates. The project appears to be in maintenance mode.","status":"active","version":"0.3.6","language":"python","source_language":"en","source_url":"https://github.com/comtravo/ctparse","tags":["nlp","time","parsing","natural-language","date-parsing"],"install":[{"cmd":"pip install ctparse","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"For handling dictionary operations","package":"benedict","optional":true},{"reason":"Date/time parsing","package":"python-dateutil","optional":false},{"reason":"Regex operations","package":"regex","optional":false},{"reason":"Parsing grammar","package":"lark-parser","optional":false}],"imports":[{"note":"Direct import of main function","symbol":"ctparse","correct":"from ctparse import ctparse"},{"note":"Wrong: no such function exists","wrong":"from ctparse import parse_time_expression","symbol":"parse_time_expression"}],"quickstart":{"code":"from ctparse import ctparse\nfrom datetime import datetime\n\nresult = ctparse('next Friday at 5pm', reference_ts=datetime.now())\nif result:\n    print(result)\nelse:\n    print('No parse')\n","lang":"python","description":"Parse a natural language time expression with a reference timestamp."},"warnings":[{"fix":"Check if result list is non-empty before accessing result[0].","message":"ctparse returns a list of results (or empty list), not a single object. Always check the list.","severity":"gotcha","affected_versions":"all"},{"fix":"Always pass reference_ts=datetime.now() or similar.","message":"The function ctparse() requires a 'reference_ts' parameter (a datetime object) to resolve relative times. Without it, parsing 'today' or 'tomorrow' may be ambiguous.","severity":"gotcha","affected_versions":"all"},{"fix":"Use 'from ctparse import ctparse'.","message":"The old import 'from ctparse import ctparse' is correct, but some older examples use 'from ctparse import parse'. That function no longer exists.","severity":"deprecated","affected_versions":"<0.3"},{"fix":"Review patterns; if something fails, file an issue on GitHub.","message":"In version 0.3, the internal rule engine was rewritten. Some expressions that worked in 0.2 may no longer parse.","severity":"breaking","affected_versions":"0.3"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use 'from ctparse import ctparse'.","cause":"Old import path from early examples or documentation.","error":"ImportError: cannot import name 'parse' from 'ctparse'"},{"fix":"Pass reference_ts=datetime.now() or try a more specific expression like 'next Monday'.","cause":"Missing reference timestamp or ambiguous expression not handled by grammar.","error":"ctparse('next week') returns an empty list"},{"fix":"Always provide reference_ts parameter as a datetime object.","cause":"reference_ts is required in newer versions.","error":"TypeError: ctparse() missing 1 required positional argument: 'reference_ts'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}