tsengwoody / Access8Math

Allows access math content written by MathML ; Assist writing math content by LaTeX
GNU General Public License v2.0
32 stars 15 forks source link

Any fraction with numerator 1 will cause Access8Math in trouble in language zh-TW or zh-CN. #84

Closed hjy1210 closed 1 year ago

hjy1210 commented 1 year ago

Please browse to following page and let NVDA+Access8Math read out.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
  <title>fraction</title>
</head>
<body>
<p>Any fraction with numerator 1 cause Access8Math in trouble in language zh-TW or zh-CN.
For example, 
<math><mfrac><mn>1</mn><mn>5</mn></mfrac></math>
will be read wrong.</p>
</body>
</html>
tsengwoody commented 1 year ago

This is an issue with the Microsoft Speech Synthesizer. Using a different Speech Synthesizer does not have this problem. If you cannot change the Microsoft Speech Synthesizer, a workaround solution is to add a new entry in the Access8Math Speech Unicode Dictionary. Here are the steps:

  1. NVDA Menu -> Tools -> Access8Math -> Localization -> Speech Unicode Dictionary
  2. Click the Add button.
  3. In the Symbol field, enter "1" and click OK.
  4. Locate the newly added entry for "1," and in the Replacement field, enter "衣".
  5. Click OK to save.
hjy1210 commented 1 year ago

@tsengwoody, Yes, using a different Speech Synthesizer DO solve the problem. Thanks.

hjy1210 commented 1 year ago

Yes, this issue is Speech Synthesizer related.

But after navigate into the details of fraction, it is correct with the same "Windows OneCore voices + Microsoft Hanhan" Speech Synthesizer.

So, is it possible to solve this issue purely in Access8Math side?

tsengwoody commented 1 year ago

Let me provide a more detailed explanation of the situation in which this issue occurs. The problematic speech sequence is as follows: ['分之', BreakCommand(time=100), '1'] PS: The BreakCommand is an NVDA speech control command that introduces a pause in the speech. I have test and known that this issue can be resolved by avoiding this specific pattern. For example: ['分枝', BreakCommand(time=100), '1'] ['分枝', BreakCommand(time=100), '衣'] So, This issue can be to resolve this by modifying the "default" data of Access8Math and let Access8Math avoid to generate ['分之', BreakCommand(time=100), '1'] speech sequence. However, this approach results in a speech sequence that deviates from the original text, making it more of a workaround. I think it's not suitable to deliberately modify "default" data of Access8Math to address this issue. That's why I initially suggested that users should resolve this issue by adding new entries to the Access8Math Unicode dictionary(or modify math rule).

hjy1210 commented 1 year ago

You mean replace ['分之', BreakCommand(time=100), '1'] with ['分枝', BreakCommand(time=100), '1'] can resolve the issue.

But replace '分之' with '分枝' is not appropriate for meaning.

How about replace "BreakCommand(time=100)" with "BreakCommand(time=50)" if it works?

tsengwoody commented 1 year ago

I tried replacing the time of BreakCommand (10, 20, ... 110), but it still doesn't work correctly. It appears that the issue arises when there is a BreakCommand between "分之" and "1". PS: The time for BreakCommand can be changed from "Tools -> Access8Math -> Settings -> Reading: Item interval time." The base value is 10, and you can add values using the select option, allowing you to set it between 10 and 110 (ms).