alex.applications.PublicTransportInfoEN package

Subpackages

Submodules

alex.applications.PublicTransportInfoEN.autopath module

self cloning, automatic path configuration

copy this into any subdirectory of pypy from which scripts need to be run, typically all of the test subdirs. The idea is that any such script simply issues

import autopath

and this will make sure that the parent directory containing “pypy” is in sys.path.

If you modify the master “autopath.py” version (in pypy/tool/autopath.py) you can directly run it which will copy itself on all autopath.py files it finds under the pypy root directory.

This module always provides these attributes:

pypydir pypy root directory path this_dir directory where this autopath.py resides

alex.applications.PublicTransportInfoEN.directions module

class alex.applications.PublicTransportInfoEN.directions.Directions(**kwargs)[source]

Bases: alex.applications.PublicTransportInfoEN.directions.Travel

Ancestor class for transit directions, consisting of several routes.

class alex.applications.PublicTransportInfoEN.directions.DirectionsFinder[source]

Bases: object

Abstract ancestor for transit direction finders.

get_directions(from_city, from_stop, to_city, to_stop, departure_time=None, arrival_time=None, parameters=None)[source]

Retrieve the transit directions from the given stop to the given stop at the given time.

Should be implemented in derived classes.

class alex.applications.PublicTransportInfoEN.directions.GoogleDirections(input_json={}, **kwargs)[source]

Bases: alex.applications.PublicTransportInfoEN.directions.Directions

Traffic directions obtained from Google Maps API.

class alex.applications.PublicTransportInfoEN.directions.GoogleDirectionsFinder(cfg)[source]

Bases: alex.applications.PublicTransportInfoEN.directions.DirectionsFinder, alex.tools.apirequest.APIRequest

Transit direction finder using the Google Maps query engine.

get_directions(*args, **kwds)[source]

Get Google maps transit directions between the given stops at the given time and date.

The time/date should be given as a datetime.datetime object. Setting the correct date is compulsory!

map_vehicle(vehicle)[source]

maps PTIEN vehicle type to GOOGLE DIRECTIONS query vehicle

class alex.applications.PublicTransportInfoEN.directions.GoogleRoute(input_json)[source]

Bases: alex.applications.PublicTransportInfoEN.directions.Route

class alex.applications.PublicTransportInfoEN.directions.GoogleRouteLeg(input_json)[source]

Bases: alex.applications.PublicTransportInfoEN.directions.RouteLeg

class alex.applications.PublicTransportInfoEN.directions.GoogleRouteLegStep(input_json)[source]

Bases: alex.applications.PublicTransportInfoEN.directions.RouteStep

VEHICLE_TYPE_MAPPING = {u'FUNICULAR': u'cable_car', u'COMMUTER_TRAIN': u'train', u'INTERCITY_BUS': u'bus', u'METRO_RAIL': u'tram', u'BUS': u'bus', u'SHARE_TAXI': u'bus', u'RAIL': u'train', u'Long distance train': u'train', u'CABLE_CAR': u'cable_car', u'Train': u'train', u'TRAM': u'tram', u'HEAVY_RAIL': u'train', u'OTHER': u'dontcare', u'SUBWAY': u'subway', u'TROLLEYBUS': u'bus', u'FERRY': u'ferry', u'GONDOLA_LIFT': u'ferry', u'MONORAIL': u'monorail', u'HIGH_SPEED_TRAIN': u'train'}
class alex.applications.PublicTransportInfoEN.directions.Route[source]

Bases: object

Ancestor class for one transit direction route.

class alex.applications.PublicTransportInfoEN.directions.RouteLeg[source]

Bases: object

One traffic directions leg.

class alex.applications.PublicTransportInfoEN.directions.RouteStep(travel_mode)[source]

Bases: object

One transit directions step – walking or using public transport. Data members: travel_mode – TRANSIT / WALKING

  • For TRANSIT steps:

    departure_stop departure_time arrival_stop arrival_time headsign – direction of the transit line vehicle – type of the transit vehicle (tram, subway, bus) line_name – name or number of the transit line

  • For WALKING steps:

    duration – estimated walking duration (seconds)

MODE_TRANSIT = u'TRANSIT'
MODE_WALKING = u'WALKING'
class alex.applications.PublicTransportInfoEN.directions.Travel(**kwargs)[source]

Bases: object

Holder for starting and ending point (and other parameters) of travel.

get_minimal_info()[source]

Return minimal waypoints information in the form of a stringified inform() dialogue act.

alex.applications.PublicTransportInfoEN.exceptions module

exception alex.applications.PublicTransportInfoEN.exceptions.PTIENHDCPolicyException[source]

Bases: alex.components.dm.exceptions.DialoguePolicyException

alex.applications.PublicTransportInfoEN.hdc_policy module

class alex.applications.PublicTransportInfoEN.hdc_policy.PTIENHDCPolicy(cfg, ontology)[source]

Bases: alex.components.dm.base.DialoguePolicy

The handcrafted policy for the PTI-EN system.

DEFAULT_AMPM_TIMES = {u'night': u'00:00', u'evening': u'18:00', u'pm': u'15:00', u'am': u'10:00', u'morning': u'06:00'}
DESTIN = u'FINAL_DEST'
ORIGIN = u'ORIGIN'
backoff_action(ds)[source]

Generate a random backoff dialogue act in case we don’t know what to do.

Parameters:ds – The current dialogue state
Return type:DialogueAct
check_city_state_conflict(in_city, in_state)[source]

Check for conflicts in the given city and state. Return an apology() DA if the state and city is incompatible.

Parameters:
  • in_city – city slot value
  • in_state – state slot value
Return type:

DialogueAct

Returns:

apology dialogue act in case of conflict, or None

check_directions_conflict(wp)[source]

Check for conflicts in the given waypoints. Return an apology() DA if the origin and the destination are the same, or if a city is not compatible with the corresponding stop.

Parameters:wp – wayponts of the user’s connection query
Return type:DialogueAct
Returns:apology dialogue act in case of conflict, or None
confirm_info(tobe_confirmed_slots)[source]

Return a DA containing confirming only one slot from the slot to be confirmed. Confirm the slot with the most probable value among all slots to be confirmed.

Parameters:tobe_confirmed_slots – A dictionary with keys for all slots that should be confirmed, along with their values
Return type:DialogueAct
filter_iconfirms(da)[source]

Filter implicit confirms if the same information is uttered in an inform dialogue act item. Also filter implicit confirms for stop names equaling city names. Also check if the stop and city names are equal!

Parameters:da – unfiltered dialogue act
Returns:filtered dialogue act
fix_stop_street_slots(changed_slots)[source]
gather_connection_info(ds, accepted_slots)[source]

Return a DA requesting further information needed to search for traffic directions and a dictionary containing the known information. Infers city names based on stop names and vice versa.

If the request DA is empty, the search for directions may be commenced immediately.

Parameters:ds – The current dialogue state
Return type:DialogueAct, dict
gather_time_info(ds, accepted_slots)[source]

Handles if in_city specified it handles properly filled in_state slot. If needed, a Request DA is formed for missing in_state slot.

Returns Reqest DA and in_state If the request DA is empty, the search for current_time may be commenced immediately.

Parameters:ds – The current dialogue state,
gather_weather_info(ds, accepted_slots)[source]

Handles in_city and in_state to be properly filled. If needed, a Request DA is formed for missing slots to be filled.

Returns Reqest DA and WeatherPoint - information about the place If the request DA is empty, the search for weather may be commenced immediately.

Parameters:ds – The current dialogue state,
get_accepted_mpv(ds, slot_name, accepted_slots)[source]

Return a slot’s ‘mpv()’ (most probable value) if the slot is accepted, and return ‘none’ otherwise. Also, convert a mpv of ‘*’ to ‘none’ since we don’t know how to interpret it.

Parameters:
  • ds – Dialogue state
  • slot_name – The name of the slot to query
  • accepted_slots – The currently accepted slots of the dialogue state
Return type:

string

get_an_alternative(ds)[source]

Return an alternative route, if there is one, or ask for origin stop if there has been no route searching so far.

Parameters:ds – The current dialogue state
Return type:DialogueAct
get_confirmed_info(confirmed_slots, ds, accepted_slots)[source]

Return a DA containing information about all slots being confirmed by the user (confirm/deny).

Update the current dialogue state regarding the information provided.

WARNING This confirms only against values in the dialogue state, however, it should (also in some cases) confirm against the results obtained from database, e.g. departure_time slot.

Parameters:
  • ds – The current dialogue state
  • confirmed_slots – A dictionary with keys for all slots being confirmed, along with their values
Return type:

DialogueAct

get_connection_res_da(ds, ludait, slots_being_requested, slots_being_confirmed, accepted_slots, changed_slots, state_changed)[source]

Handle the public transport connection dialogue topic.

Parameters:ds – The current dialogue state
Return type:DialogueAct
get_current_time(in_city, in_state, longitude, latitude)[source]
get_current_time_res_da(ds, accepted_slots, state_changed)[source]

Generates a dialogue act informing about the current time. :rtype: DialogueAct

get_da(dialogue_state)[source]
The main policy decisions are made here. For each action, some set of conditions must be met. These
conditions depends on the action.
Parameters:dialogue_state – the belief state provided by the tracker
Returns:a dialogue act - the system action
get_default_stop_for_city(city)[source]

Return a `default’ stop based on the city name (main bus/train station).

Parameters:city – city name (unicode)
Return type:unicode
get_directions(ds, route_type=u'true', check_conflict=False)[source]

Retrieve Google directions, save them to dialogue state and return corresponding DAs.

Responsible for the interpretation of AM/PM time expressions.

Parameters:
  • ds – The current dialogue state
  • route_type – a label for the found route (to be passed on to say_directions())
  • check_conflict – If true, will check if the origin and destination stops are different and issue a warning DA if not.
Return type:

DialogueAct

get_help_res_da(ds, accepted_slots, state_changed)[source]
get_iconfirm_info(changed_slots)[source]

Return a DA containing all needed implicit confirms.

Implicitly confirm all slots provided but not yet confirmed.

This include also slots changed during the conversation.

Parameters:changed_slots – A dictionary with keys for all slots that have not been implicitly confirmed, along with their values
Return type:DialogueAct
get_limited_context_help(dialogue_state)[source]
get_requested_alternative(ds, slots_being_requested, accepted_slots)[source]

Return the requested route (or inform about not finding one).

Parameters:ds – The current dialogue state
Return type:DialogueAct
get_requested_info(requested_slots, ds, accepted_slots)[source]

Return a DA containing information about all requested slots.

Parameters:
  • ds – The current dialogue state
  • requested_slots – A dictionary with keys for all requested slots and the correct return values.
Return type:

DialogueAct

get_weather(ds, ref_point=None)[source]

Retrieve weather information according to the current dialogue state. Infers state names based on city names and vice versa.

Parameters:ds – The current dialogue state
Return type:DialogueAct
get_weather_res_da(ds, ludait, slots_being_requested, slots_being_confirmed, accepted_slots, changed_slots, state_changed)[source]

Handle the dialogue about weather.

Parameters:
  • ds – The current dialogue state
  • slots_being_requested – The slots currently requested by the user
Return type:

DialogueAct

interpret_time(time_abs, time_ampm, time_rel, date_rel, lta_time)[source]

Interpret time, given current dialogue state most probable values for relative and absolute time and date, plus the corresponding last-talked-about value.

Returns:the inferred time value + flag indicating the inferred time type (‘abs’ or ‘rel’)
Return type:tuple(datetime, string)
process_directions_for_output(dialogue_state, route_type)[source]

Return DAs for the directions in the current dialogue state. If the directions are not valid (nothing found), delete their object from the dialogue state and return apology DAs.

Parameters:
  • dialogue_state – the current dialogue state
  • route_type – the route type requested by the user (“last”, “next” etc.)
Return type:

DialogueAct

req_arrival_time(dialogue_state)[source]

Return a DA informing about the arrival time the destination stop of the last recommended connection.

req_arrival_time_rel(dialogue_state)[source]

Return a DA informing about the relative arrival time the destination stop of the last recommended connection.

req_departure_time(dialogue_state)[source]

Generates a dialogue act informing about the departure time from the origin stop of the last recommended connection.

:rtype : DialogueAct

req_departure_time_rel(dialogue_state)[source]

Return a DA informing the user about the relative time until the last recommended connection departs.

req_distance(dialogue_state)[source]

Return a DA informing the user about the distance and number of stops in the last recommended connection.

req_duration(dialogue_state)[source]

Return a DA informing about journey time to the destination stop of the last recommended connection.

req_from_stop(ds)[source]

Generates a dialogue act informing about the origin stop of the last recommended connection.

TODO: this gives too much of information. Maybe it would be worth to split this into more dialogue acts
and let user ask for all individual pieces of information. The good thing would be that it would lead to longer dialogues.

:rtype : DialogueAct

req_num_transfers(dialogue_state)[source]

Return a DA informing the user about the number of transfers in the last recommended connection.

req_time_transfers(dialogue_state)[source]

Return a DA informing the user about transfer places and time needed for the trasfer in the last recommended connection.

req_to_stop(ds)[source]

Return a DA informing about the destination stop of the last recommended connection.

reset_on_change(ds, changed_slots)[source]

Reset slots which depends on changed slots.

Parameters:
  • ds – dialogue state
  • changed_slots – slots changed in the last turn
select_info(tobe_selected_slots)[source]

Return a DA containing select act for two most probable values of only one slot from the slot to be used for select DAI.

Parameters:tobe_selected_slots – A dictionary with keys for all slots which the two most probable values should be selected
Return type:DialogueAct
alex.applications.PublicTransportInfoEN.hdc_policy.randbool(n)[source]

Randomly return True in 1 out of n cases.

Parameters:n – Inverted chance of returning True
Return type:Boolean

alex.applications.PublicTransportInfoEN.hdc_slu module

class alex.applications.PublicTransportInfoEN.hdc_slu.DAIBuilder(utterance, abutterance_lenghts=None)[source]

Bases: object

Builds DialogueActItems with proper alignment to corresponding utterance words. When words are successfully matched using DAIBuilder, their indices in the utterance are added to alignment set of the DAI as a side-effect.

all_words_in(words)[source]
any_phrase_in(phrases, sub_utt=None)[source]
any_word_in(words)[source]
build(act_type=None, slot=None, value=None)[source]

Produce DialogueActItem based on arguments and alignment from this DAIBuilder state.

clear()[source]
ending_phrases_in(phrases)[source]

Returns True if the utterance ends with one of the phrases

Parameters:phrases – a list of phrases to search for
Return type:bool
first_phrase_span(phrases, sub_utt=None)[source]

Returns the span (start, end+1) of the first phrase from the given list that is found in the utterance. Returns (-1, -1) if no phrase is found.

Parameters:phrases – a list of phrases to be tried (in the given order)
Return type:tuple
phrase_in(phrase, sub_utt=None)[source]
phrase_pos(words, sub_utt=None)[source]

Returns the position of the given phrase in the given utterance, or -1 if not found.

Return type:int
class alex.applications.PublicTransportInfoEN.hdc_slu.PTIENHDCSLU(preprocessing, cfg)[source]

Bases: alex.components.slu.base.SLUInterface

abstract_utterance(utterance)[source]

Return a list of possible abstractions of the utterance.

Parameters:utterance – an Utterance instance
Returns:a list of abstracted utterance, form, value, category label tuples
handle_false_abstractions(abutterance)[source]

Revert false positive alarms of abstraction

Parameters:abutterance – the abstracted utterance
Returns:the abstracted utterance without false positive abstractions
parse_1_best(obs, verbose=False, *args, **kwargs)[source]

Parse an utterance into a dialogue act.

:rtype DialogueActConfusionNetwork

parse_ampm(abutterance, cn)[source]

Detects the ampm in the input abstract utterance.

Parameters:
  • abutterance – the input abstract utterance.
  • cn – The output dialogue act item confusion network.
parse_borough(abutterance, cn)[source]

Detects stops in the input abstract utterance.

Parameters:
  • abutterance – the input abstract utterance.
  • cn – The output dialogue act item confusion network.
parse_city(abutterance, cn)[source]

Detects stops in the input abstract utterance.

Parameters:
  • abutterance – the input abstract utterance.
  • cn – The output dialogue act item confusion network.
parse_date_rel(abutterance, cn)[source]

Detects the relative date in the input abstract utterance.

Parameters:
  • abutterance – the input abstract utterance.
  • cn – The output dialogue act item confusion network.
parse_meta(utterance, abutt_lenghts, cn)[source]

Detects all dialogue acts which do not generalise its slot values using CLDB.

NOTE: Use DAIBuilder (‘dai’ variable) to match words and build DialogueActItem,
so that the DAI is aligned to corresponding words. If matched words are not supposed to be aligned, use PTICSHDCSLU matching method instead. Make sure to list negative conditions first, so the following positive conditions are not added to alignment, when they shouldn’t. E.g.: (not any_phrase_in(u, [‘dobrý den’, ‘dobrý večer’]) and dai.any_word_in(“dobrý”))
Parameters:
  • utterance – the input utterance
  • cn – The output dialogue act item confusion network.
Returns:

None

parse_non_speech_events(utterance, cn)[source]

Processes non-speech events in the input utterance.

Parameters:
  • utterance – the input utterance
  • cn – The output dialogue act item confusion network.
Returns:

None

parse_number(abutterance)[source]

Detect a number in the input abstract utterance

Number words that form time expression are collapsed into a single TIME category word. Recognized time expressions (where FRAC, HOUR and MIN stands for fraction, hour and minute numbers respectively):

  • FRAC [na] HOUR
  • FRAC hodin*
  • HOUR a FRAC hodin*
  • HOUR hodin* a MIN minut*
  • HOUR hodin* MIN
  • HOUR hodin*
  • HOUR [0]MIN
  • MIN minut*

Words of NUMBER category are assumed to be in format parsable to int or float

Parameters:abutterance (Utterance) – the input abstract utterance.
parse_state(abutterance, cn)[source]

Detects state in the input abstract utterance.

Parameters:
  • abutterance – the input abstract utterance.
  • cn – The output dialogue act item confusion network.
parse_stop(abutterance, cn)[source]

Detects stops in the input abstract utterance.

Parameters:
  • abutterance – the input abstract utterance.
  • cn – The output dialogue act item confusion network.
parse_street(abutterance, cn)[source]

Detects street in the input abstract utterance.

Parameters:
  • abutterance – the input abstract utterance.
  • cn – The output dialogue act item confusion network.
parse_task(abutterance, cn)[source]

Detects the task in the input abstract utterance.

Parameters:
  • abutterance
  • cn – The output dialogue act item confusion network.
parse_time(abutterance, cn)[source]

Detects the time in the input abstract utterance.

Parameters:
  • abutterance – the input abstract utterance.
  • cn – The output dialogue act item confusion network.
parse_vehicle(abutterance, cn)[source]

Detects the vehicle (transport type) in the input abstract utterance.

Parameters:
  • abutterance – the input abstract utterance.
  • cn – The output dialogue act item confusion network.
parse_waypoint(abutterance, cn, wp_id, wp_slot_suffix, phr_wp_types, phr_in=None)[source]

Detects stops or cities in the input abstract utterance (called through parse_city or parse_stop).

Parameters:
  • abutterance – the input abstract utterance.
  • cn – The output dialogue act item confusion network.
  • wp_id – waypoint slot category label (e.g. “STOP=”, “CITY=”)
  • wp_slot_suffix – waypoint slot suffix (e.g. “stop”, “city”)
  • phr_wp_types – set of phrases for each waypoint type
  • phr_in – phrases for ‘in’ waypoint type
alex.applications.PublicTransportInfoEN.hdc_slu.all_words_in(utterance, words)[source]
alex.applications.PublicTransportInfoEN.hdc_slu.any_phrase_in(utterance, phrases)[source]
alex.applications.PublicTransportInfoEN.hdc_slu.any_word_in(utterance, words)[source]
alex.applications.PublicTransportInfoEN.hdc_slu.ending_phrases_in(utterance, phrases)[source]

Returns True if the utterance ends with one of the phrases

Parameters:
  • utterance – The utterance to search in
  • phrases – a list of phrases to search for
Return type:

bool

alex.applications.PublicTransportInfoEN.hdc_slu.first_phrase_span(utterance, phrases)[source]

Returns the span (start, end+1) of the first phrase from the given list that is found in the utterance. Returns (-1, -1) if no phrase is found.

Parameters:
  • utterance – The utterance to search in
  • phrases – a list of phrases to be tried (in the given order)
Return type:

tuple

alex.applications.PublicTransportInfoEN.hdc_slu.last_phrase_pos(utterance, words)[source]

Returns the last position of a given phrase in the given utterance, or -1 if not found.

Return type:int
alex.applications.PublicTransportInfoEN.hdc_slu.last_phrase_span(utterance, phrases)[source]

Returns the span (start, end+1) of the last phrase from the given list that is found in the utterance. Returns (-1, -1) if no phrase is found.

Parameters:
  • utterance – The utterance to search in
  • phrases – a list of phrases to be tried (in the given order)
Return type:

tuple

alex.applications.PublicTransportInfoEN.hdc_slu.phrase_in(utterance, words)[source]
alex.applications.PublicTransportInfoEN.hdc_slu.phrase_pos(utterance, words)[source]

Returns the position of the given phrase in the given utterance, or -1 if not found.

Return type:int

alex.applications.PublicTransportInfoEN.preprocessing module

class alex.applications.PublicTransportInfoEN.preprocessing.PTIENNLGPreprocessing(ontology)[source]

Bases: alex.components.nlg.template.TemplateNLGPreprocessing

Template NLG preprocessing routines for English public transport information.

This serves for spelling out relative and absolute time expressions,

preprocess(template, svs_dict)[source]

Preprocess values to be filled into an NLG template. Spells out temperature and time expressions and translates some of the values to English.

Parameters:svs_dict – Slot-value dictionary
Returns:The same dictionary, with modified values
spell_temperature(value, interval)[source]

Convert a temperature expression into words (assuming nominative).

Parameters:
  • value – Temperature value (whole number in degrees as string), e.g. ‘1’ or ‘-10’.
  • interval – Boolean indicating whether to treat this as a start of an interval, i.e. omit the degrees word.
Returns:

temperature expression as string

spell_time_absolute(time)[source]

Convert a time expression into words.

Parameters:time – The 12hr numerical time value in a string, e.g. ‘08:05:pm’
Returns:time string with all numerals written out as words
spell_time_relative(time)[source]

Convert a time expression into words.

Parameters:time – Numerical time value in a string, e.g. ‘8:05’
Returns:time string with all numerals written out as words 0:15 will generate ‘15 minutes’ and not ‘0 hours and 15 minutes’.
class alex.applications.PublicTransportInfoEN.preprocessing.PTIENSLUPreprocessing(*args, **kwargs)[source]

Bases: alex.components.slu.base.SLUPreprocessing

Extends SLUPreprocessing for some transformations:

normalise_utterance(utterance)[source]

alex.applications.PublicTransportInfoEN.site_preprocessing module

alex.applications.PublicTransportInfoEN.site_preprocessing.expand(element, spell_numbers=True)[source]
alex.applications.PublicTransportInfoEN.site_preprocessing.expand_stop(stop, spell_numbers=True)[source]
alex.applications.PublicTransportInfoEN.site_preprocessing.fix_ordinal(word)[source]
alex.applications.PublicTransportInfoEN.site_preprocessing.spell_if_number(word, use_coupling, ordinal=True)[source]

alex.applications.PublicTransportInfoEN.test_hdc_policy module

class alex.applications.PublicTransportInfoEN.test_hdc_policy.TestPTIENHDCPolicy(methodName='runTest')[source]

Bases: unittest.case.TestCase

get_clean_ds()[source]
get_config()[source]
get_directions_json()[source]
setUp()[source]
set_ds_connection_info(to_stop='none', from_stop='none', to_city='none', from_city='none')[source]
set_ds_directions()[source]
set_ds_street_connection_info(to_street='none', to_street2='none', to_borough='none', from_street='none', from_street2='none', from_borough='none')[source]
test_gather_connection_info_combined()[source]
test_gather_connection_info_from_street_to_stop()[source]
test_gather_connection_info_from_streets_to_stops()[source]
test_gather_connection_info_from_streets_to_stops2()[source]
test_gather_connection_info_infer_from_borough()[source]
test_gather_connection_info_infer_from_city()[source]
test_gather_connection_info_infer_from_city_iconfirm()[source]
test_gather_connection_info_infer_from_to_city()[source]
test_gather_connection_info_infer_to_city()[source]
test_gather_connection_info_request_from_stop()[source]
test_gather_connection_info_request_from_street()[source]
test_gather_connection_info_request_to_borough()[source]
test_gather_connection_info_request_to_city()[source]
test_gather_connection_info_request_to_stop()[source]
test_gather_connection_info_request_to_stop_from_empty()[source]
test_gather_connection_info_request_to_street()[source]
test_gather_connection_info_street_infer_from_to_borough()[source]
test_gather_connection_info_street_infer_to_borough()[source]
test_interpret_time_empty()[source]
test_interpret_time_in_twenty_minutes()[source]
test_interpret_time_morning()[source]
test_interpret_time_string_now()[source]
test_interpret_time_tomorrow()[source]
test_interpret_time_tomorrow_at_eight_pm()[source]
test_req_arrival_time_abs()[source]
test_req_arrival_time_rel_in_five_minutes()[source]
test_req_departure_time_abs()[source]
test_req_departure_time_rel_in_five_minutes()[source]
test_req_departure_time_rel_missed()[source]
test_req_departure_time_rel_now()[source]

alex.applications.PublicTransportInfoEN.test_hdc_slu module

class alex.applications.PublicTransportInfoEN.test_hdc_slu.TestPTIENHDCSLU(methodName='runTest')[source]

Bases: unittest.case.TestCase

classmethod get_cfg()[source]
classmethod setUpClass()[source]
test_hour_and_a_half()[source]
test_parse_borough_from()[source]
test_parse_borough_from_to()[source]
test_parse_borough_int()[source]
test_parse_borough_to()[source]
test_parse_form_street_to_stop()[source]
test_parse_from_borough_from_street()[source]
test_parse_from_street_street_to_street()[source]
test_parse_from_to_city()[source]
test_parse_half_an_hour()[source]
test_parse_in_a_minute()[source]
test_parse_in_an_hour()[source]
test_parse_in_two_hours()[source]
test_parse_next_connection_time()[source]
test_parse_quarter_to_eleven()[source]
test_parse_street_at_streets()[source]
test_parse_street_from_street_to_streets()[source]
test_parse_street_from_streets()[source]
test_parse_street_from_streets_to_streets()[source]
test_parse_street_to_streets()[source]
test_parse_three_twenty_five()[source]
test_parse_to_borough_to_street()[source]
test_parse_to_city_to_stop()[source]
test_parse_to_city_to_stop2()[source]
test_parse_two_and_a_half()[source]
test_parse_two_hours()[source]
test_parse_two_hours_and_a_half()[source]
test_parse_two_hours_and_a_quarter()[source]
test_seventeen()[source]
test_seventeen_fourteen_o_clock()[source]
test_seventeen_zero_five()[source]
test_ten_o_clock()[source]
test_ten_p_m()[source]

alex.applications.PublicTransportInfoEN.time_zone module

class alex.applications.PublicTransportInfoEN.time_zone.GoogleTimeFinder(cfg)[source]

Bases: alex.tools.apirequest.APIRequest

get_time(place=None, lat=None, lon=None)[source]

Get time information at given place

obtain_geo_codes(place=u'New York')[source]

: :return: Returns tuple (longitude, latitude) for given place. Default value for place is New York

parse_time(response)[source]
class alex.applications.PublicTransportInfoEN.time_zone.Time[source]

Bases: object

Module contents