Class PrettyTimeParser

java.lang.Object
org.ocpsoft.prettytime.nlp.PrettyTimeParser

public class PrettyTimeParser extends Object
A utility for parsing natural language date and time expressions. (e.g. "Let's get lunch at two pm", "I did it 3 days ago")

Usage:

PrettyTimeParser p = new PrettyTimeParser();
List<Date> parsed = p.parse("I'll be there at two");
//result: Date - 2:00PM

Author:
<a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III
  • Constructor Details

  • Method Details

    • parse

      public List<Date> parse(String language)
      Parse the given language and return a List with all discovered Date instances.
    • parse

      public List<Date> parse(String language, Date referenceDate)
      Parse the given language and return a List with all discovered Date instances.
      Parameters:
      referenceDate - date to use as a reference for the parsing.
    • parseSyntax

      public List<DateGroup> parseSyntax(String language)
      Parse the given language and return a List with all discovered DateGroup instances.