From f5980781ef1ce0cd06ffaa31ba632d2bbf15b952 Mon Sep 17 00:00:00 2001 From: Reuben Morais Date: Tue, 18 Apr 2017 08:15:53 -0700 Subject: [PATCH] Open STM files as UTF-8 --- util/stm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/stm.py b/util/stm.py index 55e77002..23383341 100644 --- a/util/stm.py +++ b/util/stm.py @@ -1,3 +1,4 @@ +import codecs import unicodedata class STMSegment(object): @@ -55,7 +56,7 @@ def parse_stm_file(stm_file): Parses an STM file at ``stm_file`` into a list of :class:`STMSegment`. """ stm_segments = [] - with open(stm_file) as stm_lines: + with codecs.open(stm_file, encoding="utf-8") as stm_lines: for stm_line in stm_lines: stmSegment = STMSegment(stm_line) if not "ignore_time_segment_in_scoring" == stmSegment.transcript: