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

Various improvements to emphasis handling #1006

Merged
merged 25 commits into from
Nov 30, 2020
Merged

Various improvements to emphasis handling #1006

merged 25 commits into from
Nov 30, 2020

Conversation

bertfrees
Copy link
Member

@bertfrees bertfrees commented Oct 16, 2020

This contains quite a lot. Best look at the commit logs to see what exactly. In short, I added a new opcode called noemphchars, improved the code readability, and harmonized the behavior of caps vs. emph on the one hand and begemph/endemph mode vs. begendword etc. on the other hand.

Fixes the following issues:

Only thing missing is a little update to the documentation.

Travis status doesn't show up anymore apparently but tests pass on Travis.

@bertfrees bertfrees added enhancement An enhancement in the functionality (not a bug fix or a table improvement) needs news Update to NEWS file needed needs doc This change in functionality needs an update in the user manual labels Oct 16, 2020
@bertfrees bertfrees added this to the 3.16 milestone Oct 16, 2020
@bertfrees bertfrees requested a review from egli October 16, 2020 20:14
@bertfrees
Copy link
Member Author

@josteinaj I changed some tests for Norwegian (not the table). Would you mind having a look at https://github.com/liblouis/liblouis/pull/1006/files#diff-531a3730363a4ab7232b5933f0e0a94668637586bdf712cd740307062cdc704f?

@bertfrees
Copy link
Member Author

@garconvacher I also did a small change to the French table: see commit b4604c1. Could you verify please?

@bertfrees
Copy link
Member Author

@dkager Some Dutch tests were fixed but one was broken. To me the new result makes sense. What do you think?

- - Zie refertes D-NE004W, D-NB007B en D-NB007BDK.
- ⠨⠵⠊⠑ ⠗⠑⠋⠑⠗⠞⠑⠎ ⠨⠙⠤⠘⠝⠑⠼⠚⠚⠙⠨⠺⠂ ⠨⠙⠤⠘⠝⠃⠼⠚⠚⠛⠨⠃ ⠑⠝ ⠨⠙⠤⠘⠝⠃⠼⠚⠚⠛⠘⠃⠙⠅⠲
- xfail: "'D-NE004W, D-NB007B' is now seen as 6 words (so that phrase indication is used): 'D', 'NE', 'W', 'D', 'NB' and 'B'"

@bertfrees
Copy link
Member Author

@torchtrust I found a strange test that was added by you in 2015:

- [Ææ, ⠠⠁⠠⠘⠖⠑⠁⠘⠖⠑]

The dots 6-1-6 at the beginning, is that correct?

@josteinaj
Copy link
Contributor

@bertfrees By just skimming through the changes in no_typeform_harness.yaml I think it looks good, but I'll check with Kari to be sure.

@garconvacher
Copy link
Contributor

@garconvacher I also did a small change to the French table: see commit b4604c1. Could you verify please?

@bertfrees, I can't do tests at the moment but it's match the french braille code.

@bertfrees
Copy link
Member Author

@dkager What do you think about the "Zie refertes D-NE004W, D-NB007B en D-NB007BDK." test? "D-NE004W, D-NB007B" is now seen as 6 words (so that phrase indication is used): "D", "NE", "W", "D", "NB" and "B".

@bertfrees
Copy link
Member Author

@egli Please review. It's a really big improvement, if I may say so myself.

Copy link
Member

@egli egli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good change. Afaikt you are replacing the binary way of handling emphasis with a more flexible system.
I didn't really check if all the index bounds are kept in all corner cases.
But all in all looks very good
I think we should have some doc though

tables/nl-g0.uti Show resolved Hide resolved
tests/braille-specs/no_typeform_harness.yaml Show resolved Hide resolved
liblouis/lou_translateString.c Show resolved Hide resolved
liblouis/lou_translateString.c Show resolved Hide resolved
liblouis/lou_translateString.c Show resolved Hide resolved
liblouis/lou_translateString.c Show resolved Hide resolved
liblouis/lou_translateString.c Show resolved Hide resolved
@bertfrees
Copy link
Member Author

bertfrees commented Nov 2, 2020

Afaikt you are replacing the binary way of handling emphasis with a more flexible system.

Not sure what you mean by binary, but there is still a strict distinction between what we call "permanent" indication on the one hand, and word/phrase level indication on the other hand. Very little has changed for permanent indication.

I think we should have some doc though

Yes, I have to add some. But note that apart from the no noemphmodechars there is not all that much that changed.

@dkager
Copy link
Contributor

dkager commented Nov 5, 2020 via email

@josteinaj
Copy link
Contributor

@bertfrees: Kari approves: snaekobbi#10 (comment)

@bertfrees bertfrees self-assigned this Nov 16, 2020
@bertfrees bertfrees force-pushed the various-emphasis branch 2 times, most recently from 100f5b8 to 7d6860d Compare November 20, 2020 19:07
@bertfrees
Copy link
Member Author

bertfrees commented Nov 20, 2020

I've sent Dorine a message on Monday. I think whatever the outcome, I'm going to merge this PR because I think overall the Dutch table is definitely improved. Several issues where fixed, only this one border case is possibly (not certainly) a regression.

@dkager
Copy link
Contributor

dkager commented Nov 23, 2020 via email

@bertfrees bertfrees removed the needs doc This change in functionality needs an update in the user manual label Nov 24, 2020
@bertfrees
Copy link
Member Author

bertfrees commented Nov 24, 2020

@egli I have updated the doc. Can you quickly check again?

bertfrees and others added 23 commits November 28, 2020 20:25
- behavior of begemph/endemph w.r.t. spaces (related to
  #1002)
- order of opening and closing indicators (related to
  #922)
Related to issue #998: Issues with emphasis in German when quotation
mark or full-stop precedes/follows.

see #998
In Dutch, every word part in a capitalised compound word counts in the length of a passage.

see #779
so remove begcaps. Also, endcaps is automatically used as
endcapsphrase (after), but rename it anyway.
Added a new resolveEmphasisBeginEnd function that is used by both
capitalization and emphasis.

This is mostly refactoring, but there is also a small behavioral
change, namely:

- An emphasized section indicated with begemph/endemph will not start
  or end with a space.

The idea is to make capitalization and emphasis handling more and more
alike in the future.
…ation

For begemphphrase it is only enabled when emphmodechars is declared.
…sis handling

This changes the behavior a very little bit for tables that do not
declare capsmodechars or emphmodechars, and a bit more substantially
for tables that do. Tables and tests have been updated accordingly.

The code has also been restructured in a way that makes it easier to
see how "caps" differs from "emph" and how the various character
attributes and the capsmodechars, emphmodechars and noemphchars rules
affect the behavior. Extracting out this logic into a few simple
functions made both that logic and the rest of the code easier to
follow.

See #905
This further harmonizes the behavior and further simplifies the code.

The new noemphchars can be used to achieve the old behavior.

Related to #1002.
- use opcoderef only when it makes sense. Where they are used with a
  redundant "opocde" remove that.
- try to move the references out of sentences, so it is easier to read
- try to group references
There is a macro to generate the text "foo opcode" with a reference.
Quite often though you want to have a reference to an opcode without
the preceding "foo opcode" text. For that there are two new macros
`opref` and `pxopref`. They are just like `ref` and `pxref` but they
make sure the reference is correct (by making it "foo opcode") and
they render the opcode inside a code
@egli egli removed the needs news Update to NEWS file needed label Nov 30, 2020
@egli egli merged commit 3bf2b1c into master Nov 30, 2020
@egli egli deleted the various-emphasis branch November 30, 2020 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement in the functionality (not a bug fix or a table improvement)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants