2つのtokenizationのアラインメントを求めたい.
https://github.com/explosion/spacy-transformers/issues/87
stack overflowで質問した.
diffと似ていそう
- myers diff algorithm
- Investigating Myers' diff algorithm: Part 1 of 2 - CodeProject
- https://gist.github.com/gurimusan/7e554eb12f9f59880053
- https://susisu.hatenablog.com/entry/2017/10/09/134032
- https://www.slideshare.net/matuura/diff-3119288
つくった (Rust, Python bindingあり)
https://github.com/tamuhey/tokenizations
spacy-transformersに入れてみた
- sum(num of wordpiece per sentence) == num of doc wordpieces とならない
制御文字が先頭に来る場合,満たされないことがあるので,正しい挙動のように思う
- 間に制御文字が入る場合,alignmentが不連続になる
これもまあ正しい挙動のように思う.連続値が欲しいなら,補間すればよい