Skip to content

Commit

Permalink
Major updates in speech and Jaws scripts
Browse files Browse the repository at this point in the history
The following modifications in the English speechfiles and jaws files are not placed in the original files till Alastair revise them. So my Jaws scripts are put under "modified by Istvan" folder.

Here comes my changelog:
Improved support for Hungarian speech.
Added implementation for the following in both English and Hun:
processing of roots including nth and special ones like square, cube. 
Sum, including limits 
production, including limits 

set operations: 
union, including limits 
intersection, including limits, eg.g 
\cap_{1}^{n} a_i =P 
The above operation commands were removed from the speech.table as their implementation is made in "speech.py". 

Added support for the following: 
1. Double, triple integrals and loop integrals. 
2. A new command of fractions, namely the "\ds" . For example: \ds{a\over b 

3. Binomials with two commands: \binom{a}{b} and "a \choose b" 

4. vector command in two ways: 
\vec{x} and \vec{x +2} 

5. \ln command
Added a "correct" function in speech.py to let speech sinthesizers say correctly the double letter variaables like "xx", "yy", "dydx", ecc. I use this function in most functions e. g. superscript, sqrt, and integrals.

Changed behaviour for superscript text. Now Jaws reads the superscripted data with the superscript voice without telling "begin super" and "end super",
making the reading more convenient. 
In the jaws scripts, the <sup> and </sup> tags are treated as superscript texts, which is done in speech.py, similar to the way the italic text is implemented.
Of course I modified the super function and didn't use a sinple touple.

Improved support for bold, italic texts by adding new commands for them in the same way as they were implemented originally. 

Jaws scripts improvements:
Modified the voice alias for \mathcal command from italic to double strikeout voice.
Added support for superscript text, and assigned superscript voice fo this.
Added a message when pressing the re-initialisation keystroke in both speech and braille.
  • Loading branch information
ivelegi committed Oct 28, 2014
1 parent 6c99e20 commit b7842c1
Show file tree
Hide file tree
Showing 14 changed files with 1,874 additions and 245 deletions.
7 changes: 7 additions & 0 deletions jaws/modified_by_istvan/latex.JCF
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Braille]
Grade2Translation=0
BrailleMoveActiveCursor=1
BrailleTranslationType=1
ContractedBrailleInput=0
[Options]
Scheme=latex
258 changes: 258 additions & 0 deletions jaws/modified_by_istvan/latex.JSS
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
; latex.jss
; A part of the latex-access project at http://latex-access.sourceforge.net/
; Author: Alastair Irving <alastair.irving@sjc.ox.ac.uk>
; Modified by: István Velegi <ivelegi@gmail.com>
; Copyright (C) 2011 Alastair Irving/latex-access Contributors
;
; This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation;
; either version 2 of the License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
; See the GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License along with this program; if not, visit <http://www.gnu.org/licenses>
;


; Documentation by: Jose Tamayo( jtblas@hotmail.com)
;
; history of changes
;
; Needs:
; 1. JSM file for messages
; 2. proper variable naming
; 3. intro for functions.
; 4. Hungarian notation
; 5. Move all literals and messages to the latex.jsm file.


include "hjconst.jsh"

include "latex.jsm"

globals int initialised,
int ProcessMaths,
object latex_access,
object matrix,
int row,
int column

Void Function AutoStartEvent ()
if !initialised then
let latex_access=CreateObject (o_latexAccess)
let initialised=true
endif
EndFunction


Script reInitialise ()
let latex_access=CreateObject (o_latexAccess)
sayMessage(1, msgReInit_s);
EndScript


Void Function SayLine ()
if ProcessMaths then
var string input
let input = GetLine ()

if StringIsBlank(input) then
let input = "blank"
else
let input = latex_access.speech(input)
let input = StringReplaceSubstrings (input, "&", "&amp;")
let input = StringReplaceSubstrings (input, "<sub>", smmGetStartMarkupForAttributes (attrib_subscript|attrib_text))
let input = StringReplaceSubstrings (input, "</sub>", smmGetEndMarkupForAttributes (attrib_subscript|attrib_text))
let input = StringReplaceSubstrings (input, "<sup>", smmGetStartMarkupForAttributes (attrib_superscript|attrib_text))
let input = StringReplaceSubstrings (input, "</sup>", smmGetEndMarkupForAttributes (attrib_superscript|attrib_text))
let input = StringReplaceSubstrings (input, "<bold>", smmGetStartMarkupForAttributes (attrib_bold|attrib_text))
let input = StringReplaceSubstrings (input, "</bold>", smmGetEndMarkupForAttributes (attrib_bold|attrib_text))
let input=StringReplaceSubstrings (input, "<mathcal>", smmGetStartMarkupForAttributes (attrib_double_strikeout|attrib_text))
let input=StringReplaceSubstrings (input, "</mathcal>", smmGetEndMarkupForAttributes (attrib_double_strikeout|attrib_text))
endif
Say (input, ot_selected_item, true)
else
SayLine ()
endif
EndFunction

Script ToggleMaths ()
if ProcessMaths then
let ProcessMaths = false
SayMessage (ot_status, msgProcessingOff_L, msgProcessingOff_S)
else
let ProcessMaths = true
SayMessage(OT_STATUS,msgProcessingOn_L,msgProcessingOn_S)
endif

EndScript

Script ToggleDollarsBraille ()
var int result
let result=latex_access.toggle_dollars_nemeth()
if result==-1 then
SayMessage (ot_status, msgBrailleDollarsOff_L, msgBrailleDollarsOff_S)
else
SayMessage (ot_status, msgBrailleDollarsOn_L, msgBrailleDollarsOn_S)
endif
EndScript

Script ToggleDollarsSpeech ()
var int result
let result=latex_access.toggle_dollars_speech()
if result==-1 then
SayMessage (ot_status, msgSpeechDollarsOff_L, msgSpeechDollarsOff_S)
else
SayMessage (ot_status, msgSpeechDollarsOn_L, msgSpeechDollarsOn_S)
endif
EndScript

Int Function BrailleBuildLine ()
if ProcessMaths then
var string input
let input = GetLine()
let input = StringReplaceSubstrings (input, sScrollDownSymbols , "")
let input=StringTrimTrailingBlanks (input)
let input = latex_access.nemeth(input)
; now sort out bad dots 456
let input =StringReplaceSubstrings (input, "_", "\127")
BrailleAddString (input, 0, 0, 0)

endif
return true
EndFunction

Script InputMatrix ()
let matrix=CreateObject (o_latex_access_matrix)
let row=1
let column=1
matrix.tex_init(GetSelectedText ())
; JT: Replace the msg var with a message variable in the latex.jsm file
var string msg
let msg ="Initialised "
let msg=msg+inttostring(matrix.rows)
let msg=msg+sPadBy
let msg=msg+inttostring(matrix.columns)
let msg=msg +sPadMatrix
SayString(msg)
EndScript

Script HotKeyHelp ()
; check the virtual buffer and close it if active.
If UserBufferIsActive () Then
UserBufferDeactivate ()
EndIf
; Display the help text when the user presses JAWSKey+H
SayFormattedMessage(OT_USER_BUFFER, msgHotKeyHelp)
AddHotKeyLinks ()
EndScript

Script MatrixRight ()
if column < matrix.columns then
let column = column+1
saystring(matrix.get_cell(row,column))
else
saystring(sEndRow)
endif
EndScript

Script MatrixLeft ()
if column > 1 then
let column = column - 1
saystring(matrix.get_cell(row,column))
else
saystring(sStartRow)
endif
EndScript

Script MatrixDown ()
if row < matrix.rows then
let row = row+1
saystring(matrix.get_cell(row,column))
else
saystring(sEndColumn)
endif
EndScript

Script MatrixUp ()
if row > 1 then
let row = row - 1
saystring(matrix.get_cell(row,column))
else
SayString(sStartColumn)
endif
EndScript

; JT: This variable named i must be changed
Script SayRow (int i)
if i>0 && i <= matrix.rows then
saystring(matrix.get_row(i," "))
else
saystring(sInvalidRow)
endif
EndScript
; JT: Find out what i is for and replace if needed.
Script SayColumn (int i)
if i>0 && i <=matrix.columns then
saystring(matrix.get_col(i," "))
else
saystring(sInvalidColumn)
endif
EndScript

Script preprocessorAdd ()
var string input, int args, string strargs, string translation
if InputBox (sCommandToRedefine, "Initial LaTeX", input) then
if InputBox (sEnterCommandArguments, "Number of arguments", strargs) then
if InputBox (sEnterCustomCommandDef, "Translation", translation) then
let args=StringToInt (strargs)
latex_access.preprocessor_add(input,args,translation)
endif
endif
endif
EndScript


Script PreprocessorFromString ()
latex_access.preprocessor_from_string(GetSelectedText ())


EndScript



Script PreprocessorWrite ()
var string filename
if InputBox (sEnterFileToSaveTo , "Filename", filename) then
if FileExists (filename) then
var int result
let result=ExMessageBox (sFileExistError , sFileExistTitle , MB_YESNO)
if result==IDNO then
return
endif
endif
latex_access.preprocessor_write(filename)
endif
EndScript


Script PreprocessorRead ()
var string filename
; JT: another literal to move to the latex.jsm file.
if InputBox ("enter full filename to read from ", "Filename", filename) then
if FileExists (filename) then
latex_access.preprocessor_read(filename)
else
MessageBox (sFileNoExist )
endif
endif
EndScript








Empty file.
33 changes: 33 additions & 0 deletions jaws/modified_by_istvan/latex.jkm
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[Common Keys]
Control+M=ToggleMaths
Control+Shift+M=InputMatrix
Control+Shift+L=MatrixRight
Control+Shift+J=MatrixLeft
Control+Shift+K=MatrixDown
Control+Shift+I=MatrixUp
Control+Shift+1=SayRow(1)
Control+Shift+2=SayRow(2)
Control+Shift+3=SayRow(3)
Control+Shift+4=SayRow(4)
Control+Shift+5=SayRow(5)
Control+Shift+6=SayRow(6)
Control+Shift+7=SayRow(7)
Control+Shift+8=SayRow(8)
Control+Shift+9=SayRow(9)
Control+Alt+1=SayColumn(1)
Control+Alt+2=SayColumn(2)
Control+Alt+3=SayColumn(3)
Control+Alt+4=SayColumn(4)
Control+Alt+5=SayColumn(5)
Control+Alt+6=SayColumn(6)
Control+Alt+7=SayColumn(7)
Control+Alt+8=SayColumn(8)
Control+Alt+9=SayColumn(9)
Control+Shift+D=ToggleDollarsSpeech
Control+Shift+R=PreprocessorRead
Control+Shift+A=preprocessorAdd
Control+Shift+W=PreprocessorWrite
Control+Shift+H=PreprocessorFromString
Insert+H=HotKeyHelp
Control+Alt+Shift+R=reInitialise
Control+D=ToggleDollarsBraille
Binary file added jaws/modified_by_istvan/latex.jsb
Binary file not shown.
56 changes: 56 additions & 0 deletions jaws/modified_by_istvan/latex.jsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
:function AutoStartEvent

:script reInitialise
:Synopsis Loads the COM object again.
:Description Run this if there is no speech or Braille.

:function SayLine
:Synopsis An overidden version of the default, which processes maths before it is spoken.

:script ToggleMaths
:Synopsis Toggles the speaking of mathematical expressions as either straight latex or a more verbal rendering.

:script ToggleDollarsBraille
:Synopsis Toggles whether or not dollars are removed in braille.

:script ToggleDollarsSpeech
:Synopsis Toggles the speaking of dollars.

:function BrailleBuildLine
:Returns int No Return Description

:script InputMatrix
:Synopsis Highlight a matrix and then run this script to have it created as an object.

:script HotKeyHelp

:script MatrixRight
:Synopsis Moves the matrix cursor to the right and speaks the new cell.

:script MatrixLeft
:Synopsis Moves the matrix cursor to the left and speaks the new cell.

:script MatrixDown
:Synopsis Moves the matrix cursor down and speaks the cell.

:script MatrixUp
:Synopsis Moves the matrix cursor up and speaks the cell.

:script SayRow
:Synopsis Speaks the required row of the matrix.

:script SayColumn
:Synopsis Says the required column of the matrix

:script preprocessorAdd
:Synopsis Adds a custom command to the preprocessor.

:script PreprocessorFromString
:Synopsis adds commands defined in the highlighted text to the preprocessor.

:script PreprocessorWrite
:Synopsis Saves the preprocessor to a file.

:script PreprocessorRead
:Synopsis Reads preprepreprocessor entries from a file.

Loading

0 comments on commit b7842c1

Please sign in to comment.