natural language date parser written in lex yacc and C
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
IOSMakeFile
LICENSE
Makefile
README.md
TimeParser.c
TimeParser.h
buildFatLibIOS.sh
parseIt.y
tokeIt.l

README.md

core

Natural Language Date/Time parser written in Lex, Yacc and C.

###Build It:

  1. clone repo
  2. run command "make"
  3. make creates a static library called libMoment.a and an executable testParser.exe that links to the static library.

Run ./testParser.exe to try it out.

If you want to use the library in XCode you can run the script buildFatLibIOS.sh This will build a fat library containing the library for ISO and for Simulator. Currently only set for 9.2 sdk.

To use it:
Add the library and TimeParser.h to your project
Include "TimeParser.h" 
Then call the method parseDateTimeString(StringToParse), which returns a double type (unix time).
You can then turn it into struct tm * with the localtime function but first would need to cast it to a time_t type.

Example Expressions:

Simple

  • thursday
  • november
  • friday 13:00
  • mon 2:35
  • 4pm
  • 6 in the morning
  • friday 1pm
  • sat 7 in the evening
  • yesterday
  • today
  • tomorrow
  • this tuesday
  • next month
  • this morning
  • last night
  • this second
  • yesterday at 4:00
  • last friday at 20:00
  • last week tuesday
  • tomorrow at 6:45pm
  • afternoon yesterday
  • thursday last week

Complex

  • 3 years ago
  • 5 months before now
  • 7 hours ago
  • 7 days from now
  • 1 week hence
  • in 3 hours
  • 1 year ago tomorrow
  • 3 months ago saturday at 5:00 pm
  • 7 hours before tomorrow at noon
  • 3rd wednesday in november
  • 3rd month next year
  • 3rd thursday this september
  • 4th day last week

Specific Dates

  • January 5
  • dec 25
  • may 27th
  • October 2006
  • jan 3 2010
  • March 14, 2004
  • March 14th, 2004
  • 3 jan 2000
  • 17 april 85
  • 5/27/1979
  • 27/5/1979
  • 1979-05-27
  • Friday
  • 5
  • 4:00
  • 17:00
  • 0800