Skip to content
SoluMilken edited this page Dec 22, 2018 · 2 revisions

UttutPipe

ref: https://hackmd.io/DWNGXRTJS9eQQ35lzJutwQ?both

Forward

Input RAW DATA

  • label = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 2, 2, 3, 3, 3, 0, 0, 0]
  • utt = "><><我想要喝200.5元的@@珍奶10杯!!!"

Step_1: normalize

  • label = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 2, 2, 3, 3, 3, 0, 0, 0]
  • utt = "><><我想要喝200.5元的@@珍奶10杯!!!"
  • forward_edits = [(0, 4, ''), (8, 13, '3float1'), (15, 17, ''), (19, 21, '2int')]
  • reverse_edits = [(0, 0, '><><'), (4, 13, '200.5'), (17, 23, '10'), (24, 24, '!!!')]

Step_2: tokenize

  • label = [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 3, 3, 3, 3, 3, 3, 3]
  • utt = "我想要喝_3float1_元的珍奶_2int_杯"
  • spans = [(0, 1), (1, 3), (3, 4), (4, 13), (13, 14), (14, 15), (15, 17), (17, 23), (23, 24)]
  • reverse: 好像不用

Step_3: add sos and eos

  • label = [0, 0, 0, 1, 1, 0, 2, 3, 3]
  • utt = ['我', '想要'. '喝', '3float1', '元', '的', '珍奶', '2int', 杯']
  • forward_edits = [(0, 0, ['sos']), (9, 9, ['eos'])]
  • reverse_edits = [(0, 1, []), (10, 11, [])]

Step_4: padding

  • label = [0, 0, 0, 0, 1, 1, 0, 2, 3, 3, 0]
  • utt = ['sos', '我', '想要'. '喝', '3float1', '元', '的', '珍奶', '2int', 杯', 'eos']
  • forward_edits = [(11, 11 , ['pad', 'pad'])]
  • reverse_edits = [(11, 13, [])]

Step_5: token2int

  • label = [0, 0, 0, 0, 1, 1, 0, 2, 3, 3, 0]
  • utt = ['sos', '我', '想要'. '喝', '3float1', '元', '的', '珍奶', '2int', 杯', 'eos']
  • forward_edits = [(0, 1, [0]), (1, 2, [1]), (2, 3, [2]), (3, 4, [3]), (4, 5, [4]), ...]
  • reverse_edits = [(0, 1, ['sos']), (1, 2, ['我']), (2, 3, ['想要']), ...]

Output

  • label = [0, 0, 0, 0, 1, 1, 0, 2, 3, 3, 0, 0, 0]
  • utt = ['sos', '我', '想要', '喝', '3float1', '元', '的', '珍奶', '2int', '杯', 'eos', 'pad', 'pad']

Prediction

  • prediction = [2, 1, 0, 3, 0, 1, 2, 0, 1, 0, 3, 1, 2]

=========================================

Backward

Input

  • prediction = [2, 1, 0, 3, 0, 1, 2, 0, 1, 0, 3, 1, 2]
  • transformed_utt = ['sos', '我', '想要', '喝', '3float1', '元', '的', '珍奶', '2int', '杯', 'eos', 'pad', 'pad']

Step_4: Unpadding

  • forward_edits = [(11, 11 , ['pad', 'pad'])]
  • reverse_edits = [(11, 13, [])]
  • propagated_prediction = [2, 1, 0, 3, 0, 1, 2, 0, 1, 0, 3]

Step_3: remove sos and eos

  • forward_edits = [(0, 0, ['sos']), (9, 9, ['eos'])]
  • reverse_edits = [(0, 1, []), (10, 11, [])]
  • propagated_prediction = [1, 0, 3, 0, 1, 2, 0, 1, 0]

Step_2: Untokenize

  • spans = [(0, 1), (1, 3), (3, 4), (4, 13), (13, 14), (14, 15), (15, 17), (17, 23), (23, 24)]
  • propagated_prediction = [1, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 1, 1, 1, 1, 1, 1, 0]

Step_1: denormalize

  • forward_edits = [(0, 4, ''), (8, 13, '3float1'), (15, 17, ''), (19, 21, '2int')]
  • reverse_edits = [(0, 0, '><><'), (4, 13, '200.5'), (17, 23, '10'), (24, 24, '!!!')]
  • propagated_prediction = [0, 0, 0, 0, 1, 0, 0, 3, 0, 0, 0, 0, 0, 1, 2, 0, 0, 1, 1, 0, 0, 0, 0]
  • default label 0
  • reduce func

OUTPUT

  • raw_utt = "><><我想要喝200.5元的@@珍奶10杯!!!"
  • [0, 0, 0, 0, 1, 0, 0, 3, 0, 0, 0, 0, 0, 1, 2, 0, 0, 1, 1, 0, 0, 0, 0]

Aggregate

  • h_output = [我 -> 1, 喝 -> 3, 元 -> 1, 的 -> 2, 10 -> 1]