docs: def extract_text(fpath):
      """
      Extracts structured text content from a plain-text file at ``fpath``.
  
      Parameters
      ----------
      fpath : str
          Path to the text file..
  
      Returns
      -------
      :class:`.StructuredFeature`
          A :class:`.StructuredFeature` that contains sentence context.
      """
      with codecs.open(fpath, 'r') as f:  # Determine the encoding of the file.
          document = f.read()
      encoding = chardet.detect(document)['encoding']
      document = document.decode(encoding)
  
      tokens = []
      sentences = []
  
      i = 0
      for sentence in nltk.tokenize.sent_tokenize(document):
          sentences.append(i)
  
          for word in nltk.tokenize.word_tokenize(sentence):
              tokens.append(word)
              i += 1
  
      contexts = [('sentence', sentences)]
      return StructuredFeature(tokens, contexts)