libdumbtts-0.3.2/0000755000076400017500000000000011406150721013476 5ustar ethanakethanaklibdumbtts-0.3.2/conf/0000755000076400017500000000000011410060525014420 5ustar ethanakethanaklibdumbtts-0.3.2/conf/en.conf0000644000076400017500000000334111406150721015675 0ustar ethanakethanak[clist] //no special characters needed [spell] // some examples only ß sharp s ð eth þ thorn ı dotless i ĸ kra ŋ eng ſ long s [pronunciation] // some examples only ź zh ż zh ř zh š sh ś sh č tsh ć tsh ž zh ß ss ď dzh ŋ ng [diacritics] ill // illegal let // letter cap // capital caplet // no need to define lig // ligature caplig // no need to define sym // symbol ced // cedilla bre // breve dot // dot above dia // diaeresis or umlaut acu // acute gra // grave ac2 // double acutr cir // circumflex mac // macron rin // ring above str // stroke ogo // ogonek til // tilde car // caron or hacek [characters] #32 space ! exclamation " quotes # number $ dollar % percent & and ' quote ( left paren ) right paren * asterisk + plus , comma - dash . dot / slash : colon ; semicolon < less than = equals > greater than ? question @ at \[ left bracket \\ backslash ] right bracket ^ circumflex _ underscore ` grave { left curly bracket | vertical bar } right curly bracket ~ tilde #160 hardspace ¡ inverted exclamation ¢ cent £ pound ¤ currency ¥ yen ¦ broken bar § section ¨ diaeresis © copyright « left french quote ¬ not #173 soft hyphen ® trademark ¯ macron ° degree ± plusminus ² square ³ cube ´ acute µ micro ¶ paragraph · middle dot ¸ cedilla ¹ superscript one » right french quote ¼ one quarter ½ one half ¾ three quarters ¿ inverted question × multiply ÷ divide [keys] // no need to translate [cyrillic] // untested! я ya е ye ю yu ё yo ъ ч tsh чё tsho че tshe щ shtsh ще shtshe э e ш sh з z ы y ь в v ж zh же zhe у u т t с s р r п p о o н n м m л w лю lu лё lo ле le ля la ли li ль l к k й y и i х h г g ф ph д d де de ц ts б b а a ў w libdumbtts-0.3.2/conf/ro.conf0000644000076400017500000000120011406150721015703 0ustar ethanakethanak[clist] //this section must be defined before at start xBA ș xBA ş xFE ț xFE ţ xE2 â xE3 ă xEE î [spell] [pronunciation] ß s // comma -> cedilla #x219 ş #x21b ţ [diacritics] ill // illegal let // letter cap // capital caplet // capital letter lig // ligature caplig // capital ligature sym // symbol ced // cedilla bre // breve dot // dot above dia // diaeresis or umlaut acu // acute gra // grave ac2 // double acute cir // circumflex mac // macron rin // ring above str // stroke ogo // ogonek til // tilde car // caron or hacek [characters] [keys] space underscore double-quotes control home escape libdumbtts-0.3.2/conf/pl.dic0000644000076400017500000001361411406150721015524 0ustar ethanakethanak// libdumbtts dictionary I(.|)+wojna pierwsza wojna II(.|)+wojna druga wojna III(.|)+wojna trzecia wojna I(.|)+wojn(y|ie) pierwszej wojn%2 II(.|)+wojn(y|ie) drugiej wojn%2 III(.|)+wojn(y|ie) trzeciej wojn%2 I(.|)+wojn(ą|ę) pierwszą wojn%2 II(.|)+wojn(ą|ę) drugą wojn%2 III(.|)+wojn(ą|ę) trzecią wojn%2 XX-wieczn(ego|emu|a|ej|ą|e|i|ych|ymi|ym|y) dwudziestowieczn% XIX-wieczn(ego|emu|a|ej|ą|e|i|ych|ymi|ym|y) dziewiętnastowieczn% XVIII-wieczn(ego|emu|a|ej|ą|e|i|ych|ymi|ym|y) osiemnastowieczn% XVII-wieczn(ego|emu|a|ej|ą|e|i|ych|ymi|ym|y) siedemnastowieczn% XVI-wieczn(ego|emu|a|ej|ą|e|i|ych|ymi|ym|y) szesnastowieczn% // screenreadery nvda enfałde~!a orca orka jaws dżełs // komputery, komputery home hołm page_up pejdż~!ap page_down pejdżd~!ałn caps_lock kapslok num_lock numlok escape esk~!ejp backspace bekspejs evolution ewoluszyn load lołd office ofis play plej scane skan screen_reader skrinrider thunderbird fenderberd thunderbird(em|ami|ach|a|owi|zie|om) fenderberd% view wiu e-mail(ami|ach|em|e|u|owym|owych|owymi|owy|owego|owe|) imejl% e_mail(ami|ach|em|e|u|owym|owych|owymi|owy|owego|owe|) imejl% delete dil~!ejt eject iż~!ekt forward forłerd backward bekłerd device diw~!ajs devices diwajsjs usb ułesb~!e url ułer~!el drive drajw scsi skazj hda chade~!a sda esde~!a dvd diwid~!i sh esh~!a ascii askej // polityki i artysty berlusconi(ego|emu|m|) berluskoni% copeland(a|owi|zie|em|) kołplend% einstejn(ami|ach|a|owi|om|ów|em|ie|) ajnsztajn% eisenstein ~!ajzensztain eisenstein(ami|ach|a|owi|om|ów|em|ie) ajzensztajn% graves(ami|ach|a|owie|owi|em|ie|) grejws% javier(a|owi|em|ze|) hawier% ratzinger r~!ac~'inger ratzinger(owie|owi|om|ami|ach|ów|a|em|ze) rac~'inger% summer(a|owi|rze|) samer% the+police zepolis // english city sjty mountain małnten rocky raki // Imiona żeńskie alison ~!alison agatha agata amy emy alice elis jane dżejn janet dżanet circe kirke margaret margret maureen mor~!in jackie dżeki jacqueline żakl~!in janice dżenis jeanette żan~!et // Imiona angielskie męskie alistair ~!alister alistair(a|em|owi|rze) alister% chuck(ami|ach|a|owi|om|u|) czak% jonathan dż~!onatan jonathan(a|owi|em|ie) dżonatan% keith(a|em|owie|ie|owi|ów|om|) kicz% john(a|owi|em|ie|) dżon% george`(a|em|owi|u) dżordż% george dżordż sean(a|owi|em|) szon% connery(m|) k~!onery connery`e(go|mu) konerie% johnson(a|owie|em|ie|owi|ami|om|) dżonson% smith(a|em|owie|ie|owi|ów|om|) smis% bush(a|owi|em|u|) busz% o`neil ołn~!il o`neil(a|owie|em|u|ach|ami|om|owie) ołnil% russel(a|owie|em|u|ach|ami|om|owie|) rasel% challenger(owi|em|ze|ami|ach|om|a) czelendżer% challenger cz~!elendżer chippendale cz~!ipendejl chippendale`(ami|ach|om|a|owi|u) czipendejl% steward(ach|a|owi|zie|om|ów|) stiuard% // Tom Clancy ryan(a|em|ie|owi|ch|om|ów|) rajen% chavez(ami|a|em|ie|owi|ch|om|ów|) czawez% clark(ami|a|owi|iem|ów|ami|owie|om|) klerk% // Verne cyrus(a|owi|em|ie|) sajrus% pencroff(a|owi|em|ie|) penkrof% // Christie poirot pułar~!o poiro(ta|towi|tem|cie) płaro% marple merpyl // różne takie ad+hoc adh~!ok adieu adj~!e ad+oculos ad~!okulos airbus(ami|ach|a|em|y|om|owi|ów|u|) erbas% air+force+one erfors łan air+force+two erfors tu buick(ach|ami|a|iem|i|om|owi|ów|u|) błik% boeing(ach|ami|a|iem|i|om|owi|ów|u) bełing% bungalow bangloł calendas kalendas carte+blanche kartbl~!ansz challenge czelendż chanson szans~!ą charg[ée] d`affaires szarżdaf~!er charmant szarm~!an charme szarm charmeur szarm~!er charmeuse szarm~!ez chip(ami|ach|a|u|ów|em|ie|) czip% chow+chow czałcz~!ał ciao ciał cicer+cum+caule cjcerkumkałle ci+devant sjdew~!an cinquecento czinkeczento circa cjrka cis+dur cjsdur cis+moll cjsmol cito cjto clich[ée] klisz clou klu collage kol~!aż college koledż //en collège kol~!eż //fr comte kąt comtesse kąt~!es con kon concierge konsj~!erż cool kul copyright k~!opyrajt cosa+nostra koza nostra cottage kotydż coup[ée] kup~!e country kantry cubiculum kub~!ikulum culpa kulpa curriculum kur~!ikulum d,amour dam~!ur de+facto defakto de+iure dejure d[ée]j[àa]+vu(e|) deżaw~!i dell`arte del~!ar del`arte del~!ar dies+irae dijes ire dinghy dingi faciendi fasjendi foyer fułaj~!e gentleman dż~!entelmen geographic dżij~!ogrefik graecas grekas monsieur mesj~!e madame mad~!am mademoiselle madmłaz~!el maitr[ée]+d`hotel metredot~!el mlle madmłazel mme mad~!am mon+ami monam~!i mon+cher mąsz~!er music mjuzjk musical mi~!uzjkal musical(ami|ach|em|e|owi|a|u|ów) miuzjkal% national n~!ejszynel nacional nasjonal new niu out awt qui+pro+quo kwiprokw~!o rock rok sir ser sire sjir street strit va+banque vab~!ank vari[eé]t[eé]s warjet~!e vis+[àa]+vis wizaw~!i voil[aà] włal~!a vivace wiwacze von fon voodoo wudu // kuchnia, kuchnia, jeść nam się chce! ragout rag~!u fondue fąd~!i beaujolais bożol~!e boeuf bef cabernet kabern~!e caberne(tami|ta|tem|cie|tom|tu) kaberne% camembert kamemb~!er camember(tami|ta|tem|cie|tom|tu) kamember% caf[eé] kaf~!e chablis szabl~!i chantilly szantil~!i chianti kjanti chili czili chilli czili chili+con+carne czilikonkarne chop+suey czopsu~!i coca koka cola kola coleslaw kolsloł croissant krłaz~!an cumberland k~!amberlend cura_[çc]ao kirasao curry kary de+la+maison delamez~!ą de+volaille dewol~!aj [aá]+la al~!a muesli musli müsli musli quiche kisz ratatouille ratat~!uj sp[ée]cialit[ée] spesjalit~!e vinaigrette winegr~!et winegret winegr~!et // USA pittsburgh(u|owi|iem|) pitsberg% illinois ~!ilinoj paducah p~!adjuka chattanooga czetanuga new+york niujork richmond(u|em|zie|) riczmond% wilderness ł~!yldernes massachusetts masaczusets new+jersey niudżer~'zy utah juta iowa ajoła delaware d~!elałor colorado kolorado chicago(wskim|wskiemu|wski|wskich|wskimi|wskie|wskiej|) czikago% californi(a|ę|i|o|) kaliforni% kentucky kentaki columbi(a|ą|ę|i|o) kolambi% georgi(a|ą|ę|i|o) dżordż j% // geografia różne cruz kruz zimbabwe zjmbabwe lesotho lesoto libdumbtts-0.3.2/conf/pl.conf0000644000076400017500000002360711406150721015715 0ustar ethanakethanak[clist] //this section must be defined before at start xB1 ą xEA ę xB6 ś xE6 ć xF1 ń xF3 ó xBC ź xBF ż xB3 ł [spell] a a ą ą b be c ce ć ci d de e e ę ę f ef g gie h ha i i j jot k ka l el ł eł m em n en ń ni o o ó o z kreską p pe q ku r er s es ś si t te u u v fał w wu x iks y igrek z zet ź zi ż żet z kropką ß szarfes es ð et þ torn ı i bez kropki ĸ kra ʼn en po apostrofie ŋ eng ſ długie es [pronunciation] ą ą ę ę ć ć ś ś ń ń ź ź ż ż ř ż š sz č cz ž ż ł ł ß s ä e å o æ e ð d ñ ń ó ó ö e ø e ü i þ t ď dż ĸ k ʼn n ň ń ŋ ng œ e [diacritics] ill nielegalny let litera cap wielkie caplet wielka litera lig ligatura caplig wielka ligatura sym znak ced cedilla bre brewis dot z kropką dia umlałt acu ostre gra ciężkie ac2 hungarumlałt cir z daszkiem mac nadkreślone rin z kółkiem str skreślone ogo z ogonkiem til z tyldą dot z kropką car z haczkiem [characters] #32 spacja ! wykrzyknik " cudzysłów # hasz $ dolar % procent & and ' apostrof ( nawias ) po nawiasie * gwiazdka + plus , przecinek - myślnik . kropka / slesz : dwukropek ; średnik < mniejsze = równe > większe ? pytajnik @ małpa \[ nawias kwadratowy \\ bekslesz ] po nawiasie kwadratowym ^ daszek _ podkreślenie ` akcent { klamra | kreska pionowa } po klamrze ~ tylda #160 twarda spacja ¡ odwrotny wykrzyknik ¢ cent £ funt ¤ waluta ¥ jen ¦ kreska z przerwą § paragraf ¨ umlałt © k~!opyrajt ª żeński porządkowy « francuski cudzysłów ¬ not #173 miękki myślnik ® trejdmark ¯ nadkreślenie ° stopień ± plusminus ² kwadrat ³ sześcian ´ ostry akcent µ mikro ¶ akapit · środkowa kropka ¸ cedilla ¹ podniesione jeden º męski porządkowy » prawy francuski cudzysłów ¼ jedna czwarta ½ jedna druga ¾ trzy czwarte ¿ odwrotny pytajnik × razy ÷ dzielone [keys] space spacja underscore podkreślenie double-quotes cudzysłów control kontrol home hołm escape esk~!ejp [abbreviations] zł złotych mln miliony bm bieżącego miesiąca ds. do spraw d/s do spraw np. na przykład proc. procent tys. tysiące mln. miliony ok. około bm. bieżącego miesiąca br. bieżącego roku m._in. między innymi r. rok art. artykuł m-c miesiąc m-ce miesiące prof. profesor [cyrillic] я ja е je ю ju ё jo ъ ч cz чё czo че cze щ szcz ще szcze э e ш sz з z зю z~'iu зё z~'io зе z~'ie зя z~'ia зи z~'i ы y ь в w ж ż же że у u т t ть ć с s сз s~'z сю s~'iu сё s~'io се s~'ie ся s~'ia си s~'i р r рз r~'z п p о o н n нь ń м m л ł лю lu лё lo ле le ля la ли li ль l к k й j и i х h г g ф f д d дь dź дз d~'z ц c цз c~'z цх c~'h це ce ци c~'i б b а a бё bio дё dio фё fio гё gio хё hio кё kio мё mio нё nio пё pio рё rio тё tio вё wio ьё io бю biu дю diu фю fiu гю giu хю hiu кю kiu мю miu ню niu пю piu рю riu тю tiu вю wiu ью iu бе bie де die фе fie ге gie хе hie ке kie ме mie не nie пе pie ре rie те tie ве wie ье ie бя bia дя dia фя fia гя gia хя hia кя kia мя mia ня nia пя pia ря ria тя tia вя wia ья ia ў ł [roman] minlen 2 maxval 3999 ignore 100-1900 XL [dictionary] path /usr/share/dumbtts/pl.dic [formats] recognize hm h{2d0-24}:m{2d0-59} recognize hms h{2d0-24}:m{2d0-59}:s{2d0-59} recognize dm d{d1-31} m{r1-12} recognize dm d{d1-31}.m{r1-12} recognize dmy d{d1-31} m{r1-12} y{4d} recognize dmy d{d1-31}.m{r1-12}.y{4d} recognize dmy d{2d1-31}.m{2d1-12}.y{4d} recognize dmy y{4d}/m{2d1-12}/d{2d1-31} recognize dmy d{d1-31} m{cmons} y{4d} recognize dm d{d1-31} m{cmons} recognize dm d{d1-31}. m{cmons} // daty łączone recognize mdma "między" f{d1-31} "a" d{d1-31} m{cmons} recognize mdmi "między" f{d1-31} "i" d{d1-31} m{cmons} recognize fdm "od" f{d1-31} "do" d{d1-31} m{cmons} recognize fdm "od" f{d1-31}. "do" d{d1-31}. m{cmons} sayas fdm "od" f{mday2} "do" d{mday2} m{mon2} sayas mdmi "między" f{mday1} "i" d{mday1} m{mon2} sayas mdma "między" f{mday1} "a" d{mday1} m{mon2} choice mons 1 stycznia choice mons 2 lutego choice mons 3 marca choice mons 4 kwietnia choice mons 5 maja choice mons 6 czerwca choice mons 7 lipca choice mons 8 sierpnia choice mons 9 września choice mons 10 października choice mons 11 listopada choice mons 12 grudnia sayas hm h{hour} m{min} sayas hms h{hour} m{min} "i" s{sec} s{sekundy} sayas dmy d{mday2} m{mon2} y sayas dm d{mday2} m{mon2} format hour 0 zero format hour 1 pierwsza format hour 2 druga format hour 3 trzecia format hour 4 czwarta format hour 5 piąta format hour 6 szósta format hour 7 siódma format hour 8 ósma format hour 9 dziewiąta format hour 10 dziesiąta format hour 11 jedenasta format hour 12 dwunasta format hour 13 trzynasta format hour 14 czternasta format hour 15 piętnasta format hour 16 szesnasta format hour 17 siedemnasta format hour 18 osiemnasta format hour 19 dziewiętnasta format hour 20 dwudziesta format hour 21 dwudziesta pierwsza format hour 22 dwudziesta druga format hour 23 dwudziesta trzecia format hour 24 dwudziesta czwarta format min default %02d format min 2 zero dwie format min 22 dwadzieścia dwie format min 32 trzydzieści dwie format min 42 czterdzieści dwie format min 52 pięćdziesiąt dwie format sec default %d format sec 1 jedna format sec 2 dwie format sec 22 dwadzieścia dwie format sec 32 trzydzieści dwie format sec 42 czterdzieści dwie format sec 52 pięćdziesiąt dwie format sekundy default sekund format sekundy 1 sekunda format sekundy 2 sekundy format sekundy 3 sekundy format sekundy 4 sekundy format sekundy 22 sekundy format sekundy 23 sekundy format sekundy 24 sekundy format sekundy 32 sekundy format sekundy 33 sekundy format sekundy 34 sekundy format sekundy 42 sekundy format sekundy 43 sekundy format sekundy 44 sekundy format mon2 1 stycznia format mon2 2 lutego format mon2 3 marca format mon2 4 kwietnia format mon2 5 maja format mon2 6 czerwca format mon2 7 lipca format mon2 8 sierpnia format mon2 9 września format mon2 10 października format mon2 11 listopada format mon2 12 grudnia format mday 1 pierwszy format mday 2 drugi format mday 3 trzeci format mday 4 czwarty format mday 5 piąty format mday 6 szósty format mday 7 siódmy format mday 8 ósmy format mday 9 dziewiąty format mday 10 dziesiąty format mday 11 jedenasty format mday 12 dwunasty format mday 13 trzynasty format mday 14 czternasty format mday 15 piętnasty format mday 16 szesnasty format mday 17 siedemnasty format mday 18 osiemnasty format mday 19 dziewiętnasty format mday 20 dwudziesty format mday 21 dwudziesty pierwszy format mday 22 dwudziesty drugi format mday 23 dwudziesty trzeci format mday 24 dwudziesty czwarty format mday 25 dwudziesty piąty format mday 26 dwudziesty szósty format mday 27 dwudziesty siódmy format mday 28 dwudziesty ósmy format mday 29 dwudziesty dziewiąty format mday 30 trzydziesty format mday 31 trzydziesty pierwszy format mday1 1 pierwszym format mday1 2 drugim format mday1 3 trzecim format mday1 4 czwartym format mday1 5 piątym format mday1 6 szóstym format mday1 7 siódmym format mday1 8 ósmym format mday1 9 dziewiątym format mday1 10 dziesiątym format mday1 11 jedenastym format mday1 12 dwunastym format mday1 13 trzynastym format mday1 14 czternastym format mday1 15 piętnastym format mday1 16 szesnastym format mday1 17 siedemnastym format mday1 18 osiemnastym format mday1 19 dziewiętnastym format mday1 20 dwudziestym format mday1 21 dwudziestym pierwszym format mday1 22 dwudziestym drugim format mday1 23 dwudziestym trzecim format mday1 24 dwudziestym czwartym format mday1 25 dwudziestym piątym format mday1 26 dwudziestym szóstym format mday1 27 dwudziestym siódmym format mday1 28 dwudziestym ósmym format mday1 29 dwudziestym dziewiątym format mday1 30 trzydziestym format mday1 31 trzydziestym pierwszym format mday2 1 pierwszego format mday2 2 drugiego format mday2 3 trzeciego format mday2 4 czwartego format mday2 5 piątego format mday2 6 szóstego format mday2 7 siódmego format mday2 8 ósmego format mday2 9 dziewiątego format mday2 10 dziesiątego format mday2 11 jedenastego format mday2 12 dwunastego format mday2 13 trzynastego format mday2 14 czternastego format mday2 15 piętnastego format mday2 16 szesnastego format mday2 17 siedemnastego format mday2 18 osiemnastego format mday2 19 dziewiętnastego format mday2 20 dwudziestego format mday2 21 dwudziestego pierwszego format mday2 22 dwudziestego drugiego format mday2 23 dwudziestego trzeciego format mday2 24 dwudziestego czwartego format mday2 25 dwudziestego piątego format mday2 26 dwudziestego szóstego format mday2 27 dwudziestego siódmego format mday2 28 dwudziestego ósmego format mday2 29 dwudziestego dziewiątego format mday2 30 trzydziestego format mday2 31 trzydziestego pierwszego recognize wiekb w{r1-29} "wiek" recognize wiekb w{r1-29} "w". recognize wiek w{r1-29} "wieku" recognize wieka w{r1-29} "wiekiem" sayas wiek w{mday2} "wieku" sayas wieka w{mday1} "wiekiem" sayas wiekb w{mday} "wiek" form int 3 default form int 1 d=1 form int 2 (d%10)>=2 & (d%10)<=4 form int 3 (d%100)>10 & (d%100)<20 form float 4 default unit mm milimetr|milimetry|milimetrów|milimetra unit cm centymetr|centymetry|centymetrów|centymetra unit km/h kilometr na godzinę|kilometry na godzinę|kilometrów na godzinę|kilometra na godzinę unit km/s kilometr na sekundę|kilometry na sekundę|kilometrów na sekundę|kilometra na sekundę unit m/s metr na sekundę|metry na sekundę|metrów na sekundę|metra na sekundę unit km/sek kilometr na sekundę|kilometry na sekundę|kilometrów na sekundę|kilometra na sekundę unit m/sek metr na sekundę|metry na sekundę|metrów na sekundę|metra na sekundę unit km/sec kilometr na sekundę|kilometry na sekundę|kilometrów na sekundę|kilometra na sekundę unit m/sec metr na sekundę|metry na sekundę|metrów na sekundę|metra na sekundę unit °C stopień celsjusza|stopnie celsjusza|stopni celsjusza|stopnia celsjusza unit hPa hektopaskal|hektopaskale|hektopaskali|hektopaskala libdumbtts-0.3.2/conf/fr.conf0000644000076400017500000000271711406151130015703 0ustar ethanakethanak[clist] //this section must be defined before at start xE0 à xE1 á xE2 â xE4 ä xE8 è xE9 é xEA ê xEB ë xEC ì xED í xEE î xEF ï xF2 ò xF3 ó xF4 ô xF6 ö xFA ú xFB û xF9 ù xFC ü xFD ý xFF ÿ xE7 ç [spell] [pronunciation] ę en ą on à à á á â â ä ä è è é é ê ê ë ë ì ì í í î î ï ï ò ò ó ó ô ô ö ö ú ú û û ù ù ü ü ý ý ÿ ÿ ç ç [diacritics] ill // illegal let // letter cap majuscule // capital caplet // capital letter lig ligature //collées?// ligature caplig majuscule ligature // capital ligature sym // symbol ced cédille// cedilla bre // breve dot point// dot above dia tréma// diaeresis or umlaut acu accent aigu// acute gra accent grave// grave ac2 double accent aigu// double acute cir circonflexe// circumflex mac // macron rin rond en chef// ring above str barré// stroke ogo // ogonek til tilde// tilde car // caron or hacek [characters] #32 espace ! exclamation ' apostrophe , virgule . point ^ circonflexe ? point d'interrogation ( parenthèse ouvrante ) parenthèse fermante - tiret _ souligné : deux point ; point virgule < moins que > plus grand que \\ barre oblique inversée | barre verticale ` accent grave ~ tilde { accolade ouvrante } accolade fermante \[ crochet ouvrant ] crochet fermant £ livre $ dollar % pourcent & et * astérisque + plus / barre oblique = égal @ arrobe " guillemet [keys] space espace underscore souligné double-quotes guillemet escape échap libdumbtts-0.3.2/conf/de.conf0000644000076400017500000000226311410060346015663 0ustar ethanakethanak[clist] //this section must be defined before at start xEB ë xE4 ä xF6 ö xFC ü xDF ß [spell] [pronunciation] ę en ą on ë ë ä ä ö ö ü ü ß ß š sch č tsch [diacritics] ill // illegal let // letter cap // capital caplet // capital letter lig // ligature caplig // capital ligature sym // symbol ced // cedilla bre // breve dot // dot above dia umlaut// diaeresis or umlaut acu akut // acute gra // grave ac2 doppelakut// double acute cir // circumflex mac // macron rin // ring above str // stroke ogo // ogonek til // tilde car // caron or hacek [characters] #32 blank . punkt * stern + plus = gleich # nummer € Euro £ Pound & und @ klammeraffe ~ tilde ° Gerat _ Unterstrich " zitat \\ Backslasch $ dollar ( Klammer auf ) Klammer zu \[ geschweifte Klammer auf ] geschweifte Klammer zu { eckige Klammer auf } eckige Klammer zu : Doppelpunkt ; Semikolon , Komma ! Ausrufezeichen ? Fragezeichen - Bindestrich < kleiner als > größer als § Paragraph % Prozent / Schrägstrich [keys] space blank underscore unterstrich double-quotes zitat control home escape libdumbtts-0.3.2/demo/0000755000076400017500000000000011406151070014420 5ustar ethanakethanaklibdumbtts-0.3.2/demo/demo.c0000644000076400017500000000061111406150721015510 0ustar ethanakethanak#include #include #include main(int argc,char *argv[]) { struct dumbtts_conf *conf; char *buf; int len; conf=dumbtts_TTSInit(argv[1]); len=dumbtts_GetString(conf,argv[2],NULL,0,0,"()[]",".,!?;:"); if (len < 0) exit(1); printf("Len=%d\n",len); buf=malloc(len); dumbtts_GetString(conf,argv[2],buf,len,0,"()[]",".,!?;:"); printf("%s\n",buf); } libdumbtts-0.3.2/src/0000755000076400017500000000000011410060016014255 5ustar ethanakethanaklibdumbtts-0.3.2/src/libdumbtts.c0000644000076400017500000016761611406156523016631 0ustar ethanakethanak/* * libdumbtts.c - dumb synthesizers helper library * Copyright (C) Bohdan R. Rau 2008 * * libdumbtts.c 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. * * libdumbtts.c 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 libdumbtts.c. If not, write to: * The Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301, USA. */ #include #include #include #include #include "local.h" #define addstr(str) do {if (outbuf && strlen(str)+pos < len) strcpy(outbuf+pos,str);pos+=strlen(str);} while(0) #define addbuf(chr) do {if (outbuf && pos < len-1) outbuf[pos]=chr;pos++;} while(0) #define endbuf do {if (outbuf && pos < len) {outbuf[pos]=0;return 0;};return pos+1;} while(0) struct recog_param { char name; int value; }; static int roman(int wc,wchar_t *oc,char *str,char **ostr,struct dumbtts_conf *conf); static struct { unsigned short flags; char letter; char second; } char_descr[]={ {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {8,'a',0},{3,'a',0},{6,'a',0},{14,'a',0},{7,'a',0},{12,'a',0},{1,'a','e'},{5,'c',0}, {8,'e',0},{3,'e',0},{6,'e',0},{7,'e',0},{8,'i',0},{3,'i',0},{6,'i',0},{7,'i',0}, {0,0,0},{14,'n',0},{8,'o',0},{3,'o',0},{6,'o',0},{14,'o',0},{7,'o',0},{0,0,0}, {13,'o',0},{8,'u',0},{3,'u',0},{6,'u',0},{7,'u',0},{3,'y',0},{0,0,0},{0,0,0}, {8,'a',0},{3,'a',0},{6,'a',0},{14,'a',0},{7,'a',0},{12,'a',0},{1,'a','e'},{5,'c',0}, {8,'e',0},{3,'e',0},{6,'e',0},{7,'e',0},{8,'i',0},{3,'i',0},{6,'i',0},{7,'i',0}, {0,0,0},{14,'n',0},{8,'o',0},{3,'o',0},{6,'o',0},{14,'o',0},{7,'o',0},{0,0,0}, {13,'o',0},{8,'u',0},{3,'u',0},{6,'u',0},{7,'u',0},{3,'y',0},{0,0,0},{7,'y',0}, {10,'a',0},{10,'a',0},{4,'a',0},{4,'a',0},{11,'a',0},{11,'a',0},{3,'c',0},{3,'c',0}, {6,'c',0},{6,'c',0},{15,'c',0},{15,'c',0},{9,'c',0},{9,'c',0},{9,'d',0},{9,'d',0}, {13,'d',0},{13,'d',0},{10,'e',0},{10,'e',0},{4,'e',0},{4,'e',0},{15,'e',0},{15,'e',0}, {11,'e',0},{11,'e',0},{9,'e',0},{9,'e',0},{6,'g',0},{6,'g',0},{4,'g',0},{4,'g',0}, {15,'g',0},{15,'g',0},{5,'g',0},{5,'g',0},{6,'h',0},{6,'h',0},{13,'h',0},{13,'h',0}, {14,'i',0},{14,'i',0},{10,'i',0},{10,'i',0},{4,'i',0},{4,'i',0},{11,'i',0},{11,'i',0}, {15,'i',0},{0,0,0},{1,'i','j'},{1,'i','j'},{6,'j',0},{6,'j',0},{5,'k',0},{5,'k',0}, {0,0,0},{3,'l',0},{3,'l',0},{5,'l',0},{5,'l',0},{9,'l',0},{9,'l',0},{0,'l',0}, {0,'l',0},{13,'l',0},{13,'l',0},{3,'n',0},{3,'n',0},{5,'n',0},{5,'n',0},{9,'n',0}, {9,'n',0},{0,0,0},{0,0,0},{0,0,0},{10,'o',0},{10,'o',0},{4,'o',0},{4,'o',0}, {2,'o',0},{2,'o',0},{1,'o','e'},{1,'o','e'},{3,'r',0},{3,'r',0},{5,'r',0},{5,'r',0}, {9,'r',0},{9,'r',0},{3,'s',0},{3,'s',0},{6,'s',0},{6,'s',0},{5,'s',0},{5,'s',0}, {9,'s',0},{9,'s',0},{5,'t',0},{5,'t',0},{9,'t',0},{9,'t',0},{13,'t',0},{13,'t',0}, {14,'u',0},{14,'u',0},{10,'u',0},{10,'u',0},{4,'u',0},{4,'u',0},{12,'u',0},{12,'u',0}, {2,'u',0},{2,'u',0},{11,'u',0},{11,'u',0},{6,'w',0},{6,'w',0},{6,'y',0},{6,'y',0}, {7,'y',0},{3,'z',0},{3,'z',0},{15,'z',0},{15,'z',0},{9,'z',0},{9,'z',0},{0,0,0}}; /* fctype - simplified, locale independent wctype functions */ #define U_LETTER 1 #define U_UPPER 2 #define U_DIGIT 4 #define U_SPACE 8 #define U_PRINT 16 static unsigned char letter_flags[0x1000]={ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 24,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 20,20,20,20,20,20,20,20,20,20,16,16,16,16,16,16, 16,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19, 19,19,19,19,19,19,19,19,19,19,19,16,16,16,16,16, 16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,16,16,16,16,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 24,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 16,16,16,16,16,17,16,16,16,16,16,16,16,16,16,16, 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19, 19,19,19,19,19,19,19,16,19,19,19,19,19,19,19,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,16,17,17,17,17,17,17,17,17, 19,17,19,17,19,17,19,17,19,17,19,17,19,17,19,17, 19,17,19,17,19,17,19,17,19,17,19,17,19,17,19,17, 19,17,19,17,19,17,19,17,19,17,19,17,19,17,19,17, 19,17,19,17,19,17,19,17,17,19,17,19,17,19,17,19, 17,19,17,19,17,19,17,19,17,17,19,17,19,17,19,17, 19,17,19,17,19,17,19,17,19,17,19,17,19,17,19,17, 19,17,19,17,19,17,19,17,19,17,19,17,19,17,19,17, 19,17,19,17,19,17,19,17,19,19,17,19,17,19,17,17, 17,19,19,17,19,17,19,19,17,19,19,19,17,17,19,19, 19,19,17,19,19,17,19,19,19,17,17,17,19,19,17,19, 19,17,19,17,19,17,19,19,17,19,17,17,19,17,19,19, 17,19,19,19,17,19,17,19,19,17,17,17,19,17,17,17, 17,17,17,17,19,17,17,19,17,17,19,17,17,19,17,19, 17,19,17,19,17,19,17,19,17,19,17,19,17,17,19,17, 19,17,19,17,19,17,19,17,19,17,19,17,19,17,19,17, 17,19,17,17,19,17,8,8,8,8,19,17,19,17,19,17, 19,17,19,17,19,17,19,17,19,17,19,17,19,17,19,17, 19,17,19,17,19,17,19,17,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,8,8,8,8,8,8,8, 17,17,17,17,17,17,17,17,17,16,16,17,17,17,17,17, 17,17,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 17,17,16,16,16,16,16,16,16,16,16,16,16,16,16,8, 17,17,17,17,17,16,16,16,16,16,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 16,16,16,16,16,16,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 16,16,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,16,16,8,8,8,8,17,8,8,8,16,8, 8,8,8,8,16,16,19,16,19,19,19,8,19,8,19,19, 17,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19, 19,19,8,19,19,19,19,19,19,19,19,19,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,8, 17,17,19,19,19,17,17,8,8,8,19,8,19,8,19,8, 19,8,19,17,19,17,19,17,19,17,19,17,19,17,19,17, 17,17,17,17,8,8,8,8,8,8,8,8,8,8,8,8, 8,19,19,19,19,19,19,19,19,19,19,19,19,8,19,19, 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19, 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 8,17,17,17,17,17,17,17,17,17,17,17,17,8,17,17, 19,17,19,17,19,17,19,17,19,17,19,17,19,17,19,17, 19,17,19,17,19,17,19,17,19,17,19,17,19,17,19,17, 19,17,16,16,16,16,16,8,8,8,8,8,8,8,8,8, 19,17,19,17,19,17,19,17,19,17,19,17,19,17,19,17, 19,17,19,17,19,17,19,17,19,17,19,17,19,17,19,17, 19,17,19,17,19,17,19,17,19,17,19,17,19,17,19,17, 17,19,17,19,17,8,8,19,17,8,8,19,17,8,8,8, 19,17,19,17,19,17,19,17,19,17,19,17,19,17,19,17, 19,17,19,17,19,17,19,17,19,17,19,17,8,8,19,17, 19,17,19,17,19,17,8,8,19,17,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19, 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19, 19,19,19,19,19,19,19,8,8,17,16,16,16,16,16,16, 8,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,8,16,8,8,8,8,8,8, 8,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 16,16,8,16,16,16,16,16,16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16,16,16,8,16,16,16,16,16, 16,16,16,16,16,8,8,8,8,8,8,8,8,8,8,8, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,8,8,8,8,8, 17,17,17,16,16,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,16,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,16,8,8,8,16, 8,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,8,8,8,8,8, 17,17,17,17,17,17,17,17,17,17,17,16,16,16,16,16, 16,16,16,8,8,8,8,8,8,8,8,8,8,8,8,8, 20,20,20,20,20,20,20,20,20,20,16,16,16,16,8,8, 16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,8,8,17,17,17,17,17,8, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,8, 17,17,17,17,16,17,16,16,16,16,16,16,16,16,16,16, 16,16,16,16,16,17,17,16,16,16,16,16,16,16,8,8, 20,20,20,20,20,20,20,20,20,20,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,16,16,16,8,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,8,8,16,17,16,16, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,8,8, 17,16,16,16,16,8,8,8,17,17,17,17,17,17,17,17, 17,17,16,16,16,16,20,20,20,20,20,20,20,20,20,20, 16,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,16,16,16,8,17,17,17,17,17,17,17,17,8,8,17, 17,8,8,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,8,17,17,17,17,17,17, 17,8,17,8,8,8,17,17,17,17,8,8,16,8,16,16, 16,16,16,16,16,8,8,16,16,8,8,16,16,16,8,8, 8,8,8,8,8,8,8,16,8,8,8,8,17,17,8,17, 17,17,16,16,8,8,20,20,20,20,20,20,20,20,20,20, 17,17,16,16,16,16,16,16,16,16,16,8,8,8,8,8, 8,8,16,8,8,17,17,17,17,17,17,8,8,8,8,17, 17,8,8,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,8,17,17,17,17,17,17, 17,8,17,17,8,17,17,8,17,17,8,8,16,8,16,16, 16,16,16,8,8,8,8,16,16,8,8,16,16,16,8,8, 8,8,8,8,8,8,8,8,8,17,17,17,17,8,17,8, 8,8,8,8,8,8,20,20,20,20,20,20,20,20,20,20, 16,16,17,17,17,8,8,8,8,8,8,8,8,8,8,8, 8,16,16,16,8,17,17,17,17,17,17,17,8,17,8,17, 17,17,8,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,8,17,17,17,17,17,17, 17,8,17,17,8,17,17,17,17,17,8,8,16,17,16,16, 16,16,16,16,16,16,8,16,16,16,8,16,16,16,8,8, 17,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 17,8,8,8,8,8,20,20,20,20,20,20,20,20,20,20, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,16,16,16,8,17,17,17,17,17,17,17,17,8,8,17, 17,8,8,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,8,17,17,17,17,17,17, 17,8,17,17,8,8,17,17,17,17,8,8,16,17,16,16, 16,16,16,16,8,8,8,16,16,8,8,16,16,16,8,8, 8,8,8,8,8,8,16,16,8,8,8,8,17,17,8,17, 17,17,8,8,8,8,20,20,20,20,20,20,20,20,20,20, 16,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,16,16,8,17,17,17,17,17,17,8,8,8,17,17, 17,8,17,17,17,17,8,8,8,17,17,8,17,8,17,17, 8,8,8,17,17,8,8,8,17,17,17,8,8,8,17,17, 17,17,17,17,17,17,8,17,17,17,8,8,8,8,16,16, 16,16,16,8,8,8,16,16,16,8,16,16,16,16,8,8, 8,8,8,8,8,8,8,16,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,20,20,20,20,20,20,20,20,20, 16,16,16,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,16,16,16,8,17,17,17,17,17,17,17,17,8,17,17, 17,8,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,8,17,17,17,17,17,17, 17,17,17,17,8,17,17,17,17,17,8,8,8,8,16,16, 16,16,16,16,16,8,16,16,16,8,16,16,16,16,8,8, 8,8,8,8,8,16,16,8,8,8,8,8,8,8,8,8, 17,17,8,8,8,8,20,20,20,20,20,20,20,20,20,20, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,16,16,8,17,17,17,17,17,17,17,17,8,17,17, 17,8,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,8,17,17,17,17,17,17, 17,17,17,17,8,17,17,17,17,17,8,8,8,8,16,16, 16,16,16,16,16,8,16,16,16,8,16,16,16,16,8,8, 8,8,8,8,8,16,16,8,8,8,8,8,8,8,17,8, 17,17,8,8,8,8,20,20,20,20,20,20,20,20,20,20, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,16,16,8,17,17,17,17,17,17,17,17,8,17,17, 17,8,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,8,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,8,8,8,8,16,16, 16,16,16,16,8,8,16,16,16,8,16,16,16,16,8,8, 8,8,8,8,8,8,8,16,8,8,8,8,8,8,8,8, 17,17,8,8,8,8,20,20,20,20,20,20,20,20,20,20, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,16,17,17,16,16,16,16,16,16,16,8,8,8,8,16, 17,17,17,17,17,17,17,16,16,16,16,16,16,16,16,16, 20,20,20,20,20,20,20,20,20,20,16,16,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,17,17,8,17,8,8,17,17,8,17,8,8,17,8,8, 8,8,8,8,17,17,17,17,8,17,17,17,17,17,17,17, 8,17,17,17,8,17,8,17,8,8,17,17,8,17,17,17, 17,16,17,17,16,16,16,16,16,16,8,16,16,17,8,8, 17,17,17,17,17,8,17,8,16,16,16,16,16,16,8,8, 20,20,20,20,20,20,20,20,20,20,8,8,17,17,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 17,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 20,20,20,20,20,20,20,20,20,20,16,16,16,16,16,16, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 17,17,17,17,17,17,17,17,8,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,8,8,8,8,8,8, 8,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16,17,17,17,17,8,8,8,8, 16,16,16,16,16,16,8,16,8,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,8,8, 8,16,16,16,16,16,16,16,8,16,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}; static unsigned short letter_lower[0x1000]={ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, 64,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, 112,113,114,115,116,117,118,119,120,121,122,91,92,93,94,95, 96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, 240,241,242,243,244,245,246,215,248,249,250,251,252,253,254,223, 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255, 257,257,259,259,261,261,263,263,265,265,267,267,269,269,271,271, 273,273,275,275,277,277,279,279,281,281,283,283,285,285,287,287, 289,289,291,291,293,293,295,295,297,297,299,299,301,301,303,303, 105,305,307,307,309,309,311,311,312,314,314,316,316,318,318,320, 320,322,322,324,324,326,326,328,328,329,331,331,333,333,335,335, 337,337,339,339,341,341,343,343,345,345,347,347,349,349,351,351, 353,353,355,355,357,357,359,359,361,361,363,363,365,365,367,367, 369,369,371,371,373,373,375,375,255,378,378,380,380,382,382,383, 384,595,387,387,389,389,596,392,392,598,599,396,396,397,477,601, 603,402,402,608,611,405,617,616,409,409,410,411,623,626,414,629, 417,417,419,419,421,421,640,424,424,643,426,427,429,429,648,432, 432,650,651,436,436,438,438,658,441,441,442,443,445,445,446,447, 448,449,450,451,454,454,454,457,457,457,460,460,460,462,462,464, 464,466,466,468,468,470,470,472,472,474,474,476,476,477,479,479, 481,481,483,483,485,485,487,487,489,489,491,491,493,493,495,495, 496,499,499,499,501,501,502,503,504,505,507,507,509,509,511,511, 513,513,515,515,517,517,519,519,521,521,523,523,525,525,527,527, 529,529,531,531,533,533,535,535,536,537,538,539,540,541,542,543, 544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559, 560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575, 576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591, 592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607, 608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623, 624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639, 640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655, 656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671, 672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687, 688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703, 704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719, 720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735, 736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751, 752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767, 768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783, 784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799, 800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815, 816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831, 832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847, 848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863, 864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879, 880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895, 896,897,898,899,900,901,940,903,941,942,943,907,972,909,973,974, 912,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959, 960,961,930,963,964,965,966,967,968,969,970,971,940,941,942,943, 944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959, 960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975, 976,977,0,0,0,981,982,983,984,985,0,987,0,989,0,991, 0,993,995,995,997,997,999,999,1001,1001,1003,1003,1005,1005,1007,1007, 1008,1009,1010,1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023, 1024,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1037,1118,1119, 1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087, 1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103, 1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087, 1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103, 1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1117,1118,1119, 1121,1121,1123,1123,1125,1125,1127,1127,1129,1129,1131,1131,1133,1133,1135,1135, 1137,1137,1139,1139,1141,1141,1143,1143,1145,1145,1147,1147,1149,1149,1151,1151, 1153,1153,1154,1155,1156,1157,1158,1159,1160,1161,1162,1163,1164,1165,1166,1167, 1169,1169,1171,1171,1173,1173,1175,1175,1177,1177,1179,1179,1181,1181,1183,1183, 1185,1185,1187,1187,1189,1189,1191,1191,1193,1193,1195,1195,1197,1197,1199,1199, 1201,1201,1203,1203,1205,1205,1207,1207,1209,1209,1211,1211,1213,1213,1215,1215, 1216,1218,1218,1220,1220,1221,1222,1224,1224,1225,1226,1228,1228,1229,1230,1231, 1233,1233,1235,1235,1237,1237,1239,1239,1241,1241,1243,1243,1245,1245,1247,1247, 1249,1249,1251,1251,1253,1253,1255,1255,1257,1257,1259,1259,1260,1261,1263,1263, 1265,1265,1267,1267,1269,1269,1270,1271,1273,1273,1274,1275,1276,1277,1278,1279, 1280,1281,1282,1283,1284,1285,1286,1287,1288,1289,1290,1291,1292,1293,1294,1295, 1296,1297,1298,1299,1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310,1311, 1312,1313,1314,1315,1316,1317,1318,1319,1320,1321,1322,1323,1324,1325,1326,1327, 1328,1377,1378,1379,1380,1381,1382,1383,1384,1385,1386,1387,1388,1389,1390,1391, 1392,1393,1394,1395,1396,1397,1398,1399,1400,1401,1402,1403,1404,1405,1406,1407, 1408,1409,1410,1411,1412,1413,1414,1367,1368,1369,1370,1371,1372,1373,1374,1375, 1376,1377,1378,1379,1380,1381,1382,1383,1384,1385,1386,1387,1388,1389,1390,1391, 1392,1393,1394,1395,1396,1397,1398,1399,1400,1401,1402,1403,1404,1405,1406,1407, 1408,1409,1410,1411,1412,1413,1414,1415,1416,1417,1418,1419,1420,1421,1422,1423, 1424,1425,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,1438,1439, 1440,1441,1442,1443,1444,1445,1446,1447,1448,1449,1450,1451,1452,1453,1454,1455, 1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471, 1472,1473,1474,1475,1476,1477,1478,1479,1480,1481,1482,1483,1484,1485,1486,1487, 1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503, 1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,1515,1516,1517,1518,1519, 1520,1521,1522,1523,1524,1525,1526,1527,1528,1529,1530,1531,1532,1533,1534,1535, 1536,1537,1538,1539,1540,1541,1542,1543,1544,1545,1546,1547,1548,1549,1550,1551, 1552,1553,1554,1555,1556,1557,1558,1559,1560,1561,1562,1563,1564,1565,1566,1567, 1568,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583, 1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,1595,1596,1597,1598,1599, 1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615, 1616,1617,1618,1619,1620,1621,1622,1623,1624,1625,1626,1627,1628,1629,1630,1631, 1632,1633,1634,1635,1636,1637,1638,1639,1640,1641,1642,1643,1644,1645,1646,1647, 1648,1649,1650,1651,1652,1653,1654,1655,1656,1657,1658,1659,1660,1661,1662,1663, 1664,1665,1666,1667,1668,1669,1670,1671,1672,1673,1674,1675,1676,1677,1678,1679, 1680,1681,1682,1683,1684,1685,1686,1687,1688,1689,1690,1691,1692,1693,1694,1695, 1696,1697,1698,1699,1700,1701,1702,1703,1704,1705,1706,1707,1708,1709,1710,1711, 1712,1713,1714,1715,1716,1717,1718,1719,1720,1721,1722,1723,1724,1725,1726,1727, 1728,1729,1730,1731,1732,1733,1734,1735,1736,1737,1738,1739,1740,1741,1742,1743, 1744,1745,1746,1747,1748,1749,1750,1751,1752,1753,1754,1755,1756,1757,1758,1759, 1760,1761,1762,1763,1764,1765,1766,1767,1768,1769,1770,1771,1772,1773,1774,1775, 1776,1777,1778,1779,1780,1781,1782,1783,1784,1785,1786,1787,1788,1789,1790,1791, 1792,1793,1794,1795,1796,1797,1798,1799,1800,1801,1802,1803,1804,1805,1806,1807, 1808,1809,1810,1811,1812,1813,1814,1815,1816,1817,1818,1819,1820,1821,1822,1823, 1824,1825,1826,1827,1828,1829,1830,1831,1832,1833,1834,1835,1836,1837,1838,1839, 1840,1841,1842,1843,1844,1845,1846,1847,1848,1849,1850,1851,1852,1853,1854,1855, 1856,1857,1858,1859,1860,1861,1862,1863,1864,1865,1866,1867,1868,1869,1870,1871, 1872,1873,1874,1875,1876,1877,1878,1879,1880,1881,1882,1883,1884,1885,1886,1887, 1888,1889,1890,1891,1892,1893,1894,1895,1896,1897,1898,1899,1900,1901,1902,1903, 1904,1905,1906,1907,1908,1909,1910,1911,1912,1913,1914,1915,1916,1917,1918,1919, 1920,1921,1922,1923,1924,1925,1926,1927,1928,1929,1930,1931,1932,1933,1934,1935, 1936,1937,1938,1939,1940,1941,1942,1943,1944,1945,1946,1947,1948,1949,1950,1951, 1952,1953,1954,1955,1956,1957,1958,1959,1960,1961,1962,1963,1964,1965,1966,1967, 1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983, 1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999, 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015, 2016,2017,2018,2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029,2030,2031, 2032,2033,2034,2035,2036,2037,2038,2039,2040,2041,2042,2043,2044,2045,2046,2047, 2048,2049,2050,2051,2052,2053,2054,2055,2056,2057,2058,2059,2060,2061,2062,2063, 2064,2065,2066,2067,2068,2069,2070,2071,2072,2073,2074,2075,2076,2077,2078,2079, 2080,2081,2082,2083,2084,2085,2086,2087,2088,2089,2090,2091,2092,2093,2094,2095, 2096,2097,2098,2099,2100,2101,2102,2103,2104,2105,2106,2107,2108,2109,2110,2111, 2112,2113,2114,2115,2116,2117,2118,2119,2120,2121,2122,2123,2124,2125,2126,2127, 2128,2129,2130,2131,2132,2133,2134,2135,2136,2137,2138,2139,2140,2141,2142,2143, 2144,2145,2146,2147,2148,2149,2150,2151,2152,2153,2154,2155,2156,2157,2158,2159, 2160,2161,2162,2163,2164,2165,2166,2167,2168,2169,2170,2171,2172,2173,2174,2175, 2176,2177,2178,2179,2180,2181,2182,2183,2184,2185,2186,2187,2188,2189,2190,2191, 2192,2193,2194,2195,2196,2197,2198,2199,2200,2201,2202,2203,2204,2205,2206,2207, 2208,2209,2210,2211,2212,2213,2214,2215,2216,2217,2218,2219,2220,2221,2222,2223, 2224,2225,2226,2227,2228,2229,2230,2231,2232,2233,2234,2235,2236,2237,2238,2239, 2240,2241,2242,2243,2244,2245,2246,2247,2248,2249,2250,2251,2252,2253,2254,2255, 2256,2257,2258,2259,2260,2261,2262,2263,2264,2265,2266,2267,2268,2269,2270,2271, 2272,2273,2274,2275,2276,2277,2278,2279,2280,2281,2282,2283,2284,2285,2286,2287, 2288,2289,2290,2291,2292,2293,2294,2295,2296,2297,2298,2299,2300,2301,2302,2303, 2304,2305,2306,2307,2308,2309,2310,2311,2312,2313,2314,2315,2316,2317,2318,2319, 2320,2321,2322,2323,2324,2325,2326,2327,2328,2329,2330,2331,2332,2333,2334,2335, 2336,2337,2338,2339,2340,2341,2342,2343,2344,2345,2346,2347,2348,2349,2350,2351, 2352,2353,2354,2355,2356,2357,2358,2359,2360,2361,2362,2363,2364,2365,2366,2367, 2368,2369,2370,2371,2372,2373,2374,2375,2376,2377,2378,2379,2380,2381,2382,2383, 2384,2385,2386,2387,2388,2389,2390,2391,2392,2393,2394,2395,2396,2397,2398,2399, 2400,2401,2402,2403,2404,2405,2406,2407,2408,2409,2410,2411,2412,2413,2414,2415, 2416,2417,2418,2419,2420,2421,2422,2423,2424,2425,2426,2427,2428,2429,2430,2431, 2432,2433,2434,2435,2436,2437,2438,2439,2440,2441,2442,2443,2444,2445,2446,2447, 2448,2449,2450,2451,2452,2453,2454,2455,2456,2457,2458,2459,2460,2461,2462,2463, 2464,2465,2466,2467,2468,2469,2470,2471,2472,2473,2474,2475,2476,2477,2478,2479, 2480,2481,2482,2483,2484,2485,2486,2487,2488,2489,2490,2491,2492,2493,2494,2495, 2496,2497,2498,2499,2500,2501,2502,2503,2504,2505,2506,2507,2508,2509,2510,2511, 2512,2513,2514,2515,2516,2517,2518,2519,2520,2521,2522,2523,2524,2525,2526,2527, 2528,2529,2530,2531,2532,2533,2534,2535,2536,2537,2538,2539,2540,2541,2542,2543, 2544,2545,2546,2547,2548,2549,2550,2551,2552,2553,2554,2555,2556,2557,2558,2559, 2560,2561,2562,2563,2564,2565,2566,2567,2568,2569,2570,2571,2572,2573,2574,2575, 2576,2577,2578,2579,2580,2581,2582,2583,2584,2585,2586,2587,2588,2589,2590,2591, 2592,2593,2594,2595,2596,2597,2598,2599,2600,2601,2602,2603,2604,2605,2606,2607, 2608,2609,2610,2611,2612,2613,2614,2615,2616,2617,2618,2619,2620,2621,2622,2623, 2624,2625,2626,2627,2628,2629,2630,2631,2632,2633,2634,2635,2636,2637,2638,2639, 2640,2641,2642,2643,2644,2645,2646,2647,2648,2649,2650,2651,2652,2653,2654,2655, 2656,2657,2658,2659,2660,2661,2662,2663,2664,2665,2666,2667,2668,2669,2670,2671, 2672,2673,2674,2675,2676,2677,2678,2679,2680,2681,2682,2683,2684,2685,2686,2687, 2688,2689,2690,2691,2692,2693,2694,2695,2696,2697,2698,2699,2700,2701,2702,2703, 2704,2705,2706,2707,2708,2709,2710,2711,2712,2713,2714,2715,2716,2717,2718,2719, 2720,2721,2722,2723,2724,2725,2726,2727,2728,2729,2730,2731,2732,2733,2734,2735, 2736,2737,2738,2739,2740,2741,2742,2743,2744,2745,2746,2747,2748,2749,2750,2751, 2752,2753,2754,2755,2756,2757,2758,2759,2760,2761,2762,2763,2764,2765,2766,2767, 2768,2769,2770,2771,2772,2773,2774,2775,2776,2777,2778,2779,2780,2781,2782,2783, 2784,2785,2786,2787,2788,2789,2790,2791,2792,2793,2794,2795,2796,2797,2798,2799, 2800,2801,2802,2803,2804,2805,2806,2807,2808,2809,2810,2811,2812,2813,2814,2815, 2816,2817,2818,2819,2820,2821,2822,2823,2824,2825,2826,2827,2828,2829,2830,2831, 2832,2833,2834,2835,2836,2837,2838,2839,2840,2841,2842,2843,2844,2845,2846,2847, 2848,2849,2850,2851,2852,2853,2854,2855,2856,2857,2858,2859,2860,2861,2862,2863, 2864,2865,2866,2867,2868,2869,2870,2871,2872,2873,2874,2875,2876,2877,2878,2879, 2880,2881,2882,2883,2884,2885,2886,2887,2888,2889,2890,2891,2892,2893,2894,2895, 2896,2897,2898,2899,2900,2901,2902,2903,2904,2905,2906,2907,2908,2909,2910,2911, 2912,2913,2914,2915,2916,2917,2918,2919,2920,2921,2922,2923,2924,2925,2926,2927, 2928,2929,2930,2931,2932,2933,2934,2935,2936,2937,2938,2939,2940,2941,2942,2943, 2944,2945,2946,2947,2948,2949,2950,2951,2952,2953,2954,2955,2956,2957,2958,2959, 2960,2961,2962,2963,2964,2965,2966,2967,2968,2969,2970,2971,2972,2973,2974,2975, 2976,2977,2978,2979,2980,2981,2982,2983,2984,2985,2986,2987,2988,2989,2990,2991, 2992,2993,2994,2995,2996,2997,2998,2999,3000,3001,3002,3003,3004,3005,3006,3007, 3008,3009,3010,3011,3012,3013,3014,3015,3016,3017,3018,3019,3020,3021,3022,3023, 3024,3025,3026,3027,3028,3029,3030,3031,3032,3033,3034,3035,3036,3037,3038,3039, 3040,3041,3042,3043,3044,3045,3046,3047,3048,3049,3050,3051,3052,3053,3054,3055, 3056,3057,3058,3059,3060,3061,3062,3063,3064,3065,3066,3067,3068,3069,3070,3071, 3072,3073,3074,3075,3076,3077,3078,3079,3080,3081,3082,3083,3084,3085,3086,3087, 3088,3089,3090,3091,3092,3093,3094,3095,3096,3097,3098,3099,3100,3101,3102,3103, 3104,3105,3106,3107,3108,3109,3110,3111,3112,3113,3114,3115,3116,3117,3118,3119, 3120,3121,3122,3123,3124,3125,3126,3127,3128,3129,3130,3131,3132,3133,3134,3135, 3136,3137,3138,3139,3140,3141,3142,3143,3144,3145,3146,3147,3148,3149,3150,3151, 3152,3153,3154,3155,3156,3157,3158,3159,3160,3161,3162,3163,3164,3165,3166,3167, 3168,3169,3170,3171,3172,3173,3174,3175,3176,3177,3178,3179,3180,3181,3182,3183, 3184,3185,3186,3187,3188,3189,3190,3191,3192,3193,3194,3195,3196,3197,3198,3199, 3200,3201,3202,3203,3204,3205,3206,3207,3208,3209,3210,3211,3212,3213,3214,3215, 3216,3217,3218,3219,3220,3221,3222,3223,3224,3225,3226,3227,3228,3229,3230,3231, 3232,3233,3234,3235,3236,3237,3238,3239,3240,3241,3242,3243,3244,3245,3246,3247, 3248,3249,3250,3251,3252,3253,3254,3255,3256,3257,3258,3259,3260,3261,3262,3263, 3264,3265,3266,3267,3268,3269,3270,3271,3272,3273,3274,3275,3276,3277,3278,3279, 3280,3281,3282,3283,3284,3285,3286,3287,3288,3289,3290,3291,3292,3293,3294,3295, 3296,3297,3298,3299,3300,3301,3302,3303,3304,3305,3306,3307,3308,3309,3310,3311, 3312,3313,3314,3315,3316,3317,3318,3319,3320,3321,3322,3323,3324,3325,3326,3327, 3328,3329,3330,3331,3332,3333,3334,3335,3336,3337,3338,3339,3340,3341,3342,3343, 3344,3345,3346,3347,3348,3349,3350,3351,3352,3353,3354,3355,3356,3357,3358,3359, 3360,3361,3362,3363,3364,3365,3366,3367,3368,3369,3370,3371,3372,3373,3374,3375, 3376,3377,3378,3379,3380,3381,3382,3383,3384,3385,3386,3387,3388,3389,3390,3391, 3392,3393,3394,3395,3396,3397,3398,3399,3400,3401,3402,3403,3404,3405,3406,3407, 3408,3409,3410,3411,3412,3413,3414,3415,3416,3417,3418,3419,3420,3421,3422,3423, 3424,3425,3426,3427,3428,3429,3430,3431,3432,3433,3434,3435,3436,3437,3438,3439, 3440,3441,3442,3443,3444,3445,3446,3447,3448,3449,3450,3451,3452,3453,3454,3455, 3456,3457,3458,3459,3460,3461,3462,3463,3464,3465,3466,3467,3468,3469,3470,3471, 3472,3473,3474,3475,3476,3477,3478,3479,3480,3481,3482,3483,3484,3485,3486,3487, 3488,3489,3490,3491,3492,3493,3494,3495,3496,3497,3498,3499,3500,3501,3502,3503, 3504,3505,3506,3507,3508,3509,3510,3511,3512,3513,3514,3515,3516,3517,3518,3519, 3520,3521,3522,3523,3524,3525,3526,3527,3528,3529,3530,3531,3532,3533,3534,3535, 3536,3537,3538,3539,3540,3541,3542,3543,3544,3545,3546,3547,3548,3549,3550,3551, 3552,3553,3554,3555,3556,3557,3558,3559,3560,3561,3562,3563,3564,3565,3566,3567, 3568,3569,3570,3571,3572,3573,3574,3575,3576,3577,3578,3579,3580,3581,3582,3583, 3584,3585,3586,3587,3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599, 3600,3601,3602,3603,3604,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615, 3616,3617,3618,3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631, 3632,3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,3643,3644,3645,3646,3647, 3648,3649,3650,3651,3652,3653,3654,3655,3656,3657,3658,3659,3660,3661,3662,3663, 3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,3676,3677,3678,3679, 3680,3681,3682,3683,3684,3685,3686,3687,3688,3689,3690,3691,3692,3693,3694,3695, 3696,3697,3698,3699,3700,3701,3702,3703,3704,3705,3706,3707,3708,3709,3710,3711, 3712,3713,3714,3715,3716,3717,3718,3719,3720,3721,3722,3723,3724,3725,3726,3727, 3728,3729,3730,3731,3732,3733,3734,3735,3736,3737,3738,3739,3740,3741,3742,3743, 3744,3745,3746,3747,3748,3749,3750,3751,3752,3753,3754,3755,3756,3757,3758,3759, 3760,3761,3762,3763,3764,3765,3766,3767,3768,3769,3770,3771,3772,3773,3774,3775, 3776,3777,3778,3779,3780,3781,3782,3783,3784,3785,3786,3787,3788,3789,3790,3791, 3792,3793,3794,3795,3796,3797,3798,3799,3800,3801,3802,3803,3804,3805,3806,3807, 3808,3809,3810,3811,3812,3813,3814,3815,3816,3817,3818,3819,3820,3821,3822,3823, 3824,3825,3826,3827,3828,3829,3830,3831,3832,3833,3834,3835,3836,3837,3838,3839, 3840,3841,3842,3843,3844,3845,3846,3847,3848,3849,3850,3851,3852,3853,3854,3855, 3856,3857,3858,3859,3860,3861,3862,3863,3864,3865,3866,3867,3868,3869,3870,3871, 3872,3873,3874,3875,3876,3877,3878,3879,3880,3881,3882,3883,3884,3885,3886,3887, 3888,3889,3890,3891,3892,3893,3894,3895,3896,3897,3898,3899,3900,3901,3902,3903, 3904,3905,3906,3907,3908,3909,3910,3911,3912,3913,3914,3915,3916,3917,3918,3919, 3920,3921,3922,3923,3924,3925,3926,3927,3928,3929,3930,3931,3932,3933,3934,3935, 3936,3937,3938,3939,3940,3941,3942,3943,3944,3945,3946,3947,3948,3949,3950,3951, 3952,3953,3954,3955,3956,3957,3958,3959,3960,3961,3962,3963,3964,3965,3966,3967, 3968,3969,3970,3971,3972,3973,3974,3975,3976,3977,3978,3979,3980,3981,3982,3983, 3984,3985,3986,3987,3988,3989,3990,3991,3992,3993,3994,3995,3996,3997,3998,3999, 4000,4001,4002,4003,4004,4005,4006,4007,4008,4009,4010,4011,4012,4013,4014,4015, 4016,4017,4018,4019,4020,4021,4022,4023,4024,4025,4026,4027,4028,4029,4030,4031, 4032,4033,4034,4035,4036,4037,4038,4039,4040,4041,4042,4043,4044,4045,4046,4047, 4048,4049,4050,4051,4052,4053,4054,4055,4056,4057,4058,4059,4060,4061,4062,4063, 4064,4065,4066,4067,4068,4069,4070,4071,4072,4073,4074,4075,4076,4077,4078,4079, 4080,4081,4082,4083,4084,4085,4086,4087,4088,4089,4090,4091,4092,4093,4094,4095}; static int isfalnum(wc) { if (wc < 0x1000) return letter_flags[wc] & (U_DIGIT | U_LETTER); return 0; } static int isfdigit(wc) { if (wc < 0x1000) return letter_flags[wc] & U_DIGIT; return 0; } static int isfalpha(wc) { if (wc < 0x1000) return letter_flags[wc] & U_LETTER; return 0; } static int isfupper(wc) { if (wc < 0x1000) return letter_flags[wc] & U_UPPER; return 0; } static int isflower(wc) { if (wc < 0x1000) { if (letter_flags[wc] & U_UPPER) return 0; return letter_flags[wc] & U_LETTER; } return 0; } static int isfspace(wc) { if (wc < 0x1000) { if (!letter_flags[wc]) return U_SPACE; return letter_flags[wc] & U_SPACE; } return 0; } static int toflower(wc) { if (wc<0x1000) { int i=letter_lower[wc]; if (i) return i; } return wc; } static int get_unichar(char *str,char **ptr,int hMode) { wchar_t wc;int n; if (hMode) { char *c;int base; c=(char *)str; if (*c=='&') c++; if (*c=='#') { c++; base=10; if (*c=='x' || *c=='X') { c++; base=16; } if (*c && (((base == 10) && isdigit(*c)) || ((base == 16) && isxdigit(*c)))) { wc=strtol(c,&c,base); if (*c==';') { c++; if (ptr) *ptr=c; return wc; } if (hMode==2) { if (ptr) *ptr=c; return wc; } } } } wc=*str++ & 255; if ((wc & 0xe0)==0xc0) { wc &=0x1f; n=1; } else if ((wc & 0xf0)==0xe0) { wc &=0x0f; n=2; } else if ((wc & 0xf8)==0xf0) { wc &=0x07; n=3; } else if ((wc & 0xfc)==0xf8) { wc &=0x03; n=4; } else if ((wc & 0xfe)==0xfc) { wc &=0x01; n=5; } else { if (ptr) *ptr=str; return wc; } while (n--) { if ((*str & 0xc0) != 0x80) { wc='?'; break; } wc=(wc << 6) | ((*str++) & 0x3f); } if (ptr) *ptr=str; return wc; } static int ustrlen(char *c) { int i; for (i=0;;i++) if (!get_unichar(c,&c,1)) return i; } static void *allocMemBlock(struct dumbtts_conf *conf,int size,int flags) { char *mb; if (!conf->memo || conf->memo->lastfree - conf->memo->firstfree < size) { struct memblock *memo; memo=malloc(sizeof(*memo)); if (!memo) return NULL; memo->next=conf->memo; conf->memo=memo; memo->firstfree=0; memo->lastfree=MEMO_BLOCK_SIZE; } if (!flags) { conf->memo->lastfree-=size; mb=conf->memo->block+conf->memo->lastfree; } else { size=(size+7) & 0xfff8; mb=conf->memo->block+conf->memo->firstfree; conf->memo->firstfree+=size; } return mb; } static char *strdupMemBlock(struct dumbtts_conf *conf,char *str) { char *dst=allocMemBlock(conf,strlen(str)+1,0); if (dst) strcpy(dst,str); return dst; } static void add_keyname(struct dumbtts_conf *conf,char *key,char *trans) { struct dumbtts_keyname *k; char *c; for (k=conf->keynames;k;k=k->next) if (!strcmp(k->key,key)) { if (!strcmp(k->trans,trans)) return; c=strdupMemBlock(conf,trans); if (c) k->trans=c; return; } k=allocMemBlock(conf,sizeof(*k),1); if (!k) return; if (!(k->key=strdupMemBlock(conf,key))) return; if (!(k->trans=strdupMemBlock(conf,trans))) return; k->next=conf->keynames; conf->keynames=k; } static struct dumbtts_charlist *find_conf_cl(struct dumbtts_conf *conf,wchar_t wc) { struct dumbtts_charlist *cl; for (cl=conf->charlist;cl;cl=cl->next) if (cl->wc == wc) return cl; cl=allocMemBlock(conf,sizeof(*cl),1); if (!cl) return NULL; cl->next=conf->charlist; conf->charlist=cl; cl->wc=wc; cl->name=NULL; cl->prono=NULL; return cl; } static void add_charname(struct dumbtts_conf *conf,wchar_t wc,char *name) { char *c=strdupMemBlock(conf,name); struct dumbtts_charlist *cl; if (!c) return; if (wc < 0x180) { conf->chartable[wc].name=c; return; } cl=find_conf_cl(conf,wc); if (cl) cl->name=c; } static void add_charpron(struct dumbtts_conf *conf,wchar_t wc,char *pron) { char *c=strdupMemBlock(conf,pron); struct dumbtts_charlist *cl; if (!c) return; if (wc < 0x180) { conf->chartable[wc].prono=c; return; } cl=find_conf_cl(conf,wc); if (cl) cl->prono=c; } static void add_cyril(struct dumbtts_conf *conf,wchar_t wc,wchar_t nc,char *trans) { struct dumbtts_cyrtrans *dc; if (trans) { if (!(trans=strdupMemBlock(conf,trans))) return; } dc=allocMemBlock(conf,sizeof(*dc),1); if (!dc) return; dc->c1=wc; dc->c2=nc; dc->translit=trans; dc->next=conf->cyrtrans; conf->cyrtrans=dc; } static void add_abbr(struct dumbtts_conf *conf,char *abbr,char *res) { struct dumbtts_abbr *da; da=allocMemBlock(conf,sizeof(*da),1); if (!da) return; if (!(da->abbr=strdupMemBlock(conf,abbr))) return; if (!(da->res=strdupMemBlock(conf,res))) return; da->next=conf->abbrev; conf->abbrev=da; } static char *local_conv(char *line,struct dumbtts_conf *conf) { int i; char *dst,*s; wchar_t wc; while (*line && isspace(*line)) line++; if (!*line) return NULL; s=dst=line; while ((wc=get_unichar(line,&line,1))!= 0) { if (wc < 0x7f) { *s++=wc; continue; } for (i=0;irconf.nchar;i++) if (conf->rconf.wc[i]==wc) break; if (i>=conf->rconf.nchar) return NULL; *s++=conf->rconf.ch[i]; } *s=0; return dst; } static char *line_trim(char *str) { char *c,*d; while (*str && isspace(*str)) str++; for (c=d=str;*c;c++) if (!strchr(" \t\r\n",*c)) d=c+1; *d=0; return str; } char *dia_sym[14]={"ac2","acu","bre","ced","cir","dia","gra","car", "mac","ogo","rin","str","til","dot"}; char *dia_names[14]={"double acute","acute","breve","cedilla", "circumflex","diaeresis","grave","caron", "macron","ogonek","ring","stroke", "tilde","dot"}; static int is_7bit(char *c) { for (;*c;c++) if ((*c) & 0x80) return 0; return 1; } static void read_roman_line(struct dumbtts_conf *conf,char *line) { char *par;int nr; if (!is_7bit(line)) return; par=line; while (*par && !isspace(*par)) par++; if (*par) *par++=0; while (*par && isspace(*par)) par++; if (!*par) return; if (!strcasecmp(line,"minlen")) { nr=strtol(par,&par,10); if (nr<1 || nr>10) return; conf->roman_minlen=nr; return; } if (!strcasecmp(line,"maxval")) { nr=strtol(par,&par,10); if (nr<10 || nr>5000) return; conf->roman_maxval=nr; return; } if (!strcasecmp(line,"ignore")) { if (!strncmp(par,"reset",5) && (!par[5] || isspace(par[5]))) { conf->roman_ignore=NULL; par+=5; while (*par && isspace(*par)) par++; } while (*par) { int v1,v2; struct dumbtts_intpair *pair; if (isdigit(*par)) { v1=strtol(par,&par,10); if (*par=='-') { par++; if (!*par || !isdigit(*par)) return; v2=strtol(par,&par,10); } else v2=v1; } else { wchar_t w1,w2; w1=*par++; w2=0; v1=roman(w1,&w2,par,NULL,NULL); v2=v1; while (*par && !isspace(*par)) par++; } if (*par && !isspace(*par)) return; if (!v1) return; pair=allocMemBlock(conf,sizeof(*pair),1); if (!pair) return; pair->next=conf->roman_ignore; conf->roman_ignore=pair; pair->v1=v1; pair->v2=v2; while (*par && isspace(*par)) par++; } return; } } #include "libdumbtts_dic.c" #include "libdumbtts_re.c" static int read_line(struct dumbtts_conf *conf,FILE *f) { char buf[1024]; char *line,*c; int zn;wchar_t wc,nc; int i; if (!fgets(buf,256,f)) return 0; c=strstr(buf,"//"); if (c) *c=0; line=line_trim(buf); if (!*line) return 1; if (*line=='[') { line++; if (!strncmp(line,"clis",4)) conf->rconf.mode=1; else if (!strncmp(line,"spel",4)) conf->rconf.mode=2; else if (!strncmp(line,"pron",4)) conf->rconf.mode=3; else if (!strncmp(line,"diac",4)) conf->rconf.mode=4; else if (!strncmp(line,"char",4)) conf->rconf.mode=5; else if (!strncmp(line,"keys",4)) conf->rconf.mode=6; else if (!strncmp(line,"cyri",4)) conf->rconf.mode=7; else if (!strncmp(line,"abbr",4)) conf->rconf.mode=8; else if (!strncmp(line,"roma",4)) conf->rconf.mode=9; else if (!strncmp(line,"dict",4)) conf->rconf.mode=10; else if (!strncmp(line,"form",4)) conf->rconf.mode=11; else conf->rconf.mode=0; return 1; } switch(conf->rconf.mode) { case 1: /* character list */ if (*line=='x') { line++; zn=strtol(line,&line,16); } else zn=strtol(line,&line,10); if (zn<161 || zn >255) return 1; while (*line && isspace(*line)) line++; if (!*line) return 1; wc=get_unichar(line,&line,1); if (!wc) return 1; for (i=0;irconf.nchar;i++) { if (conf->rconf.wc[i]==wc) { conf->rconf.wc[i]=zn; return 1; } } if (conf->rconf.nchar >= 128) return 1; conf->rconf.wc[conf->rconf.nchar]=wc; conf->rconf.ch[conf->rconf.nchar++]=zn; return 1; case 2: /* letter spelling */ case 5: /* character names */ if (*line == '\\') { line++; if (!*line) return 1; wc=get_unichar(line,&line,0); } else wc=get_unichar(line,&line,2); if (!*line || !isspace(*line)) return 1; line=local_conv(line,conf); if (!line) return 1; add_charname(conf,wc,line); return 1; case 3: /* unicode letter pronunciation */ if (*line == '\\') { line++; if (!*line) return 1; wc=get_unichar(line,&line,0); } else wc=get_unichar(line,&line,1); if (!*line || !isspace(*line)) return 1; line=local_conv(line,conf); if (!line) return 1; add_charpron(conf,wc,line); return 1; case 4: /* diacritics and special symbols */ c=line; while (*c && !isspace(*c)) c++; if (!*c) return 1; *c++=0; c=local_conv(c,conf); if (!c) return 1; c=strdupMemBlock(conf,c); if (!strcmp(line,"cap")) conf->cap=c; else if (!strcmp(line,"ill")) conf->ill=c; else if (!strcmp(line,"sym")) conf->sym=c; else if (!strcmp(line,"lig")) conf->lig=c; else if (!strcmp(line,"let")) conf->let=c; else if (!strcmp(line,"caplet")) conf->caplet=c; else if (!strcmp(line,"caplig")) conf->caplig=c; else { int i; for (i=0;i<14;i++) if (!strcmp(dia_sym[i],line)) { conf->dia[i]=c; break; } } return 1; case 6: /* key name translation */ c=line; while (*c && !isspace(*c)) c++; if (!*c) return 1; *c++=0; c=local_conv(c,conf); if (!c) return 1; add_keyname(conf,line,c); return 1; case 7: /* cyrillic transliteration */ wc=get_unichar(line,&line,1); if (!*line || wc < 0x400 || wc >= 0x480) return 1; nc=0; if (!isspace(*line)) { nc=get_unichar(line,&line,1); if (nc < 0x400 || nc >= 0x480) return 1; } c=local_conv(line,conf); add_cyril(conf,wc,nc,c); return 1; case 8: /* abbreviations */ c=line; while (*c && !isspace(*c)) c++; if (!*c) return 1; *c++=0; c=local_conv(c,conf); if (c) add_abbr(conf,line,c); return 1; case 9: /* roman numbers */ read_roman_line(conf,line); return 1; case 10: /* dictionary */ if (conf->flags & 1) return 1; /* ignore dict */ c=line; while (*c && !isspace(*c)) c++; if (!*c) return 1; *c++=0; if (strcasecmp(line,"path")) return 1; while (*c && isspace(*c)) c++; if (*c) dumbtts_LoadDictionary(conf,c); return 1; case 11: read_format_line(conf,line); return 1; } return 1; } struct dumbtts_conf *dumbtts_TTSInitWithFlags(char *lang,int flags) { FILE *f; char namebuf[256],*c; struct dumbtts_conf *conf; conf=malloc(sizeof(*conf)); if (!conf) return NULL; memset(conf,0,sizeof(*conf)); conf->flags = flags; conf->roman_minlen=2; conf->roman_maxval=2999; sprintf(namebuf,"/usr/share/dumbtts/%s.conf",lang); f=fopen(namebuf,"r"); if (f) { conf->rconf.mode=0; while (read_line(conf,f)); fclose(f); } sprintf(namebuf,"/etc/dumbtts/%s.conf",lang); f=fopen(namebuf,"r"); if (f) { conf->rconf.mode=0; while (read_line(conf,f)); fclose(f); } c=getenv("HOME"); if (c) { sprintf(namebuf,"%s/.dumbtts_%s.conf",c,lang); f=fopen(namebuf,"r"); if (f) { conf->rconf.mode=0; while(read_line(conf,f)); fclose(f); } } return conf; } struct dumbtts_conf *dumbtts_TTSInit(char *lang) { return dumbtts_TTSInitWithFlags(lang,0); } void dumbtts_TTSFree(struct dumbtts_conf *conf) { struct memblock *mb; if (!conf) return; while ((mb=conf->memo) != NULL) { conf->memo=mb->next; free(mb); } free(conf); } int dumbtts_WCharString(struct dumbtts_conf *conf,wchar_t wc,char *outbuf,int len,int capMode,int *isCap) { wchar_t owc; int cap=0,pos=0,lett; char *chname,nbuf[32]; owc=wc; if (isfupper(wc)) { owc=toflower(wc); cap=1; } if (capMode == 1) { if (isCap) *isCap=cap; capMode=0; } else if (isCap) *isCap=0; chname=NULL; if (conf) { if (owc<0x180) chname=conf->chartable[owc].name; else { struct dumbtts_charlist *cl; for (cl=conf->charlist;cl;cl=cl->next) if (cl->wc == owc) { chname=cl->name; break; } } } if (chname) { if (cap && capMode) { if (conf && conf->cap) addstr(conf->cap); else addstr("capital"); addbuf(' '); } addstr(chname); endbuf; } if (owc < 0x180 && char_descr[owc].letter) { /* diacritical */ if (char_descr[owc].flags == 1) { /* ligature */ if (cap && capMode) { if (conf) { if (conf->caplig) addstr(conf->caplig); else { if (conf->cap) addstr(conf->cap); else addstr("capital"); addbuf(' '); if (conf->lig) addstr(conf->lig); else addstr("ligature"); } addbuf(' '); } else addstr("capital ligature "); } else { if (conf && conf->lig) addstr(conf->lig); else addstr("ligature"); addbuf(' '); } lett=char_descr[owc].letter; if (conf && conf->chartable[lett].name) addstr(conf->chartable[lett].name); else addbuf(lett); lett=char_descr[owc].second; if (lett) { addbuf(' '); if (conf && conf->chartable[lett].name) addstr(conf->chartable[lett].name); else addbuf(lett); } endbuf; } /* not ligature */ if (cap && capMode) { if (conf && conf->cap) addstr(conf->cap); else addstr("capital"); addbuf(' '); } lett=char_descr[owc].letter; if (conf && conf->chartable[lett].name) addstr(conf->chartable[lett].name); else addbuf(lett); if (char_descr[owc].flags) { addbuf(' '); if (conf && conf->dia[char_descr[owc].flags - 2]) { addstr(conf->dia[char_descr[owc].flags - 2]); } else { addstr(dia_names[char_descr[owc].flags - 2]); } } endbuf; } if (owc<0x7f && isalnum(owc)) { if (cap && capMode) { if (conf && conf->cap) addstr(conf->cap); else addstr("capital"); addbuf(' '); } addbuf(owc); endbuf; } if (owc==' ') { addstr("space"); endbuf; } if (isfalpha(owc)) { if (cap && capMode) { if (conf) { if (conf->caplet) addstr(conf->caplet); else { if (conf->cap) addstr(conf->cap); else addstr("capital"); addbuf(' '); if (conf->let) addstr(conf->let); else addstr("letter"); } addbuf(' '); } else addstr("capital letter "); } else { if (conf && conf->let) addstr(conf->let); else addstr("letter"); addbuf(' '); } } else { if (conf && conf->sym) addstr(conf->sym); else addstr("symbol"); addbuf(' '); } sprintf(nbuf,"%d",(int)wc); addstr(nbuf); endbuf; } int dumbtts_CharString(struct dumbtts_conf *conf,char *ch,char *outbuf,int len,int capMode,int *isCap) { wchar_t wc; if (!strcmp(ch,"space")) wc=32; else wc=get_unichar(ch,NULL,0); if (wc) return dumbtts_WCharString(conf,wc,outbuf,len,capMode,isCap); return -1; } static char *dumbtts_translateKey(struct dumbtts_conf *conf,char *inbuf,int len,char *buf) { int i;char *c;wchar_t wc; struct dumbtts_keyname *key; if (len>63) return (conf && conf->ill)?conf->ill:"illegal"; memcpy(buf,inbuf,len); buf[len]=0; wc=get_unichar(buf,&c,1); if (!*c) { /* single character */ i=dumbtts_WCharString(conf,wc,buf,64,0,NULL); if (i) return (conf && conf->ill)?conf->ill:"illegal"; return buf; } if (conf) { for (key=conf->keynames;key;key=key->next) { if (!strcmp(key->key,buf)) return key->trans; } } return buf; /* untranslated */ } int dumbtts_KeyString(struct dumbtts_conf *conf,char *str,char *outbuf,int len,int capMode,int *isCap) { char *c,*s; int pos; char buf[64]; pos=0; if (ustrlen(str)==1) return dumbtts_CharString(conf,str,outbuf,len,capMode,isCap); if (isCap) *isCap=0; for (;;) { while (*str && strchr(" _\"",*str)) str++; if (!*str) break; c=strpbrk(str," _\""); if (!c) c=(char *)(str+strlen(str)); s=dumbtts_translateKey(conf,str,c-str,buf); if(s) { if (pos) addbuf(' '); addstr(s); } str=c; } if (!pos) return -1; endbuf; } static char *dumbtts_pron(struct dumbtts_conf *conf,wchar_t wc,char *buf) { wc=toflower(wc); if (wc >= 0x180) return NULL; if (wc < 0x7f && isalnum(wc)) { buf[0]=wc; buf[1]=0; return buf; } if (conf) { char *c;struct dumbtts_charlist *dc; if (wc < 0x180) c=conf->chartable[wc].prono; else { for (dc=conf->charlist;dc;dc=dc->next) if (dc->wc == wc) { c=dc->prono; break; } } if (c) return c; } if (wc>=0x180 || !char_descr[wc].letter) return NULL; buf[0]=char_descr[wc].letter; if (char_descr[wc].second) { buf[1]=char_descr[wc].second; buf[2]=0; } else buf[1]=0; return buf; } static int speak_punct(wchar_t wc,char *punct) { wchar_t wx; if (!punct) return 0; while ((wx=get_unichar(punct,&punct,0)) != 0) if (wx==wc) return 1; return 0; } static int isfpunct(wchar_t wc) { static wchar_t wcs[]={0xa1,0xab,0xbb,0xbf,0}; static int pairs[][2]={ {0x2010,0x2028}, {0x2039,0x2047}, {0x2329,0x232A}, {0x3008,0x301F}, {0,0}}; int i; if (wc < 0x7f) { return !strchr("@\\#$%&^+*/<>~|=",wc); } for (i=0;wcs[i];i++) if (wcs[i] == wc) return 1; for (i=0;pairs[i][0];i++) if (pairs[i][0]<=wc && pairs[i][1]>wc) return 1; return 0; } static char *charname(struct dumbtts_conf *conf,wchar_t wc) { struct dumbtts_charlist *cl; if (!conf) return NULL; if (wc<0x180) return conf->chartable[wc].name; for (cl=conf->charlist;cl;cl=cl->next) if (cl->wc == wc) { return cl->name; } return NULL; } int compare_word(char *word,char *str,char **outstr,wchar_t wc) { wchar_t w1,w2; for (;;) { if (!*word) { if (*str && !isspace(*str)) return 0; *outstr=str; return 1; return 0; } if (wc) { w2=toflower(wc); wc=0; } else { w2=get_unichar(str,&str,0); if (!w2) return 0; w2=toflower(w2); } w1=get_unichar(word,&word,0); if (!w1) return 0; w1=toflower(w1); if (w1 == '_') { for (;;) { if (w2>=0x7f || !isspace(w2)) break; w2=get_unichar(str,&str,0); if (!w2) return 0; } wc=w2; continue; } if (w1 != w2) return 0; } } static char *abbrname(struct dumbtts_conf *conf,char **str,wchar_t wc) { struct dumbtts_abbr *da; char *c; for (da=conf->abbrev;da;da=da->next) { if (compare_word(da->abbr,*str,&c,wc)) { *str=c; return da->res; } } return NULL; } static int legal_roman(struct dumbtts_conf *conf,int len,int v) { struct dumbtts_intpair *ip; if (len < conf->roman_minlen) return 0; if (v > conf->roman_maxval) return 0; for (ip=conf->roman_ignore;ip;ip=ip->next) { if (v>=ip->v1 && v <=ip->v2) return 0; } return 1; } static int roman(int wc,wchar_t *oc,char *str,char **ostr,struct dumbtts_conf *conf) { int goc=0; int val=0; int chr,i; int len=0; int nchar() { if (wc) return wc; if (*oc && !goc) return *oc; return *str; return 0; } int gchar() { int n; len++; if (wc) { n=wc; wc=0; return n; } if (*oc && !goc) { goc=1; return *oc; } if (*str) return *str++; return 0; } while(nchar() == 'M' && val<4000) { val+=1000; gchar(); } if(nchar()=='C') { gchar(); if (nchar()=='M') { gchar(); val+=900; } else if (nchar()=='D') { gchar(); val+=400; } else { val+=100; for (i=0;i<2;i++) { if (nchar()=='C') { val+=100; gchar(); } else break; } } } else if (nchar() == 'D') { val+=500; gchar(); for (i=0;i<3;i++) { if (nchar()=='C') { val+=100; gchar(); } else break; } } /* decimals */ if (nchar()=='X') { gchar(); if (nchar()=='C') { val+=90; gchar(); } else if (nchar()=='L') { val+=40; gchar(); } else { val+=10; for (i=0;i<2;i++) { if (nchar()=='X') { gchar(); val+=10; } else break; } } } else if (nchar()=='L') { val+=50; gchar(); for (i=0;i<3;i++) { if (nchar()=='X') { gchar(); val+=10; } else break; } } /* units */ if (nchar()=='I') { gchar(); if (nchar()=='X') { gchar(); val+=9; } else if (nchar()=='V') { gchar(); val+=4; } else { val++; for (i=0;i<2;i++) { if (nchar()=='I') { gchar(); val++; } else break; } } } else if (nchar()=='V') { gchar(); val+=5; for (i=0;i<3;i++) { if (nchar()=='I') { gchar(); val++; } else break; } } if (!val) return 0; if (conf && !legal_roman(conf,len,val)) return 0; if (!goc && *oc) chr=*oc; else if (*str) chr=get_unichar(str,NULL,0); else chr=0; if (chr && isfalnum(chr)) return 0; if (goc) *oc=0; if (ostr) *ostr=str; return val; } static int check_word_type(struct dumbtts_conf *conf,wchar_t wc,char *str) { int llet,hlet,dit,wlen; for (llet=hlet=dit=wlen=0;wc;wc=get_unichar(str,&str,0),wlen++) { if (!wc || !isfalnum(wc)) break; if (wc>=0x180) break; if (isfupper(wc)) hlet=1; else if (isflower(wc)) llet=1; else if (isfdigit(wc)) dit=1; } if (wlen<2) return 0; if (!(conf->flags & 2) && hlet && !llet) return 1; if (dit) return 1; return 0; } int dumbtts_GetString( struct dumbtts_conf *conf, char *str, char *outbuf, int len, int punctMode, char *punctChars, char *punctLeave) { int pos=0; int blank=0; wchar_t wc,oc; char *c,nbuf[32]; int speak_char; oc=0; while (oc || *str) { if (oc) { wc=oc; oc=0; } else wc=get_unichar(str,&str,0); if (!wc) break; if (wc == 173) continue; /* soft hyphen */ if (isfspace(wc)) { if (pos) blank=1; continue; } if (isfalnum(wc)) { if (blank || !pos) { char *s; int rom; char dictbuf[1024]; struct recog_param rparams[16]; int rcount; char *fmname; if (blank) addbuf(' '); blank=0; s=abbrname(conf,&str,wc); if (s) { addstr(s); continue; } if (get_dict(conf,&str,wc,dictbuf)) { addstr(dictbuf); continue; } if ((fmname=do_recognize(conf,wc,&str,rparams,&rcount))) { do_format(conf,fmname,rparams,rcount,dictbuf); addstr(dictbuf); continue; } if (do_units(conf,wc,&str,dictbuf)) { addstr(dictbuf); continue; } rom=roman(wc,&oc,str,&str,conf); if (rom) { char buf[8]; sprintf(buf,"%d",rom); addstr(buf); continue; } /* configuration check! */ if (check_word_type(conf,wc,str)) { int lastlet=2; for(;wc;) { char *cn; if (!isfalnum(wc)) break; if (isfdigit(wc)) { //if (lastlet==1) addbuf(' '); if (lastlet != 2) addbuf(' '); lastlet=0; for (;;) { addbuf(wc); wc=get_unichar(str,&cn,0); if (wc && isfalnum(wc)) str=cn; if (!wc || !isfdigit(wc)) break; } continue; } dumbtts_WCharString(conf,wc,dictbuf,1024,0,NULL); wc=get_unichar(str,&cn,0); //if (lastlet==0) addbuf(' '); if (lastlet!=2) addbuf(' '); lastlet=1; //if (!isfalnum(wc)) addstr("~!"); //else str=cn; if (isfalnum(wc)) str=cn; //addstr("~'"); addstr(dictbuf); } continue; } } if (wc>=0x400 && wc<0x480 && conf && conf->cyrtrans) { /* simplified cyrillic translation */ int u1,u2; struct dumbtts_cyrtrans *dc; c=NULL; u1=toflower(wc); if (!oc && *str) oc=get_unichar(str,&str,0); u2=oc?toflower(oc):0; for (dc=conf->cyrtrans;dc;dc=dc->next) { if (dc->c1 != u1) continue; if (!dc->c2) break; if (dc->c2 == u2) break; } if (dc) { c=dc->translit; if (dc->c2) oc=0; } if (c) addstr(c); continue; } c=dumbtts_pron(conf,wc,nbuf); if (c) { addstr(c); continue; } /* unknown letter? */ if (pos) addbuf(' '); if (conf && conf->let) addstr(conf->let); else addstr("letter"); sprintf(nbuf," %d",(int)wc); addstr(nbuf); blank=1; continue; } speak_char=0; if (!isfpunct(wc) || punctMode == 2 || (punctMode == 1 && speak_punct(wc,punctChars))) { speak_char=1; } if (speak_char) { char *chname=charname(conf,wc); if (pos) addbuf(' '); if (chname) { addstr(chname); } else { if (conf && conf->sym) addstr(conf->sym); else addstr("symbol"); sprintf(nbuf," %d",(int)wc); addstr(nbuf); } if (wc< 0x7f && punctLeave && strchr(punctLeave,wc)) { if (!oc && *str) oc=get_unichar(str,&str,0); if (!oc || isfspace(oc)) { addbuf(wc); blank=0; } else blank=1; } else blank=2; continue; } if (wc< 0x7f && punctLeave && strchr(punctLeave,wc)) { if (blank == 1) addbuf(' '); addbuf(wc); blank=0; continue; } /* special characters sequence */ if (wc == '-' || wc == 0x2013 || wc == 0x2014) { if (blank == 0) { blank=3; continue; } if (!oc && *str) oc=get_unichar(str,&str,0); if (oc && isfspace(oc)) { blank=0; addbuf(','); } continue; } if (wc == '(') { if (blank == 0) continue; if (!oc && *str) oc=get_unichar(str,&str,0); if (!oc) continue; if (isfspace(oc) || isfalnum(oc)) { addbuf(','); } continue; } if (wc == ')') { if (!pos) continue; if (!oc && *str) oc=get_unichar(str,&str,0); if (!oc) continue; if (isfspace(oc)) { addbuf(','); blank=1; } continue; } blank=3; } endbuf; } libdumbtts-0.3.2/src/libdumbtts.h0000644000076400017500000000476411406156553016633 0ustar ethanakethanak/* * libdumbtts.h - dumb synthesizers helper library * Copyright (C) Bohdan R. Rau 2008 * * libdumbtts.h 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. * * libdumbtts.h 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 libdumbtts.h. If not, write to: * The Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301, USA. */ #ifndef LIBDUMBTTS_H #define LIBDUMBTTS_H 1 #include struct dumbtts_conf *dumbtts_TTSInit(char *lang); struct dumbtts_conf *dumbtts_TTSInitWithFlags(char *lang,int flags); void dumbtts_TTSFree(struct dumbtts_conf *conf); void dumbtts_LoadDictionary(struct dumbtts_conf *conf,char *fname); #define DUMBTTS_NO_DICTS 1 #define DUMBTTS_DONT_SPELL_UCASE 2 /* Arguments: outbuf - output buffer or NULL len - size of output buffer capMode - announce capital letters isCap - if not NULL, functions set it to 1 on capitals punctMode - punctuation mode. Set to 0 (no punctuation), 1 (some), 2 (all) punctChars - if punctMode is set to 'some', should contain utf-8 encoded string with all punctuation characters which should be spoken punctLeave - ASCII string containing characters which should be passed to synthesizer. Return value: 0 - argument is converted >0 - minimum size of output buffer needed <0 - conversion error */ /* convert wide-character to speakable string */ int dumbtts_WCharString( struct dumbtts_conf *conf, wchar_t wc, char *outbuf, int len, int capMode, int *isCap); /* convert utf-8 character to speakable string */ int dumbtts_CharString( struct dumbtts_conf *conf, char *ch, char *outbuf, int len, int capMode, int *isCap); /* convert key name to speakable string */ int dumbtts_KeyString( struct dumbtts_conf *conf, char *str,char *outbuf, int len, int capMode, int *isCap); /* convert utf-8 string to speakable string */ int dumbtts_GetString( struct dumbtts_conf *conf, char *str, char *outbuf, int len, int punctMode, char *punctChars, char *punctLeave); #endif libdumbtts-0.3.2/src/libdumbtts_re.c0000644000076400017500000004515711406150721017304 0ustar ethanakethanak/* * libdumbtts_re.c - dumb synthesizers helper library * Copyright (C) Bohdan R. Rau 2008 * * libdumbtts 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. * * libdumbtts 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 libdumbtts.c. If not, write to: * The Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301, USA. */ static int is_good_recog(char *c) { wchar_t wc; while (*c) { wc=get_unichar(c,&c,0); if (!wc) return 0; if (wc == '"') { for (;;) { wc=get_unichar(c,&c,0); if (!wc) return 0; if (wc=='"') break; if (wc=='\\') { wc=get_unichar(c,&c,0); if (!wc) return 0; } } continue; } if (isfspace(wc)) continue; if (wc>=0x7f) return 0; if (isalpha(wc)) { if (*c++!='{') return 0; if (*c=='c') { c++; if (!isalnum(*c)) return 0; while (*c && isalnum(*c)) c++; if (*c++!='}') return 0; continue; } if (isdigit(*c)) c++; if (*c!='r' && *c!='d' && *c!='x') return 0; c++; if (isdigit(*c)) { c++; while(*c && isdigit(*c)) c++; if (*c++!='-') return 0; if (!*c || !isdigit(*c)) return 0; c++; while(*c && isdigit(*c)) c++; } if (*c++!='}') return 0; continue; } if (!strchr(":,.-_/",wc)) return 0; } return 1; } static int is_good_sayas(char *c) { while (*c) { if (isspace(*c)) { c++;continue; } if (*c=='"') { c++; while (*c) { if (*c=='"') { c++; break; } if (*c=='\\') { c++; } if (!*c) return 0; c++; } continue; } if (!isalpha(*c++)) return 0; if (*c=='{') { c++; while (*c && isalnum(*c)) c++; if (*c++!='}') return 0; } } return 1; } static struct dumbtts_expr *read_rc_expr(struct dumbtts_conf *conf,char **str,int level); static struct dumbtts_expr *read_rc_item(struct dumbtts_conf *conf,char **str); static struct dumbtts_expr *alloc_expr(struct dumbtts_conf *conf) { return allocMemBlock(conf,sizeof(struct dumbtts_expr),1); } static void read_format_line(struct dumbtts_conf *conf,char *line) { char *c; c=line; while (*c && !isspace(*c)) c++; if (!*c) return; *c++=0; while (*c && isspace(*c)) c++; if (!*c) return; if (!strcmp(line,"sayas")) { char *fname=c; struct dumbtts_abbr *sy; while (c && !isspace(*c)) c++; if (!*c) return; *c++=0; while (*c && isspace(*c)) c++; if (!*c) return; c=local_conv(c,conf);if (!c) return; if (!is_good_sayas(c)) return; if (!(c=strdupMemBlock(conf,c))) return; for (sy=conf->sayas;sy;sy=sy->next) if (!strcmp(sy->abbr,fname)) break; if (!sy) { if (!(sy=allocMemBlock(conf,sizeof(*sy),1))) return; if (!(sy->abbr=strdupMemBlock(conf,fname))) return; sy->next=conf->sayas; conf->sayas=sy; } sy->res=c; return; } if (!strcmp(line,"recognize")) { char *fname=c; struct dumbtts_abbr *sy; while (c && !isspace(*c)) c++; if (!*c) return; *c++=0; while (*c && isspace(*c)) c++; if (!*c) return; if (!is_good_recog(c)) return; if (!(c=strdupMemBlock(conf,c))) return; if (!(sy=allocMemBlock(conf,sizeof(*sy),1))) return; if (!(sy->abbr=strdupMemBlock(conf,fname))) return; sy->next=conf->recog; conf->recog=sy; sy->res=c; return; } if (!strcmp(line,"format")) { char *fname=c; int is_dflt=0; int val; struct dumbtts_format *df; struct dumbtts_format_item *dfi; while (c && !isspace(*c)) c++; if (!*c) return; *c++=0; while (*c && isspace(*c)) c++; if (!*c) return; if (!strncmp(c,"default",7)) { is_dflt=1; c+=7; } else { if (!isdigit(*c)) return; val=strtol(c,&c,10); } if (!*c || !isspace(*c)) return; while (*c && isspace(*c)) c++; if (!*c) return; c=local_conv(c,conf);if (!c) return; for (df=conf->formats;df;df=df->next) if (!strcmp(df->name,fname)) break; if (!df) { df=allocMemBlock(conf,sizeof(*df),1); if (!df) return; if (!(df->name=strdupMemBlock(conf,fname))) return; df->next=conf->formats; conf->formats=df; df->dfi=NULL; df->deflt=NULL; } c=strdupMemBlock(conf,c); if (!c) return; if (is_dflt) { df->deflt=c; } else { for (dfi=df->dfi;dfi;dfi=dfi->next) if (dfi->value==val) break; if (!dfi) { dfi=allocMemBlock(conf,sizeof(*dfi),1); if (!dfi) return; dfi->value=val; dfi->format=c; dfi->next=df->dfi; df->dfi=dfi; } else { dfi->format=c; } } return; } if (!strcmp(line,"choice")) { char *fname=c; int val; struct dumbtts_choice *df; struct dumbtts_format_item *dfi; while (c && !isspace(*c)) c++; if (!*c) return; *c++=0; while (*c && isspace(*c)) c++; if (!*c) return; if (!isdigit(*c)) return; val=strtol(c,&c,10); if (!*c || !isspace(*c)) return; while (*c && isspace(*c)) c++; if (!*c) return; for (df=conf->choices;df;df=df->next) if (!strcmp(df->name,fname)) break; if (!df) { df=allocMemBlock(conf,sizeof(*df),1); if (!df) return; if (!(df->name=strdupMemBlock(conf,fname))) return; df->next=conf->choices; conf->choices=df; df->dfi=NULL; } c=strdupMemBlock(conf,c); if (!c) return; dfi=allocMemBlock(conf,sizeof(*dfi),1); if (!dfi) return; dfi->value=val; dfi->format=c; dfi->next=df->dfi; df->dfi=dfi; return; } if (!strcmp(line,"form")) { char *stype=c; int type; int forma; struct dumbtts_expr *e; struct dumbtts_formex *fe; while (*c && !isspace(*c)) c++; if (!*c) return; *c++=0; if (!strcmp(stype,"int")) type=0; else if (!strcmp(stype,"float")) type=1; else return; while (*c && isspace(*c)) c++; if (!*c || !isdigit(*c)) return; forma=strtol(c,&c,10); if (!*c || !isspace(*c)) return; while (*c && isspace(*c)) c++; if (!*c) return; if (!strcmp(c,"default")) { conf->defforms[type]=forma; return; } e=read_rc_expr(conf,&c,4); if (!e || *c) return; fe=allocMemBlock(conf,sizeof(*fe),1); fe->type=type; fe->forma=forma; fe->expr=e; fe->next=conf->formex; conf->formex=fe; return; } if (!strcmp(line,"unit")) { struct dumbtts_unit *u; char *uname=c; while (*c && !isspace(*c)) c++; if (!*c) return; *c++=0; while (*c && isspace(*c)) c++; if (!*c) return; c=local_conv(c,conf);if (!c) return; if (!(u=allocMemBlock(conf,sizeof(*u),1))) return; if (!(u->unit=strdupMemBlock(conf,uname))) return; if (!(u->result=strdupMemBlock(conf,c))) return; u->next=conf->units; conf->units=u; return; } } static int do_recognize_item(struct dumbtts_conf *conf,char *patr,int wnc,char **str,struct recog_param *rp,int *rcount) { char *c,*d; wchar_t wc,pc,zero; int pname,ndits,range1,range2,mode,val; int chrget() { if (wnc) { int n=wnc; wnc=0; return n; } return get_unichar(c,&c,0); } int chrgot() { if (wnc) { int n=wnc; wnc=0; d=c; return n; } return get_unichar(c,&d,0); } int nchar() { if (wnc) return wnc; return get_unichar(c,NULL,0); } int chcom(char *a,char *b) { while (*a) if (*a++!=*b++) return 0; if (*b != '}') return 0; return 1; } int cmwrd(char *fmat) { char *dx=c; wchar_t wxc=wnc; wchar_t px,sx; for (;*fmat;) { px=get_unichar(fmat,&fmat,0); if (!px) return 0; if (wxc) { sx=wxc; wxc=0; } else { sx=get_unichar(dx,&dx,0); } if (!sx) return 0; if (isfupper(px)) { if (sx != px) return 0; } else { if (toflower(sx)!=px) return 0; } } sx=get_unichar(dx,NULL,0); if (sx && isfalnum(sx)) return 0; c=dx; return 1; } if (rcount) *rcount=0; c=*str; while (*patr) { pc=get_unichar(patr,&patr,0); if (!pc) return 0; if (isfspace(pc)) { wc=chrget(); if (!wc) return 0; if (!isfspace(wc)) return 0; for (;;) { wc=chrgot(); if (!wc) return 0; if (!isfspace(wc)) break; c=d; } continue; } if (pc==':' || pc=='.' || pc=='/' || pc==',') { wc=chrget(); if (pc != wc) return 0; continue; } if (pc=='_') { /* optional space */ for (;;) { wc=chrgot(); if (!wc) return 0; if (!isfspace(wc)) break; c=d; } continue; } if (pc=='-') { /* any dash */ wc=chrget(); if (wc != '-') return 0; continue; } if (pc=='"') { for (;;) { pc=get_unichar(patr,&patr,0); if (!pc) return 0; if (pc=='"') break; if (pc=='\\') { pc=get_unichar(patr,&patr,0); if (!pc) return 0; } wc=chrget(); if (!wc) return 0; if (isflower(pc)) { if (pc != toflower(wc)) return 0; } else { if (pc != wc) return 0; } } continue; } if (pc<'a' || pc>'z') return 0; pname=pc; ndits=0; range1=0; range2=0; if (*patr++!='{') return 0; if (*patr=='c') { struct dumbtts_choice *dc; struct dumbtts_format_item *dfi; patr++; for (dc=conf->choices;dc;dc=dc->next) if (chcom(dc->name,patr)) break; if (!dc) return 0; patr=strchr(patr,'}'); if (!patr) return 0; patr++; for (dfi=dc->dfi;dfi;dfi=dfi->next) if (cmwrd(dfi->format)) break; if (!dfi) return 0; if (rp && rcount) { rp[*rcount].name=pname; rp[(*rcount)++].value=dfi->value; } continue; } if (isdigit(*patr)) ndits=(*patr++)-'0'; if (*patr=='d') mode=0; else if (*patr=='r') mode=1; else if (*patr=='x') mode=2; else return 0; patr++; if (isdigit(*patr)) { range1=strtol(patr,&patr,10); if(*patr++!='-') return 0; if (!*patr || !isdigit(*patr)) return 0; range2=strtol(patr,&patr,10); } if (*patr++!='}') return 0; switch(mode) { case 0: /* decimal */ if (ndits) { int i; if (wnc) { if (wnc<'0' || wnc>'9') return 0; ndits--; } for (i=0;i'9') return 0; } else { if (!*c || !isdigit(*c)) return 0; } } if (wnc) { val=wnc-'0'; wnc=0; for (;*c && isdigit(*c);c++) { val=10*val+(*c)-'0'; } } else val=strtol(c,&c,10); break; case 2: /* hexadecimal */ if (ndits) { int i; if (wnc) { if (wnc>0x7f || !isxdigit(wnc)) return 0; ndits--; } for (i=0;i0x7f || !isxdigit(wnc)) return 0; } else { if (!*c || !isxdigit(*c)) return 0; } } val=strtol(c,&c,16); break; default: /* roman */ pc=chrget(); if (!pc) return 0; zero=0; val=roman(pc,&zero,c,&c,NULL); break; } if (valrange2) return 0; if (rp && rcount) { rp[*rcount].name=pname; rp[(*rcount)++].value=val; } } if (*c=='.' || *c==':') { d=c+1; if (*d) { pc=get_unichar(d,NULL,0); if (pc && !isfspace(pc)) return 0; } } else { pc=nchar(); if (pc && isfalnum(pc)) return 0; } *str=c; return 1; } static char *do_recognize(struct dumbtts_conf *conf,wchar_t wc,char **str,struct recog_param *rp,int *rcount) { struct dumbtts_abbr *rc; for (rc=conf->recog;rc;rc=rc->next) { if (do_recognize_item(conf,rc->res,wc,str,rp,rcount)) return rc->abbr; } return NULL; } void do_format(struct dumbtts_conf *conf,char *fname,struct recog_param *rp,int rcount,char *outbuf) { struct dumbtts_abbr *df; char *fmt; for (df=conf->sayas;df;df=df->next) if (!strcmp(df->abbr,fname)) break; if (!df) { int i; for (i=0;ires; *outbuf=0; while (*fmt) { int val,i;char *fstr; if (isspace(*fmt)) { while (*fmt && isspace(*fmt)) fmt++; if (!*fmt) break; *outbuf++=' '; continue; } if (*fmt=='"') { fmt++; while(*fmt) { if (*fmt=='"') break; if (*fmt=='\\') { fmt++; if (!*fmt) break; } *outbuf++=*fmt++; } fmt++; continue; } if (!isalpha(*fmt)) break; val=0; for (i=0;iformats;dfo;dfo=dfo->next) if (!strcmp(dfo->name,fbuf)) break; if (dfo) { if (dfo->deflt) fstr=dfo->deflt; for (dfi=dfo->dfi;dfi;dfi=dfi->next) if (dfi->value == val) { fstr=dfi->format; break; } } } sprintf(outbuf,fstr,val); while(*outbuf) outbuf++; } *outbuf=0; } /* units At now only integer values are implemented! */ #define PFT_INT 1 #define PFT_INTVAR 2 #define PFT_FLT 3 #define PFT_FLTVAR 4 #define PFT_EXPR 5 #define PFO_ADD 1 #define PFO_SUB 2 #define PFO_DIV 3 #define PFO_MUL 4 #define PFO_MOD 5 #define PFO_EQU 6 #define PFO_NE 7 #define PFO_GT 8 #define PFO_GE 9 #define PFO_LT 10 #define PFO_LE 11 #define PFO_AND 12 #define PFO_OR 13 #define PFO_NOT 14 #define PFO_NEG 15 static char *rc_opstrs[]={ "!-","+-","*/%","<>=","&|"}; static int rc_is_operator(char **str,int level) { if (!**str) return 0; return strchr(rc_opstrs[level],**str)?1:0; } static int rc_get_operator(char **str) { char znak; int i; static char *opstr=" +-/*%=_>_<_&|"; znak=*(*str)++; if (znak=='!') { if (**str == '=') { (*str)++; return PFO_NE; } return 0; } else if (znak=='>') { if (**str == '=') { (*str)++; return PFO_GE; } } else if (znak=='<') { if (**str == '=') { (*str)++; return PFO_LE; } } for (i=1;opstr[i];i++) if (opstr[i]==znak) return i; return 0; } #define desp while(**str && isspace(**str)) (*str)++ static struct dumbtts_expr *read_rc_item(struct dumbtts_conf *conf,char **str) { struct dumbtts_expr *expr; desp; if (!**str) return NULL; if (**str=='(') { (*str)++; desp; expr=read_rc_expr(conf,str,4); if (!expr) return NULL; if (**str !=')') return NULL; (*str)++; desp; return expr; } if (**str=='!') { (*str)++; desp; expr=alloc_expr(conf); expr->type=PFT_EXPR; expr->operator=PFO_NEG; expr->u.ops[0]=read_rc_item(conf,str); if (!expr->u.ops[0]) return NULL; return expr; } if (**str == '-') { (*str)++; if (!**str) return NULL; if (isdigit(**str)) { expr=read_rc_item(conf,str); if (!expr) return NULL; if (expr->type == PFT_INT) expr->u.ival=-expr->u.ival; else if (expr->type == PFT_FLT) expr->u.fval=-expr->u.fval; else return NULL; return expr; } desp; expr=alloc_expr(conf); expr->type=PFT_EXPR; expr->operator=PFO_NEG; expr->u.ops[0]=read_rc_item(conf,str); if (!expr->u.ops[0]) return NULL; return expr; } if (isdigit(**str)) { char *c=*str; expr=alloc_expr(conf); while (*c && isdigit(*c)) c++; if (*c!='.') { expr->type=PFT_INT; expr->u.ival=strtol(*str,str,10); desp; return expr; } expr->type=PFT_FLT; expr->u.fval=strtod(*str,str); desp; return expr; } if (**str=='d') { (*str)++; desp; expr=alloc_expr(conf); expr->type=PFT_INTVAR; return expr; } if (**str=='f') { (*str)++; desp; expr=alloc_expr(conf); expr->type=PFT_FLTVAR; return expr; } return NULL; } static struct dumbtts_expr *read_rc_expr(struct dumbtts_conf *conf,char **str,int level) { struct dumbtts_expr *expr,*eit; if (!level) return read_rc_item(conf,str); expr=read_rc_expr(conf,str,level-1); if (!expr) return NULL; for (;;) { if (!rc_is_operator(str,level)) return expr; eit=alloc_expr(conf); eit->type=PFT_EXPR; eit->operator=rc_get_operator(str); eit->u.ops[0]=expr; expr=eit; if (!(eit->u.ops[1]=read_rc_expr(conf,str,level-1))) return NULL; } } #undef desp /* emiter */ static int unit_compare(char **str,char *patr) { wchar_t wu,wp; char *c; c=*str; while (*patr) { wp=get_unichar(patr,&patr,0); if (!wp) return 0; wu=get_unichar(c,&c,0); if (wp !=wu) return 0; } if (!*c) { *str=c; return 1; } wu=get_unichar(c,NULL,0); if (!isfalnum(wu)) { *str=c; return 1; } return 0; } #define di(e) dumbtts_compute_iexpr(e,v) int dumbtts_compute_iexpr(struct dumbtts_expr *e,int v) { int i; switch(e->type) { case PFT_INT: return e->u.ival; case PFT_INTVAR: return v; case PFT_EXPR: switch(e->operator) { case PFO_ADD: return di(e->u.ops[0])+di(e->u.ops[1]); case PFO_SUB: return di(e->u.ops[0])-di(e->u.ops[1]); case PFO_DIV: i=di(e->u.ops[1]); if (!i) return 0; return di(e->u.ops[0])/i; case PFO_MUL: return di(e->u.ops[0])*di(e->u.ops[1]); case PFO_MOD: i=di(e->u.ops[1]); if (!i) return 0; return di(e->u.ops[0])%i; case PFO_EQU: return (di(e->u.ops[0])==di(e->u.ops[1]))?1:0; case PFO_NE: return (di(e->u.ops[0])!=di(e->u.ops[1]))?1:0; case PFO_GT: return (di(e->u.ops[0])>di(e->u.ops[1]))?1:0; case PFO_GE: return (di(e->u.ops[0])>=di(e->u.ops[1]))?1:0; case PFO_LT: return (di(e->u.ops[0])u.ops[1]))?1:0; case PFO_LE: return (di(e->u.ops[0])<=di(e->u.ops[1]))?1:0; case PFO_AND: return di(e->u.ops[0])?di(e->u.ops[1]):0; case PFO_OR: return di(e->u.ops[0])?1:di(e->u.ops[1]); case PFO_NOT: return di(e->u.ops[0])?0:1; case PFO_NEG: return -di(e->u.ops[0]); } } return 0; } static int compute_form_imode(struct dumbtts_conf *conf,int ival) { struct dumbtts_formex *fe; for (fe=conf->formex;fe;fe=fe->next) { if (fe->type) continue; if (dumbtts_compute_iexpr(fe->expr,ival)) return fe->forma; } return conf->defforms[0]; } static int do_units(struct dumbtts_conf *conf,wchar_t wc,char **str,char *outbuf) { char *c,*d,*eos;int ival,i,forma,typ; struct dumbtts_unit *u; wchar_t ws; if (wc>0x7f || !isdigit(wc) || !conf->units) return 0; ival=wc-'0'; c=*str; for (i=0;i<6 && *c && isdigit(*c);i++) { ival=(10*ival)+(*c++)-'0'; } typ=0; if (*c=='.') { c++; if (!isdigit(*c)) return 0; while(*c && isdigit(*c)) c++; typ=1; } if (*c && isdigit(*c))return 0; eos=c; while (*c && isspace(*c)) c++; for (u=conf->units;u;u=u->next) if (unit_compare(&c,u->unit)) break; if (!u) return 0; if (!typ) { forma=compute_form_imode(conf,ival); } else { forma=conf->defforms[1]; } if (!forma) return 0; if (!typ) { sprintf(outbuf,"%d ",ival); outbuf+=strlen(outbuf); } else { *outbuf++=wc; while (*strresult; while (forma>1) { forma--; d=strchr(c,'|'); if (!d) break; c=d+1; } while (*c && *c!='|') *outbuf++=*c++; *outbuf++=0; return 1; } libdumbtts-0.3.2/src/local.h0000644000076400017500000000634211406150721015535 0ustar ethanakethanak/* * libdumbtts - dumb synthesizers helper library * Copyright (C) Bohdan R. Rau 2008 * * libdumbtts 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. * * libdumbtts 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 libdumbtts. If not, write to: * The Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301, USA. */ #ifndef DUMBTTS_LOCAL_H #define DUMBTTS_LOCAL_H #define MEMO_BLOCK_SIZE 8160 struct dumbtts_char { char *name; char *prono; }; struct memblock { struct memblock *next; int firstfree; int lastfree; char block[MEMO_BLOCK_SIZE]; }; struct dumbtts_keyname { struct dumbtts_keyname *next; char *key; char *trans; }; struct dumbtts_charlist { struct dumbtts_charlist *next; wchar_t wc; char *name; char *prono; }; struct dumbtts_cyrtrans { struct dumbtts_cyrtrans *next; short c1; short c2; char *translit; }; struct dumbtts_abbr { struct dumbtts_abbr *next; char *abbr; char *res; }; struct dumbtts_rconf { int mode; int nchar; wchar_t wc[128]; char ch[128]; }; struct dumbtts_intpair { struct dumbtts_intpair *next; int v1; int v2; }; struct dumbtts_format_item { struct dumbtts_format_item *next; int value; char *format; }; struct dumbtts_format { struct dumbtts_format *next; char *name; char *deflt; struct dumbtts_format_item *dfi; }; struct dumbtts_choice { struct dumbtts_choice *next; char *name; struct dumbtts_format_item *dfi; }; struct dumbtts_arth_item { char mode; union { int d; struct dumbtts_arth_item *it; } v; }; struct dumbtts_diction_letter { struct dumbtts_diction_letter *nlet[32]; //nastpna litera struct dumbtts_diction_letter *parent; struct dumbtts_abbr *patterns; }; struct dumbtts_expr { char type; char operator; union { int ival; double fval; struct dumbtts_expr *ops[2]; } u; }; struct dumbtts_formex { struct dumbtts_formex *next; short type; short forma; struct dumbtts_expr *expr; }; struct dumbtts_unit { struct dumbtts_unit *next; char *unit; char *result; }; struct dumbtts_conf { int flags; struct dumbtts_keyname *keynames; struct dumbtts_charlist *charlist; struct dumbtts_cyrtrans *cyrtrans; struct dumbtts_abbr *abbrev; struct dumbtts_char chartable[0x180]; char *cap; char *caplet; char *lig; char *caplig; char *sym; char *let; char *ill; char *dia[16]; struct dumbtts_rconf rconf; struct memblock *memo; int roman_minlen; int roman_maxval; struct dumbtts_intpair *roman_ignore; struct dumbtts_abbr *dic; struct dumbtts_format *formats; struct dumbtts_choice *choices; struct dumbtts_abbr *recog; struct dumbtts_abbr *sayas; struct dumbtts_formex *formex; short defforms[2]; struct dumbtts_unit *units; struct dumbtts_diction_letter *dics[32]; }; #include "libdumbtts.h" #endif libdumbtts-0.3.2/src/libdumbtts_dic.c0000644000076400017500000001332511406150721017425 0ustar ethanakethanak /* configuration reader */ static void get_diction(struct dumbtts_conf *conf,char *str,char *repl) { int litera,n; struct dumbtts_diction_letter *dl,*paren; struct dumbtts_abbr *pair; char *c=str; struct dumbtts_diction_letter **dc=conf->dics; dl=NULL; for (;;) { litera=get_unichar(c,&c,0); if (!litera || !isfalnum(litera)) break; litera=toflower(litera); n=litera & 31; paren=dl; dl=dc[n]; if (!dl) { if (!(dl=allocMemBlock(conf,sizeof(*dl),1))) return; memset(dl,0,sizeof(*dl)); dc[n]=dl; dl->parent=paren; } dc=dl->nlet; } if (!dl) return; pair=allocMemBlock(conf,sizeof(*pair),1); if (!pair) return; if (!(pair->abbr=strdupMemBlock(conf,str))) return; if (!(pair->res=strdupMemBlock(conf,repl))) return; pair->next=dl->patterns; dl->patterns=pair; } void dumbtts_LoadDictionary(struct dumbtts_conf *conf,char *fname) { FILE *f; char buf[1024]; char *line,*c; struct dumbtts_abbr *dic; if (!conf) return; f=fopen(fname,"r"); if (!f) return; while (fgets(buf,1024,f)) { int bra,ok;wchar_t pc; c=strstr(buf,"//"); if (c) *c=0; line=line_trim(buf); if (!*line) continue; c=line; bra=ok=0; while (*c) { char *d; pc=get_unichar(c,&d,0); if (!pc) break; if (isfspace(pc)) { if (!bra) { ok=1; *c=0; c=d; } break; } c=d; if (pc=='(') { if (bra) break; bra=2; continue; } if (pc==')') { if (bra!=2) break; bra=0; pc=get_unichar(c,NULL,0); if (isfspace(pc)) continue; if (pc < 0x7f && strchr("+-_",pc)) continue; break; } if (pc=='|') { if (bra != 2) break; continue; } if (pc=='[') { if (bra) break; bra=1; continue; } if (pc==']') { if (bra != 1) break; bra=0; continue; } } if (!ok) continue; c=local_conv(c,conf); if (!c || !*c) continue; if (isdigit(*line)) { dic=allocMemBlock(conf,sizeof(*dic),1); if (!dic) break; if (!(dic->abbr=strdupMemBlock(conf,line))) break; if (!(dic->res=strdupMemBlock(conf,c))) break; dic->next=conf->dic; conf->dic=dic; continue; } get_diction(conf,line,c); } fclose(f); } /* matcher */ static int dic_compare_word(struct dumbtts_abbr *da,char *str,char **res,wchar_t wc,char *db,struct dumbtts_conf *conf) { char *pat=da->abbr; int nmatch,n; char *matches[10]; wchar_t pc,sc; char *c; int chrget(char *str,char **outstr) { int n; if (wc) { n=wc; wc=0; return n; } return get_unichar(str,outstr,0); } nmatch=0; for (;;) { if (!*pat) { /* end of pattern */ if (!*str) break; sc=get_unichar(str,NULL,0); if (sc && !isfalnum(sc)) break; return 0; } pc=get_unichar(pat,&pat,0); if (pc=='_') { /* optional space */ for (;*str;) { sc=chrget(str,&c); if (!sc) return 0; if (!isfspace(sc)) break; str=c; } continue; } if (pc=='+') { /* space */ if (!*str) return 0; sc=chrget(str,&str); if (!sc || !isfspace(sc)) return 0; for (;*str;) { sc=chrget(str,&c); if (!sc) return 0; if (!isfspace(sc)) break; str=c; } continue; } if (pc=='[') { sc=chrget(str,&str); if (!sc) return 0; while (*pat) { pc=get_unichar(pat,&pat,0); if (pc==']') return 0; /* not found */ if (isflower(pc)){ if (pc==toflower(sc)) break; } else { if (pc == sc) break; } } if (pc != ']') { pat=strchr(pat,']'); if (!pat) return 0; } pat++; continue; } if (pc=='`') { sc=chrget(str,&c); if (sc=='\'') str=c; continue; } if (pc != '(') { sc=chrget(str,&str); if (isflower(pc)) sc=toflower(sc); if (sc != pc) return 0; continue; } if (nmatch>=10) return 0; /* too many matches */ for (;;) { char *pstr,*sstr; wchar_t owc; int found; if (!*pat) return 0; pstr=pat; sstr=str; owc=wc; found=0; for (;;) { pc=get_unichar(pat,&pat,0); if (!pc) return 0; if (pc=='|' || pc==')') { found=1; break; } sc=chrget(sstr,&sstr); if (isflower(pc)) sc=toflower(sc); if (sc != pc) break; } if (found) { str=sstr; if (pc!=')') { pat=strchr(pat,')'); if (!pat) return 0; pat++; } matches[nmatch++]=pstr; break; } while (*pat && *pat != '|' && *pat !=')') pat++; if (*pat != '|') return 0; pat++; wc=owc; } } c=da->res; n=0; while (*c) { int pos; char *d; wchar_t zn; if (*c != '%') { *db++=*c++; continue; } c++; if (isdigit(*c)) { pos=(*c)-'1'; c++; } else pos=n++; if (pos<0 || pos >=nmatch) continue; d=matches[pos]; for (;;) { zn=get_unichar(d,&d,0); if (!zn || zn=='|' || zn==')') break; if (zn<=0x7f) *db++=zn; else { int i; for (i=0;irconf.nchar;i++) if (conf->rconf.wc[i]==zn) break; if (irconf.nchar) *db++=conf->rconf.ch[i]; } } } *db=0; *res=str; return 1; } static struct dumbtts_diction_letter *findmat_dic(struct dumbtts_diction_letter **dc,wchar_t wc,char *str) { int n; struct dumbtts_diction_letter *dl; n=toflower(wc) & 31; if (!(dl=dc[n])) return NULL; for (;;) { n=get_unichar(str,&str,0); if (!n || !isfalnum(n)) return dl; n=toflower(n) & 31; if (!dl->nlet[n]) return dl; dl=dl->nlet[n]; } } static int get_dict(struct dumbtts_conf *conf,char **str,wchar_t wc,char *dictbuf) { struct dumbtts_abbr *da; char *c; struct dumbtts_diction_letter *dl; if (wc < 0x7f && isdigit(wc)) { for (da=conf->dic;da;da=da->next) { if (dic_compare_word(da,*str,&c,wc,dictbuf,conf)) { *str=c; return 1; } } return 0; } dl=findmat_dic(conf->dics,wc,*str); while(dl) { for (da=dl->patterns;da;da=da->next) { if (dic_compare_word(da,*str,&c,wc,dictbuf,conf)) { *str=c; return 1; } } dl=dl->parent; } return 0; } libdumbtts-0.3.2/src/Makefile0000644000076400017500000000227311410060016015721 0ustar ethanakethanakINCDIR=/usr/include LIBDIR=/usr/lib DATADIR=/usr/share/dumbtts RELEASE = 3.1 LIB_NAME = libdumbtts.so LIB_VERSION = 0 LIBTAG = $(LIB_VERSION).$(RELEASE) INSTALL = /usr/bin/install LN_SF = /bin/ln -sf MKDIR = mkdir -p C = gcc PIC = ARCH = $(shell uname -m) ifeq "$(ARCH)" "x86_64" PIC = -fPIC endif SRCS = libdumbtts.c libdumbtts.h libdumbtts_re.c libdumbtts_dic.c local.h OBJS = libdumbtts.o all: $(LIB_NAME) mv $(LIB_NAME) $(LIB_NAME).$(LIBTAG) $(OBJS): $(SRCS) $(C) $(PIC) -o $(OBJS) -c -Wall libdumbtts.c $(LIB_NAME): $(OBJS) $(C) $(PIC) -shared -Wl,-soname,$(LIB_NAME).$(LIB_VERSION) -o $@ $(OBJS) clean: rm -f *.o *.a *~ $(LIB_NAME).$(LIBTAG) ../conf/*~ install: all # Create directories rm -rf $(DESTDIR)$(DATADIR) $(MKDIR) $(DESTDIR)$(LIBDIR) $(MKDIR) $(DESTDIR)$(INCDIR) $(MKDIR) $(DESTDIR)$(DATADIR) # Install shared library $(INSTALL) -m 755 $(LIB_NAME).$(LIBTAG) $(DESTDIR)$(LIBDIR) $(LN_SF) $(LIB_NAME).$(LIBTAG) $(DESTDIR)$(LIBDIR)/$(LIB_NAME).$(LIB_VERSION) $(LN_SF) $(LIB_NAME).$(LIB_VERSION) $(DESTDIR)$(LIBDIR)/$(LIB_NAME) # Install development headers $(INSTALL) -pm 644 libdumbtts.h $(DESTDIR)$(INCDIR) # Install data files cp -prf ../conf/* $(DESTDIR)$(DATADIR) libdumbtts-0.3.2/INSTALL0000644000076400017500000000047411406150721014534 0ustar ethanakethanakThere is a simple instalation instruction. 1) unpack libdumbtts-0.x.y.tar.gz with command: tar -xzf libdumbtts-0.x.y.tar.gz (where 0.x.y is version of library) 2) cd libdumbtts-0.x.y/src 3) make 4) make install 5) ldconfig You must be root to perform steps 4 and 5. Bohdan R. Rau libdumbtts-0.3.2/README0000644000076400017500000001305511406150721014362 0ustar ethanakethanakLIBDUMBTTS Libdumbtts is library extending capabilities of "dumb synthesizers", which can say only input text including characters of language alphabet. This library enriches: 1) translated key names 2) saying single characters; it recognizes all characters between 0x20 and 0x17f. In case of letters, it is possible to recognize capital letters by adding prefix 'capital' or by using function returning information if said letter is capital (helpful when you're using sound icon prefix or pitch change). Accented letters are pronounced by connecting character and name of accent (ie. "o acute" for '') 3) converting input unicode text to one-byte synthesizer encoding. Pronunciation of all letters is configurable. This library implements also simple transliteration method of cyryllic (for characters range: 0x400 - 0x47f). Library is projected to be used by Ivona synthesizer and speech-dispatcher. On the other side, it should be as flexible as it can be to generate output texts for every other synthesizer. METHODS: struct dumbtts_conf *dumbtts_TTSInit(char *lang); Initializes dumbtts_conf structure and reads config file. Configuration files should be placed in /usr/share/dumbtts/xx.conf, where xx is two-character code of language. After reading this file, function is trying to search /etc/dumbtts/xx.conf and then ~/.dumbtts_xx.conf file and corrects elements read before. It returns allocated memory, which cannot be freed by free() function! void dumbtts_TTSFree(struct dumbtts_conf *conf); It frees memory allocated by dumbtts_TTSConf. int dumbtts_WCharString( struct dumbtts_conf *conf, wchar_t wc, char *outbuf, int len, int capMode, int *isCap); int dumbtts_CharString( struct dumbtts_conf *conf, char *ch, char *outbuf, int len, int capMode, int *isCap); It pronounces character (in case of CharString, first character of input). Output text is allocated in area pointed by parameter 'outbuf', sized at least 'len' of bytes. 'capMode' parameter indicates way of announcing capital letters. It can be: 0 - no capital letters announcing 1 - announcing capital letter by application 2 - preceding capital letter by word 'capital' (or language-specific equivalent) At this moment, values 1 and 0 works in the same way. isCap parameter should include pointer to integer variable or NULL. If not NULL, value of variable will be set to 1 in case of capital letter and to 0 in case of other character. Returns: If conversion succeeds, function returns 0. If outbuf parameter was NULL or given size of pointed area is to small to fit converted text, it returns minimal size of area. In case of error, it returns negative value. int dumbtts_KeyString( struct dumbtts_conf *conf, char *str, char *outbuf, int len, int capMode, int *isCap); Converts name of key (eg. "space", "underscore") included in 'str' to text translated to local language and pronouncable by synthesizer. Meaning of parameters and returning value - the same as for CharString. int dumbtts_GetString( struct dumbtts_conf *conf, char *str, char *outbuf, int len, int punctMode, char *punctChars, char *punctLeave); Converts given input to form pronouncable by synthesizer. punctMode parameter can be set by three possible values : 0 - punctuation characters are ignored 1 - punctuation is limited to characters given in punctChars parameter 2 - all punctuation characters are spoken. punctLeave parameter is input containing characters, which have to be left unchanged in output, regardless the punctMode value - they are basic punctuation characters controlling pronounciation. For Ivona, value of input should be ".,!?;:". Meaning of rest parameters and returning value - the same as for CharString. CONFIGURATION FILES File is divided into sections. Name of each is enclosed in square brackets. During parsing, first four letters of name are read. Empty lines are ignored. Comments are preceded by "//" string. Files have to be in UTF-8. For examples - see pl.conf file. Meaning of sections: SECTION [clist] Includes declaration of all letters recognized by synthesizer by : number character where "number" jest representation of character in encoding used by synthesizer and "character" is single small letter. SECTION [spell] Contains pairs character-name, used when pronouncing single characters. Character can be encoded in #number notation (decimal) or in #xnumber (hexadecimal). Read number is adequate to character code in UNICODE. Example : y igrek SECTION [pronunciation] Contains pronounciation tables for each characters used when reading texts. SECTION [diacritics] Contains names of diacriticts and some reserved words. ill illegal // illegal symbol etc. let letter cap capital caplet capital letter // if not same as 'cap' 'let' lig ligature caplig capital ligature // if not same as 'cap' 'lig' sym symbol ced cedilla bre breve dot dot above dia diaeresis // umlaut acu acute gra grave ac2 double acute // hungarumlaut cir circumflex mac macron rin ring // above str stroke ogo ogonek til tilde car caron // hacek SECTION [keys] Includes pairs name - translation used when reading keys. SECTION [cyrillic] Contains pairs characters - transliteration used when reading cyryllic. "Characters" are single single letter or two small letters in cyryllic, transliteration can be empty. SECTION [abbreviations] Contains pairs abbreviation - pronunciation. Abbreviation may be followed by dot (to prevent pass dot to synthesizer). Please send every suggestion and bugfix requests to: Bohdan R. Rau libdumbtts-0.3.2/README_pl0000644000076400017500000001674411406150721015065 0ustar ethanakethanakLIBDUMBTTS Libdumbtts to biblioteka, rozszerzająca możliwości tzw. "głupich syntezatorów", które potrafią jedynie wypowiedzieć podany na wejściu napis zawierający wyłącznie znaki z alfabetu języka, którym operuje syntezator. Wzbogaca możliwości syntezatora o: 1) tłumaczone nazwy klawiszy. 2) Wymawianie pojedynczych znaków. Rozpoznaje wszystkie znaki z zakresu 0x20-0x17f. W przypadku liter możliwe jest rozpoznawanie wielkich liter zarówno poprzez poprzedzenie litery prefiksem 'wielka', jak i zasygnalizowanie funkcji wywołującej że wymawiana jest wielka litera (przydatne przede wszystkim, gdy poprzedzamy wielkie litery ikona dźwiękową). Akcentowane litery są wymawiane poprzez złożenie litery i nazwy akcentu (np. 'č' dla języka polskiego może być wymawiane jak 'ce z haczkiem'). 3) Konwersja wprowadzonego tekstu w kodowaniu UTF-8 do jednobajtowego kodowania syntezatora. Wymowa wszystkich liter jest konfigurowalna (np "maček" w języku polskim będzie wymawiane jako "maczek"). Zaimplementowane jest również prosta metoda transliteracji cyrylicy (dla znaków z zakresu 0x400 - 0x47f). Biblioteka zaprojektowana została do obsługi syntezatora Ivona i współpracy ze speech-dispatcherem, jednak powinna być na tyle uniwersalna, aby możliwe było generowanie tekstów dla dowolnego syntezatora. FUNKCJE: struct dumbtts_conf *dumbtts_TTSInit(char *lang); Inicjalizuje strukturę dumbtts_conf oraz wczytuje plik danych. Pliki danych znajduje się w /usr/share/dumbtts/xx.conf. gdzie "xx" to dwuliterowy kod języka. Po wczytaniu tego pliku funkcja próbuje znaleźć kolejno pliki /etc/dumbtts/xx.conf oraz ~/.dumbtts_xx.conf i koryguje wczytane uprzednio elementy. Zwraca nowo przydzielony obszar pamięci, który nie może być zwalniany przez free()! void dumbtts_TTSFree(struct dumbtts_conf *conf); Zwalnia pamięć przydzieloną przez dumbtts_TTSInit. int dumbtts_WCharString( struct dumbtts_conf *conf, wchar_t wc, char *outbuf, int len, int capMode, int *isCap); int dumbtts_CharString( struct dumbtts_conf *conf, char *ch, char *outbuf, int len, int capMode, int *isCap); Literuje znak (w przypadku CharString pierwszy znak napisu). Wynikowy napis umieszczany jest w obszarze wskazanym przez parametr outbuf o wielkości co naajmniej len znaków. Parametr capMode oznacza sposób oznaczania wielkich liter. Może przyjmować jedną z trzech wartości: 0 - brak oznaczania wielkich liter 1 - oznaczenie wielkiej litery przez aplikację 2 - poprzedzenie wielkiej litery słowem "capital" (lub odpowiednikiem dla konkretnego języka). Aktualnie wartość 1 i 0 mają identyczne działanie. Parametr isCap powinien zawierać wskaźnik do zmiennej typu int lub NULL. Jeśli nie jest NULL, wartość zmiennej zostanie ustawiona na 1 w przypadku wielkiej litery lub na 0 w przypadku innego znaku. Wartość zwracana: Jeśli konwersja się powiodła, zwracane jest 0. Jeśli parametr outbuf był NULL lub podana wielkość wskazanego obszaru jest zbyt mała aby pomieścić skonwertowany napis, zwracana jest minimalna potrzebna wielkość obszaru. W przypadku błędu zwracana jest wartość ujemna. int dumbtts_KeyString( struct dumbtts_conf *conf, char *str, char *outbuf, int len, int capMode, int *isCap); Konwertuje nazwę klawisza (np "space", "underscore") zawarty w str na wymawialny przez syntezator napis. Znaczenie parametrów i wartość zwracana jak dla CharString. int dumbtts_GetString( struct dumbtts_conf *conf, char *str, char *outbuf, int len, int punctMode, char *punctChars, char *punctLeave); Konwertuje podany w str napis na postać wymawialną przez syntezator. Parametr punctMode może przyjąć jedną z trzech wartości: 0 - znaki interpunkcyjne są pomijane; 1 - czytane są wyłącznie znaki interpunkcyjne podane w parametrze punctChars; 2 - czytane są wszystkie znaki interpunkcyjne. Parametr punctLeave to napis składający się ze znaków, które muszą być pozostawione w wynikowym napisie bez względu na wartość punctMode - są to podstawowe znaki interpunkcyjne sterujące wymową. Dla Ivony wartością napisu powinno być ".,!?;:" Znaczenie parametrów outbuf i len oraz wartość zwracana jak dla CharString. PLIKI DANYCH Plik podzielony jest na sekcje. Nazwa każdej sekcji ujęta jest w nawiasy kwadratowe. Przy wczytywaniu rozpoznawane są pierwsze cztery litery nazwy. Puste linie są pomijane. Komentarze rozpoczynają się od ciągu "//". Pliki muszą być w kodowaniu UTF-8. Pliki znajdujące się w /usr/share/dumbtts nie powinny być edytowane, zamiast tego należy skopiować je do katalogu /etc/dumbtts i tam nanieść konieczne poprawki. Znaczenie sekcji: SEKCJA [clist] Zawiera deklarację wszystkich liter rozpoznawanych przez syntezator w postaci: #numer znak gdzie "numer" jest reprezentacją danego znaku w kodowaniu używanym przez syntezator, "znak" jest pojedynczą małą literą. Przykładowo dla języka polskiego sekcja będzie miała postać: [clist] xB1 ą xEA ę xB6 ś xE6 ć xF1 ń xF3 ó xBC ź xBF ż xB3 ł SEKCJA [spell] Zawiera pary znak - nazwa używane przy wymawianiu pojedynczych znaków. Znak może być zakodowany w notacji #numer (dziesiętnie) lub #xnumer (szesnastkowo). Odczytany numer odpowiada kodowi znaku w UNICODE. Przykład: y igrek Sekcja [pronunciation] Zawiera tabele wymowy poszczególnych znaków przy czytaniu tekstów. Przykłady: ń ń č cz SEKCJA [diacritics] Zawiera nazwy modyfikatorów oraz kilka słów zastrzeżonych. ill nielegalny // nielegalny symbol itp. let litera // przed literą czytaną numerycznie cap wielkie // przed pojedynczą wielką literą caplet wielka litera // przed wielką literą czytaną numerycznie lig ligatura // przed ligaturą caplig wielka ligatura // przed wielką ligaturą sym znak // przed pozostałymi znakami czytanymi numerycznie ced cedilla // cedilla bre brewis // breve dot z kropką // dot above dia umlałt // diaeresis, umlaut acu ostre // acute gra ciężkie // grave ac2 hungarumlałt // double acute cir z daszkiem // circumflex mac nadkreślone // macron rin z kółkiem // ring above str skreślone // stroke ogo z ogonkiem // ogonek til z tyldą // tilde car z haczkiem // caron, hacek SEKCJA [keys] Zawiera pary nazwa - tłumaczenie przy odczytywaniu klawiszy. Przykład: space spacja underscore podkreślenie double-quotes cudzysłów SEKCJA [cyrillic] Zawiera pary znaki - transliteracja przy czytaniu cyrylicy. "Znaki" to jedna lub dwie małe litery w cyrylicy, transliteracja może być pusta. SEKCJA [roman] Zawiera konfigurację konwersji liczb rzymskich: minlen minimalna długość liczby rzymskiej maxval największa liczba interpretowana jako rzymska ignore te liczby nie będą interpretowane jako rzymskie. to ciąg zapisów typu: n1-n2 (wartości od n1 do n2 nie będą interpretowane jako rzymskie) nn (ta wartośc nie będzie interpretowana jako rzymska) Liczby mogą być podawane w notacji rzymskiej lub arabskiej Przykład: ignore 100-200 300-1900 XL LX ignore reset niweluje działanie poprzednich linii "ignore" (przydatne we własnych plikach konfiguracyjnych) SEKCJA [dictionary] Zawiera linie zawierające ścieżki do plików słownika: path /ścieżka/do/słownika (opisy słownika - todo) SEKCJA [formats] Zawiera formatowania czytania dat, godzin oraz liczb mianowanych (todo) Wszelkie sugestie i poprawki mile widziane. Bohdan R. Rau