code: def get_word_index(tokens, char_index):
      '''
      Given word return word index.
      '''
      for (i, token) in enumerate(tokens):
          if token['char_end'] == 0:
              continue
          if token['char_begin'] <= char_index and char_index <= token['char_end']:
              return i
      return f get_word_index(tokens, char_index):
      '''
      Given word return word index.
      '''
      for (i, token) in enumerate(tokens):
          if token['char_end'] == 0:
              continue
          if token['char_begin'] <= char_index and char_index <= token['char_end']:
              return i
      return 0
docs: Given word return word index.