def validate_sample(ext, expected_transcripts, out_segments):
    base_output = f"{test_dir}/good"
    convert(f"{sample_dir}/invalid.stm", base_output + ext)
    validated_transcript = time_aligned_text(base_output + ext)
    assert len(validated_transcript.segments) == out_segments
    for seg, expected_text in zip(validated_transcript.segments, expected_transcripts):
        assert seg.text == expected_text
Пример #2
0
def validate(input_file):
    """
    Overwrites an STM file, leaving only valid input lines
    """

    # after reading in, only valid lines will remain
    # so write it back in place
    convert(input_file, input_file)
Пример #3
0
def validate_sample(ext, expected_transcripts, out_segments):
    base_output = 'tests/good'
    convert('samples/invalid.stm', base_output + ext)
    validated_transcript = time_aligned_text(base_output + ext)
    assert len(validated_transcript.segments) == out_segments
    for seg, expected_text in zip(validated_transcript.segments,
                                  expected_transcripts):
        assert seg.text == expected_text
Пример #4
0
def validate():
    parser = argparse.ArgumentParser(
        description='convert between text file formats')
    parser.add_argument('input_file',
                        metavar='input_file',
                        type=str,
                        help='input file')
    args = parser.parse_args()

    # after reading in, only valid lines will remain
    # so write it back in place
    convert(args.input_file, args.input_file)