Re: Maths?
Michael
Damien,
toggle quoted messageShow quoted text
The material below is from the appendix to a calculus book for blind students I have written. Its position in the market place has not yet been decided. I hope it helps you. Appendix 2 How To Modify The Speech Dictionary In NVDA NVDA is a screen reading program produced by NV Access(R). It speaks the information about various parts of the active window in response to keystrokes pressed by the user. If the keystroke is not an NVDA command, NVDA merely echoes the keystroke. But, if it is an NVDA command keystroke such as NVDA-key + t, NVDA tells the user something about the active window. In the case of NVDA-Key + t, NVDA announces the title of the active window. NVDA commands take the form of the NVDA-key followed by a letter. The INSERT key is by default the NVDA-key. However, NVDA allows the user to change the NVDA-key to the CapsLock key if desired. The user can control how NVDA announces a string of characters. If the user wants NVDA to speak a particular string of characters a certain way, he or she can make an entry in its speech dictionary for that particular string of characters. After this entry is saved into the speech dictionary, whenever that particular string of characters is encountered, NVDA speaks it according to the entry just made in the speech dictionary. For example, NVDA ordinarily speaks the word tortilla with an "L" sound rather than a "y" sound. To force NVDA to pronounce it with the "y" sound, there must be an entry in the speech dictionary to instruct NVDA to speak the string of characters "torteeya" as desired. To make such an entry do the following. STEP 1: Put focus on the main NVDA menu with the keystroke NVDA-key + n. The user can arrow down through a list of submenus. Or, press the letter "p" to go to the preferences menu. The first menu under "Preferences" is 'General'. The user may arrow down the the Speech Dictionary or type 'd" and NVDA will jump into the default speech dictionary, There are three entries. They are respectively "Default", "voice", and "temporary". I suggest putting my changes into the default dictionary. But before entering the default dictionnary, a word about the other two choices is in order. The user can arrow once to the voice dictionary which is the dictionary belonging to the synthesizer currently running. For instance, if the Microsoft Speech Platform synthesizer is running, arrowing to the Voice Dictionary opens the dictionary whose entries govern the speech under that synthesizer. The entries in this dictionary apply to the Microsoft Speech Platform session and not to any other synthesizer that has been installed. Whatever synthesizer is running, the entries in the default speech dictionary apply. The tempory dictionary is like the voice dictionary, but it is erased when you exit the NVDA session. Entering the default dictionary. A list of entries will appear. The user may add a new entry or arrow down to an entry he or she wishes to change. To add a new entry Tab once. To change an entry, arrow down the the entry in question and tab twice. Or to remove the entry in question, tab three times. But the object of this appendix is to add entries in support of the calculus book. So, tab only once to add an entry. Focus will be on the "Add" button. Press the ENTER key to activate it. NVDA says "add a dictionary entry dialogue, pattern edit". Focus is now in an edit box. The string of characters to be entered here is the string of characters as they appear in the text, that is, the actual character string encountered by the reading cursor. As an example, type in the word tortilla. Press the TAB key ". again, and the focus will be in another edit box. NVDA will say "replacement pattern edit". The replacement string to be typed will force NVDA to pronounce the word tortilla with a 'y' sound rather than an 'l' sound. That pattern is "tortee ya". Tab again to put focus in a comment edit box. Tabbing again puts focus on a check box called "Case sensitive". Its default value is "not checked". To make the replacement happen only when tortilla is upper case (either its first letter or all of them), press the space bar to check it. Tabbing again puts focus on a combo box whose entries are respectively "anywhere, "forward", and "regular expression". The "anywhere" choice means that the pattern being replaced may appear either by itself or anywhere in a longer string of non-blank characters. The "forward" choice means that the pattern being replaced must appear at the very front of a longer string of characters. Of course, it may appear by itself and not part of a longer string of characters. If the "forward" choice is picked, and the pattern being replaced appears following one or more non-blank characters, NVDA will not speak using the replacement pattern. Regular expressions are required to address certain situations where more flexibility is needed, and they will be discussed later. For now, suffice it to say, that in the case of a regular expression, the pattern to be replaced and the replacement pattern will contain special characters that will cause a more suffisticated replacement to take place. Now, the user is ready to implement the changes specified below. However, since NVDA supports regular expressions, some of them will not be entered into the NVDA speech dictionary. The speech dictionary dialog may ask you if the Actual Pattern should be case sensitive. If you check "no", then any characters in the Actual Pattern string may be either upper or lower case. If however, you check "yes", then the characters in the Actual Pattern string must exactly match the case of the characters encountered in the text before the Replacement Pattern will be triggorred. The changes listed below do not need case sensitivity unless otherwise stated. SECTION0.1 Modifications For Chapter 1 Number Systems Chapter 1 discusses number systems which uses * for multiplication, / for division, + for addition, and - for subtraction. One change for chapter 1 is that for section headings, "SECTION". Actual Pattern="SECTION", Replacement Pattern="section" The other change is that Subscripts in this book are indicated by the suffix underscore plus an integer. An example is x_0 for x sub zero. Actual Pattern=_", Replacement Pattern="sub" Some readers may wish to hear x^2 read as x squared rather than x raised to exponent 2 and also x^3 read as x cubed. . If the reader is willing to treat these two cases as special cases, the preferred reading can be supported as follows. Use two carot symbols instead of one, and preceed the carots with a space. Without that space, the variable name may not be spoken clearly. For example, write x cubed as x ^^3. This will require the user to make the following changes to the speech dictionary. Add the following entry. Actual Pattern ^^2 and Replacement Pattern squared. The change for x cubed is similar. SECTION0.2 Modifications for Chapter 2 Functions Chapter 2 discusses functions of one and of two variables. I introduce notation for exponents, denominators, and absolute value. Below is a list of changes I propose to make to the speech dictionary for chapter 2. It would be nice if the characters "f(x)" is spoken as "f of x". But, we also want "g(t)" to be read as "g of t". IN other words, we want the function name to be any character upper or lower case and to have a subscript. We also want flexibility in the number of independent variables and also flexibility of variable names. Three regular expressions working together accomplish this goal. Regular expression recognizing the function name and opening parenthesis.: Actual Pattern: "([a-zA-Z])\(" Replacement Pattern: "\1 of open parenthesis " Regular expression recognizing all arguments which are followed by a comma: Actual Pattern: "*([a-zA-Z]?)(\_?\d*)([/\.]?\d*) *([-]|[+]?) *([a-zA-Z]?)(\_?\d*)([/\.]?\d*) *[\,]{1}" Replacement Pattern: "\1 \2 \3 \4 \5 \6 \7 , " Regular expression recognizing an argument not followed by a comma: Actual Pattern: "*([a-zA-Z]*)(\_?\d*)([/\.]?\d*) *([-]|[+]?) *([a-zA-Z]?)(\_?\d*)([/\.]?\d*) *\)" Replacement Pattern: "\1 \2 \3 \4 \5\6 \7 close parenthesis " H(x0) will be read as "h of x". The function name (f, g, h, or any other letter) does not matter. The following changes do not involve regular expressions. actualPattern=:R->R, Replacement Pattern= maps R into R Actual Pattern="+/-", Replacement Pattern="plus or minus" Actual Pattern="<=", Replacement Pattern="less than or equal to" Actual Pattern=">=", Replacement Pattern="greater than or equal to" ActualPattern=!, Replacement Pattern=factorial ActualPattern=_, Replacement Pattern=sub Actual Pattern="(/", Replacement Pattern="open parenthesis begin denominator" Actual Pattern="/)", Replacement Pattern="end of denominator close parenthesis" Actual Pattern="(^", Replacement Pattern="open parenthesis begin exponent" Actual Pattern="^)", Replacement Pattern="end of exponent close parenthesis" Actual Pattern="(|", Replacement Pattern="open parenthesis begin absolute value" Actual Pattern="|)", Replacement Pattern="end of absolute value close parenthesis" Actual Pattern="}/", Replacement Pattern="open brace begin denominator" Actual Pattern="/}", Replacement Pattern="end of denominator close brace" Actual Pattern="{^", Replacement Pattern="open brace begin exponent" Actual Pattern="^}", Replacement Pattern="end of exponent close brace" Actual Pattern="{|", Replacement Pattern="open brace begin absolute value" Actual Pattern="|}", Replacement Pattern="end of absolute value close brace" Actual Pattern="[/", Replacement Pattern="open bracket begin denominator" Actual Pattern="/]", Replacement Pattern="end of denominator close bracket" Actual Pattern="[^", Replacement Pattern="open bracket begin exponent" Actual Pattern="^]", Replacement Pattern="end of exponent close bracket" Actual Pattern="[|", Replacement Pattern="open bracket begin absolute value" Actual Pattern="|]", Replacement Pattern="end of absolute value close bracket" NOTE: In the text, I only use parentheses to specify begin and end of exponents, denominators, and absolute value. It is up to you whether to use braces and brackets as well. But, if you do decide to use braces and brackets n addition to parentheses, I strongly suggest that the Replacement Pattern mentions the brace or bracket . unless you do, the speech will not help you keep track of opening and closing braces and brackets. If documents you send to your professor do not have an equal number of opening and closing braces/brackets/parentheses, he or she will think you are confused and maybe lower your grade. SECTION0.3Modifications For Chapters 3, 4, and 5 The chapter on limits only needs two changes to the speech dictionary. No changes are needed for chapters 4 and 5. Actual Pattern="lim:", Replacement Pattern="limit as" Actual Pattern="->", Replacement Pattern="approaches" SECTION0.4Modifications For Chapters 6, 7, and 8 Regular expression for what variable a derivative is taken with respect to: Actual Pattern: "(\/)d([a-zA-Z])(\))" Replacement Pattern: "with respect to \2" Actual Pattern= (d0 Replacement Pattern="Open parenthesis ze rowth derivative" Actual Pattern="(d1" Replacement Pattern="Open parenthesis first derivative" Actual Pattern= "(d2" Replacement Pattern=" Open parenthesis second derivative" Actual Pattern= "(d3" Replacement Pattern="Open parenthesis third derivative" Ordinary derivative whose differentiation level is specified by an integer: Fourth derivative: Actual Pattern: "(d4" Replacement Pattern: "open parenthesis fourth derivative" Eighth derivative: Actual Pattern: "(d8" Replacement Pattern: "Open parenthesis eighthth derivative " The first, second, third, fourth, and eighth derivatives are entries that are not regular expressions. They are more understandable when not handled by a regular expression. However, the fifth, sixth, seventh, and ninth derivatives are all handled by a regular expression. Their replacement patterns are very understandable. Regular expression recognizing fifth, sixth, seventh, and ninth derivatives: Actual Pattern: "(\()d([5679])" Replacement Pattern: "open parenthesis \2 th derivative" Ordinary derivatives whose differentiation level is specified by an index variable: This regular expression comes into play in a future chapter, but it fits here. Actual Pattern: "(\()d([a-zA-Z])([-]|[+]?)([1-9]?)" Replacement Pattern: "open parenthesis \2 th \3 \4 derivative" SECTION0.5 Modifications For Chapter 9, Rieman Integration This chapter introduces notations for summation and for integrals. I leave it to the reader whether or not to make this group case sensitive. I mean demanding that the characters "int" should be upper case to prevent collisions in the text. Actual Pattern="INT:", Replacement Pattern="integral" Actual Pattern="INT:{", Replacement Pattern="integral lower bound" Actual Pattern="}{", Replacement Pattern="and upper bound" Actual Pattern="}:", Replacement Pattern="of the integrand" Actual Pattern="INT{}", Replacement Pattern="indefinite integral" Actual Pattern="INT{}:", Replacement Pattern="indefinite integral of the integrand" Actual Pattern="INT:{}", Replacement Pattern="integral" I found myself entering the above integral notations using brackets instead of braces, so I recommend including the following just to make the entering text more forgiving. Actual pattern="INT [", replacement pattern="integral lower bound" actual pattern ="][", replacement pattern ="and upper bound" actual pattern ="]:", replacement pattern ="of the integrand" actual pattern ="INT[]", replacement pattern ="indefinite integral" actual pattern ="INT[]:", replacement pattern ="indefinite integral of the integrand" Your professor might prefer the representation of an upper bound used in latex which is "\to". Actual Pattern="\to", Replacement Pattern="and upper bound" Actual Pattern="INTI:", Replacement Pattern="inner integral" Actual Pattern="INTM:", Replacement Pattern="middle integral" Actual Pattern="INTO:", Replacement Pattern="outer integral" SECTION0.6 Modifications for Chapter 12 Vectors actual pattern={||x+y||}, Replacement Pattern=open brace begin norm x+y end norm close brace Actual pattern=DET2, Replacement Pattern=second order determinant Actual pattern=DET3, Replacement Pattern=third order determinant Actual pattern=(.), Replacement Pattern=dot product Actual pattern=(*), Replacement Pattern=cross product SECTION0.7 Modifications For Chapter 13 Partial derivative whose differentiation level is specified by an integer: Fourth partial derivative: Actual Pattern: "(pd4" Replacement Pattern: "open parenthesis fourth partial derivative" Eighth partial derivative: Actual Pattern: "(pd8" Replacement Pattern: "open parenthesis eighth partial derivative" Regular expression recognizing fifth, sixth, seventh, and ninth partial derivatives: Actual Pattern: "(\()pd([5679] )" Replacement Pattern: "open parenthesis \2 th partial derivative Partial derivative whose differentation level is specified by an index variable: Actual Pattern: "(\()pd([a-zA-Z])([-]|[+]?)([1-9]?)" Replacement Pattern: open parenthesis \2 th \3 \4 partial derivative SECTION0.8 Modifications For Chapters 14, 15, 16, and 17 actualWord=:R->Rn Replacement Pattern=maps R into R n actualWord=:R2->R2 Replacement Pattern=maps R2 into R2 actualWord=:R3->R3 Replacement Pattern=maps R3 into R3 actualWord=:Rn->Rn Replacement Pattern=maps R n into R n actualWord=:R2->R Replacement Pattern=maps R2 into R actualWord=:R3->R Replacement Pattern=maps R3 into R actualWord=:RN->R Replacement Pattern=maps RN into R This group is case sensitive. Actual Pattern="DINT::", Replacement Pattern="double integral" Actual Pattern="LINT::", Replacement Pattern="line integral over curve" Actual Pattern="SINT::", Replacement Pattern="surface integral" Actual Pattern="TINT::", Replacement Pattern="triple integral" There is a set of notations for derivatives for which I made no entries into the speech dictionary. It is not uncommon to represent a derivative by following the function name with an apostrophe. For example, f'(x) represents the first derivative of f(x). Likewise, f''(x) is the second derivative of f(x). You may occasionally encounter three apostrophes for third derivative such as for example f'''(x). However, it is unlikely that the student will ever see more than three apostrophes for differentiation. In fact, the use of apostrophe for differentiation is more prevalent in differential equations books than in a calculus text. So, if the student hears y' or y'', he or she should understand that differentiation is being represented. Just get used to it. Testing regular expressions involving carrot and parenthesis exposed a problem in two of the seven synthesizers I exercised. Those two are Microsoft Speech Platform and Microsoft SAPI5. The other five synthesizers passed the test. I tested regular expressions for beginning and ending exponential expressions. My syntax for these exponential expressions is that the expressions are bracketed between (^ and ^). Regular expression to recognize beginning of exponential expression: Actual Pattern: [\(][\^] Replacement Pattern: Begin exponent Regular expression to recognize end of exponential expression: Actual Pattern: [\^][\)] Replacement Pattern: end of exponent The regular expression for the end of an exponential expression fails to recognize the end. The regular expression for the beginning exponential expression works as expected. The two regular expressions are very similar. Why does one work and not the other? Here are some test cases: (^ ^) (^w+3^) I then wrote a regular expression to recognize the pair "()", and NVDA sees the closing parenthesis but not the opening one. Puzzling! The following synthesizers execute these regular expressions correctly. Eloquence, ESpeak NG, Soft Voice, Speech Player ESpeak, SVox Pico Synthesizer, The following synthesizers did not execute these regular expressions correctly. Microsoft Speech API Version 5, Microsoft Speech Platform For these last two synthesizers, I input the regular expressions into their Voice Dictionaries. (^ w + 3^) Begin exponent is recognized but not the end of exponent. This is not a fix but what I did to expose the problem. NOTE: The number of spaces specified in the replacement patterns for regular expressions should not be ignored. Some parts of the replacement string may be spoken so quickly, that you, the listener, may hear them as a nonintelligible blip. C Michael R. Cross
-----Original Message-----
|
|