예제 #1
0
 def test_cut_features_mask(self, supervisions):
     cut = Cut('cut', start=0, duration=2, channel=0,
               features=Mock(sampling_rate=16000, frame_shift=0.01, num_frames=2000),
               supervisions=supervisions)
     mask = cut.supervisions_feature_mask()
     assert (mask[:50] == 1).all()
     assert (mask[50:] == 0).all()
예제 #2
0
 def test_cut_features_mask(self):
     cut = Cut('cut',
               start=0,
               duration=2,
               channel=0,
               features=Mock(sampling_rate=16000, frame_shift=0.01))
     mask = cut.supervisions_feature_mask()
     assert mask.sum() == 0
예제 #3
0
 def test_cut_features_mask(self, supervisions, alignment):
     cut = Cut('cut',
               start=0,
               duration=2,
               channel=0,
               features=Mock(sampling_rate=16000,
                             frame_shift=0.01,
                             num_frames=2000),
               supervisions=supervisions)
     mask = cut.supervisions_feature_mask(use_alignment_if_exists=alignment)
     if alignment == "word":
         ones = np.index_exp[list(
             chain(range(0, 10), range(20, 40), range(60, 80)))]
         zeros = np.index_exp[list(
             chain(range(10, 20), range(40, 60), range(80, 200)))]
     else:
         ones = np.index_exp[list(chain(range(0, 50), range(60, 80)))]
         zeros = np.index_exp[list(chain(range(50, 60), range(80, 200)))]
     assert (mask[ones] == 1).all()
     assert (mask[zeros] == 0).all()