Repository: paddlepaddle/paddlespeech
Issue: when process english text with !" , get error

English text: The girls stared at their father. Mrs. Bennet said only, "Nonsense, nonsense!"

remove !  then the error disappeared.

Error Log:

Traceback (most recent call last):
  File "readText_Paddle.py", line 1175, in <module>
    englishTxt2WavbyPaddle(mp3filepath,textforSpeak)
  File "readText_Paddle.py", line 147, in englishTxt2WavbyPaddle
    wav_file = tts_executor(	\\
  File "/home/grow/PaddleSpeech/paddlespeech/cli/utils.py", line 328, in _warpper
    return executor_func(self, *args, **kwargs)
  File "/home/grow/PaddleSpeech/paddlespeech/cli/tts/infer.py", line 538, in __call__
    self.infer(text=text, lang=lang, am=am, spk_id=spk_id)
  File "/home/grow/.conda/envs/paddleconda/lib/python3.8/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/home/grow/.conda/envs/paddleconda/lib/python3.8/site-packages/paddle/fluid/dygraph/base.py", line 331, in _decorate_function
    return func(*args, **kwargs)
  File "/home/grow/PaddleSpeech/paddlespeech/cli/tts/infer.py", line 405, in infer
    mel = self.am_inference(part_phone_ids)
  File "/home/grow/.conda/envs/paddleconda/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 914, in __call__
    outputs = self.forward(*inputs, **kwargs)
  File "/home/grow/PaddleSpeech/paddlespeech/t2s/models/fastspeech2/fastspeech2.py", line 812, in forward
    normalized_mel, d_outs, p_outs, e_outs = self.acoustic_model.inference(
  File "/home/grow/PaddleSpeech/paddlespeech/t2s/models/fastspeech2/fastspeech2.py", line 709, in inference
    _, outs, d_outs, p_outs, e_outs = self._forward(
  File "/home/grow/PaddleSpeech/paddlespeech/t2s/models/fastspeech2/fastspeech2.py", line 514, in _forward
    x_masks = self._source_mask(ilens)
  File "/home/grow/PaddleSpeech/paddlespeech/t2s/models/fastspeech2/fastspeech2.py", line 783, in _source_mask
    x_masks = make_non_pad_mask(ilens)
  File "/home/grow/PaddleSpeech/paddlespeech/t2s/modules/nets_utils.py", line 249, in make_non_pad_mask
    return paddle.logical_not(make_pad_mask(lengths, xs, length_dim))
  File "/home/grow/PaddleSpeech/paddlespeech/t2s/modules/nets_utils.py", line 148, in make_pad_mask
    seq_range_expand = seq_range.unsqueeze(0).expand([bs, maxlen])
  File "/home/grow/.conda/envs/paddleconda/lib/python3.8/site-packages/paddle/tensor/manipulation.py", line 1869, in expand
    return _C_ops.expand_v2(x, 'shape', shape)
ValueError: (InvalidArgument) The 1th element of 'shape' for expand_v2 op must be greater than 0, but the value given is 0.
  [Hint: Expected expand_shape[i] > 0, but received expand_shape[i]:0 <= 0:0.] (at /paddle/paddle/fluid/operators/expand_v2_op.cc:78)
  [operator < expand_v2 > error]



Changed files:
paddlespeech/t2s/frontend/phonectic.py

diff --git a/paddlespeech/t2s/frontend/phonectic.py b/paddlespeech/t2s/frontend/phonectic.py
index 8e9f1173..7ec821ed 100644
--- a/paddlespeech/t2s/frontend/phonectic.py
+++ b/paddlespeech/t2s/frontend/phonectic.py
@@ -99,7 +99,8 @@ class English(Phonetics):
                 if (phn in self.vocab_phones and phn not in self.punc) else "sp"
                 for phn in phones
             ]
-            phones_list.append(phones)
+            if len(phones) != 0:
+                phones_list.append(phones)
 
         if merge_sentences:
             merge_list = sum(phones_list, [])