Skip to content

Commit

Permalink
Brand new Nemeth edit table supporting production of "UEB with Nemeth…
Browse files Browse the repository at this point in the history
…" documents

Adds support for UEB literary texts containing Nemeth blocks for
technical content. Nemeth switch indicators are applied to mark the
beginning and end of each math block, so one can always distinguish
between literary text and technical content. Handles a range of
punctuation, grouping and other symbols and their spacing around the
math blocks.

Use nemeth_edit_en_ueb_with_switch_indicators.ctb as editTable along
with en-ueb-g1.ctb or en-ueb-g2.ctb as mathtextTable.

Co-authored-by: Norbert Márkus <[email protected]>

Signed-off-by: Attila Hammer <[email protected]>
  • Loading branch information
hammera authored and bertfrees committed Oct 18, 2023
1 parent fe1f7ab commit 61f0ebc
Show file tree
Hide file tree
Showing 2 changed files with 206 additions and 0 deletions.
1 change: 1 addition & 0 deletions lbu_files/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ lbu_files_DATA = \
nemeth.ctb \
nemeth.sem \
nemeth_edit.ctb \
nemeth_edit_en_ueb_with_switch_indicators.ctb \
nemeth_edit_en_us_with_switch_indicators.ctb \
nimas.cfg \
nimas.sem \
Expand Down
205 changes: 205 additions & 0 deletions lbu_files/nemeth_edit_en_ueb_with_switch_indicators.ctb
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
# liblouis Table for Post-Translation Editing
#Use it for UEB literary texts surrounding Nemeth math blocks
#Typical usecase:
# mathtextTable en-ueb-g1.ctb or en-ueb-g2.ctb
# mathexprTable nemeth.ctb
# editTable nemeth_edit_en_ueb_with_switch_indicators.ctb
#
# Based on the Linux screenreader BRLTTY, copyright (C) 1999-2006 by
# The BRLTTY Team
#
# Copyright (C) 2004-2006 ViewPlus Technologies, Inc. www.viewplus.com
# Copyright (C) 2004-2006 JJB Software, Inc. www.jjb-software.com
# Copyright (C) 2023 Norbert Márkus (hamilfonz at gmail dot com),
# Hungary
#
# This file is part of liblouis.
#
# liblouis is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 2.1 of the
# License, or (at your option) any later version.
#
# liblouis 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with liblouis. If not, see
# <http://www.gnu.org/licenses/>.

#liblouisutdml inserts a space before and after each math block to separate it from the literary text.
#Such spaces are often undesirable, e.g., for punctuation and grouping symbols around the math blocks.
#In many cases these signs do not take their most appropriate forms as the math blocks
#are not yet present at the stage of literary Braille translation.
#This table makes a limited attempt to reconstruct the most likely form of some of the signs
#directly preceding or following a math block and to decide which of the automatically added spaces
#are to be kept or removed.

include en-chardefs.cti
#helps decide whether a preceding space can be removed
attribute herethisisapunctuation 432
#when followed by these below, the ones above are punctuations rather than contractions
attribute thecharbeforeitisnotacontraction \x0023-'0
#single-cell signs that may follow a seqafterpattern
attribute wordfinalpunctuation 1234680-
#used to reduce the number of rules dealing with the seqafterpatterns 're and 've
attribute RorV rv
#remove an extra space added by an ellipsis, shape, etc. at the beginning of the math block following the switch indicator
noback correct "\eb\s" "\eb"
repeated \s 0
#unconditionally remove the space before punctuation following a math block
always \ee\s6 1b-15-235 exclamation point
always \ee\s1 1b-15-2 comma
always \ee\s.0 1b-15-46-356 percent sign
always \ee\s- 1b-15-36 hyphen
always \ee\s,- 1b-15-6-36 long dash
always \ee\s",- 1b-15-5-6-36 horizontal line
always \ee\s.- 1b-15-46-36 underline
always \ee\s"9 1b-15-5-3 asterisk
always \ee\s44 1b-15-256-256
#conditional treatment of punctuation and spacing following a math block
#question mark
noback context "\ee"["\s;8"]$s @236 drop the grade-1 prefix
noback context "\ee\s;8"~ @1b-15-236
always \ee\s;8 1b-15-56-236 keep the prefix
#period
always \ee\s;4 1b-15-56-256 preserve the grade-1 prefix
noback context "\ee"["\s4"]$s @256
noback context "\ee\s4"~ @1b-15-256
#colon
always \ee\s;3 1b-15-56-25 preserve the grade-1 prefix
noback context "\ee"["\s3"]$s @25
noback context "\ee\s3"~ @1b-15-25
#semicolon
noback context "\ee"["\s;2"]$s @23 drop the grade-1 prefix
noback context "\ee\s;2"~ @1b-15-23 drop the prefix
always \ee\s;2 1b-15-56-23 keep the prefix
#common rules for periods, colons and semicolons
#drop the space if $w below is a punctuation rather than a contraction
noback context "\ee"["\s"]$w$x ? $w cannot be a contraction here because of $x
noback context "\ee"["\s"]$w",7" ? followed by quotation mark
noback context "\ee"["\s"]$w"`>" ? right angle bracket
noback context "\ee"["\s"]$w"\">" ? right parenthesis
noback context "\ee"["\s"]$w".>" ? right bracket
noback context "\ee"["\s"]$w"_>" ? right brace
noback context "\ee"["\s"]$w"`.>" ? end of transnote
noback context "\ee"["\s"]$w",0" ? right single quote
noback context "\ee"["\s"]$w"\"9" ? asterisk
noback context "\ee"["\s"]$w",-" ? long dash
noback context "\ee"["\s"]$w"\",-" ? horizontal line
noback context "\ee"["\s"]$w".-" ? underline
#conditional treatment of grouping symbols and spacing
#opening apostrophe before a math block
noback context $s["'\s"]"\eb" @6-236
#noback context `["'\s\eb"] @6-236-1b-12 #the ` operand doesn't seem to work
noback context ",7"["'\s"]"\eb" @6-236 preceded by quotation mark
noback context "\"<"["'\s"]"\eb" @6-236 left parenthesis
noback context ".<"["'\s"]"\eb" @6-236 left bracket
noback context ["`_<'\s\eb"] * preserve the apostrophe and space, this is not a grouping symbol: normal subgroup
noback context ["__<'\s\eb"] * preserve the apostrophe and space: normal subgroup or equal
noback context "_<"["'\s"]"\eb" @6-236 preceded by left brace
noback context "`.<"["'\s"]"\eb" @6-236 beginning of transnote
noback context ",8"["'\s"]"\eb" @6-236 left single quote
noback context $a["'\s"]"\eb" @3-0 in any other case preserve the apostrophe and space
noback context ["'\s"]"\eb" @6-236 #assumed to be a single quote at the beginning of the string
#closing apostrophe after a math block
noback context "\ee"["\s'"]$s @6-356
noback context "\ee"["\s'"]~ @6-356
noback context "\ee"["\s'"]",7" @6-356 followed by quotation mark
noback context "\ee"["\s'"]"\">" @6-356 right parenthesis
noback context "\ee"["\s'"]".>" @6-356 right bracket
noback context "\ee"["\s'"]"_>" @6-356 right brace
noback context "\ee"["\s'"]"`.>" @6-356 end of transnote
noback context "\ee"["\s'"]",0" @6-356 right single quote
#opening quotation mark before a math block
noback context $s[",7\s"]"\eb" @236
#noback context `[",7\s\eb"] @236-1b-12 #the ` operand does not appear to be working
noback context "\"<"[",7\s"]"\eb" @236
noback context ".<"[",7\s"]"\eb" @236
noback context ["`_<,7\s\eb"] * preserve the general quotation mark and space
noback context ["__<,7\s\eb"] * keep it as it is
noback context "_<"[",7\s"]"\eb" @236 preceded by left brace
noback context "`.<"[",7\s"]"\eb" @236 beginning of transnote
noback context ",8"[",7\s"]"\eb" @236 left single quote
noback context $a[",7\s"]"\eb" @6-2356-0 in any other case keep it as it is
noback context [",7\s"]"\eb" @236 #assumed to be a left quotation mark at the beginning of the string
#closing quotation mark after a math block
noback context "\ee"["\s,7"]$s @356
noback context "\ee"["\s,7"]~ @356
noback context "\ee"["\s,7"]"\">" @356
noback context "\ee"["\s,7"]".>" @356
noback context "\ee"["\s,7"]"_>" @356
noback context "\ee"["\s,7"]"`.>" @356
noback context "\ee"["\s,7"]",0" @356
#unconditionally remove the space adjacent to grouping symbols and others
#before a math block
always _`<\s\eb 456-4-126-0-1b-12 preserve the space, this isn't a grouping symbol: less than or equal to
always .`<\s\eb 46-4-126-0-1b-12 keep the space: much less than
always `<\s\eb 4-126-1b-12 can be a left angle bracket
always .<\s\eb 46-126-1b-12 left bracket
always `.<\s\eb 4-46-126-1b-12 beginning of transnote
always ,-\s\eb 6-36-1b-12 preceding long dash
always ",-\s\eb 5-6-36-1b-12 horizontal line
always ~.-\s\eb 45-46-36-0-1b-12 keep the space, this isn't an underline: low tone
always .-\s\eb 46-36-1b-12 underline
always _-\s\eb 456-36-0-1b-12 keep the space: minus or plus
always #-\s\eb 3456-36-0-1b-12 keep the space, this isn't a hyphen: uptack or perpendicular
always -\s\eb 36-1b-12 hyphen
always ~;8\s\eb 45-56-236-1b-12 inverted question mark
always ~;6\s\eb 45-56-235-1b-12 inverted exclamation point
always `s\s\eb 4-234-1b-12 Dollar sign
always `l\s\eb 4-123-1b-12 Pound
always `y\s\eb 4-13456-1b-12 Yen
always `f\s\eb 4-124-1b-12 Franc
always `n\s\eb 4-1345-1b-12 Naira
always `e\s\eb 4-15-1b-12 Euro
always `_<\s\eb 4-456-126-0-1b-12 keep the space, not a left brace: normal subgroup
always __<\s\eb 456-456-126-0-1b-12 keep the space, not a left brace: normal subgroup or equal
always _<\s\eb 456-126-1b-12 left brace
always "<\s\eb 5-126-1b-12 left parenthesis
#grouping and others after a math block
always \ee\s"> 1b-15-5-345 right parenthesis
always \ee\s.> 1b-15-46-345 right bracket
always \ee\s_> 1b-15-456-345 right brace
always \ee\s`>`: 1b-15-0-4-345-4-156 keep the space, not a right angle bracket: not greater than
always \ee\s`> 1b-15-4-345 can be a right angle bracket
always \ee\s`.> 1b-15-4-46-345 end of transnote
always \ee\s`c 1b-15-4-14 Cent sign
#handle seqafterpatterns following a math block
always \ee\s';s 1b-15-3-234
always \ee\s';d 1b-15-3-145
always \ee\s';ll 1b-15-3-123-123
#More seqafterpatterns
noback context "\ee"["\s"]"'"$z"e\s" ? where $z either represents the letter r or v
noback context "\ee"["\s"]"'"$z"e"~ ?
noback context "\ee"["\s"]"'"$z"e"$y1-10~ ?
noback context "\ee"["\s"]"'"$z"e"$y1-10"\s" ?
noback context "\ee"["\s"]"'"$z"e,7" ?
noback context "\ee"["\s"]"'"$z"e\">" ?
noback context "\ee"["\s"]"'"$z"e`>" ?
noback context "\ee"["\s"]"'"$z"e.>" ?
noback context "\ee"["\s"]"'"$z"e_>" ?
noback context "\ee"["\s"]"'"$z"e`.>" ?
noback context "\ee"["\s"]"'"$z"e,0" ?
noback context "\ee"["\s"]"'"$z"e\"9" ?
noback context "\ee"["\s"]"'"$z"e,-" ?
noback context "\ee"["\s"]"'"$z"e\",-" ?
noback context "\ee"["\s"]"'"$z"e.-" ?
noback context "\ee"["\s"]"'"$z"e"$y1-10",7" ?
noback context "\ee"["\s"]"'"$z"e"$y1-10"\">" ?
noback context "\ee"["\s"]"'"$z"e"$y1-10"`>" ?
noback context "\ee"["\s"]"'"$z"e"$y1-10".>" ?
noback context "\ee"["\s"]"'"$z"e"$y1-10"_>" ?
noback context "\ee"["\s"]"'"$z"e"$y1-10"`.>" ?
noback context "\ee"["\s"]"'"$z"e"$y1-10",0" ?
noback context "\ee"["\s"]"'"$z"e"$y1-10"\"9" ?
noback context "\ee"["\s"]"'"$z"e"$y1-10",-" ?
noback context "\ee"["\s"]"'"$z"e"$y1-10"\",-" ?
noback context "\ee"["\s"]"'"$z"e"$y1-10".-" ?

#noback context "\eb"[]$l"\ee" @56
#noback context "\eb"[]","$l"\ee" @56
noback pass2 @1b-12 @456-146-0 #Nemeth block start indicator
noback pass2 @1b-15 @0-456-156 Nemeth block end indicator

0 comments on commit 61f0ebc

Please sign in to comment.