subtitle_analyzer package

Submodules

subtitle_analyzer.entry module

subtitle_analyzer.lib module

subtitle_analyzer.lib.extend_ranges(ranges, maxlen)
subtitle_analyzer.lib.find_phrases_pos(sentence, phrases, label)
subtitle_analyzer.lib.find_vocabs_pos(sentence, vocabs, label)
subtitle_analyzer.lib.make_markers(line_phrases)
subtitle_analyzer.lib.merge_ranges(ranges)

subtitle_analyzer.phrase_analyzer module

class subtitle_analyzer.phrase_analyzer.PhraseAnalyzer(lang)

Bases: object

To get phrase information from sentences with timestamp

get_line_phrases(sentences, external=False)

Parse sentences with timestamp into phrases and look up dictionary for explanation

Parameters:
  • sentences (list) – sentences with timestamp information

  • external (bool) – whether using external translation

subtitle_analyzer.phrase_ass_writer module

class subtitle_analyzer.phrase_ass_writer.PhraseASSWriter(using_marked_subs=True, cn_srtfile=None)

Bases: object

Write phrase information with time stamp into ass file

write(content, assfile, options)

Write phrase information into ass file

Parameters:
  • content (list) – phrase information with time stamp

  • assfile (str) – ass filename

  • options (dict) – argument for ass format

subtitle_analyzer.tbr module

subtitle_analyzer.tbr.merge_content(npfile, vpfile)
subtitle_analyzer.tbr.test_read(npfile)

subtitle_analyzer.vocab_analyzer module

class subtitle_analyzer.vocab_analyzer.VocabAnalyzer(lang)

Bases: object

To get vocabulary information from sentences with timestamp

get_line_vocabs(sentences, external=False)

Parse sentences with timestamp into vocabularies and look up dictionary for explanation

Parameters:
  • sentences (list) – sentences with timestamp information

  • external (bool) – whether using external translation

subtitle_analyzer.vocab_ass_writer module

class subtitle_analyzer.vocab_ass_writer.VocabASSWriter(srtfile)

Bases: object

Write vocabulary information with time stamp into ass file

write(content, assfile, options)

Write vocabulary information into ass file

Parameters:
  • content (list) – vocabulary information with time stamp

  • assfile (str) – ass filename

  • options (dict) – argument for ass format

Module contents

subtitle_analyzer pacakage

This module demostrates the usage of package subtitle_analyzer.