Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TTS]merge_yi function's bug #3652

Closed
lanyuer opened this issue Dec 20, 2023 · 1 comment · Fixed by #3786
Closed

[TTS]merge_yi function's bug #3652

lanyuer opened this issue Dec 20, 2023 · 1 comment · Fixed by #3786

Comments

@lanyuer
Copy link

lanyuer commented Dec 20, 2023

For support and discussions, please use our Discourse forums.

If you've found a bug then please create an issue with the following information:

Describe the bug
merge_yi这个方法的实现有问题,如果一句话中出现了多个 <动词,一,动词>组合的话,会有溢出错误。

To Reproduce
Steps to reproduce the behavior:
case:
seg = [('奶嘴', 'n'), ('儿', 'n'), ('是不是', 'l'), ('平常', 'a'), ('咱', 'r'), ('煮', 'v'), ('一', 'm'), ('煮', 'v'), ('烫', 'v'), ('一', 'm'), ('烫', 'v'), ('啥', 'r'), ('的', 'uj'), ('沙', 'n'), ('杀', 'v'), ('小菌', 'n'), ('菌用', 'n'), ('的', 'uj'), ('干净', 'a'), (',', 'x')]

fixed version:

  def _merge_yi(seg):
      new_seg = []
      skip_next = False
      # function 1
      for i, (word, pos) in enumerate(seg):
          if skip_next:
              skip_next = False
              continue
          if i - 1 >= 0 and word == "一" and i + 1 < len(seg) and seg[i - 1][0] == seg[i + 1][0] and seg[i - 1][1] == "v":
              new_seg[-1] = (new_seg[-1][0] + "一" + seg[i + 1][0], new_seg[-1][1])
              skip_next = True
          else:
              new_seg.append((word, pos))
      seg = new_seg
      new_seg = []
      # function 2
      for i, (word, pos) in enumerate(seg):
          if new_seg and new_seg[-1][0] == "一":
              new_seg[-1] = (new_seg[-1][0] + word, new_seg[-1][1])
          else:
              new_seg.append((word, pos))
      return new_seg

  res = _merge_yi(seg)
  print(res)

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: [e.g. Ubuntu]
  • GCC/G++ Version [e.g. 8.3]
  • Python Version [e.g. 3.7]
  • PaddlePaddle Version [e.g. 2.0.0]
  • Model Version [e.g. 2.0.0]
  • GPU/DRIVER Informationo [e.g. Tesla V100-SXM2-32GB/440.64.00]
  • CUDA/CUDNN Version [e.g. cuda-10.2]
  • MKL Version
  • TensorRT Version

Additional context
Add any other context about the problem here.

@zxcd
Copy link
Collaborator

zxcd commented Jan 16, 2024

感谢支持,是否有意向提一个pr解决这个问题?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants