original_docstring: Find instances of tags in the content of a WebVTT file, and wrap them in
          <c.tagtype>tag value</c>.
  
         tags should be an iterable of dicts as in auto_tag_text
  
         Writes content to output, which should be a file-like object
docstring: Find instances of tags in the content of a WebVTT file, and wrap them in
  tag value.
  
  tags should be an iterable of dicts as in auto_tag_text
  
  Writes content to output, which should be a file-like object
docstring_tokens: Find instances of tags in the content of a WebVTT file and wrap them in tag value . tags should be an iterable of dicts as in auto_tag_text Writes content to output which should be a file - like object
code: def auto_tag_file(file_obj, tags, output):
      """Find instances of tags in the content of a WebVTT file, and wrap them in
          <c.tagtype>tag value</c>.
  
         tags should be an iterable of dicts as in auto_tag_text
  
         Writes content to output, which should be a file-like object"""
  
      webvtt = get_webvttfile(file_obj)
  
      previous = None
      for item in webvtt:
          item.text = auto_tag_text(item.text, tags)
  
          # TODO check that the end of the previous item's text (after any tags)
          # and the beginning of this one don't contain anything that should be
          # auto tagged
          if previous:
              prev_split = TAG_RE_FULL.split(previous.text)
              current_split = TAG_RE_FULL.split(item.text)
              span = '%s %s' % (prev_split[-1], current_split[0])
              tagged = auto_tag_text(span, tags)
              if len(tagged) > len(span):
                  # assume only one item has been tagged, and determine where to
                  # split the text based on the lengths of the original text and
                  # the assumed addition of a closing tag to the second part
                  current_len = len(current_split[0]) + TAG_CLOSE_LEN
                  prev_split[-1] = tagged[:-current_len]
                  current_split[0] = tagged[-current_len:]
                  previous.text = ''.join(prev_split).strip()
                  item.text = ''.join(current_split).strip()
  
          previous = item
  
      webvtt.write_into(output, include_indexes=True)
      return output
code_tokens: def auto_tag_file ( file_obj , tags , output ) : webvtt = get_webvttfile ( file_obj ) previous = None for item in webvtt : item . text = auto_tag_text ( item . text , tags ) if previous : prev_split = TAG_RE_FULL . split ( previous . text ) current_split = TAG_RE_FULL . split ( item . text ) span = '%s %s' % ( prev_split [ - 1 ] , current_split [ 0 ] ) tagged = auto_tag_text ( span , tags ) if len ( tagged ) > len ( span ) : current_len = len ( current_split [ 0 ] ) + TAG_CLOSE_LEN prev_split [ - 1 ] = tagged [ : - current_len ] current_split [ 0 ] = tagged [ - current_len : ] previous . text = '' . join ( prev_split ) . strip ( ) item . text = '' . join ( current_split ) . strip ( ) previous = item webvtt . write_into ( output , include_indexes = True ) return output
short_docstring: Find instances of tags in the content of a WebVTT file, and wrap them in
  <c.tagtype>tag value</c>.
short_docstring_tokens: Find instances of tags in the content of a WebVTT file and wrap them in <c . tagtype > tag value< / c > .
comment: """Find instances of tags in the content of a WebVTT file, and wrap them in
          <c.tagtype>tag value</c>.
  
         tags should be an iterable of dicts as in auto_tag_text
  
         Writes content to output, which should be a file-like object"""$SEP$# TODO check that the end of the previous item's text (after any tags)$SEP$# and the beginning of this one don't contain anything that should be$SEP$# auto tagged$SEP$# assume only one item has been tagged, and determine where to$SEP$# split the text based on the lengths of the original text and$SEP$# the assumed addition of a closing tag to the second part