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
Speak all symbols when moving by words (#11779) #11856
Speak all symbols when moving by words (#11779) #11856
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works as expected.
Sorry to comment a bit late on this topic.
As an alternative, has it been considered to force symbol pronunciation only when they appear at the start of end of the word? Let's imagine the formatted word is retrieved as follows:
Taking the word "didn't." as an example we would split it as follows:
I would then suggest to ignore char pronunciation level for symbols in part 1. and 5., but not in part 3. I know that finding a compromise on this topic is not easy. And maybe all this has already been discussed. In this case, feel free to ignore this comment and proposal. |
I think the concern around apostrophe in the middle of words when navigating by word with this pr is valid, but at the same time I don't think it is anywhere near as bad as not saying anything at all / providing an unpredictable experience. My vote would be to take this pr, but perhaps a little more discussion should be had first. |
@CyrilleB79, I also agree your concerns are valid. |
Couldn't we make this optional? So after the punctuation/symbol level combo box, add a checkbox "Always speak all symbols when navigating by word" |
I wholeheartedly agree with @CyrilleB79 's comment. Making this configurable would not solve the problem he outlined IMHO and announcing symbols only at the beginnings/ends of words seems doable though certainly not as easy as what this PR implements. |
Does this fix also #10855? If yes, then that issue should be contained in this description of the PR to make sure it will be closed once this is merged. |
@Adriani90 wrote:
Good catch. Thanks! |
My vote is to speak words with symbol level of all by default, but allow the user to turn this off with an option if they must. This then means that by default, no symbols are missed, and the rule is totally predictable. With it off, the user gets the current behaviour. I think that trying to come up with rules about speaking specific symbols at the start or end of a word will then produce functionality which is confusing and more likely to break. |
I support this solution that allows to merge this PR quickly. In a second time, another PR could be suggested after testing this one to add a third option allowing to speak punctations only at the start and ends of words. For the current PR, I would advocate to add an unbounded gesture to be able to change quickly this verbosity option. |
Alternative implementation@michaelDCurran wrote:
I agree. This would also not fully fit the "proof-read" use case, which IMHO should take priority over the "re-read" one. Configurability@michaelDCurran wrote:
@LeonarddeR wrote:
Do you all agree with adding a new regular setting in the Speech category? Or would you prefer an experimental one in the Advanced category for less intrusive removal if we come up with a better approach? @CyrilleB79 wrote:
This would IMHO orient towards a regular setting in the Speech category. What do you think? |
I agree to put this option in the speech category. |
* New configuration setting: Speech > Speak all punctuations and symbols when reviewing by word `config.conf["speech"]["symbolLevelWord"]` * New constant: characterProcessing.SYMLVL_UNCHANGED = -1
2614f46
Added configurability and unassigned global command. |
Also I have had a look at the code and have noted the following comments:
Is all this coded the way you did in order to support more symbol levels in the future? |
@CyrilleB79 wrote:
The checkbox implements the high-level on/off toggling from the UI.
Actually, the implementation of the new behavior really boils down to "Use another symbol level when reviewing by word"
I indeed had your #11856 (comment) in mind when not limiting support for evolution. |
hi @JulienCochuyt |
Sorry for participating in an irrelevant way. There is another similar problem (#12556). Different speech behavior for each language precludes me from understanding whether this pr covers it. |
You can test if this fixes your problem by running a copy of this build. Happy to reopen your issue if it is not a duplicate, and has a separate cause. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks ready to go. I'll leave it up to you about what to do with the test.
tests/system/robot/notepadTests.py
Outdated
for expectedWord in wordsWithSymbols: | ||
wordSpoken = _notepad.getSpeechAfterKey("numpad6") | ||
for symbol in symbolMap.keys(): | ||
if isSymbolLevelWordAllExpected: | ||
expectedWord = expectedWord.replace(symbol, f" {symbolMap[symbol]}{symbol}") | ||
# unlike other symbols used, symbols.dic doesn't preserve quote symbols with SYMPRES_ALWAYS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic in tests smells, being pragmatic it may not easily be avoidable. The problems it introduces are:
- higher possibility of a bug in the test itself.
- the test is harder to read, it doesn't serve as documentation for the expected behavior as well.
Parameterized tests are useful, but mostly when there is a lot of data to get through. Say every combination of a number of parameters. If it's a small number of combinations personally I think explicit is better.
You could instead have something like:
wordsToExpectedSymbolSpeech = {
'Say':'Say',
'(quietly)': 'left paren quietly right paren',
'"Hello,': 'quote Hello comma',
'Jim".': 'Jim dot quote',
}
def test_symbolLevelWord_symbolLevelWord:
textStr = ' '.join(wordsToExpectedSymbolSpeech.keys())
_notepad.prepareNotepad(f"Test: {textStr}")
for expectedWord in wordsToExpectedSymbolSpeech.values():
wordSpoken = _notepad.getSpeechAfterKey("numpad6") # navigate to next word
# unlike other symbols used, symbols.dic doesn't preserve quote symbols with SYMPRES_ALWAYS
expectedWord = expectedWord.replace('"', ' ').strip()
_asserts.strings_match(wordSpoken, expectedWord)
wordsToExpectedSymbolSpeech = {
'Say':'Say',
'(quietly)': 'quietly',
'"Hello,': 'Hello',
'Jim".': 'Jim',
}
def test_symbolLevelWord_symbolLevelSome: # todo: is 'some' the correct level?
textStr = ' '.join(wordsToExpectedSymbolSpeech.keys())
_notepad.prepareNotepad(f"Test: {textStr}")
for expectedWord in wordsToExpectedSymbolSpeech.values():
wordSpoken = _notepad.getSpeechAfterKey("numpad6") # navigate to next word
# unlike other symbols used, symbols.dic doesn't preserve quote symbols with SYMPRES_ALWAYS
expectedWord = expectedWord.replace('"', ' ').strip()
_asserts.strings_match(wordSpoken, expectedWord)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer that approach too, I've updated the tests to follow this pattern, but I have made some changes to simplify it further, if you want to take another look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Fixes #12653 # Summary: PR #11856 introduced speaking symbols when navigating by word. The changes produced an unintended side effect of double processing symbols. The text replacement for symbols gets spoken at symbol level all. # Description of fix: There isn't enough time before release to be confident in a fix for this behavior, instead the feature is reverted. Reverting is in commit 619e5f7 Some changes have been kept: - Symbol level enum: used in other aspects of the code and isn't a cause of this issue - System test for notepad: Useful to confirm behavior for reading by word is not changed when this feature is re-introduced. # Testing strategy: Notepad system test Generated and checked output of changes doc and userGuide Ran NVDA with symbolLevelWordAll = True remaining in config (a problem here would only affect alpha users anyway).
This reverts commit 619e5f7.
This reverts commit 619e5f7.
This reverts commit 619e5f7. Additionally re-enable and update tests so expectation matches behaviour.
This reverts commit 619e5f7. Additionally re-enable and update tests so expectation matches behaviour.
This reverts commit 619e5f7. Additionally re-enable and update tests so expectation matches behaviour.
See nvaccess/nvda#12510, nvaccess/nvda#11856 and nvaccess/nvda#12636 According to the NVDA change log: > - `characterProcessing.SYMLVL_*` constants should be replaced using their equivalent `SymbolLevel.*` before 2022.1. > - controlTypes has been split up into various submodules, symbols marked for deprecation must be replaced before 2022.1.
Removes code deprecated as part of PR #11856 Summary of the issue: PR #11856 converted module level constants for symbol levels in characterProcessing into an enum. The constants were marked for removal in 2022.1. Description of how this pull request fixes the issue: These constants are removed. Testing strategy: With git grep made sure that the removed symbol levels are not used in the source code.
This reverts commit 619e5f7. Additionally re-enable and update tests so expectation matches behaviour.
Link to issue number:
Fixes #11779
Fixes #10855
Summary of the issue:
Navigation by word is inconsistent among different editors.
This might lead to different symbol announcements, or opening and closing symbols not announced consistently.
Description of how this pull request fixes the issue:
Default: All
characterProcessing
:SYMLVL_UNCHANGED
= -1Testing performed:
Played with #11779 STR in different editors.
System tests have been added to test the STR with notepad.
Known issues with pull request:
This effectively reverts PR #11167.
The reverted portion of the code would benefit from extra clean-up, as I guess there is no need to test for UNIT_WORD there anymore.
Change log entry:
Changes:
For developers:
characterProcessing.SYMLVL_*
constants should be replaced using their equivalentSYMLVL.*
before 2022.1. (Speak all symbols when moving by words (#11779) #11856)Code Review Checklist: