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

alex.applications.PublicTransportInfoEN.hdc_slu module

alex.applications.PublicTransportInfoEN.preprocessing module

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

alex.applications.PublicTransportInfoEN.test_hdc_slu module

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