docs: def detect_sentence_ending_saying_verbs( edt_sent_text ):
      ''' Detects cases where a saying verb (potential root of the sentence) ends the sentence.
  
          We use a simple heuristic: if the given sentence has multiple clauses, and the last main 
          verb in the sentence is preceded by ", but is not followed by ", then the main verb is 
          most likely a saying verb.
          
          Examples:
              " See oli ainult unes , " [vaidles] Jan .
              " Ma ei maga enam Joogaga ! " [protesteerisin] .
              " Mis mõttega te jama suust välja ajate ? " [läks] Janil nüüd juba hari punaseks .
              
          Note that the class of saying verbs is open, so we try not rely on a listing of verbs,
          but rather on the conventional usage patterns of reported speech, indicated by quotation 
          marks.
          
          Returns a dict containing word indexes of saying verbs;
      '''
      from estnltk.mw_verbs.utils import WordTemplate
      
      if not edt_sent_text.is_tagged( VERB_CHAINS ):
          edt_sent_text.tag_verb_chains()
  
      saying_verbs = {}
      if len(edt_sent_text[VERB_CHAINS]) < 2:
          # Skip sentences that do not have any chains, or 
          #                have only a single verb chain
          return saying_verbs
  
      patColon = WordTemplate({'partofspeech':'^[Z]$', 'text': '^:$'})
          
      for vid, vc in enumerate( edt_sent_text[VERB_CHAINS] ):
          #  
          #  Look only multi-clause sentences, where the last verb chain has length 1
          # 
          if len(vc['phrase']) == 1 and vid == len(edt_sent_text[VERB_CHAINS])-1:
              wid   = vc['phrase'][0]
              token = edt_sent_text[WORDS][wid]
              clause_id = vc[CLAUSE_IDX]
              # Find corresponding clause and locations of quotation marks
              clause, insideEmbeddedCl = _get_clause_words( edt_sent_text, clause_id )
              quoteLeft  = _detect_quotes( edt_sent_text, wid, fromRight = False )
              quoteRight = _detect_quotes( edt_sent_text, wid, fromRight = True )
              #
              #  Exclude cases, where there are double quotes within the same clause:
              #     ... ootab igaüks ,] [kuidas aga kähku tagasi " varrastusse " <saaks> .]
              #     ... miljonäre on ka nende seas ,] [kes oma “ papi ” mustas äris <teenivad>  .]
              #
              quotes_in_clause = []
              for (wid2, token2) in clause:
                  if _pat_starting_quote.match(token2[TEXT]) or \
                      _pat_ending_quote.match(token2[TEXT]):
                      quotes_in_clause.append(wid2)
              multipleQuotes = len(quotes_in_clause) > 1 and quotes_in_clause[-1]==quoteLeft
              #    
              #  If the preceding double quotes are not within the same clause, and
              #     the verb is not within an embedded clause, and a quotation mark strictly
              #     precedes, but none follows, then we have most likely a saying verb:
              #         " Ma ei tea , " [kehitan] õlga .
              #         " Miks jumal meid karistab ? " [mõtles] sir Galahad .
              #         " Kaarsild pole teatavastki elusolend , " [lõpetasin] arutelu .
              #
              if not multipleQuotes and \
                 not insideEmbeddedCl and \
                 (quoteLeft != -1 and quoteLeft+1 == wid and quoteRight == -1):
                  saying_verbs[wid] = 'se_saying_verb'
      return saying_verbs