Overview

Classes

  • Horde_Date_Parser
  • Horde_Date_Parser_Handler
  • Horde_Date_Parser_Locale_Base
  • Horde_Date_Parser_Locale_Base_Grabber
  • Horde_Date_Parser_Locale_Base_Ordinal
  • Horde_Date_Parser_Locale_Base_Pointer
  • Horde_Date_Parser_Locale_Base_Repeater
  • Horde_Date_Parser_Locale_Base_Scalar
  • Horde_Date_Parser_Locale_Base_Separator
  • Horde_Date_Parser_Locale_Base_Timezone
  • Horde_Date_Parser_Locale_De
  • Horde_Date_Parser_Locale_De_Grabber
  • Horde_Date_Parser_Locale_De_Ordinal
  • Horde_Date_Parser_Locale_De_Pointer
  • Horde_Date_Parser_Locale_De_Repeater
  • Horde_Date_Parser_Locale_De_Scalar
  • Horde_Date_Parser_Locale_De_Separator
  • Horde_Date_Parser_Locale_De_Timezone
  • Horde_Date_Parser_Locale_Pt
  • Horde_Date_Parser_Locale_Pt_Grabber
  • Horde_Date_Parser_Locale_Pt_Ordinal
  • Horde_Date_Parser_Locale_Pt_Pointer
  • Horde_Date_Parser_Locale_Pt_Repeater
  • Horde_Date_Parser_Locale_Pt_Scalar
  • Horde_Date_Parser_Locale_Pt_Separator
  • Horde_Date_Parser_Locale_Pt_Timezone
  • Horde_Date_Parser_Result
  • Horde_Date_Parser_Token

Exceptions

  • Horde_Date_Parser_Exception
  • Overview
  • Class
  • Tree

Class Horde_Date_Parser_Locale_Base

Direct known subclasses

Horde_Date_Parser_Locale_De, Horde_Date_Parser_Locale_Pt
Located at Horde/Date/Parser/Locale/Base.php
Methods summary
public
# __construct( mixed $args )
public
# parse( mixed $text, mixed $specifiedOptions = array() )

Parses a string containing a natural language date or time. If the parser

can find a date or time, either a Horde_Date or Horde_Date_Span will be returned

(depending on the value of :return). 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())

#

By setting :now to a Horde_Date, all computations will be based off

of that time instead of time().

#

[:return]

'result', 'span', or 'date' (defaults to 'date')

#

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 :return to 'span' and a Horde_Date_Span will be returned.

If you want the entire result, including tokens (for retrieving the text

that was or was not tagged, for example), set :return to 'result'

and you will get a result object.

#

[:ambiguousTimeRange]

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.

Parses a string containing a natural language date or time. If the parser

can find a date or time, either a Horde_Date or Horde_Date_Span will be returned

(depending on the value of :return). 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())

#

By setting :now to a Horde_Date, all computations will be based off

of that time instead of time().

#

[:return]

'result', 'span', or 'date' (defaults to 'date')

#

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 :return to 'span' and a Horde_Date_Span will be returned.

If you want the entire result, including tokens (for retrieving the text

that was or was not tagged, for example), set :return to 'result'

and you will get a result object.

#

[:ambiguousTimeRange]

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.

public
# componentFactory( mixed $component, mixed $args = null )
public
# preNormalize( mixed $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)

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)

public
# numericizeNumbers( mixed $text )

Convert number words to numbers (three => 3)

Convert number words to numbers (three => 3)

public
# numericizeOrdinals( mixed $text )

Convert ordinal words to numeric ordinals (third => 3rd)

Convert ordinal words to numeric ordinals (third => 3rd)

public array
# preTokenize( string $text )

Split the text on spaces and convert each word into a Token.

Split the text on spaces and convert each word into a Token.

Parameters

$text
Text to tokenize

Returns

array
Array of Horde_Date_Parser_Tokens.
public array
# postTokenize( array $tokens )

Remove tokens that don't fit our definitions.

Remove tokens that don't fit our definitions.

Parameters

$tokens
Array of tagged tokens.

Returns

array
Filtered tagged tokens.
public
# initDefinitions( )
public
# tokensToSpan( mixed $tokens, mixed $options )
public
# dayOrTime( mixed $dayStart, mixed $timeTokens, mixed $options )
public
# handle_m_d( mixed $month, mixed $day, mixed $timeTokens, mixed $options )
public
# handle_rmn_sd( mixed $tokens, mixed $options )
public
# handle_rmn_od( mixed $tokens, mixed $options )
public
# handle_rmn_sy( mixed $tokens, mixed $options )
public
# handle_rdn_rmn_sd_t_tz_sy( mixed $tokens, mixed $options )
public
# handle_rmn_sd_sy( mixed $tokens, mixed $options )
public
# handle_sd_rmn_sy( mixed $tokens, mixed $options )
public
# handle_sm_sd_sy( mixed $tokens, mixed $options )
public
# handle_sd_sm_sy( mixed $tokens, mixed $options )
public
# handle_sy_sm_sd( mixed $tokens, mixed $options )
public
# handle_sm_sy( mixed $tokens, mixed $options )
public
# handle_r( mixed $tokens, mixed $options )
public
# handle_r_g_r( mixed $tokens, mixed $options )
public
# handle_srp( mixed $tokens, mixed $span, mixed $options )
public
# handle_s_r_p( mixed $tokens, mixed $options )
public
# handle_p_s_r( mixed $tokens, mixed $options )
public
# handle_s_r_p_a( mixed $tokens, mixed $options )
public
# handle_orr( mixed $tokens, mixed $outerSpan, mixed $options )
public
# handle_o_r_s_r( mixed $tokens, mixed $options )
public
# handle_o_r_g_r( mixed $tokens, mixed $options )
public
# debug( mixed $method, mixed $args )
public
# getAnchor( mixed $tokens, mixed $options )
public
# getRepeaters( mixed $tokens )
public
# findWithin( mixed $tags, mixed $span, mixed $pointer )

Recursively finds repeaters within other repeaters. Returns a Span representing the innermost time span or null if no repeater union could be found

Recursively finds repeaters within other repeaters. Returns a Span representing the innermost time span or null if no repeater union could be found

public
# dealiasAndDisambiguateTimes( mixed $tokens, mixed $options )

handle aliases of am/pm 5:00 in the morning -> 5:00 am 7:00 in the evening -> 7:00 pm

handle aliases of am/pm 5:00 in the morning -> 5:00 am 7:00 in the evening -> 7:00 pm

Properties summary
public array $definitions
# array()
public array $args
# array()
public mixed $now
#
API documentation generated by ApiGen