runtime optimizations for reorder_src_sents.py, fix encoding problems in extract_features.py