#! /usr/bin/perl use warnings; use strict; # parse-phonograms.pl --- create the 70 phonogram cards necessary for # the Spalding method, 4 to each A4 page. # To use it: # parse-phonograms.pl > phonograms.tex # Then *either*: # pdflatex phonograms.tex # then print phonograms.pdf # *or*: # latex phonograms.tex # dvips phonograms.dvi # I have not arranged the pages for printing on a duplex printer, # since I do not have one; all the front sides appear first, then the # even sides appear. My approach is to glue the front and back sheet # together, let the glue dry, then cut them out (with scissors!) and # laminate them in a plastic laminator, 4 cards at a time. # I have written this software from page 10, and # pages 213--221 of my copy of Romalda Spalding, edited by Mary # E. North, "The Writing Road to Reading", Fifth Edition. Harper # Collins. 2003. I have never seen the Spalding phonogram cards. # Copyright (C) 2005 Nick Urbanik # 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ## Handling Underlines, Numbers Above Phonograms. # The method used in the "Writing Road to Reading" (WRTR) in drawing # underlines is to put all the underlines in one word at the same # level. This level is found by the lowest part of the word. I have # not implemented that, though it would not be hard to do. # Similarly, numbers written above phonograms are all written at the # same height within one word. This height matches the highest letter # within the word. I have not implemented that, though it would not # be hard to do. # Note that it is possible to automate the shortening of underlines so # that they don't touch each other. At present, this is done by # manually placing them in the input text. However, it is better to # place them manually than automatically since underlines below gjpqy # occur lower than those under other letters, and while we could # detect these cases and reject them, it is simpler to put them in # manually, since there are only five cases where underlines occur # next to each other, and only three where the underlines would run # into each other. If there was a need to handle this for a longer # text (such as the Ayres word list) then it would not be hard to # apply it universally. # I used makebox to: # Make a shorter box on one (or both) side(s) # then underline that box # make an enclosing box that is the same width as before # We need six altogether: one with shorter underline on the left, # one with shorter underline on the right, one shorter on both sides, # and the same for the numbered underlined phonograms. # Format: See after __END__, where all the input data is maintained. # PHONOGRAM a 1 # \v{a}|at # \o{a}|n\u{a} vy|a \emph{usually} says \o{a} at the end of a syllable # (rule~4). # ah|f\n{2}{a} \n{2}{th}er|a \emph{may} say \emph{ah} at the end of a syllable. # PHONOGRAM d 2 # ... # $Id: parse-phonograms.pl,v 1.2 2005/09/21 01:33:07 nicku Exp nicku $ use File::Basename; sub usage() { my $prog = basename $0; die < phonograms.tex Then *either*: pdflatex phonograms.tex then print phonograms.pdf *or*: latex phonograms.tex dvips phonograms.dvi USAGE } use constant PHONO => "phono"; use constant EXAMPLE => "example"; use constant TIP => "tip"; use constant NUMBER => "number"; use constant LINES => "lines"; our %phonograms; # If we get three or more underlined phonograms in a row, then # shrink first on right, middle one on both sides, last on left. # If we get two in a row, shrink first on right, second on left. # s\nu{2}{ch}\,\u{oo}l school # \u{au} \u{th}\,\u{or} author # \u{ph}\u{o}\,\u{n}\,\u{e} phone # \nu{2}{th}\u{ough} though # \u{th}\nu{5}{ough}t thought # \nu{2}{th}\u{ey} they sub show_adjacent_underlines(\$) { my ( $example ) = @_; # do we have three or more underlines in our example? if ( $$example =~ /(?:(?:\\nu[lrc]?\{\d\}|\\u[lrc]?)\{(.+?)\}(?:\\,)*){2,}/ ) { warn $$example, "\n"; } } sub read_phonogram_file() { # paragraph mode: local $/ = ""; my $phonogram; PARA: while ( ) { chomp; s/#.*$//mg; next PARA if /^%/; next PARA if /^\s*$/; if ( /^PHONOGRAM\s+(\S+)\s+(\d+)/ ) { $phonogram = $1; $phonograms{$phonogram}{NUMBER()} = $2; } else { my ( $phono, $example, $tip ) = split /\|/; warn "cannot understand this line: '$_'" and next PARA unless $phono and $example; show_adjacent_underlines $example; push @{$phonograms{$phonogram}{LINES()}}, { PHONO() => $phono, EXAMPLE() => $example, TIP() => $tip, }; } } } sub print_header() { print "% AUTOMATICALLY GENERATED on @{[scalar localtime]}\n", "% by program $0.\n"; print <<'EOH'; % DO NOT EDIT if you mind your changes being overwritten. \documentclass[a4paper,landscape,12pt]{article} % for each page: % a b % c d % on the other side: % B A % D C % make two macros: one prints the phonogram, (simple!) % the other prints the detailed instructions. \usepackage{amstext,amsmath,array,calc} \usepackage{pgf} \ifx\pdftexversion\undefined \usepackage[margin=12mm]{geometry} \else \usepackage[dvips,margin=12mm]{geometry} \fi % Fix this later when have the Companion at hand. \DeclareFontShape{T1}{cmr}{m}{n} { <5><6><7><8>cmr8 <9>cmr9 <10><10.95>cmr10 <12><14.4>cmr12 <17.28><20.74><24.88-> cmr17 }{} \DeclareFontShape{T1}{cmr}{bx}{n} { <5> <6> <7> <8> <9> cmbx10 <10> <10.95> <12> <14.4> <17.28> <20.74> <24.88-> cmbx12 }{} \newcommand{\ENORMOUS}{\fontsize{107}{100}\usefont{T1}{cmr}{bx}{n}} \newcommand{\Bnormal}{\fontsize{30}{35}\usefont{T1}{cmr}{bx}{n}} \newcommand{\Blarge}{\fontsize{40}{45}\usefont{T1}{cmr}{bx}{n}} \newcommand{\BLarge}{\fontsize{50}{55}\usefont{T1}{cmr}{bx}{n}} \newcommand{\BLARGE}{\fontsize{70}{80}\usefont{T1}{cmr}{bx}{n}} \newcommand{\Bhuge}{\fontsize{90}{100}\usefont{T1}{cmr}{bx}{n}} \newcommand{\BHuge}{\fontsize{100}{110}\usefont{T1}{cmr}{bx}{n}} \newcommand{\BHUGE}{\fontsize{120}{130}\usefont{T1}{cmr}{bx}{n}} \newcommand{\BHUGER}{\fontsize{140}{150}\usefont{T1}{cmr}{bx}{n}} % How much to shrink the underline by when underlines adjacent: \newlength{\shorterby} \setlength{\shorterby}{1pt} % single underline *not* italic \renewcommand*{\u}[1]{\underline{#1}} \newlength{\origwidth} % shrink underline on left by \shorterby: \newcommand*{\ul}[1]{% \settowidth{\origwidth}{#1}% \makebox[\origwidth][r]{\underline{\makebox[\origwidth-\shorterby][r]{#1}}}% } % shrink underline on right by \shorterby: \newcommand*{\ur}[1]{% \settowidth{\origwidth}{#1}% \makebox[\origwidth][l]{\underline{\makebox[\origwidth-\shorterby][l]{#1}}}% } % shrink underline on both sides by \shorterby: \newcommand*{\ub}[1]{% \settowidth{\origwidth}{#1}% \makebox[\origwidth][c]{\underline{\makebox[\origwidth-2\shorterby][c]{#1}}}% } % small number above *not* italic \newcommand*{\n}[2]{\ensuremath{\overset{#1}{\text{#2}}}} % single overbar italic \renewcommand*{\o}[1]{\ensuremath{\overline{\textit{\text{#1}}}}} % double underline: *not* italic \renewcommand*{\d}[1]{\underline{\underline{#1}}} % a v accent: italic \renewcommand*{\v}[1]{\ensuremath{\check{\text{\textit{#1}}}}} % small number as subscript after a double underline: *not* italic \newcommand*{\nc}[2]{\ensuremath{\underline{\underline{\text{#2}}}_{#1}}} % underline with number above, *not* italic \renewcommand*{\nu}[2]{\n{#1}{\u{#2}}} % underline with number above, *not* italic, shrink underline on left: \newcommand*{\nul}[2]{\n{#1}{\ul{#2}}} % underline with number above, *not* italic, shrink underline on right: \newcommand*{\nur}[2]{\n{#1}{\ur{#2}}} % underline with number above, *not* italic, shrink underline on both sides: \newcommand*{\nuc}[2]{\n{#1}{\uc{#2}}} \setlength{\parindent}{0pt} \renewcommand{\arraystretch}{1.5} % This implements the thin line which is the frame to cut out with a % guillotine or scissors around each phonogram card: \DeclareRobustCommand*{\frame}{% \begin{pgfpicture}{0cm}{0cm}{0cm}{0cm} \pgfsetlinewidth{0.05pt} % start at bottom right: \pgfmoveto{\pgfxy(0.45,-0.45)} % Go up to the top right \pgflineto{\pgfpoint{0.45cm}{0.47\textheight}} % now to the top corner where the corner is cut off: \pgflineto{\pgfpoint{5mm-\linewidth+27mm}{0.47\textheight}} % Now snip the corner off: \pgflineto{\pgfpoint{5mm-\linewidth}{0.47\textheight-16mm}} % Down to the bottom: \pgflineto{\pgfpoint{5mm-\linewidth}{-0.45cm}} % then back to the start. \pgfclosestroke \end{pgfpicture}% } \begin{document} \pagestyle{empty} \vspace*{2ex}\par EOH } sub print_end() { print '\end{document}', "\n"; } # for each page: # a b # c d # on the other side: # B A # D C sub by_number { return $phonograms{$a}{NUMBER()} <=> $phonograms{$b}{NUMBER()} } sub init_back_page_order() { my @bp = ( 0 ); for ( my $i = 1; $i <= 72; $i += 2 ) { push @bp, ( $i + 1, $i ); } return @bp; } my @back_page_order = init_back_page_order; sub by_back_page_order { return $back_page_order[ $phonograms{$a}{NUMBER()} ] <=> $back_page_order[ $phonograms{$b}{NUMBER()} ]; } # The first parameter is a phonogram such as "a", or "th". # The second parameter is the phonogram number. sub print_phono($$) { my ( $p, $number ) = @_; print <{\itshape}p{0.1\linewidth-\tabcolsep}% # p{0.05\linewidth-\tabcolsep}p{0.2\linewidth-\tabcolsep}%|% # % See page 246 of LaTeX Companion Second Edition: # >{\raggedright\hspace{0pt}}p{0.5\linewidth-2\tabcolsep}@{}} # \multicolumn{4}{c}{\textsc{Sounds/Sample Words}} # & \multicolumn{1}{c}{\textsc{Instructional Tips}} \\ # EOI # The first is the name of the phonogram, the second is the # data structure for *one* phonogram sub print_instructions($\%) { my ( $phonogram, $p ) = @_; print <<'EOI'; \begin{minipage}[t][0.4\textheight][c]{0.5\linewidth} % pad left centre right tips \begin{tabular}{@{}p{0.15\linewidth-2\tabcolsep}% >{\itshape}p{0.1\linewidth-\tabcolsep}% p{0.05\linewidth-\tabcolsep}p{0.2\linewidth-\tabcolsep}%|% % See page 246 of LaTeX Companion Second Edition: >{\raggedright\hspace{0pt}}p{0.5\linewidth-3\tabcolsep}@{}} \multicolumn{4}{c}{\textsc{Sounds/Sample Words}} & \multicolumn{1}{c}{\textsc{Instructional Tips}} \\ EOI print ' \multicolumn{4}{c}{\scriptsize{}(Sound each separately)} & \\\\', "\n" if @{$p->{LINES()}} > 1; print " [1ex]\n & & $phonogram & & \\\\\n"; foreach my $l ( @{$p->{LINES()}} ) { print " & ", $l->{PHONO()}, " & & ", $l->{EXAMPLE()}, " & "; print $l->{TIP()} if $l->{TIP()}; # See page 246 of LaTeX Companion Second Edition: print '\tabularnewline', "\n"; } print <{NUMBER()}}\\frame \\end{minipage}%\n%\n% EOIF print "\\par\\vfill\\par\n" if ( $back_page_order[ $p->{NUMBER()} ] + 2 ) % 4 == 0; print "\\newpage\n\\vspace*{2ex}\\par\n" if $back_page_order[ $p->{NUMBER()} ] % 4 == 0; } sub dump_data() { while ( ) { print; } exit 0; } use Getopt::Long; sub main() { my $dump; GetOptions( dump => \$dump ) or usage; dump_data if $dump; read_phonogram_file; print_header; foreach my $phonogram ( sort by_number keys %phonograms ) { print_phono $phonogram, $phonograms{$phonogram}{NUMBER()}; } print "\\newpage\n\\vspace*{2ex}\\par\n"; foreach my $phonogram ( sort by_back_page_order keys %phonograms ) { print_instructions $phonogram, %{$phonograms{$phonogram}}; } print_end; } main; __END__ % -*- latex -*- PHONOGRAM a 1 \v{a}|at \o{a}|n\u{a} vy|\textbf{a} \emph{usually} says \o{a} at the end of a syllable (rule~4). # Q: Why isn't that \o{a}|n\nu{2}{a} vy? ah|f\n{2}{a} \n{2}{th}er|\textbf{a} \emph{may} say \emph{ah} at the end of a syllable. PHONOGRAM c 2 k|can s|cent|\textbf{c} before \textbf{e}, \textbf{i}, or \textbf{y} says \emph{s} but followed by any other letter says \emph{k} (rule 2). # Q: Why isn't that s|\n{2}{c}ent? PHONOGRAM d 3 d|lid|Press tip of tongue against upper ridge behind teeth, then voice sound. Keep jaw still. PHONOGRAM f 4 f|if|gently bite on lower lip and blow (unvoiced). PHONOGRAM g 5 g|bag j|gem|\textbf{g} before \textbf{e}, \textbf{i}, or \textbf{y} \emph{may} say \emph{j} and followed by any other letter says \emph{g} (rule 3). # Q: Why isn't that j|\n{2}{g}em? PHONOGRAM o 6 \v{o}|odd \o{o}|\u{o} pen|\textbf{o} \emph{usually} says \o{o} at the end of a syllable (rule 4).\par{}\textbf{o} \emph{may} say \o{o} \emph{(most)} when followed by two consonants (rule~19). # Q: Why isn't that \o{o}|\nu{2}{o} pen? \o{oo}|d\n{3}{o} PHONOGRAM s 7 s|us z|a\n{2}{s} PHONOGRAM qu 8 kw|\u{qu}it|Raise back of tongue to soft palate and release breath (unvoiced).\par{}\textbf{q} is always followed by \textbf{u} saying the consonant sound \emph{w} (rule~1). PHONOGRAM b 9 b|rib|Close lips to form a line, then voice sound. PHONOGRAM e 10 \v{e}|end \o{e}|m\u{e}|\textbf{e} \emph{usually} says \o{e} at the end of a syllable (rule~4). # Q: Why isn't that \o{e}|m\nu{2}{e}? PHONOGRAM h 11 h|him|Open mouth and release breath (unvoiced). PHONOGRAM i 12 \v{\i}|big|\textbf{i} usually says \v{\i} (rule~5). \o{\i}|s\u{i} lent|\textbf{i} may say \o{\i} at the end of a syllable (rule~5).\par{}\textbf{i} may say \o{\i} \emph{(find)} when followed by two consonants (rule~19). # Q: Why isn't that \o{\i}|s\nu{2}{i} lent? PHONOGRAM j 13 j|jam|Keep jaw still. PHONOGRAM k 14 k|ink PHONOGRAM l 15 l|lag|Broaden tip of tongue against ridge behind teeth and voice sound. PHONOGRAM m 16 m|ham|Close lips and voice sound. PHONOGRAM n 17 n|win|Press tongue against roof of mouth and voice sound. PHONOGRAM p 18 p|map|Close lips to form line, then release breath (unvoiced). PHONOGRAM r 19 r|rat|Move back of tongue upward and back at the same time forming contact with upper molars and back edges of tongue. Keep position and voice sound. (\textbf{r} is not pronounced \emph{er}.) PHONOGRAM t 20 t|bat|Press tongue against roof of mount and release breath (unvoiced). PHONOGRAM u 21 \v{u}|up \o{u}|m\u{u} \n{2}{s}ic|\textbf{u} \emph{usually} says \o{u} at the end of a syllable (rule~4). # Q: Why isn't that \o{u}|m\nu{2}{u} \n{2}{s}ic \v{oo}|p\n{3}{u}t PHONOGRAM v 22 v|viv id|Gently bite on lower lip and voice sound (feel vibration).\\ Teach students to hear and feel the difference between \emph{f} and \emph{v}. PHONOGRAM w 23 w|wit|Round lips, then release breath while voicing sound.\\Keep jaw still.\\(\textbf{w} is not pronounced \emph{wh}.) PHONOGRAM x 24 ks|box|\textbf{x} has two sounds blended. PHONOGRAM y 25 y|yet|The consonant sound \emph{y} is used \emph{only} at the beginning of a syllable, \emph{usually} the first one. \v{\i}|gym|\textbf{y} usually says \v{\i}, but may say \o{\i} \emph{(my)} at the end of a syllable (rule~5). # Q: Looks as if it should definitely be \v{\i}|g\n{2}{y}m|\textbf{y} \o{\i}|m\u{y}|\textbf{y}, not \textbf{i}, is used at the end of English words (rule~6). # Q: Why isn't that \o{\i}|m\nu{3}{y}|\textbf{y}? PHONOGRAM z 26 z|zest|Words beginning with the sound \emph{z} are \emph{always} spelled with a \textbf{z}, never an \textbf{s} (rule~27). PHONOGRAM sh 27 sh|di\u{sh}|\emph{sh} is used at the beginning or end of a base syllable word, at the end of a syllable, but not at the beginning of a syllable after the first one except for the ending \emph{ship} (rule~13). PHONOGRAM ee 28 \o{e}|s\u{ee} PHONOGRAM th 29 th|\u{th}in|Place extreme tip of tongue barely between teeth and release breath (unvoiced). th|\nu{2}{th}is|Place extreme tip of tongue barely between teeth and release breath with voice (feel vibration). PHONOGRAM ow 30 ow|h\u{ow} \o{o}|l\nu{2}{ow} PHONOGRAM ou 31 ow|r\u{ou}nd \o{o}|s\nu{2}{ou}l \o{oo}|y\nu{3}{ou} \v{u}|c\nu{4}{ou}n try|Pronounce as in \emph{up}. PHONOGRAM oo 32 \o{oo}|b\u{oo}t \v{oo}|f\nu{2}{oo}t PHONOGRAM ch 33 ch|mu\u{ch} # k|s\nu{2}{ch}\,\u{oo}l k|s\nur{2}{ch}\ul{oo}l sh|\nu{3}{ch}ef PHONOGRAM ar 34 ar|f\u{ar} PHONOGRAM ay 35 \o{a}|d\u{ay} PHONOGRAM ai 36 \o{a}|p\u{ai}nt PHONOGRAM oy 37 oy|b\u{oy}|Say quickly with one impulse of voice. PHONOGRAM oi 38 oi|p\u{oi}nt|Say quickly with one impulse of voice. PHONOGRAM er 39 er|h\u{er} PHONOGRAM ir 40 ir|f\u{ir}st PHONOGRAM ur 41 ur|n\u{ur}s\nc{5}{e} PHONOGRAM wor 42 wor|w\u{or}ks|\emph{wor} has two phonograms.\\\textbf{or} may say \emph{er} after \textbf{w} (rule~8) # Q: Why is the pronunciation shown as wor and not wer? PHONOGRAM ear 43 er|\u{ear} ly PHONOGRAM ng 44 ng|ra\u{ng}|Raise back of tongue as if to say \emph{k}. Keep position, and voice sound through nose (nasal). Do not pronounce \textbf{g}. PHONOGRAM ea 45 \o{e}|\u{ea}t \v{e}|h\nu{2}{ea}d \o{a}|br\nu{3}{ea}k PHONOGRAM aw 46 aw|l\u{aw}|Drop jaw and resonate from vocal cords. PHONOGRAM au 47 # au|\u{au} \u{th}\,\u{or}|Drop jaw and resonate from the vocal cords. au|\u{au} \ur{th}\ul{or}|Drop jaw and resonate from the vocal cords. # Q: Why is the ``or'' in au|\u{au} \ur{th}\ul{or} shown as the same as # the phonogram or, which sounds quite different? I would have expected # it to have a double underline, as an unusual pronunciation. PHONOGRAM or 48 or|f\u{or} PHONOGRAM ck 49 k|ne\u{ck} PHONOGRAM wh 50 wh|\u{wh}en|Blow softly on palm of hand.\\Air should be felt when saying \emph{wh}. (\textbf{wh} is not pronounced \emph{w}.) # Q: Why is when pronounced when and not w\v{e}n? PHONOGRAM ed 51 \v{e}d|grad \u{ed} d|lov\nu{2}{ed}|Keep jaw still. t|\u{wr}e\u{ck} \nu{3}{ed}|Keep jaw still. PHONOGRAM ew 52 \o{oo}|gr\u{ew} \o{u}|f\nu{2}{ew}|Sound the same as \emph{ui}. PHONOGRAM ui 53 \o{oo}|fr\u{ui}t \o{u}|s\nu{2}{ui}t|Sound the same as \emph{ew}. # Q: This seems wrong. I say s\o{oo}t, not s\o{u}t. PHONOGRAM oa 54 \o{o}|b\u{oat} PHONOGRAM gu 55 g|\u{gu}ess PHONOGRAM ph 56 f|\u{ph}\ur{o}\ub{n}\ul{e}|Gently bite on lower lip and blow (unvoiced). # Q: The one should have one double underline, if any underlining at all. # I have no idea why the o, n and e are underlined separately, since # the underline is supposed to join multiple letter phonograms into one. PHONOGRAM ough 57 \o{o}|\nu{2}{th}\u{ough} \o{oo}|\u{th}r\nu{2}{ough} \v{u}f|r\nu{3}{ough} \v{o}f|c\nu{4}{ough} aw|\u{th}\nu{5}{ough}t ow|dr\nu{6}{ough}t PHONOGRAM oe 58 \o{o}|t\u{oe} PHONOGRAM ey 59 \o{a}|\nur{2}{th}\ul{ey} # \o{a}|\nu{2}{th}\u{ey} \o{e}|k\nu{2}{ey} \v{\i}|val l\nu{3}{ey} PHONOGRAM igh 60 \o{\i}|s\u{igh} PHONOGRAM kn 61 n|\u{kn}ot|Press tongue against roof of mouth and voice sound. PHONOGRAM gn 62 n|si\u{gn}|Press tongue against roof of mouth and voice sound. PHONOGRAM wr 63 r|\u{wr}ap|Move back of tongue upward and back at the same time forming contact with upper molars and back edges of tongue. Keep position and voice sound. (\textbf{r} is not pronounced \emph{er}.) PHONOGRAM ie 64 \o{e}|f\u{ie}ld \o{\i}|p\nu{2}{ie} \v{\i}|lil \nu{3}{ie}\n{2}{s} % There is a typing mistake in the book, where they forgot to put the % underline under ie. PHONOGRAM dge 65 j|bri\u{dge}|Keep jaw still. PHONOGRAM ei 66 \o{e}|con c\u{ei}t \o{a}|v\nu{2}{ei}l \v{\i}|f\u{or} f\nu{3}{ei}t PHONOGRAM eigh 67 \o{a}|w\u{eigh} PHONOGRAM ti 68 sh|n\u{a} \u{ti}on PHONOGRAM si 69 sh|ses \u{si}on zh|vi \nu{2}{si}on PHONOGRAM ci 70 sh|f\u{a} \u{ci}al # End of the input data.