You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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')]
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):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: