class_docstr: A utility class to help extract subsequences out of a batch
  of sequences
  
  Arguments
  ---------
  word_separator: int
      the index of the word separator (used in p_seq)
  word_separator_base int
      the index of word separators used in unprocessed
      targets (if different)
  
  Example
  -------
  >>> import torch
  >>> from speechbrain.lobes.models.g2p.homograph import SubsequenceExtractor
  >>> extractor = SubsequenceExtractor()
  >>> phns = torch.Tensor(
  ...     [[1, 2, 0, 1, 3, 0, 2, 1, 0],
  ...      [2, 1, 3, 0, 1, 2, 0, 3, 2]]
  ... )
  >>> phn_lens = torch.IntTensor([8, 9])
  >>> subsequence_phn_start = torch.IntTensor([3, 4])
  >>> subsequence_phn_end = torch.IntTensor([5, 7])
  >>> p_seq = torch.Tensor([
  ...     [[0., 1., 0., 0.],
  ...      [0., 0., 1., 0.],
  ...      [1., 0., 0., 0.],
  ...      [0., 1., 0., 0.],
  ...      [0., 0., 0., 1.],
  ...      [1., 0., 0., 0.],
  ...      [0., 0., 1., 0.],
  ...      [0., 1., 0., 0.],
  ...      [1., 0., 0., 0.]],
  ...     [[0., 0., 1., 0.],
  ...      [0., 1., 0., 0.],
  ...      [0., 0., 0., 1.],
  ...      [1., 0., 0., 0.],
  ...      [0., 1., 0., 0.],
  ...      [0., 0., 1., 0.],
  ...      [1., 0., 0., 0.],
  ...      [0., 0., 0., 1.],
  ...      [0., 0., 1., 0.]]
  ... ])
  >>> extractor.extract_seq(
  ...    phns,
  ...    phn_lens,
  ...    p_seq,
  ...    subsequence_phn_start,
  ...    subsequence_phn_end
  ... )
  (tensor([[[0., 1., 0., 0.],
           [0., 0., 0., 1.],
           [0., 0., 0., 0.]],
  <BLANKLINE>
          [[0., 1., 0., 0.],
           [0., 0., 1., 0.],
           [0., 0., 0., 0.]]]), tensor([[1., 3., 0.],
          [1., 2., 0.]]), tensor([0.6667, 1.0000]))
docstr: Computes the target word indexes
  
  Arguments
  ---------
  phns: torch.Tensor
      a phoneme batch tensor
  range_phns: torch.Tensor
      a range tensor over thephoneme sequence
  start: torch.Tensor
      the beginning of the subsequence
  word_separator: int
      the word separator being used
  
  Returns
  -------
  word_indexes: torch.Tensor
      the word index tensor
docstr_tok: ["Computes","the","target","word","indexes","Arguments","--","--","--","--","-","phns",":","torch.Tensor","a","phoneme","batch","tensor","range_phns",":","torch.Tensor","a","range","tensor","over","thephoneme","sequence","start",":","torch.Tensor","the","beginning","of","the","subsequence","word_separator",":","int","the","word","separator","being","used","Returns","--","--","--","-","word_indexes",":","torch.Tensor","the","word","index","tensor"]
code: def _get_target_word_indexes(
      self, phns, range_phns, start, word_separator, phn_lens=None
  ):
      """Computes the target word indexes
  
      Arguments
      ---------
      phns: torch.Tensor
          a phoneme batch tensor
      range_phns: torch.Tensor
          a range tensor over thephoneme sequence
      start: torch.Tensor
          the beginning of the subsequence
      word_separator: int
          the word separator being used
  
      Returns
      -------
      word_indexes: torch.Tensor
          the word index tensor
  
      """
      end_of_sequence = (
          (
              range_phns
              == ((phn_lens).unsqueeze(-1) * phns.size(1)).long()
          )
          if phn_lens is not None
          else False
      )
      word_boundaries = (range_phns < start) & (
          (phns == word_separator) | end_of_sequence
      )
      word_indexes = word_boundaries.sum(dim=-1)
      return word_indexes
  
imports: import torch
  from torch import nn
label_desc: Use image node_id 7 for calling the SubsequenceExtractor obj's underlying member method code with example usage: obj._get_target_word_indexes(phns, range_phns, start, word_separator, phn_lens) and returns: word_indexes