alex.applications.PublicTransportInfoCS.data package

Submodules

alex.applications.PublicTransportInfoCS.data.add_cities_to_stops module

A script that creates a compatibility table from a list of stops in a certain city and its neighborhood and a list of towns and cities.

Usage:

./add_cities_to_stops.py [-d “Main city”] stops.txt cities.txt cities_stops.tsv

alex.applications.PublicTransportInfoCS.data.add_cities_to_stops.add_cities_to_stops(cities, stops, main_city)[source]
alex.applications.PublicTransportInfoCS.data.add_cities_to_stops.get_city_for_stop(cities, stop, main_city)[source]
alex.applications.PublicTransportInfoCS.data.add_cities_to_stops.load_list(filename, suppress_comments=False, cols=1)[source]
alex.applications.PublicTransportInfoCS.data.add_cities_to_stops.main()[source]

alex.applications.PublicTransportInfoCS.data.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.PublicTransportInfoCS.data.convert_idos_stops module

Convert stops gathered from the IDOS portal into structures accepted by the PublicTransportInfoCS application.

Usage:

./convert_idos_stops.py cities.txt idos_stops.tsv stops.txt cites_stops.tsv idos_map.tsv

Input:
cities.txt = list of all cities idos_stops.tsv = stops gathered from IDOS (format: “list_id<t>abbrev_stop”)

List ID is the name of the city for city public transit, “vlak” for trains and “bus” for buses.

Output:
stops.txt = list of all stops (unabbreviated) cities_stops.tsv = city-to-stop mapping idos_map.tsv = mapping from (city, stop) pairs into (list_id, abbrev_stop) used by IDOS
alex.applications.PublicTransportInfoCS.data.convert_idos_stops.expand_abbrevs(stop_name)[source]

Apply all abreviation expansions to the given stop name, all resulting variant names, starting with the ‘main’ variant.

alex.applications.PublicTransportInfoCS.data.convert_idos_stops.expand_numbers(stop_name)[source]

Spell out all numbers that appear as separate tokens in the word (separated by spaces).

alex.applications.PublicTransportInfoCS.data.convert_idos_stops.main()[source]
alex.applications.PublicTransportInfoCS.data.convert_idos_stops.unambig_variants(variants, idos_list)[source]

Create ‘unambiguos’ variants for a stop name that equals a city name, depending on the type of the stop (bus, train or city public transit).

alex.applications.PublicTransportInfoCS.data.convert_idos_stops.unify_casing_and_punct(stop_name)[source]

Unify casing of a stop name (if a second stop of the same name is encountered, let it have the same casing as the first one).

alex.applications.PublicTransportInfoCS.data.database module

alex.applications.PublicTransportInfoCS.data.download_data module

alex.applications.PublicTransportInfoCS.data.expand_stops module

alex.applications.PublicTransportInfoCS.data.get_cities_location module

A script that collects the locations of all the given cities using the Google Geocoding API.

Usage:

./get_cities_locations.py [-d delay] [-l limit] [-a] cities_locations-in.tsv cities_locations-out.tsv

-d = delay between requests in seconds (will be extended by a random period
up to 1/2 of the original value)

-l = limit maximum number of requests -a = retrieve all locations, even if they are set

alex.applications.PublicTransportInfoCS.data.get_cities_location.get_google_coords(city)[source]

Retrieve (all possible) coordinates of a city using the Google Geocoding API.

alex.applications.PublicTransportInfoCS.data.get_cities_location.random() → x in the interval [0, 1).

alex.applications.PublicTransportInfoCS.data.ontology module

alex.applications.PublicTransportInfoCS.data.ontology.add_slot_values_from_database(slot, category, exceptions=set([]))[source]
alex.applications.PublicTransportInfoCS.data.ontology.load_additional_information(fname, slot, keys)[source]
alex.applications.PublicTransportInfoCS.data.ontology.load_compatible_values(fname, slot1, slot2)[source]

Module contents