Documentation

Horde_Date_Parser_Locale_Base
in package

Tags
author

Chuck Hagenbuch chuck@horde.org

author

Jan Schneider jan@horde.org

category

Horde

copyright

2008-2017 Horde LLC

license

http://www.horde.org/licenses/lgpl21 LGPL

Table of Contents

$args  : mixed
$definitions  : array<string|int, array<string|int, Horde_Date_Parser_Handler>>
$now  : mixed
__construct()  : mixed
componentFactory()  : mixed
dayOrTime()  : mixed
dealiasAndDisambiguateTimes()  : mixed
handle aliases of am/pm 5:00 in the morning -> 5:00 am 7:00 in the evening -> 7:00 pm
debug()  : mixed
findWithin()  : mixed
Recursively finds repeaters within other repeaters. Returns a Span representing the innermost time span or null if no repeater union could be found
getAnchor()  : mixed
getRepeaters()  : mixed
handle_m_d()  : mixed
handle_o_r_g_r()  : mixed
handle_o_r_s_r()  : mixed
handle_orr()  : mixed
handle_p_s_r()  : mixed
handle_r()  : mixed
handle_r_g_r()  : mixed
handle_rdn_rmn_sd_t_tz_sy()  : mixed
handle_rmn_od()  : mixed
handle_rmn_sd()  : mixed
handle_rmn_sd_sy()  : mixed
handle_rmn_sy()  : mixed
handle_s_r_p()  : mixed
handle_s_r_p_a()  : mixed
handle_sd_rmn_sy()  : mixed
handle_sd_sm_sy()  : mixed
handle_sm_sd_sy()  : mixed
handle_sm_sy()  : mixed
handle_srp()  : mixed
handle_sy_sm_sd()  : mixed
initDefinitions()  : mixed
numericizeNumbers()  : mixed
Convert number words to numbers (three => 3)
numericizeOrdinals()  : mixed
Convert ordinal words to numeric ordinals (third => 3rd)
parse()  : mixed
# 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 <tt>:return</tt>). If no date or time can be found, # +nil+ will be returned.
postTokenize()  : array<string|int, mixed>
Remove tokens that don't fit our definitions.
preNormalize()  : mixed
# 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)
preTokenize()  : array<string|int, mixed>
Split the text on spaces and convert each word into a Token.
tokensToSpan()  : mixed

Properties

$args

public mixed $args = array()

Methods

__construct()

public __construct(mixed $args) : mixed
Parameters
$args : mixed
Return values
mixed

componentFactory()

public componentFactory(mixed $component[, mixed $args = null ]) : mixed
Parameters
$component : mixed
$args : mixed = null
Return values
mixed

dayOrTime()

public dayOrTime(mixed $dayStart, mixed $timeTokens, mixed $options) : mixed
Parameters
$dayStart : mixed
$timeTokens : mixed
$options : mixed
Return values
mixed

dealiasAndDisambiguateTimes()

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

public dealiasAndDisambiguateTimes(mixed $tokens, mixed $options) : mixed
Parameters
$tokens : mixed
$options : mixed
Return values
mixed

debug()

public debug(mixed $method, mixed $args) : mixed
Parameters
$method : mixed
$args : mixed
Return values
mixed

findWithin()

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

public findWithin(mixed $tags, mixed $span, mixed $pointer) : mixed
Parameters
$tags : mixed
$span : mixed
$pointer : mixed
Return values
mixed

getAnchor()

public getAnchor(mixed $tokens, mixed $options) : mixed
Parameters
$tokens : mixed
$options : mixed
Return values
mixed

getRepeaters()

public getRepeaters(mixed $tokens) : mixed
Parameters
$tokens : mixed
Return values
mixed

handle_m_d()

public handle_m_d(mixed $month, mixed $day, mixed $timeTokens, mixed $options) : mixed
Parameters
$month : mixed
$day : mixed
$timeTokens : mixed
$options : mixed
Return values
mixed

handle_o_r_g_r()

public handle_o_r_g_r(mixed $tokens, mixed $options) : mixed
Parameters
$tokens : mixed
$options : mixed
Return values
mixed

handle_o_r_s_r()

public handle_o_r_s_r(mixed $tokens, mixed $options) : mixed
Parameters
$tokens : mixed
$options : mixed
Return values
mixed

handle_orr()

public handle_orr(mixed $tokens, mixed $outerSpan, mixed $options) : mixed
Parameters
$tokens : mixed
$outerSpan : mixed
$options : mixed
Return values
mixed

handle_p_s_r()

public handle_p_s_r(mixed $tokens, mixed $options) : mixed
Parameters
$tokens : mixed
$options : mixed
Return values
mixed

handle_r()

public handle_r(mixed $tokens, mixed $options) : mixed
Parameters
$tokens : mixed
$options : mixed
Return values
mixed

handle_r_g_r()

public handle_r_g_r(mixed $tokens, mixed $options) : mixed
Parameters
$tokens : mixed
$options : mixed
Return values
mixed

handle_rdn_rmn_sd_t_tz_sy()

public handle_rdn_rmn_sd_t_tz_sy(mixed $tokens, mixed $options) : mixed
Parameters
$tokens : mixed
$options : mixed
Return values
mixed

handle_rmn_od()

public handle_rmn_od(mixed $tokens, mixed $options) : mixed
Parameters
$tokens : mixed
$options : mixed
Return values
mixed

handle_rmn_sd()

public handle_rmn_sd(mixed $tokens, mixed $options) : mixed
Parameters
$tokens : mixed
$options : mixed
Return values
mixed

handle_rmn_sd_sy()

public handle_rmn_sd_sy(mixed $tokens, mixed $options) : mixed
Parameters
$tokens : mixed
$options : mixed
Return values
mixed

handle_rmn_sy()

public handle_rmn_sy(mixed $tokens, mixed $options) : mixed
Parameters
$tokens : mixed
$options : mixed
Return values
mixed

handle_s_r_p()

public handle_s_r_p(mixed $tokens, mixed $options) : mixed
Parameters
$tokens : mixed
$options : mixed
Return values
mixed

handle_s_r_p_a()

public handle_s_r_p_a(mixed $tokens, mixed $options) : mixed
Parameters
$tokens : mixed
$options : mixed
Return values
mixed

handle_sd_rmn_sy()

public handle_sd_rmn_sy(mixed $tokens, mixed $options) : mixed
Parameters
$tokens : mixed
$options : mixed
Return values
mixed

handle_sd_sm_sy()

public handle_sd_sm_sy(mixed $tokens, mixed $options) : mixed
Parameters
$tokens : mixed
$options : mixed
Return values
mixed

handle_sm_sd_sy()

public handle_sm_sd_sy(mixed $tokens, mixed $options) : mixed
Parameters
$tokens : mixed
$options : mixed
Return values
mixed

handle_sm_sy()

public handle_sm_sy(mixed $tokens, mixed $options) : mixed
Parameters
$tokens : mixed
$options : mixed
Return values
mixed

handle_srp()

public handle_srp(mixed $tokens, mixed $span, mixed $options) : mixed
Parameters
$tokens : mixed
$span : mixed
$options : mixed
Return values
mixed

handle_sy_sm_sd()

public handle_sy_sm_sd(mixed $tokens, mixed $options) : mixed
Parameters
$tokens : mixed
$options : mixed
Return values
mixed

initDefinitions()

public initDefinitions() : mixed
Return values
mixed

numericizeNumbers()

Convert number words to numbers (three => 3)

public numericizeNumbers(mixed $text) : mixed
Parameters
$text : mixed
Return values
mixed

numericizeOrdinals()

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

public numericizeOrdinals(mixed $text) : mixed
Parameters
$text : mixed
Return values
mixed

parse()

# 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 <tt>:return</tt>). If no date or time can be found, # +nil+ will be returned.

public parse(mixed $text[, mixed $specifiedOptions = array() ]) : mixed

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.

Parameters
$text : mixed
$specifiedOptions : mixed = array()
Return values
mixed

postTokenize()

Remove tokens that don't fit our definitions.

public postTokenize(array<string|int, mixed> $tokens) : array<string|int, mixed>
Parameters
$tokens : array<string|int, mixed>

Array of tagged tokens.

Return values
array<string|int, mixed>

Filtered tagged tokens.

preNormalize()

# 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 preNormalize(mixed $text) : mixed
Parameters
$text : mixed
Return values
mixed

preTokenize()

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

public preTokenize(string $text) : array<string|int, mixed>
Parameters
$text : string

Text to tokenize

Return values
array<string|int, mixed>

Array of Horde_Date_Parser_Tokens.

tokensToSpan()

public tokensToSpan(mixed $tokens, mixed $options) : mixed
Parameters
$tokens : mixed
$options : mixed
Return values
mixed

Search results