alex.applications.PublicTransportInfoCS package

Subpackages

Submodules

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

Various enums, semi-automatically adapted from the CHAPS CRWS enum list written in C#.

Comments come originally from the CRWS description and are in Czech.

alex.applications.PublicTransportInfoCS.crws_enums.BEDS

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.CLIENTEXCEPTION_CODE

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.COMBFLAGS

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.COOR

alias of Enum

class alex.applications.PublicTransportInfoCS.crws_enums.CRCONST[source]
DELAY_CD = 'CD:'
DELAY_INTERN = 'X{0}_{1}:'
DELAY_INTERN_EXT = 'Y{0}_{1}:'
DELAY_TELMAX1 = 'TELMAX1:'
DELAY_ZSR = 'ZSR:'
EXCEPTIONEXCLUSION_CD = 'CD:'
alex.applications.PublicTransportInfoCS.crws_enums.DELTAMAX

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.DEP_TABLE

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.EXFUNCTIONRESULT

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.FCS

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.LISTID

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.OBJECT_STATUS

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.REG

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.REMMASK

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.ROUTE_FLAGS

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.SEARCHMODE

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.ST

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.SVCSTATE

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.TIMETABLE_FLAGS

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.TRCAT

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.TRSUBCAT

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.TTDETAILS

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.TTERR

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.TTGP

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.TTINFODETAILS

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.TTLANG

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.VF

alias of Enum

alex.applications.PublicTransportInfoCS.crws_enums.enum(**enums)[source]

alex.applications.PublicTransportInfoCS.cs_morpho module

alex.applications.PublicTransportInfoCS.directions module

alex.applications.PublicTransportInfoCS.exceptions module

exception alex.applications.PublicTransportInfoCS.exceptions.PTICSHDCPolicyException[source]

Bases: alex.components.dm.exceptions.DialoguePolicyException

alex.applications.PublicTransportInfoCS.hdc_policy module

alex.applications.PublicTransportInfoCS.hdc_slu module

class alex.applications.PublicTransportInfoCS.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.PublicTransportInfoCS.hdc_slu.PTICSHDCSLU(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_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_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_task(abutterance, cn)[source]

Detects the task in the input abstract utterance.

Parameters:
  • abutterance – the input abstract utterance.
  • 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_train_name(abutterance, cn)[source]

Detects the train name in the input abstract utterance.

Parameters:
  • abutterance
  • cn
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.PublicTransportInfoCS.hdc_slu.all_words_in(utterance, words)[source]
alex.applications.PublicTransportInfoCS.hdc_slu.any_phrase_in(utterance, phrases)[source]
alex.applications.PublicTransportInfoCS.hdc_slu.any_word_in(utterance, words)[source]
alex.applications.PublicTransportInfoCS.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.PublicTransportInfoCS.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.PublicTransportInfoCS.hdc_slu.phrase_in(utterance, words)[source]
alex.applications.PublicTransportInfoCS.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.PublicTransportInfoCS.platform_info module

class alex.applications.PublicTransportInfoCS.platform_info.CRWSPlatformInfo(crws_response, finder)[source]

Bases: object

find_platform_by_station(to_obj)[source]
find_platform_by_train_name(train_name)[source]
station_name_splitter = <_sre.SRE_Pattern object>
class alex.applications.PublicTransportInfoCS.platform_info.PlatformFinderResult(platform, track, direction)[source]

Bases: object

class alex.applications.PublicTransportInfoCS.platform_info.PlatformInfo(from_stop, to_stop, from_city, to_city, train_name, directions)[source]

Bases: object

alex.applications.PublicTransportInfoCS.platform_info_test module

class alex.applications.PublicTransportInfoCS.platform_info_test.PlatformInfoTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_matching()[source]

alex.applications.PublicTransportInfoCS.preprocessing module

alex.applications.PublicTransportInfoCS.test_hdc_policy module

alex.applications.PublicTransportInfoCS.test_hdc_slu module

Module contents