测试对象:open-cc和zhconv简繁体转换工具

测试字符:王力《古代汉语》附录简繁体对照字表

测试结果:

(1)繁体-简体准确率:open-cc-0.8883;zhconv-0.8849

(2)简体-繁体准确率:open-cc-0.9695;zhconv-0.9814

繁体字以台湾繁体为准。

测试代码示例:

  from zhconv import convert
  id_c_s2t = 0
  id_c_t2s = 0
  id = 0
  with open("characters.txt", "r",encoding='utf-8') as file:
      lines = file.readlines()
      for line in lines:
          id = id + 1
          char_s2t = convert(line.strip()[0],'zh-tw')
          if char_s2t == line.strip()[-1] or char_s2t == line.strip()[-2]:
              id_c_s2t = id_c_s2t + 1
          line2 = line[0:3]
          char_t2s = convert(line2.strip()[-1],'zh-cn')
          if char_t2s == line2.strip()[0]:
              id_c_t2s = id_c_t2s + 1
          # print(line.strip()[-2])
  pre_s2t = id_c_s2t / id
  print(f'pre_s2t={pre_s2t}\n')
  pre_t2s = id_c_t2s / id
  print(f'pre_t2s={pre_t2s}\n')