This is a Sprint interface implementation. See SprintInterface.py for another Sprint interface. This Sprint interface is to be used for ExternSprintDataset, which should automatically use it.

SprintExternInterface.getSegmentList(corpusName, segmentList, **kwargs)[source]

Called by Sprint PythonSegmentOrder. Set python-segment-order = true in Sprint to use this.

If this is used, this gets called really early. If it is used together with the Sprint PythonTrainer, it will get called way earlier before the init() below. It might also get called multiple times, e.g. if Sprint is in interactive mode to calc the seg count. This is optional. You can use the SprintInterface only for the PythonTrainer.

Return type:list[str]

:returns segment list. Can also be an iterator.

SprintExternInterface.exchook(exc_type, exc_obj, exc_tb)[source]
SprintExternInterface.init_PythonTrainer(inputDim, outputDim, config, targetMode, **kwargs)[source]

Called by Sprint when it initializes the PythonTrainer. Set trainer = python-trainer in Sprint to enable. Note that Sprint will call this, i.e. the trainer init lazily quite late, only once it sees the first data.

  • config (str) – config string, passed by Sprint. assumed to be “,”-separated
  • targetMode (str) – “target-alignment” or “criterion-by-sprint” or so
SprintExternInterface.feedInput(features, weights=None, segmentName=None)[source]
SprintExternInterface.feedInputAndTargetAlignment(features, targetAlignment, weights=None, segmentName=None)[source]
SprintExternInterface.feedInputAndTargetSegmentOrth(features, targetSegmentOrth, weights=None, segmentName=None)[source]
SprintExternInterface.feedInputUnsupervised(features, weights=None, segmentName=None)[source]
SprintExternInterface.feedInputAndTarget(features, weights=None, segmentName=None, orthography=None, alignment=None, speaker_name=None, speaker_gender=None, **kwargs)[source]
class SprintExternInterface.PythonControl(config, **kwargs)[source]
instance = None[source]
classmethod init(**kwargs)[source]
init_processing(input_dim, output_dim, **kwargs)[source]
process_segment(name, orthography, features, alignment, soft_alignment, **kwargs)[source]
class SprintExternInterface.ExternSprintDatasetSource(c2p_fd, p2c_fd, inputDim, outputDim, numSegments)[source]

This will send data to ExternSprintDataset over a pipe. We expect that we are child process and the parent process has spawned us via ExternSprintDataset and is waiting for our data.

  • c2p_fd (int) – child-to-parent file descriptor
  • p2c_fd (int) – parent-to-child file descriptor
  • numSegments (int | None) – can be None if not known in advance
addNewData(segmentName, features, targets)[source]
  • features (numpy.ndarray) – 2D array, (feature,time)
  • targets (dict[str,numpy.ndarray]) – each target is either 1D (time->idx) or 2D (time,class)