Skip to content

Commit 1ae1883

Browse files
committed
Fix confidence file parsing errors
1 parent cc0db78 commit 1ae1883

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

heliport-model/src/languagemodel.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,12 @@ impl Model {
226226
parts.len()
227227
);
228228
}
229-
let lang = Lang::from_str(parts[0])
230-
.with_context(|| "Loading confidence file, lang '{parts[0]}' does not exist")?;
231-
let prob = f32::from_str(parts[1])
232-
.with_context(|| "Loading confidence file: could not parse float '{parts[1]}'")?;
229+
let lang = Lang::from_str(parts[0]).with_context(|| {
230+
format!("Loading confidence file, lang '{}' does not exist", parts[0])
231+
})?;
232+
let prob = f32::from_str(parts[1]).with_context(|| {
233+
format!("Loading confidence file: could not parse float '{}'", parts[1])
234+
})?;
233235

234236
loaded_langs.set(&lang, true);
235237
confidence.insert(lang, prob);

0 commit comments

Comments
 (0)