mirror of
https://github.com/browsermt/bergamot-translator.git
synced 2024-09-11 05:35:33 +03:00
Use right range and threshold for showing "bad" words/sentences (#370)
* Use ln(0.5) as the threshold * Use right range for showing "bad" words/sentences
This commit is contained in:
parent
1360941ab9
commit
89a96bf71e
@ -59,13 +59,13 @@ const addQualityClasses = (root) => {
|
||||
// You can do this wit CSS variables, calc() and min/max, but JS is just easier
|
||||
|
||||
root.querySelectorAll('[x-bergamot-sentence-score]').forEach(el => {
|
||||
// Note: these thresholds are just examples, they are not good thresholds!
|
||||
el.classList.toggle('bad', parseFloat(el.getAttribute('x-bergamot-sentence-score')) > -0.1);
|
||||
// The threshold is ln(0.5) (https://github.com/browsermt/bergamot-translator/pull/370#issuecomment-1058123399)
|
||||
el.classList.toggle('bad', parseFloat(el.getAttribute('x-bergamot-sentence-score')) < -0.6931);
|
||||
});
|
||||
|
||||
root.querySelectorAll('[x-bergamot-word-score]').forEach(el => {
|
||||
// Note: these thresholds are just examples, they are not good thresholds!
|
||||
el.classList.toggle('bad', parseFloat(el.getAttribute('x-bergamot-word-score')) > -0.1);
|
||||
// The threshold is ln(0.5) (https://github.com/browsermt/bergamot-translator/pull/370#issuecomment-1058123399)
|
||||
el.classList.toggle('bad', parseFloat(el.getAttribute('x-bergamot-word-score')) < -0.6931);
|
||||
});
|
||||
|
||||
// Add tooltips to each (sub)word with sentence and word score.
|
||||
|
Loading…
Reference in New Issue
Block a user