Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a different cost function to select the best paragraph #23

Closed
gucci-on-fleek opened this issue Mar 7, 2022 · 0 comments
Closed
Assignees
Labels
Generic/All Formats Affects all formats Internal/Refactor Changes the internal functioning of lwc
Milestone

Comments

@gucci-on-fleek
Copy link
Owner

Right now, lua-widow-control selects the paragraph with the fewest absolute demerits. However, a paragraph's demerits is the sum of the demerits for each line, so a longer paragraph will almost always have more demerits, even if it has a lower badness.

Choices

cost = demerits

This is what we have right now. This probably isn't a great choice, for the reasons discussed above.

cost = demerits / prevgraf

This is a decent option. It tries to minimize the average demerits for each line.

cost = sqrt(demerits) / prevgraf

This tries to minimize the badness for each line.

cost = demerits / sqrt(prevgraf)

This tries to minimize the average demerits, while slightly penalizing longer paragraphs. This makes sense, since given two paragraphs with equal average demerits per line, you should prefer the shorter one since it will give fewer overall "bad" lines.

@gucci-on-fleek gucci-on-fleek added Internal/Refactor Changes the internal functioning of lwc Generic/All Formats Affects all formats labels Mar 7, 2022
@gucci-on-fleek gucci-on-fleek added this to the v2.0.0 milestone Mar 7, 2022
@gucci-on-fleek gucci-on-fleek self-assigned this Mar 7, 2022
gucci-on-fleek added a commit that referenced this issue Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Generic/All Formats Affects all formats Internal/Refactor Changes the internal functioning of lwc
Projects
Status: Done
Development

No branches or pull requests

1 participant