fuzzyparsers

A collection of free-form input parsers (with special focus on dates)
Download

fuzzyparsers Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Publisher Name:
  • Joel B. Mohler

fuzzyparsers Tags


fuzzyparsers Description

A collection of free-form input parsers (with special focus on dates) fuzzyparsers is a Python library that provides a small collection of functions to sanitize free form user input. For the moment its chief value is the flexible date parser.The library has two main parsers. The first is a prefix parser which compares a string to a list of strings and returns the unique element of the list which matches the prefix. An exception is thrown if the match is not unique. >>> from fuzzyparsers import fuzzy_match >>> fuzzy_match(,'aa') 'aab' >>> fuzzy_match(,'a') # two strings starting with 'a'. Traceback (most recent call last): ... ValueError: ambigious matchThe second parser parses dates in various formats and returns a datetime.date object. Accepted formats include:jan 12, 2003jan 52004-3-5+34 -- 34 days in the future (relative to todays date)-4 -- 4 days in the past (relative to todays date)For instance: >>> from fuzzyparsers import sanitized_date >>> sanitized_date('jun 17 2010') # my youngest son's birthday datetime.date(2010, 6, 17)Fuzzyparsers is written by Joel B. Mohler and distributed under the terms of the GPL v2 (or later).The doc-tests provide fair code coverage. Use the following command:python -m doctest fuzzyparsers/*.pyTo install fuzzyparsers, do the normal python thing (probably as root):python setup.py installor:eazy_install fuzzyparsers Requirements: · Python What's New in This Release: · Overhaul of date parsing api to support relative dates (not necessarily relative to the current date)


fuzzyparsers Related Software