Project Wonder 5.0

er.chronic
Class Chronic

java.lang.Object
  extended by er.chronic.Chronic

public class Chronic
extends java.lang.Object


Field Summary
static java.lang.String VERSION
           
 
Method Summary
protected static java.util.List<Token> baseTokenize(java.lang.String text)
          Split the text on spaces and convert each word into a Token
protected static Span guess(Span span)
          Guess a specific time within the given span
protected static java.lang.String numericizeNumbers(java.lang.String text)
          Convert number words to numbers (three => 3)
protected static java.lang.String numericizeOrdinals(java.lang.String text)
          Convert ordinal words to numeric ordinals (third => 3rd)
static Span parse(java.lang.String text)
           
static Span parse(java.lang.String text, Options options)
          Parses a string containing a natural language date or time.
protected static java.lang.String preNormalize(java.lang.String text)
          Clean up the specified input text by stripping unwanted characters, converting idioms to their canonical form, converting number words to numbers (three => 3), and converting ordinal words to numeric ordinals (third => 3rd)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values
Method Detail

parse

public static Span parse(java.lang.String text)

parse

public static Span parse(java.lang.String text,
                         Options options)
Parses a string containing a natural language date or time. If the parser can find a date or time, either a Time or Chronic::Span will be returned (depending on the value of :guess). If no date or time can be found, +nil+ will be returned. Options are: [:context] :past or :future (defaults to :future) If your string represents a birthday, you can set :context to :past and if an ambiguous string is given, it will assume it is in the past. Specify :future or omit to set a future context. [:now] Time (defaults to Time.now) By setting :now to a Time, all computations will be based off of that time instead of Time.now. If set to null, Chronic will use Time.now. [:guess] +true+ or +false+ (defaults to +true+) By default, the parser will guess a single point in time for the given date or time. If you'd rather have the entire time span returned, set :guess to +false+ and a Chronic::Span will be returned. [:ambiguous_time_range] Integer or :none (defaults to 6 (6am-6pm)) If an Integer is given, ambiguous times (like 5:00) will be assumed to be within the range of that time in the AM to that time in the PM. For example, if you set it to 7, then the parser will look for the time between 7am and 7pm. In the case of 5:00, it would assume that means 5:00pm. If :none is given, no assumption will be made, and the first matching instance of that time will be used.


preNormalize

protected static java.lang.String preNormalize(java.lang.String text)
Clean up the specified input text by stripping unwanted characters, converting idioms to their canonical form, converting number words to numbers (three => 3), and converting ordinal words to numeric ordinals (third => 3rd)


numericizeNumbers

protected static java.lang.String numericizeNumbers(java.lang.String text)
Convert number words to numbers (three => 3)


numericizeOrdinals

protected static java.lang.String numericizeOrdinals(java.lang.String text)
Convert ordinal words to numeric ordinals (third => 3rd)


baseTokenize

protected static java.util.List<Token> baseTokenize(java.lang.String text)
Split the text on spaces and convert each word into a Token


guess

protected static Span guess(Span span)
Guess a specific time within the given span


Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.