akoumjian / datefinder

Find dates inside text using Python and get back datetime objects
http://datefinder.readthedocs.org/en/latest/
MIT License
635 stars 165 forks source link

Identifies dates that are not present in the string #56

Open Nav33nn opened 7 years ago

Nav33nn commented 7 years ago

Below is the snippet: ` import datefinder

s = '1.1 This Addendum applies to Software Maintenance & Support Services ("Services") for all copies of software designated on the attached Exhibit 1 ("S oftware") which you have licensed from ABC. The Services for specific Software products may be more fully described in attached Appendices. In the event of a conflict, the order of precedence will be the Appendices, this Addendum, and the Agreement, in that order.' m = list(datefinder.find_dates(s)) print m `

On printing m this is seen [datetime.datetime(2017, 8, 1, 0, 0), datetime.datetime(2017, 8, 1, 0, 0), datetime.datetime(2017, 5, 14, 0, 0)]

There is no date present in the string. Is this an expected behaviour or a mistake from my end?

zeluspudding commented 7 years ago

That 2017, 5, 14, 0, 0 date is most likely because of the word "may" in Software products may be more fully described

Yeah, datefinder throws a lot of false positives. One work around is to feed it sentences you know have numbers (and therefor dates) in them. Not perfect but then again basically every date parser I've come across has its faults. Even duckling fails on sentences with the word may in them.