Improve BPE (#281)
* use list
* use priority queue
* some corrections
* thread safe use of RE2
* optimizations and cleanup
* wip
* fix segfault
* use shared_ptrs instead of raw pointers
* minor corrections
* fix comparing in PriorityQueue
* minor improvements