eSpeak NG is an open source speech synthesizer that supports more than hundred languages and accents.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

tr_languages.cpp 65KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670
  1. /***************************************************************************
  2. * Copyright (C) 2005 to 2011 by Jonathan Duddington *
  3. * email: [email protected] *
  4. * *
  5. * This program is free software; you can redistribute it and/or modify *
  6. * it under the terms of the GNU General Public License as published by *
  7. * the Free Software Foundation; either version 3 of the License, or *
  8. * (at your option) any later version. *
  9. * *
  10. * This program is distributed in the hope that it will be useful, *
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  13. * GNU General Public License for more details. *
  14. * *
  15. * You should have received a copy of the GNU General Public License *
  16. * along with this program; if not, see: *
  17. * <http://www.gnu.org/licenses/>. *
  18. ***************************************************************************/
  19. #include "StdAfx.h"
  20. #include <stdio.h>
  21. #include <ctype.h>
  22. #include <wctype.h>
  23. #include <stdlib.h>
  24. #include <string.h>
  25. #include <locale.h>
  26. #include <wctype.h>
  27. #include "speak_lib.h"
  28. #include "speech.h"
  29. #include "phoneme.h"
  30. #include "synthesize.h"
  31. #include "translate.h"
  32. #define L_qa 0x716100
  33. #define L_grc 0x677263 // grc Ancient Greek
  34. #define L_jbo 0x6a626f // jbo Lojban
  35. #define L_pap 0x706170 // pap Papiamento]
  36. #define L_qvi 0x717669 // qvi Kichwa
  37. #define L_shs 0x736873 // shs Shuswap / Secwepemctsin
  38. #define L_zhy 0x7a6879 // zhy
  39. // start of unicode pages for character sets
  40. #define OFFSET_GREEK 0x380
  41. #define OFFSET_CYRILLIC 0x420
  42. #define OFFSET_ARMENIAN 0x530
  43. #define OFFSET_ARABIC 0x600
  44. #define OFFSET_THAANA 0x780 // Divehi/Maldives
  45. #define OFFSET_DEVANAGARI 0x900
  46. #define OFFSET_BENGALI 0x980
  47. #define OFFSET_GURMUKHI 0xa00
  48. #define OFFSET_GUJARATI 0xa80
  49. #define OFFSET_ORIYA 0xb00
  50. #define OFFSET_TAMIL 0xb80
  51. #define OFFSET_TELUGU 0xc00
  52. #define OFFSET_KANNADA 0xc80
  53. #define OFFSET_MALAYALAM 0xd00
  54. #define OFFSET_SINHALA 0x0d80
  55. #define OFFSET_TIBET 0x0f00
  56. #define OFFSET_GEORGIAN 0x1080
  57. #define OFFSET_KOREAN 0x1100
  58. #define OFFSET_ETHIOPIC 0x1200
  59. static void Translator_Russian(Translator *tr);
  60. static void SetLetterVowel(Translator *tr, int c)
  61. {//==============================================
  62. tr->letter_bits[c] = (tr->letter_bits[c] & 0x40) | 0x81; // keep value for group 6 (front vowels e,i,y)
  63. }
  64. static void ResetLetterBits(Translator *tr, int groups)
  65. {//====================================================
  66. // Clear all the specified groups
  67. unsigned int ix;
  68. unsigned int mask;
  69. mask = ~groups;
  70. for(ix=0; ix<sizeof(tr->letter_bits); ix++)
  71. {
  72. tr->letter_bits[ix] &= mask;
  73. }
  74. }
  75. static void SetLetterBits(Translator *tr, int group, const char *string)
  76. {//=====================================================================
  77. int bits;
  78. unsigned char c;
  79. bits = (1L << group);
  80. while((c = *string++) != 0)
  81. tr->letter_bits[c] |= bits;
  82. }
  83. static void SetLetterBitsRange(Translator *tr, int group, int first, int last)
  84. {//===========================================================================
  85. int bits;
  86. int ix;
  87. bits = (1L << group);
  88. for(ix=first; ix<=last; ix++)
  89. {
  90. tr->letter_bits[ix] |= bits;
  91. }
  92. }
  93. // ignore these characters
  94. static const unsigned short chars_ignore_default[] = {
  95. 0xad, 1, // soft hyphtn
  96. 0x200c, 1, // zero width non-joiner
  97. 0x200d, 1, // zero width joiner
  98. 0, 0 };
  99. // alternatively, ignore characters but allow zero-width-non-joiner (lang-fa)
  100. static const unsigned short chars_ignore_zwnj_hyphen[] = {
  101. 0xad, 1, // soft hyphen
  102. 0x200c, '-', // zero width non-joiner, replace with hyphen
  103. 0x200d, 1, // zero width joiner
  104. 0, 0 };
  105. static Translator* NewTranslator(void)
  106. {//===================================
  107. Translator *tr;
  108. int ix;
  109. static const unsigned char stress_amps2[] = {18,18, 20,20, 20,22, 22,20 };
  110. static const short stress_lengths2[8] = {182,140, 220,220, 220,240, 260,280};
  111. static const wchar_t empty_wstring[1] = {0};
  112. static const wchar_t punct_in_word[2] = {'\'', 0}; // allow hyphen within words
  113. static const unsigned char default_tunes[6] = {0, 1, 2, 3, 0, 0};
  114. // Translates character codes in the range transpose_min to transpose_max to
  115. // a number in the range 1 to 63. 0 indicates there is no translation.
  116. // Used up to 57 (max of 63)
  117. static const char transpose_map_latin[] = {
  118. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // 0x60
  119. 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 0, 0, 0, 0, // 0x70
  120. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x80
  121. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x90
  122. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xa0
  123. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xb0
  124. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xc0
  125. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xd0
  126. 27, 28, 29, 0, 0, 30, 31, 32, 33, 34, 35, 36, 0, 37, 38, 0, // 0xe0
  127. 0, 0, 0, 39, 0, 0, 40, 0, 41, 0, 42, 0, 43, 0, 0, 0, // 0xf0
  128. 0, 0, 0, 44, 0, 45, 0, 46, 0, 0, 0, 0, 0, 47, 0, 0, // 0x100
  129. 0, 48, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, // 0x110
  130. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x120
  131. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x130
  132. 0, 0, 50, 0, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x140
  133. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, // 0x150
  134. 0, 53, 0, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x160
  135. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 0, 56, 0, 57, 0, // 0x170
  136. };
  137. tr = (Translator *)Alloc(sizeof(Translator));
  138. if(tr == NULL)
  139. return(NULL);
  140. tr->charset_a0 = charsets[1]; // ISO-8859-1, this is for when the input is not utf8
  141. dictionary_name[0] = 0;
  142. tr->dict_condition=0;
  143. tr->data_dictrules = NULL; // language_1 translation rules file
  144. tr->data_dictlist = NULL; // language_2 dictionary lookup file
  145. tr->transpose_min = 0x60;
  146. tr->transpose_max = 0x17f;
  147. tr->transpose_map = transpose_map_latin;
  148. tr->frequent_pairs = NULL;
  149. // only need lower case
  150. tr->letter_bits_offset = 0;
  151. memset(tr->letter_bits,0,sizeof(tr->letter_bits));
  152. memset(tr->letter_groups,0,sizeof(tr->letter_groups));
  153. // 0-6 sets of characters matched by A B C H F G Y in pronunciation rules
  154. // these may be set differently for different languages
  155. SetLetterBits(tr,0,"aeiou"); // A vowels, except y
  156. SetLetterBits(tr,1,"bcdfgjklmnpqstvxz"); // B hard consonants, excluding h,r,w
  157. SetLetterBits(tr,2,"bcdfghjklmnpqrstvwxz"); // C all consonants
  158. SetLetterBits(tr,3,"hlmnr"); // H 'soft' consonants
  159. SetLetterBits(tr,4,"cfhkpqstx"); // F voiceless consonants
  160. SetLetterBits(tr,5,"bdgjlmnrvwyz"); // G voiced
  161. SetLetterBits(tr,6,"eiy"); // Letter group Y, front vowels
  162. SetLetterBits(tr,7,"aeiouy"); // vowels, including y
  163. tr->char_plus_apostrophe = empty_wstring;
  164. tr->punct_within_word = punct_in_word;
  165. tr->chars_ignore = chars_ignore_default;
  166. for(ix=0; ix<8; ix++)
  167. {
  168. tr->stress_amps[ix] = stress_amps2[ix];
  169. tr->stress_amps_r[ix] = stress_amps2[ix] - 1;
  170. tr->stress_lengths[ix] = stress_lengths2[ix];
  171. }
  172. memset(&(tr->langopts),0,sizeof(tr->langopts));
  173. tr->langopts.max_lengthmod = 500;
  174. tr->langopts.lengthen_tonic = 20;
  175. tr->langopts.stress_rule = STRESSPOSN_2R;
  176. tr->langopts.unstressed_wd1 = 1;
  177. tr->langopts.unstressed_wd2 = 3;
  178. tr->langopts.param[LOPT_SONORANT_MIN] = 95;
  179. tr->langopts.param[LOPT_LONG_VOWEL_THRESHOLD] = 190/2;
  180. tr->langopts.param[LOPT_MAXAMP_EOC] = 19;
  181. tr->langopts.param[LOPT_UNPRONOUNCABLE] = 's'; // don't count this character at start of word
  182. tr->langopts.param[LOPT_BRACKET_PAUSE] = 4; // pause at bracket
  183. tr->langopts.param2[LOPT_BRACKET_PAUSE] = 2; // pauses when announcing bracket names
  184. tr->langopts.max_initial_consonants = 3;
  185. tr->langopts.replace_chars = NULL;
  186. tr->langopts.ascii_language = ""; // Non-Latin alphabet languages, use this language to speak Latin words, default is English
  187. SetLengthMods(tr,201);
  188. // tr->langopts.length_mods = length_mods_en;
  189. // tr->langopts.length_mods0 = length_mods_en0;
  190. tr->langopts.long_stop = 100;
  191. tr->langopts.max_roman = 49;
  192. tr->langopts.min_roman = 2;
  193. tr->langopts.thousands_sep = ',';
  194. tr->langopts.decimal_sep = '.';
  195. tr->langopts.break_numbers = BREAK_THOUSANDS; // 1000, 1000,000 1,000,000 etc
  196. tr->langopts.max_digits = 14;
  197. memcpy(tr->punct_to_tone, punctuation_to_tone, sizeof(tr->punct_to_tone));
  198. memcpy(tr->langopts.tunes, default_tunes, sizeof(tr->langopts.tunes));
  199. return(tr);
  200. }
  201. // common letter pairs, encode these as a single byte
  202. // 2 bytes, using the transposed character codes
  203. static const short pairs_ru[] = {
  204. 0x010c, // ла 21052 0x23
  205. 0x010e, // на 18400
  206. 0x0113, // та 14254
  207. 0x0301, // ав 31083
  208. 0x030f, // ов 13420
  209. 0x060e, // не 21798
  210. 0x0611, // ре 19458
  211. 0x0903, // ви 16226
  212. 0x0b01, // ак 14456
  213. 0x0b0f, // ок 17836
  214. 0x0c01, // ал 13324
  215. 0x0c09, // ил 16877
  216. 0x0e01, // ан 15359
  217. 0x0e06, // ен 13543 0x30
  218. 0x0e09, // ин 17168
  219. 0x0e0e, // нн 15973
  220. 0x0e0f, // он 22373
  221. 0x0e1c, // ын 15052
  222. 0x0f03, // во 24947
  223. 0x0f11, // ро 13552
  224. 0x0f12, // со 16368
  225. 0x100f, // оп 19054
  226. 0x1011, // рп 17067
  227. 0x1101, // ар 23967
  228. 0x1106, // ер 18795
  229. 0x1109, // ир 13797
  230. 0x110f, // ор 21737
  231. 0x1213, // тс 25076
  232. 0x1220, // яс 14310
  233. 0x7fff};
  234. //0x040f ог 12976
  235. //0x1306 ет 12826
  236. //0x0f0d мо 12688
  237. static const unsigned int replace_cyrillic_latin[] =
  238. {0x430,'a',
  239. 0x431,'b',
  240. 0x446,'c',
  241. 0x45b,0x107,
  242. 0x447,0x10d,
  243. 0x45f,'d'+(0x17e<<16),
  244. 0x455,'d'+('z'<<16),
  245. 0x434,'d',
  246. 0x452,0x111,
  247. 0x435,'e',
  248. 0x444,'f',
  249. 0x433,'g',
  250. 0x445,'h',
  251. 0x438,'i',
  252. 0x458,'j',
  253. 0x43a,'k',
  254. 0x459,'l'+('j'<<16),
  255. 0x43b,'l',
  256. 0x43c,'m',
  257. 0x45a,'n'+('j'<<16),
  258. 0x43d,'n',
  259. 0x43e,'o',
  260. 0x43f,'p',
  261. 0x440,'r',
  262. 0x441,'s',
  263. 0x448,0x161,
  264. 0x442,'t',
  265. 0x443,'u',
  266. 0x432,'v',
  267. 0x437,'z',
  268. 0x436,0x17e,
  269. 0x453,0x111,
  270. 0x45c,0x107,
  271. 0}; // ѓ ѕ ќ
  272. static const unsigned char ru_vowels[] = {0x10,0x15,0x31,0x18,0x1e,0x23,0x2b,0x2d,0x2e,0x2f, 0xb9,0xc9,0x91,0x8f,0x36,0}; //also kazakh
  273. static const unsigned char ru_consonants[] = {0x11,0x12,0x13,0x14,0x16,0x17,0x19,0x1a,0x1b,0x1c,0x1d,0x1f,0x20,0x21,0x22,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2c, 0x73,0x7b,0x83,0x9b,0};
  274. static void SetCyrillicLetters(Translator *tr)
  275. {//===========================================
  276. // character codes offset by 0x420
  277. static const char ru_soft[] = {0x2c,0x19,0x27,0x29,0}; // letter group B [k ts; s;]
  278. static const char ru_hard[] = {0x2a,0x16,0x26,0x28,0}; // letter group H [S Z ts]
  279. static const char ru_nothard[] = {0x11,0x12,0x13,0x14,0x17,0x19,0x1a,0x1b,0x1c,0x1d,0x1f,0x20,0x21,0x22,0x24,0x25,0x27,0x29,0x2c,0};
  280. static const char ru_voiced[] = {0x11,0x12,0x13,0x14,0x16,0x17,0}; // letter group G (voiced obstruents)
  281. static const char ru_ivowels[] = {0x2c,0x2e,0x2f,0x31,0}; // letter group Y (iotated vowels & soft-sign)
  282. tr->charset_a0 = charsets[18]; // KOI8-R
  283. tr->transpose_min = 0x430; // convert cyrillic from unicode into range 0x01 to 0x22
  284. tr->transpose_max = 0x451;
  285. tr->transpose_map = NULL;
  286. tr->frequent_pairs = pairs_ru;
  287. tr->letter_bits_offset = OFFSET_CYRILLIC;
  288. memset(tr->letter_bits,0,sizeof(tr->letter_bits));
  289. SetLetterBits(tr,LETTERGP_A,(char *)ru_vowels);
  290. SetLetterBits(tr,LETTERGP_B,ru_soft);
  291. SetLetterBits(tr,LETTERGP_C,(char *)ru_consonants);
  292. SetLetterBits(tr,LETTERGP_H,ru_hard);
  293. SetLetterBits(tr,LETTERGP_F,ru_nothard);
  294. SetLetterBits(tr,LETTERGP_G,ru_voiced);
  295. SetLetterBits(tr,LETTERGP_Y,ru_ivowels);
  296. SetLetterBits(tr,LETTERGP_VOWEL2,(char *)ru_vowels);
  297. } // end of SetCyrillicLetters
  298. void SetIndicLetters(Translator *tr)
  299. {//=================================
  300. // Set letter types for Indic scripts, Devanagari, Tamill, etc
  301. static const char dev_consonants2[] = {0x02,0x03,0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f,0x7b,0x7c,0x7e,0x7f,0};
  302. static const char dev_vowels2[] = {0x60,0x61, 0x55,0x56,0x57,0x62,0x63,0}; // non-consecutive vowels and vowel-signs
  303. memset(tr->letter_bits,0,sizeof(tr->letter_bits));
  304. SetLetterBitsRange(tr,LETTERGP_A,0x04,0x14); // vowel letters
  305. SetLetterBitsRange(tr,LETTERGP_A,0x3e,0x4d); // + vowel signs, and virama
  306. SetLetterBits(tr,LETTERGP_A, dev_vowels2); // + extra vowels and vowel signs
  307. SetLetterBitsRange(tr,LETTERGP_B,0x3e,0x4d); // vowel signs, and virama
  308. SetLetterBits(tr,LETTERGP_B, dev_vowels2); // + extra vowels and vowel signs
  309. SetLetterBitsRange(tr,LETTERGP_C,0x15,0x39); // the main consonant range
  310. SetLetterBits(tr,LETTERGP_C,dev_consonants2); // + additional consonants
  311. SetLetterBitsRange(tr,LETTERGP_Y,0x04,0x14); // vowel letters
  312. SetLetterBitsRange(tr,LETTERGP_Y,0x3e,0x4c); // + vowel signs
  313. SetLetterBits(tr,LETTERGP_Y, dev_vowels2); // + extra vowels and vowel signs
  314. tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
  315. tr->langopts.suffix_add_e = tr->letter_bits_offset + 0x4d; //virama
  316. }
  317. void SetupTranslator(Translator *tr, const short *lengths, const unsigned char *amps)
  318. {//==================================================================================
  319. if(lengths != NULL)
  320. memcpy(tr->stress_lengths,lengths,sizeof(tr->stress_lengths));
  321. if(amps != NULL)
  322. memcpy(tr->stress_amps,amps,sizeof(tr->stress_amps));
  323. }
  324. Translator *SelectTranslator(const char *name)
  325. {//===========================================
  326. int name2 = 0;
  327. Translator *tr;
  328. static const short stress_lengths_fr[8] = {190, 170, 190, 200, 0, 0, 190, 240};
  329. static const unsigned char stress_amps_fr[8] = {18,16, 18,18, 18,18, 18,18 };
  330. static const unsigned char stress_amps_sk[8] = {17,16, 20,20, 20,22, 22,21 };
  331. static const short stress_lengths_sk[8] = {190,190, 210,210, 0,0, 210,210};
  332. static const short stress_lengths_ta[8] = {200, 200, 210, 210, 0, 0, 230, 230};
  333. static const unsigned char stress_amps_ta[8] = {18,18, 18,18, 20,20, 22,22 };
  334. // convert name string into a word of up to 4 characters, for the switch()
  335. while(*name != 0)
  336. name2 = (name2 << 8) + *name++;
  337. tr = NewTranslator();
  338. switch(name2)
  339. {
  340. case L('a','f'):
  341. {
  342. static const short stress_lengths_af[8] = {170,140, 220,220, 0, 0, 250,270};
  343. SetupTranslator(tr,stress_lengths_af,NULL);
  344. tr->langopts.stress_rule = STRESSPOSN_1L;
  345. tr->langopts.vowel_pause = 0x30;
  346. tr->langopts.param[LOPT_DIERESES] = 1;
  347. tr->langopts.param[LOPT_PREFIXES] = 1;
  348. SetLetterVowel(tr,'y'); // add 'y' to vowels
  349. tr->langopts.numbers = NUM_SWAP_TENS | NUM_HUNDRED_AND | NUM_SINGLE_AND | NUM_ROMAN | NUM_1900;
  350. tr->langopts.accents = 1;
  351. }
  352. break;
  353. case L('a','m'): // Amharic, Ethiopia
  354. {
  355. SetupTranslator(tr,stress_lengths_fr,stress_amps_fr);
  356. tr->letter_bits_offset = OFFSET_ETHIOPIC;
  357. tr->langopts.stress_rule = STRESSPOSN_1L;
  358. tr->langopts.stress_flags = 0x0024; // don't use secondary stress
  359. tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
  360. tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
  361. tr->langopts.numbers = NUM_OMIT_1_HUNDRED;
  362. }
  363. break;
  364. case L('a','r'): // Arabic
  365. tr->letter_bits_offset = OFFSET_ARABIC;
  366. tr->langopts.numbers = NUM_SWAP_TENS | NUM_AND_UNITS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_AND_HUNDRED | NUM_THOUSAND_AND | NUM_OMIT_1_THOUSAND;
  367. tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
  368. break;
  369. case L('b','g'): //Bulgarian
  370. {
  371. SetCyrillicLetters(tr);
  372. SetLetterVowel(tr,0x2a);
  373. tr->langopts.param[LOPT_UNPRONOUNCABLE] = 0x432; // [v] don't count this character at start of word
  374. tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x107; // devoice at end of word, and change voicing to match a following consonant (except v)
  375. tr->langopts.param[LOPT_REDUCE] = 2;
  376. tr->langopts.stress_rule = STRESSPOSN_2R;
  377. tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_OMIT_1_HUNDRED | NUM_HUNDRED_AND | NUM_AND_UNITS | NUM_SINGLE_AND | NUM_ROMAN | NUM_ROMAN_ORDINAL | NUM_ROMAN_CAPITALS ;
  378. tr->langopts.thousands_sep = ' '; // don't allow dot as thousands separator
  379. }
  380. break;
  381. case L('b','n'): // Bengali
  382. {
  383. static const short stress_lengths_bn[8] = {180, 180, 210, 210, 0, 0, 230, 240};
  384. static const unsigned char stress_amps_bn[8] = {18,18, 18,18, 20,20, 22,22 };
  385. SetupTranslator(tr,stress_lengths_bn,stress_amps_bn);
  386. tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
  387. tr->langopts.stress_rule = STRESSPOSN_1L;
  388. tr->langopts.stress_flags = 0x10004; // use 'diminished' for unstressed final syllable
  389. tr->letter_bits_offset = OFFSET_BENGALI;
  390. SetIndicLetters(tr); // call this after setting OFFSET_BENGALI
  391. SetLetterBitsRange(tr,LETTERGP_F,0x3e,0x4c); // vowel signs, but not virama
  392. tr->langopts.numbers = 0x1;
  393. tr->langopts.break_numbers = 0x24924aa8; // for languages which have numbers for 100,000 and 100,00,000, eg Hindi
  394. }
  395. break;
  396. case L('b','o'): // Tibet
  397. {
  398. tr->langopts.stress_rule = STRESSPOSN_1L;
  399. tr->letter_bits_offset = OFFSET_TIBET;
  400. SetLetterBitsRange(tr,LETTERGP_A,0x71,0x7d); // vowel signs
  401. SetLetterBitsRange(tr,LETTERGP_B,0x71,0x81); // vowel signs and subjoined letters
  402. SetLetterBitsRange(tr,LETTERGP_B,0x90,0xbc);
  403. SetLetterBitsRange(tr,LETTERGP_C,0x40,0x6c); // consonant letters (not subjoined)
  404. tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
  405. tr->langopts.numbers = 1;
  406. }
  407. break;
  408. case L('c','y'): // Welsh
  409. {
  410. static const short stress_lengths_cy[8] = {170,220, 180,180, 0, 0, 250,270};
  411. static const unsigned char stress_amps_cy[8] = {17,15, 18,18, 0,0, 22,20 }; // 'diminished' is used to mark a quieter, final unstressed syllable
  412. SetupTranslator(tr,stress_lengths_cy,stress_amps_cy);
  413. tr->charset_a0 = charsets[14]; // ISO-8859-14
  414. // tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
  415. tr->langopts.stress_rule = STRESSPOSN_2R;
  416. // tr->langopts.intonation_group = 4;
  417. // 'diminished' is an unstressed final syllable
  418. tr->langopts.stress_flags = 0x6 | 0x10;
  419. tr->langopts.unstressed_wd1 = 0;
  420. tr->langopts.unstressed_wd2 = 2;
  421. tr->langopts.param[LOPT_SONORANT_MIN] = 120; // limit the shortening of sonorants before short vowels
  422. tr->langopts.numbers = NUM_OMIT_1_HUNDRED;
  423. SetLetterVowel(tr,'w'); // add letter to vowels and remove from consonants
  424. SetLetterVowel(tr,'y');
  425. }
  426. break;
  427. case L('d','a'): // Danish
  428. {
  429. static const short stress_lengths_da[8] = {160,140, 200,200, 0,0, 220,230};
  430. SetupTranslator(tr,stress_lengths_da,NULL);
  431. tr->langopts.stress_rule = STRESSPOSN_1L;
  432. tr->langopts.param[LOPT_PREFIXES] = 1;
  433. SetLetterVowel(tr,'y');
  434. tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_SWAP_TENS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_ORDINAL_DOT | NUM_1900 | NUM_ROMAN | NUM_ROMAN_CAPITALS | NUM_ROMAN_ORDINAL;
  435. }
  436. break;
  437. case L('d','e'):
  438. {
  439. static const short stress_lengths_de[8] = {150,130, 200,200, 0, 0, 270,270};
  440. static const unsigned char stress_amps_de[] = {20,20, 20,20, 20,22, 22,20 };
  441. SetupTranslator(tr, stress_lengths_de, stress_amps_de);
  442. tr->langopts.stress_rule = STRESSPOSN_1L;
  443. tr->langopts.word_gap = 0x8; // don't use linking phonemes
  444. tr->langopts.vowel_pause = 0x30;
  445. tr->langopts.param[LOPT_PREFIXES] = 1;
  446. tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x100; // devoice at end of word
  447. tr->langopts.param[LOPT_LONG_VOWEL_THRESHOLD] = 175/2;
  448. tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_SWAP_TENS | NUM_ALLOW_SPACE | NUM_ORDINAL_DOT | NUM_ROMAN;
  449. // tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_SWAP_TENS | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_ALLOW_SPACE | NUM_ORDINAL_DOT | NUM_ROMAN;
  450. SetLetterVowel(tr,'y');
  451. tr->langopts.param[LOPT_UNPRONOUNCABLE] = 2; // use de_rules for unpronouncable rules
  452. }
  453. break;
  454. case L('d','v'): // Divehi (Maldives)
  455. {
  456. SetupTranslator(tr,stress_lengths_ta,stress_amps_ta);
  457. tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
  458. tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
  459. tr->letter_bits_offset = OFFSET_THAANA;
  460. tr->langopts.stress_rule = STRESSPOSN_1L;
  461. tr->langopts.stress_flags = 0x10004; // use 'diminished' for unstressed final syllable
  462. SetLetterBitsRange(tr,LETTERGP_B,0x26,0x30); // vowel signs, and virama
  463. tr->langopts.break_numbers = 0x14a8; // 1000, 100,000 10,000,000
  464. tr->langopts.numbers = 1;
  465. }
  466. break;
  467. case L('e','n'):
  468. {
  469. static const short stress_lengths_en[8] = {182,140, 220,220, 0,0, 248,275};
  470. SetupTranslator(tr,stress_lengths_en,NULL);
  471. tr->langopts.stress_rule = STRESSPOSN_1L;
  472. tr->langopts.stress_flags = 0x08;
  473. tr->langopts.numbers = NUM_HUNDRED_AND | NUM_ROMAN | NUM_1900;
  474. tr->langopts.param[LOPT_COMBINE_WORDS] = 2; // allow "mc" to cmbine with the following word
  475. tr->langopts.suffix_add_e = 'e';
  476. tr->langopts.param[LOPT_UNPRONOUNCABLE] = 2; // use en_rules for unpronouncable rules
  477. SetLetterBits(tr,6,"aeiouy"); // Group Y: vowels, including y
  478. }
  479. break;
  480. case L('e','l'): // Greek
  481. case L_grc: // Ancient Greek
  482. {
  483. static const short stress_lengths_el[8] = {155, 180, 210, 210, 0, 0, 270, 300};
  484. static const unsigned char stress_amps_el[8] = {15,12, 20,20, 20,22, 22,21 }; // 'diminished' is used to mark a quieter, final unstressed syllable
  485. // character codes offset by 0x380
  486. static const char el_vowels[] = {0x10,0x2c,0x2d,0x2e,0x2f,0x30,0x31,0x35,0x37,0x39,0x3f,0x45,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0};
  487. static const char el_fvowels[] = {0x2d,0x2e,0x2f,0x35,0x37,0x39,0x45,0x4d,0}; // ε η ι υ έ ή ί ύ
  488. static const char el_voiceless[]= {0x38,0x3a,0x3e,0x40,0x42,0x43,0x44,0x46,0x47,0}; // θ κ ξ π ς σ τ φ χ
  489. static const char el_consonants[]={0x32,0x33,0x34,0x36,0x38,0x3a,0x3b,0x3c,0x3d,0x3e,0x40,0x41,0x42,0x43,0x44,0x46,0x47,0x48,0};
  490. static const wchar_t el_char_apostrophe[] = {0x3c3,0}; // σ
  491. SetupTranslator(tr,stress_lengths_el,stress_amps_el);
  492. tr->charset_a0 = charsets[7]; // ISO-8859-7
  493. tr->char_plus_apostrophe = el_char_apostrophe;
  494. tr->letter_bits_offset = OFFSET_GREEK;
  495. memset(tr->letter_bits,0,sizeof(tr->letter_bits));
  496. SetLetterBits(tr,LETTERGP_A,el_vowels);
  497. SetLetterBits(tr,LETTERGP_VOWEL2,el_vowels);
  498. SetLetterBits(tr,LETTERGP_B,el_voiceless);
  499. SetLetterBits(tr,LETTERGP_C,el_consonants);
  500. SetLetterBits(tr,LETTERGP_Y,el_fvowels); // front vowels: ε η ι υ
  501. tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
  502. tr->langopts.stress_rule = STRESSPOSN_2R;
  503. tr->langopts.stress_flags = 0x6; // mark unstressed final syllables as diminished
  504. tr->langopts.unstressed_wd1 = 0;
  505. tr->langopts.unstressed_wd2 = 2;
  506. tr->langopts.param[LOPT_SONORANT_MIN] = 130; // limit the shortening of sonorants before short vowels
  507. tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA;
  508. tr->langopts.numbers2 = 0x2 | NUM2_MULTIPLE_ORDINAL; // variant form of numbers before thousands
  509. if(name2 == L_grc)
  510. {
  511. // ancient greek
  512. tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1;
  513. }
  514. }
  515. break;
  516. case L('e','o'):
  517. {
  518. static const short stress_lengths_eo[8] = {150, 150, 230, 180, 0, 0, 300, 320};
  519. static const unsigned char stress_amps_eo[] = {16,14, 20,20, 20,22, 22,21 };
  520. static const wchar_t eo_char_apostrophe[2] = {'l',0};
  521. SetupTranslator(tr,stress_lengths_eo,stress_amps_eo);
  522. tr->charset_a0 = charsets[3]; // ISO-8859-3
  523. tr->char_plus_apostrophe = eo_char_apostrophe;
  524. // tr->langopts.word_gap = 1;
  525. tr->langopts.vowel_pause = 2;
  526. tr->langopts.stress_rule = STRESSPOSN_2R;
  527. tr->langopts.stress_flags = 0x6 | 0x10;
  528. // tr->langopts.unstressed_wd1 = 3;
  529. tr->langopts.unstressed_wd2 = 2;
  530. tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED | NUM_ALLOW_SPACE | NUM_ROMAN;
  531. }
  532. break;
  533. case L('e','s'): // Spanish
  534. case L('a','n'): // Aragonese
  535. case L('c','a'): // Catalan
  536. case L_pap: // Papiamento
  537. {
  538. static const short stress_lengths_es[8] = {180, 190, 230, 180, 0, 0, 240, 270};
  539. static const unsigned char stress_amps_es[8] = {16,12, 18,18, 20,20, 20,20 }; // 'diminished' is used to mark a quieter, final unstressed syllable
  540. static const wchar_t ca_punct_within_word[] = {'\'',0xb7,0}; // ca: allow middle-dot within word
  541. SetupTranslator(tr,stress_lengths_es,stress_amps_es);
  542. tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
  543. tr->langopts.stress_rule = STRESSPOSN_2R;
  544. // stress last syllable if it doesn't end in vowel or "s" or "n"
  545. // 'diminished' is an unstressed final syllable
  546. tr->langopts.stress_flags = 0x200 | 0x6 | 0x10;
  547. tr->langopts.unstressed_wd1 = 0;
  548. tr->langopts.unstressed_wd2 = 2;
  549. tr->langopts.param[LOPT_SONORANT_MIN] = 120; // limit the shortening of sonorants before short vowels
  550. tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_AND_UNITS | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_ROMAN | NUM_ROMAN_AFTER;
  551. tr->langopts.numbers2 = NUM2_MULTIPLE_ORDINAL;
  552. if(name2 == L('c','a'))
  553. {
  554. tr->punct_within_word = ca_punct_within_word;
  555. tr->langopts.stress_flags = 0x200 | 0x6 | 0x30; // stress last syllable unless word ends with a vowel
  556. }
  557. else
  558. if(name2 == L('a','n'))
  559. {
  560. tr->langopts.stress_flags = 0x200 | 0x6 | 0x10;
  561. }
  562. else
  563. if(name2 == L_pap)
  564. {
  565. tr->langopts.stress_flags = 0x100 | 0x6 | 0x30; // stress last syllable unless word ends with a vowel
  566. }
  567. else
  568. {
  569. tr->langopts.param[LOPT_UNPRONOUNCABLE] = 2; // use es_rules for unpronouncable rules
  570. }
  571. }
  572. break;
  573. case L('e','u'): // basque
  574. {
  575. static const short stress_lengths_eu[8] = {200, 200, 200, 200, 0, 0, 210, 230}; // very weak stress
  576. static const unsigned char stress_amps_eu[8] = {16,16, 18,18, 18,18, 18,18 };
  577. SetupTranslator(tr,stress_lengths_eu,stress_amps_eu);
  578. tr->langopts.stress_rule = STRESSPOSN_2L; // ?? second syllable ??
  579. tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_AND_UNITS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_VIGESIMAL;
  580. }
  581. break;
  582. case L('f','a'): // Farsi
  583. {
  584. // Convert characters in the range 0x620 to 0x6cc to the range 1 to 63.
  585. // 0 indicates no translation for this character
  586. static const char transpose_map_fa[] = {
  587. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // 0x620
  588. 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 0, 0, 0, 0, // 0x630
  589. 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, // 0x640
  590. 42, 43, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x650
  591. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x660
  592. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0, // 0x670
  593. 0, 0, 0, 0, 0, 0, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x680
  594. 0, 0, 0, 0, 0, 0, 0, 0, 47, 0, 0, 0, 0, 0, 0, 0, // 0x690
  595. 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 49, // 0x6a0
  596. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x6b0
  597. 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51 }; // 0x6c0
  598. tr->transpose_min = 0x620;
  599. tr->transpose_max = 0x6cc;
  600. tr->transpose_map = transpose_map_fa;
  601. tr->letter_bits_offset = OFFSET_ARABIC;
  602. tr->langopts.numbers = NUM_AND_UNITS | NUM_HUNDRED_AND;
  603. tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
  604. tr->chars_ignore = chars_ignore_zwnj_hyphen; // replace ZWNJ by hyphen
  605. }
  606. break;
  607. case L('e','t'): // Estonian
  608. tr->charset_a0 = charsets[4]; // ISO-8859-4
  609. // drop through to Finnish
  610. case L('f','i'): // Finnish
  611. {
  612. static const unsigned char stress_amps_fi[8] = {18,16, 22,22, 20,22, 22,22 };
  613. static const short stress_lengths_fi[8] = {150,180, 200,200, 0,0, 210,250};
  614. SetupTranslator(tr,stress_lengths_fi,stress_amps_fi);
  615. tr->langopts.stress_rule = STRESSPOSN_1L;
  616. tr->langopts.stress_flags = 0x56; // move secondary stress from light to a following heavy syllable
  617. tr->langopts.param[LOPT_IT_DOUBLING] = 1;
  618. tr->langopts.long_stop = 130;
  619. tr->langopts.numbers = NUM_DECIMAL_COMMA + NUM_ALLOW_SPACE;
  620. SetLetterVowel(tr,'y');
  621. // tr->langopts.max_initial_consonants = 2; // BUT foreign words may have 3
  622. tr->langopts.spelling_stress = 1;
  623. tr->langopts.intonation_group = 3; // less intonation, don't raise pitch at comma
  624. }
  625. break;
  626. case L('f','r'): // french
  627. {
  628. SetupTranslator(tr,stress_lengths_fr,stress_amps_fr);
  629. tr->langopts.stress_rule = STRESSPOSN_1R; // stress on final syllable
  630. tr->langopts.stress_flags = 0x0024; // don't use secondary stress
  631. tr->langopts.param[LOPT_IT_LENGTHEN] = 1; // remove lengthen indicator from unstressed syllables
  632. tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
  633. tr->langopts.accents = 2; // Say "Capital" after the letter.
  634. tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_OMIT_1_HUNDRED | NUM_NOPAUSE | NUM_ROMAN | NUM_ROMAN_CAPITALS | NUM_ROMAN_AFTER | NUM_VIGESIMAL | NUM_DFRACTION_4;
  635. SetLetterVowel(tr,'y');
  636. }
  637. break;
  638. case L('h','i'): // Hindi
  639. case L('n','e'): // Nepali
  640. case L('p','a'): // Punjabi
  641. {
  642. static const short stress_lengths_hi[8] = {190, 190, 210, 210, 0, 0, 230, 250};
  643. static const unsigned char stress_amps_hi[8] = {17,14, 20,19, 20,22, 22,21 };
  644. SetupTranslator(tr,stress_lengths_hi,stress_amps_hi);
  645. tr->charset_a0 = charsets[19]; // ISCII
  646. tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
  647. tr->langopts.stress_rule = 6; // stress on last heaviest syllable, excluding final syllable
  648. tr->langopts.stress_flags = 0x10004; // use 'diminished' for unstressed final syllable
  649. tr->langopts.numbers = NUM_SWAP_TENS;
  650. tr->langopts.break_numbers = 0x14aa8; // for languages which have numbers for 100,000 and 100,00,000, eg Hindi
  651. tr->letter_bits_offset = OFFSET_DEVANAGARI;
  652. if(name2 == L('p','a'))
  653. {
  654. tr->letter_bits_offset = OFFSET_GURMUKHI;
  655. }
  656. if(name2 == L('n','e'))
  657. {
  658. tr->langopts.break_numbers = 0x2aaaa8;
  659. tr->langopts.max_digits = 22;
  660. tr->langopts.numbers2 |= NUM2_ENGLISH_NUMERALS;
  661. }
  662. SetIndicLetters(tr);
  663. }
  664. break;
  665. case L('h','r'): // Croatian
  666. case L('b','s'): // Bosnian
  667. case L('s','r'): // Serbian
  668. {
  669. static const unsigned char stress_amps_hr[8] = {17,17, 20,20, 20,22, 22,21 };
  670. static const short stress_lengths_hr[8] = {180,160, 200,200, 0,0, 220,230};
  671. static const short stress_lengths_sr[8] = {160,150, 200,200, 0,0, 250,260};
  672. if(name2 == L('s','r'))
  673. SetupTranslator(tr,stress_lengths_sr,stress_amps_hr);
  674. else
  675. SetupTranslator(tr,stress_lengths_hr,stress_amps_hr);
  676. tr->charset_a0 = charsets[2]; // ISO-8859-2
  677. tr->langopts.stress_rule = STRESSPOSN_1L;
  678. tr->langopts.stress_flags = 0x10;
  679. tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x3;
  680. tr->langopts.max_initial_consonants = 5;
  681. tr->langopts.spelling_stress = 1;
  682. tr->langopts.accents = 1;
  683. tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_DECIMAL_COMMA | NUM_THOUS_SPACE | NUM_DFRACTION_2 | NUM_ROMAN_CAPITALS;
  684. tr->langopts.numbers2 = 0xa + NUM2_THOUSANDS_VAR5; // variant numbers before thousands,milliards
  685. tr->langopts.replace_chars = replace_cyrillic_latin;
  686. SetLetterVowel(tr,'y');
  687. SetLetterVowel(tr,'r');
  688. }
  689. break;
  690. case L('h','t'): // Haitian Creole
  691. // memcpy(tr->stress_lengths,stress_lengths_fr,sizeof(tr->stress_lengths));
  692. tr->langopts.stress_rule = STRESSPOSN_1R; // stress on final syllable
  693. tr->langopts.stress_flags = 0x0024; // don't use secondary stress
  694. tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_OMIT_1_HUNDRED | NUM_NOPAUSE | NUM_ROMAN | NUM_VIGESIMAL | NUM_DFRACTION_4;
  695. break;
  696. case L('h','u'): // Hungarian
  697. {
  698. static const unsigned char stress_amps_hu[8] = {17,17, 19,19, 20,22, 22,21 };
  699. static const short stress_lengths_hu[8] = {185,195, 195,190, 0,0, 210,220};
  700. SetupTranslator(tr,stress_lengths_hu,stress_amps_hu);
  701. tr->charset_a0 = charsets[2]; // ISO-8859-2
  702. tr->langopts.vowel_pause = 0x20;
  703. tr->langopts.stress_rule = STRESSPOSN_1L;
  704. tr->langopts.stress_flags = 0x8036 | S_HYPEN_UNSTRESS;
  705. tr->langopts.unstressed_wd1 = 2;
  706. tr->langopts.param[LOPT_IT_DOUBLING] = 1;
  707. tr->langopts.param[LOPT_ANNOUNCE_PUNCT] = 2; // don't break clause before announcing . ? !
  708. tr->langopts.numbers = NUM_DFRACTION_5 | NUM_ALLOW_SPACE | NUM_ROMAN | NUM_ROMAN_ORDINAL | NUM_ROMAN_CAPITALS | NUM_ORDINAL_DOT | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND;
  709. tr->langopts.thousands_sep = ' '; // don't allow dot as thousands separator
  710. tr->langopts.decimal_sep = ',';
  711. tr->langopts.max_roman = 899;
  712. tr->langopts.min_roman = 1;
  713. SetLetterVowel(tr,'y');
  714. tr->langopts.spelling_stress = 1;
  715. SetLengthMods(tr,3); // all equal
  716. }
  717. break;
  718. case L('h','y'): // Armenian
  719. {
  720. static const short stress_lengths_hy[8] = {250, 200, 250, 250, 0, 0, 250, 250};
  721. static const char hy_vowels[] = {0x31, 0x35, 0x37, 0x38, 0x3b, 0x48, 0x55, 0};
  722. static const char hy_consonants[] = {0x32,0x33,0x34,0x36,0x39,0x3a,0x3c,0x3d,0x3e,0x3f,
  723. 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x56,0};
  724. SetupTranslator(tr,stress_lengths_hy,NULL);
  725. tr->langopts.stress_rule = STRESSPOSN_1R; // default stress on final syllable
  726. tr->letter_bits_offset = OFFSET_ARMENIAN;
  727. memset(tr->letter_bits,0,sizeof(tr->letter_bits));
  728. SetLetterBits(tr,LETTERGP_A,hy_vowels);
  729. SetLetterBits(tr,LETTERGP_VOWEL2,hy_vowels);
  730. SetLetterBits(tr,LETTERGP_C,hy_consonants);
  731. tr->langopts.max_initial_consonants = 6;
  732. tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED;
  733. // tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
  734. }
  735. break;
  736. case L('i','d'): // Indonesian
  737. {
  738. static const short stress_lengths_id[8] = {160, 200, 180, 180, 0, 0, 220, 240};
  739. static const unsigned char stress_amps_id[8] = {16,18, 18,18, 20,22, 22,21 };
  740. SetupTranslator(tr,stress_lengths_id,stress_amps_id);
  741. tr->langopts.stress_rule = STRESSPOSN_2R;
  742. tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_ROMAN;
  743. tr->langopts.stress_flags = 0x6 | 0x10;
  744. tr->langopts.accents = 2; // "capital" after letter name
  745. }
  746. break;
  747. case L('i','s'): // Icelandic
  748. {
  749. static const short stress_lengths_is[8] = {180,160, 200,200, 0,0, 240,250};
  750. static const wchar_t is_lettergroup_B[] = {'c','f','h','k','p','t','x',0xfe,0}; // voiceless conants, including 'þ' ?? 's'
  751. SetupTranslator(tr,stress_lengths_is,NULL);
  752. tr->langopts.stress_rule = STRESSPOSN_1L;
  753. tr->langopts.stress_flags = 0x10;
  754. tr->langopts.param[LOPT_IT_LENGTHEN] = 0x11; // remove lengthen indicator from unstressed vowels
  755. tr->langopts.param[LOPT_REDUCE] = 2;
  756. ResetLetterBits(tr,0x18);
  757. SetLetterBits(tr,4,"kpst"); // Letter group F
  758. SetLetterBits(tr,3,"jvr"); // Letter group H
  759. tr->letter_groups[1] = is_lettergroup_B;
  760. SetLetterVowel(tr,'y');
  761. tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_SINGLE_AND | NUM_HUNDRED_AND | NUM_AND_UNITS | NUM_1900;
  762. tr->langopts.numbers2 = 0x2;
  763. }
  764. break;
  765. case L('i','t'): // Italian
  766. {
  767. static const short stress_lengths_it[8] = {150, 140, 170, 170, 0, 0, 300, 330};
  768. static const unsigned char stress_amps_it[8] = {15,14, 19,19, 20,22, 22,20 };
  769. SetupTranslator(tr,stress_lengths_it,stress_amps_it);
  770. tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
  771. tr->langopts.stress_rule = STRESSPOSN_2R;
  772. tr->langopts.stress_flags = 0x10 | 0x20000;
  773. tr->langopts.vowel_pause = 1;
  774. tr->langopts.unstressed_wd1 = 2;
  775. tr->langopts.unstressed_wd2 = 2;
  776. tr->langopts.param[LOPT_IT_LENGTHEN] = 2; // remove lengthen indicator from unstressed or non-penultimate syllables
  777. tr->langopts.param[LOPT_IT_DOUBLING] = 2; // double the first consonant if the previous word ends in a stressed vowel
  778. tr->langopts.param[LOPT_SONORANT_MIN] = 130; // limit the shortening of sonorants before short vowels
  779. tr->langopts.param[LOPT_REDUCE] = 1; // reduce vowels even if phonemes are specified in it_list
  780. tr->langopts.param[LOPT_ALT] = 2; // call ApplySpecialAttributes2() if a word has $alt or $alt2
  781. tr->langopts.numbers = NUM_SINGLE_VOWEL | NUM_OMIT_1_HUNDRED |NUM_DECIMAL_COMMA | NUM_ROMAN | NUM_DFRACTION_1;
  782. tr->langopts.accents = 2; // Say "Capital" after the letter.
  783. SetLetterVowel(tr,'y');
  784. }
  785. break;
  786. case L_jbo: // Lojban
  787. {
  788. static const short stress_lengths_jbo[8] = {145,145, 170,160, 0,0, 330,350};
  789. static const wchar_t jbo_punct_within_word[] = {'.',',','\'',0x2c8,0}; // allow period and comma within a word, also stress marker (from LOPT_CAPS_IN_WORD)
  790. SetupTranslator(tr,stress_lengths_jbo,NULL);
  791. tr->langopts.stress_rule = STRESSPOSN_2R;
  792. tr->langopts.vowel_pause = 0x20c; // pause before a word which starts with a vowel, or after a word which ends in a consonant
  793. // tr->langopts.word_gap = 1;
  794. tr->punct_within_word = jbo_punct_within_word;
  795. tr->langopts.param[LOPT_CAPS_IN_WORD] = 2; // capitals indicate stressed syllables
  796. SetLetterVowel(tr,'y');
  797. tr->langopts.max_lengthmod = 368;
  798. }
  799. break;
  800. case L('k','a'): // Georgian
  801. {
  802. // character codes offset by 0x1080
  803. static const char ka_vowels[] = {0x50,0x54,0x58,0x5d,0x63,0x75,0x77,0};
  804. static const char ka_consonants[] = {0x51,0x52,0x53,0x55,0x56,0x57,0x59,0x5a,0x5b,0x5c,0x5e,0x5f,0x60,0x61,0x62,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x76,0};
  805. SetupTranslator(tr,stress_lengths_ta,stress_amps_ta);
  806. memset(tr->letter_bits,0,sizeof(tr->letter_bits));
  807. SetLetterBits(tr,LETTERGP_A,ka_vowels);
  808. SetLetterBits(tr,LETTERGP_C,ka_consonants);
  809. SetLetterBits(tr,LETTERGP_VOWEL2,ka_vowels);
  810. tr->langopts.stress_rule = STRESSPOSN_1L;
  811. tr->langopts.stress_flags = S_FINAL_NO_2;
  812. tr->letter_bits_offset = OFFSET_GEORGIAN;
  813. // tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
  814. tr->langopts.max_initial_consonants = 7;
  815. tr->langopts.numbers = NUM_VIGESIMAL | NUM_AND_UNITS | NUM_OMIT_1_HUNDRED |NUM_OMIT_1_THOUSAND | NUM_DFRACTION_5 | NUM_ROMAN;
  816. }
  817. break;
  818. case L('k','k'): // Kazakh
  819. {
  820. static const unsigned char stress_amps_tr[8] = {18,16, 20,21, 20,21, 21,20 };
  821. static const short stress_lengths_tr[8] = {190,180, 230,230, 0,0, 250,250};
  822. tr->letter_bits_offset = OFFSET_CYRILLIC;
  823. memset(tr->letter_bits,0,sizeof(tr->letter_bits));
  824. SetLetterBits(tr,LETTERGP_A,(char *)ru_vowels);
  825. SetLetterBits(tr,LETTERGP_C,(char *)ru_consonants);
  826. SetLetterBits(tr,LETTERGP_VOWEL2,(char *)ru_vowels);
  827. SetupTranslator(tr,stress_lengths_tr,stress_amps_tr);
  828. tr->langopts.stress_rule = 7; // stress on the last syllable, before any explicitly unstressed syllable
  829. tr->langopts.stress_flags = S_NO_AUTO_2 + S_NO_EOC_LENGTHEN; //no automatic secondary stress, don't lengthen at end-of-clause
  830. tr->langopts.lengthen_tonic = 0;
  831. tr->langopts.param[LOPT_SUFFIX] = 1;
  832. tr->langopts.numbers = NUM_OMIT_1_HUNDRED | NUM_DFRACTION_6 ;
  833. tr->langopts.max_initial_consonants = 2;
  834. SetLengthMods(tr,3); // all equal
  835. }
  836. break;
  837. case L('k','l'): // Greenlandic
  838. {
  839. tr->langopts.stress_rule = 12;
  840. tr->langopts.stress_flags = S_NO_AUTO_2;
  841. tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_SWAP_TENS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_ORDINAL_DOT | NUM_1900 | NUM_ROMAN | NUM_ROMAN_CAPITALS | NUM_ROMAN_ORDINAL;
  842. }
  843. break;
  844. case L('k','o'): // Korean, TEST
  845. {
  846. static const char ko_ivowels[] = {0x63,0x64,0x67,0x68,0x6d,0x72,0x74,0x75,0}; // y and i vowels
  847. static const unsigned char ko_voiced[] = {0x02,0x05,0x06,0xab,0xaf,0xb7,0xbc,0}; // voiced consonants, l,m,n,N
  848. tr->letter_bits_offset = OFFSET_KOREAN;
  849. memset(tr->letter_bits,0,sizeof(tr->letter_bits));
  850. SetLetterBitsRange(tr,LETTERGP_A,0x61,0x75);
  851. SetLetterBits(tr,LETTERGP_Y,ko_ivowels);
  852. SetLetterBits(tr,LETTERGP_G,(const char *)ko_voiced);
  853. tr->langopts.stress_rule = 8; // ?? 1st syllable if it is heavy, else 2nd syllable
  854. tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
  855. tr->langopts.numbers = NUM_OMIT_1_HUNDRED;
  856. tr->langopts.numbers2 = NUM2_MYRIADS;
  857. tr->langopts.break_numbers = 0x1111110;
  858. tr->langopts.max_digits = 20;
  859. }
  860. break;
  861. case L('k','u'): // Kurdish
  862. {
  863. static const unsigned char stress_amps_ku[8] = {18,18, 20,20, 20,22, 22,21 };
  864. static const short stress_lengths_ku[8] = {180,180, 190,180, 0,0, 230,240};
  865. SetupTranslator(tr,stress_lengths_ku,stress_amps_ku);
  866. tr->charset_a0 = charsets[9]; // ISO-8859-9 - Latin5
  867. tr->langopts.stress_rule = 7; // stress on the last syllable, before any explicitly unstressed syllable
  868. tr->langopts.numbers = NUM_HUNDRED_AND | NUM_AND_UNITS | NUM_OMIT_1_HUNDRED | NUM_AND_HUNDRED;
  869. tr->langopts.max_initial_consonants = 2;
  870. }
  871. break;
  872. case L('l','a'): //Latin
  873. {
  874. tr->charset_a0 = charsets[4]; // ISO-8859-4, includes a,e,i,o,u-macron
  875. tr->langopts.stress_rule = STRESSPOSN_2R;
  876. tr->langopts.stress_flags = 0x20;
  877. tr->langopts.unstressed_wd1 = 0;
  878. tr->langopts.unstressed_wd2 = 2;
  879. tr->langopts.param[LOPT_DIERESES] = 1;
  880. tr->langopts.numbers = NUM_ROMAN;
  881. tr->langopts.max_roman = 5000;
  882. }
  883. break;
  884. case L('l','t'): // Lithuanian
  885. {
  886. tr->charset_a0 = charsets[4]; // ISO-8859-4
  887. tr->langopts.stress_rule = STRESSPOSN_2R;
  888. tr->langopts.stress_flags = 0x20;
  889. tr->langopts.unstressed_wd1 = 0;
  890. tr->langopts.unstressed_wd2 = 2;
  891. tr->langopts.param[LOPT_DIERESES] = 1;
  892. tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED | NUM_DFRACTION_4 | NUM_ORDINAL_DOT;
  893. tr->langopts.numbers2 = NUM2_THOUSANDS_VAR4;
  894. tr->langopts.max_roman = 5000;
  895. }
  896. break;
  897. case L('l','v'): // latvian
  898. {
  899. static const unsigned char stress_amps_lv[8] = {17,13, 20,20, 20,22, 22,21 };
  900. static const short stress_lengths_lv[8] = {180,130, 210,210, 0,0, 210,210};
  901. SetupTranslator(tr,stress_lengths_lv,stress_amps_lv);
  902. tr->langopts.stress_rule = STRESSPOSN_1L;
  903. tr->langopts.spelling_stress = 1;
  904. tr->charset_a0 = charsets[4]; // ISO-8859-4
  905. tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED | NUM_DFRACTION_4 | NUM_ORDINAL_DOT;
  906. tr->langopts.stress_flags = 0x16 + 0x40000;
  907. }
  908. break;
  909. case L('m','k'): // Macedonian
  910. {
  911. static wchar_t vowels_cyrillic[] = {0x440, // also include 'р' [R]
  912. 0x430,0x435,0x438,0x439,0x43e,0x443,0x44b,0x44d,0x44e,0x44f,0x450,0x451,0x456,0x457,0x45d,0x45e,0};
  913. static const unsigned char stress_amps_mk[8] = {17,17, 20,20, 20,22, 22,21 };
  914. static const short stress_lengths_mk[8] = {180,160, 200,200, 0,0, 220,230};
  915. SetupTranslator(tr,stress_lengths_mk,stress_amps_mk);
  916. tr->charset_a0 = charsets[5]; // ISO-8859-5
  917. tr->letter_groups[0] = tr->letter_groups[7] = vowels_cyrillic;
  918. tr->langopts.stress_rule = STRESSPOSN_3R; // antipenultimate
  919. tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_AND_UNITS | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_DFRACTION_2;
  920. tr->langopts.numbers2 = 0x8a; // variant numbers before thousands,milliards
  921. }
  922. break;
  923. case L('m','t'): // Maltese
  924. {
  925. tr->charset_a0 = charsets[3]; // ISO-8859-3
  926. tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x100; // devoice at end of word
  927. tr->langopts.stress_rule = STRESSPOSN_2R; // penultimate
  928. tr->langopts.numbers = 1;
  929. }
  930. break;
  931. case L('n','l'): // Dutch
  932. {
  933. static const short stress_lengths_nl[8] = {160,135, 210,210, 0, 0, 260,280};
  934. tr->langopts.stress_rule = STRESSPOSN_1L;
  935. tr->langopts.vowel_pause = 0x30; // ??
  936. tr->langopts.param[LOPT_DIERESES] = 1;
  937. tr->langopts.param[LOPT_PREFIXES] = 1;
  938. tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x100; // devoice at end of word
  939. SetLetterVowel(tr,'y');
  940. tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_SWAP_TENS | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_ALLOW_SPACE | NUM_1900 | NUM_ORDINAL_DOT;
  941. tr->langopts.ordinal_indicator = "e";
  942. tr->langopts.stress_flags = S_FIRST_PRIMARY;
  943. memcpy(tr->stress_lengths,stress_lengths_nl,sizeof(tr->stress_lengths));
  944. }
  945. break;
  946. case L('n','o'): // Norwegian
  947. {
  948. static const short stress_lengths_no[8] = {160,140, 200,200, 0,0, 220,230};
  949. SetupTranslator(tr,stress_lengths_no,NULL);
  950. tr->langopts.stress_rule = STRESSPOSN_1L;
  951. SetLetterVowel(tr,'y');
  952. tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_HUNDRED_AND | NUM_ALLOW_SPACE | NUM_1900 | NUM_ORDINAL_DOT;
  953. }
  954. break;
  955. case L('o','m'):
  956. {
  957. static const unsigned char stress_amps_om[] = {18,15, 20,20, 20,22, 22,22 };
  958. static const short stress_lengths_om[8] = {200,200, 200,200, 0,0, 200,200};
  959. SetupTranslator(tr,stress_lengths_om,stress_amps_om);
  960. tr->langopts.stress_rule = STRESSPOSN_2R;
  961. tr->langopts.stress_flags = 0x16 + 0x80000;
  962. }
  963. break;
  964. case L('p','l'): // Polish
  965. {
  966. static const short stress_lengths_pl[8] = {160, 190, 175, 175, 0, 0, 200, 210};
  967. static const unsigned char stress_amps_pl[8] = {17,13, 19,19, 20,22, 22,21 }; // 'diminished' is used to mark a quieter, final unstressed syllable
  968. SetupTranslator(tr,stress_lengths_pl,stress_amps_pl);
  969. tr->charset_a0 = charsets[2]; // ISO-8859-2
  970. tr->langopts.stress_rule = STRESSPOSN_2R;
  971. tr->langopts.stress_flags = 0x6; // mark unstressed final syllables as diminished
  972. tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x9;
  973. tr->langopts.max_initial_consonants = 7; // for example: wchrzczony :)
  974. tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_DFRACTION_2;
  975. tr->langopts.numbers2 = NUM2_THOUSANDS_VAR3;
  976. tr->langopts.param[LOPT_COMBINE_WORDS] = 4 + 0x100; // combine 'nie' (marked with $alt2) with some 1-syllable (and 2-syllable) words (marked with $alt)
  977. SetLetterVowel(tr,'y');
  978. }
  979. break;
  980. case L('p','t'): // Portuguese
  981. {
  982. static const short stress_lengths_pt[8] = {170, 115, 210, 240, 0, 0, 260, 280};
  983. static const unsigned char stress_amps_pt[8] = {16,11, 19,21, 20,22, 22,21 }; // 'diminished' is used to mark a quieter, final unstressed syllable
  984. SetupTranslator(tr,stress_lengths_pt,stress_amps_pt);
  985. tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
  986. tr->langopts.stress_rule = STRESSPOSN_1R; // stress on final syllable
  987. tr->langopts.stress_flags = 0x6 | 0x10 | 0x2000 | 0x20000;
  988. tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_DFRACTION_2 | NUM_HUNDRED_AND | NUM_AND_UNITS | NUM_ROMAN;
  989. tr->langopts.numbers2 = NUM2_MULTIPLE_ORDINAL | NUM2_NO_TEEN_ORDINALS;
  990. SetLetterVowel(tr,'y');
  991. ResetLetterBits(tr,0x2);
  992. SetLetterBits(tr,1,"bcdfgjkmnpqstvxz"); // B hard consonants, excluding h,l,r,w,y
  993. tr->langopts.param[LOPT_ALT] = 2; // call ApplySpecialAttributes2() if a word has $alt or $alt2
  994. }
  995. break;
  996. case L('r','o'): // Romanian
  997. {
  998. static const short stress_lengths_ro[8] = {170, 170, 180, 180, 0, 0, 240, 260};
  999. static const unsigned char stress_amps_ro[8] = {15,13, 18,18, 20,22, 22,21 };
  1000. SetupTranslator(tr,stress_lengths_ro,stress_amps_ro);
  1001. tr->langopts.stress_rule = STRESSPOSN_2R;
  1002. tr->langopts.stress_flags = 0x100 + 0x6;
  1003. tr->charset_a0 = charsets[2]; // ISO-8859-2
  1004. tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_DFRACTION_3 | NUM_AND_UNITS | NUM_ROMAN;
  1005. tr->langopts.numbers2 = 0x1e; // variant numbers before all thousandplex
  1006. }
  1007. break;
  1008. case L('r','u'): // Russian
  1009. Translator_Russian(tr);
  1010. break;
  1011. case L('r','w'): // Kiryarwanda
  1012. {
  1013. tr->langopts.stress_rule = STRESSPOSN_2R;
  1014. tr->langopts.stress_flags = 0x16;
  1015. tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
  1016. tr->langopts.numbers = NUM_HUNDRED_AND | NUM_AND_UNITS | NUM_DFRACTION_2 | NUM_AND_HUNDRED;
  1017. tr->langopts.numbers2 = 0x200; // say "thousands" before its number
  1018. }
  1019. break;
  1020. case L('s','k'): // Slovak
  1021. case L('c','s'): // Czech
  1022. {
  1023. static const char *sk_voiced = "bdgjlmnrvwzaeiouy";
  1024. SetupTranslator(tr,stress_lengths_sk,stress_amps_sk);
  1025. tr->charset_a0 = charsets[2]; // ISO-8859-2
  1026. tr->langopts.stress_rule = STRESSPOSN_1L;
  1027. tr->langopts.stress_flags = 0x16;
  1028. tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x3;
  1029. tr->langopts.max_initial_consonants = 5;
  1030. tr->langopts.spelling_stress = 1;
  1031. tr->langopts.param[LOPT_COMBINE_WORDS] = 4; // combine some prepositions with the following word
  1032. tr->langopts.numbers = NUM_OMIT_1_HUNDRED | NUM_DFRACTION_2 | NUM_ROMAN;
  1033. tr->langopts.numbers2 = NUM2_THOUSANDS_VAR2;
  1034. tr->langopts.thousands_sep = STRESSPOSN_1L; //no thousands separator
  1035. tr->langopts.decimal_sep = ',';
  1036. if(name2 == L('c','s'))
  1037. {
  1038. tr->langopts.numbers2 = 0x108; // variant numbers before milliards
  1039. }
  1040. SetLetterVowel(tr,'y');
  1041. SetLetterVowel(tr,'r');
  1042. ResetLetterBits(tr,0x20);
  1043. SetLetterBits(tr,5,sk_voiced);
  1044. }
  1045. break;
  1046. case L('s','i'): // Sinhala
  1047. {
  1048. SetupTranslator(tr,stress_lengths_ta,stress_amps_ta);
  1049. tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
  1050. tr->langopts.stress_rule = STRESSPOSN_1L;
  1051. tr->langopts.stress_flags = S_FINAL_DIM | S_NO_AUTO_DIM | S_FINAL_NO_2;
  1052. tr->langopts.spelling_stress = 1;
  1053. tr->letter_bits_offset = OFFSET_SINHALA;
  1054. memset(tr->letter_bits,0,sizeof(tr->letter_bits));
  1055. SetLetterBitsRange(tr,LETTERGP_A,0x05,0x16); // vowel letters
  1056. SetLetterBitsRange(tr,LETTERGP_A,0x4a,0x73); // + vowel signs, and virama
  1057. SetLetterBitsRange(tr,LETTERGP_B,0x4a,0x73); // vowel signs, and virama
  1058. SetLetterBitsRange(tr,LETTERGP_C,0x1a,0x46); // the main consonant range
  1059. tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
  1060. tr->langopts.suffix_add_e = tr->letter_bits_offset + 0x4a; //virama
  1061. tr->langopts.numbers = NUM_OMIT_1_THOUSAND | NUM_SINGLE_STRESS_L | NUM_DFRACTION_7;
  1062. tr->langopts.numbers2 = NUM2_PERCENT_BEFORE;
  1063. tr->langopts.break_numbers = 0x14aa8; // for languages which have numbers for 100,000 and 100,00,000, eg Hindi
  1064. }
  1065. break;
  1066. case L('s','l'): // Slovenian
  1067. tr->charset_a0 = charsets[2]; // ISO-8859-2
  1068. tr->langopts.stress_rule = STRESSPOSN_2R; // Temporary
  1069. tr->langopts.stress_flags = 0x20;
  1070. tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x103;
  1071. tr->langopts.param[LOPT_UNPRONOUNCABLE] = 0x76; // [v] don't count this character at start of word
  1072. tr->letter_bits['r'] |= 0x80; // add 'r' to letter group 7, vowels for Unpronouncable test
  1073. tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_SWAP_TENS | NUM_OMIT_1_HUNDRED | NUM_DFRACTION_2 | NUM_ORDINAL_DOT | NUM_ROMAN;
  1074. tr->langopts.numbers2 = 0x100; // plural forms of millions etc
  1075. tr->langopts.thousands_sep = ' '; // don't allow dot as thousands separator
  1076. break;
  1077. case L('s','q'): // Albanian
  1078. {
  1079. static const short stress_lengths_sq[8] = {150, 150, 180, 180, 0, 0, 300, 300};
  1080. static const unsigned char stress_amps_sq[8] = {16,12, 16,16, 20,20, 21,19 };
  1081. SetupTranslator(tr,stress_lengths_sq,stress_amps_sq);
  1082. tr->langopts.stress_rule = STRESSPOSN_2R;
  1083. tr->langopts.stress_flags = 0x16 + 0x100;
  1084. SetLetterVowel(tr,'y');
  1085. tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_HUNDRED_AND | NUM_AND_UNITS | NUM_DFRACTION_4;
  1086. tr->langopts.accents = 2; // "capital" after letter name
  1087. }
  1088. break;
  1089. case L('s','v'): // Swedish
  1090. {
  1091. static const unsigned char stress_amps_sv[] = {16,16, 20,20, 20,22, 22,21 };
  1092. static const short stress_lengths_sv[8] = {160,135, 220,220, 0,0, 250,280};
  1093. SetupTranslator(tr,stress_lengths_sv,stress_amps_sv);
  1094. tr->langopts.stress_rule = STRESSPOSN_1L;
  1095. SetLetterVowel(tr,'y');
  1096. tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_1900;
  1097. tr->langopts.accents = 1;
  1098. }
  1099. break;
  1100. case L('s','w'): // Swahili
  1101. case L('t','n'): // Setswana
  1102. {
  1103. static const short stress_lengths_sw[8] = {160, 170, 200, 200, 0, 0, 320, 340};
  1104. static const unsigned char stress_amps_sw[] = {16,12, 19,19, 20,22, 22,21 };
  1105. SetupTranslator(tr,stress_lengths_sw,stress_amps_sw);
  1106. tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
  1107. tr->langopts.vowel_pause = 1;
  1108. tr->langopts.stress_rule = STRESSPOSN_2R;
  1109. tr->langopts.stress_flags = 0x6 | 0x10;
  1110. tr->langopts.numbers = NUM_AND_UNITS | NUM_HUNDRED_AND | NUM_SINGLE_AND | NUM_OMIT_1_HUNDRED;
  1111. tr->langopts.break_numbers = 0x49249268; // for languages which have numbers for 100,000 and 1,000,000
  1112. }
  1113. break;
  1114. case L('t','a'): // Tamil
  1115. case L('m','l'): // Malayalam
  1116. case L('k','n'): // Kannada
  1117. case L('m','r'): // Marathi
  1118. case L('t','e'): // Telugu
  1119. {
  1120. SetupTranslator(tr,stress_lengths_ta,stress_amps_ta);
  1121. tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
  1122. tr->langopts.stress_rule = STRESSPOSN_1L;
  1123. tr->langopts.stress_flags = 0x10004; // use 'diminished' for unstressed final syllable
  1124. tr->langopts.spelling_stress = 1;
  1125. tr->langopts.break_numbers = 0x14a8; // 1000, 100,000 10,000,000
  1126. if(name2 == L('t','a'))
  1127. {
  1128. tr->letter_bits_offset = OFFSET_TAMIL;
  1129. tr->langopts.numbers = NUM_OMIT_1_THOUSAND ;
  1130. }
  1131. if(name2 == L('m','r'))
  1132. {
  1133. tr->letter_bits_offset = OFFSET_DEVANAGARI;
  1134. }
  1135. else
  1136. if(name2 == L('m','l'))
  1137. {
  1138. tr->letter_bits_offset = OFFSET_MALAYALAM;
  1139. tr->langopts.numbers = NUM_OMIT_1_THOUSAND;
  1140. }
  1141. else
  1142. if(name2 == L('k','n'))
  1143. {
  1144. tr->letter_bits_offset = OFFSET_KANNADA;
  1145. tr->langopts.numbers = 0x1;
  1146. }
  1147. else
  1148. if(name2 == L('t','e'))
  1149. {
  1150. tr->letter_bits_offset = OFFSET_TELUGU;
  1151. tr->langopts.numbers = 0x1;
  1152. }
  1153. tr->langopts.param[LOPT_WORD_MERGE] = 1; // don't break vowels betwen words
  1154. SetIndicLetters(tr); // call this after setting OFFSET_
  1155. SetLetterBitsRange(tr,LETTERGP_B,0x4e,0x4e); // chillu-virama (unofficial)
  1156. }
  1157. break;
  1158. #ifdef deleted
  1159. case L('t','h'): // Thai
  1160. {
  1161. static const short stress_lengths_th[8] = {230,150, 230,230, 230,0, 230,250};
  1162. static const unsigned char stress_amps_th[] = {22,16, 22,22, 22,22, 22,22 };
  1163. SetupTranslator(tr,stress_lengths_th,stress_amps_th);
  1164. tr->langopts.stress_rule = 0; // stress on final syllable of a "word"
  1165. tr->langopts.stress_flags = 2; // don't automatically set diminished stress (may be set in the intonation module)
  1166. tr->langopts.tone_language = 1; // Tone language, use CalcPitches_Tone() rather than CalcPitches()
  1167. tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
  1168. // tr->langopts.tone_numbers = 1; // a number after letters indicates a tone number (eg. pinyin or jyutping)
  1169. tr->langopts.word_gap = 0x21; // length of a final vowel is less dependent on the next consonant, don't merge consonant with next word
  1170. }
  1171. break;
  1172. #endif
  1173. case L('t','r'): // Turkish
  1174. case L('a','z'): // Azerbaijan
  1175. {
  1176. static const unsigned char stress_amps_tr[8] = {18,16, 20,21, 20,21, 21,20 };
  1177. static const short stress_lengths_tr[8] = {190,180, 200,230, 0,0, 240,250};
  1178. SetupTranslator(tr,stress_lengths_tr,stress_amps_tr);
  1179. tr->charset_a0 = charsets[9]; // ISO-8859-9 - Latin5
  1180. tr->langopts.stress_rule = 7; // stress on the last syllable, before any explicitly unstressed syllable
  1181. tr->langopts.stress_flags = 0x20; //no automatic secondary stress
  1182. tr->langopts.param[LOPT_SUFFIX] = 1;
  1183. if(name2 == L('a','z'))
  1184. {
  1185. tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_DFRACTION_2;
  1186. }
  1187. else
  1188. {
  1189. tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_DFRACTION_2;
  1190. }
  1191. tr->langopts.max_initial_consonants = 2;
  1192. }
  1193. break;
  1194. case L('t','t'): // Tatar
  1195. {
  1196. SetCyrillicLetters(tr);
  1197. SetupTranslator(tr,stress_lengths_fr,stress_amps_fr);
  1198. tr->langopts.stress_rule = STRESSPOSN_1R; // stress on final syllable
  1199. tr->langopts.stress_flags = 0x20; //no automatic secondary stress
  1200. tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_DFRACTION_4;
  1201. }
  1202. break;
  1203. case L('u','k'): // Ukrainian
  1204. {
  1205. SetCyrillicLetters(tr);
  1206. tr->langopts.param[LOPT_UNPRONOUNCABLE] = 0x432; // [v] don't count this character at start of word
  1207. }
  1208. break;
  1209. case L('u','r'): // Urdu
  1210. tr->letter_bits_offset = OFFSET_ARABIC;
  1211. tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
  1212. tr->langopts.numbers = NUM_SWAP_TENS;
  1213. tr->langopts.break_numbers = 0x52a8; // for languages which have numbers for 100,000 and 100,00,000, eg Hindi
  1214. break;
  1215. case L('v','i'): // Vietnamese
  1216. {
  1217. static const short stress_lengths_vi[8] = {150, 150, 180, 180, 210, 230, 230, 240};
  1218. static const unsigned char stress_amps_vi[] = {16,16, 16,16, 22,22, 22,22 };
  1219. static wchar_t vowels_vi[] = {
  1220. 0x61, 0xe0, 0xe1, 0x1ea3, 0xe3, 0x1ea1, // a
  1221. 0x103, 0x1eb1, 0x1eaf, 0x1eb3, 0x1eb5, 0x1eb7, // ă
  1222. 0xe2, 0x1ea7, 0x1ea5, 0x1ea9, 0x1eab, 0x1ead, // â
  1223. 0x65, 0xe8, 0xe9, 0x1ebb, 0x1ebd, 0x1eb9, // e
  1224. 0xea, 0x1ec1, 0x1ebf, 0x1ec3, 0x1ec5, 0x1ec7, // i
  1225. 0x69, 0xec, 0xed, 0x1ec9, 0x129, 0x1ecb, // i
  1226. 0x6f, 0xf2, 0xf3, 0x1ecf, 0xf5, 0x1ecd, // o
  1227. 0xf4, 0x1ed3, 0x1ed1, 0x1ed5, 0x1ed7, 0x1ed9, // ô
  1228. 0x1a1, 0x1edd, 0x1edb, 0x1edf, 0x1ee1, 0x1ee3, // ơ
  1229. 0x75, 0xf9, 0xfa, 0x1ee7, 0x169, 0x1ee5, // u
  1230. 0x1b0, 0x1eeb, 0x1ee9, 0x1eed, 0x1eef, 0x1ef1, // ư
  1231. 0x79, 0x1ef3, 0xfd, 0x1ef7, 0x1ef9, 0x1e, 0 }; // y
  1232. SetupTranslator(tr,stress_lengths_vi,stress_amps_vi);
  1233. tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
  1234. tr->langopts.stress_rule = STRESSPOSN_1L;
  1235. tr->langopts.word_gap = 0x21; // length of a final vowel is less dependent on the next consonant, don't merge consonant with next word
  1236. // tr->langopts.vowel_pause = 4;
  1237. tr->letter_groups[0] = tr->letter_groups[7] = vowels_vi;
  1238. tr->langopts.tone_language = 1; // Tone language, use CalcPitches_Tone() rather than CalcPitches()
  1239. tr->langopts.unstressed_wd1 = 2;
  1240. tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_HUNDRED_AND_DIGIT | NUM_DFRACTION_4 | NUM_ZERO_HUNDRED;
  1241. }
  1242. break;
  1243. case L('w','o'):
  1244. tr->langopts.stress_rule = STRESSPOSN_1L;
  1245. tr->langopts.numbers = NUM_AND_UNITS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_SINGLE_STRESS;
  1246. break;
  1247. case L('z','h'):
  1248. case L_zhy:
  1249. {
  1250. static const short stress_lengths_zh[8] = {230,150, 230,230, 230,0, 240,250}; // 1=tone5. end-of-sentence, 6=tone 1&4, 7=tone 2&3
  1251. static const unsigned char stress_amps_zh[] = {22,16, 22,22, 22,22, 22,22 };
  1252. SetupTranslator(tr,stress_lengths_zh,stress_amps_zh);
  1253. tr->langopts.stress_rule = STRESSPOSN_1R; // stress on final syllable of a "word"
  1254. tr->langopts.stress_flags = 2; // don't automatically set diminished stress (may be set in the intonation module)
  1255. tr->langopts.vowel_pause = 0;
  1256. tr->langopts.tone_language = 1; // Tone language, use CalcPitches_Tone() rather than CalcPitches()
  1257. tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
  1258. tr->langopts.tone_numbers = 1; // a number after letters indicates a tone number (eg. pinyin or jyutping)
  1259. tr->langopts.ideographs = 1;
  1260. tr->langopts.word_gap = 0x21; // length of a final vowel is less dependent on the next consonant, don't merge consonant with next word
  1261. if(name2 == L('z','h'))
  1262. {
  1263. tr->langopts.textmode = 1;
  1264. tr->langopts.listx = 1; // compile zh_listx after zh_list
  1265. }
  1266. }
  1267. break;
  1268. default:
  1269. tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
  1270. break;
  1271. }
  1272. tr->translator_name = name2;
  1273. if(tr->langopts.numbers & NUM_DECIMAL_COMMA)
  1274. {
  1275. // use . and ; for thousands and decimal separators
  1276. tr->langopts.thousands_sep = '.';
  1277. tr->langopts.decimal_sep = ',';
  1278. }
  1279. if(tr->langopts.numbers & NUM_THOUS_SPACE)
  1280. {
  1281. tr->langopts.thousands_sep = 0; // don't allow thousands separator, except space
  1282. }
  1283. return(tr);
  1284. } // end of SelectTranslator
  1285. //**********************************************************************************************************
  1286. static void Translator_Russian(Translator *tr)
  1287. {//===========================================
  1288. static const unsigned char stress_amps_ru[] = {16,16, 18,18, 20,24, 24,22 };
  1289. static const short stress_lengths_ru[8] = {150,140, 220,220, 0,0, 260,280};
  1290. static const char ru_ivowels2[] = {0x2c,0x15,0x18,0x2e,0x2f,0}; // add more vowels to letter group Y (iotated vowels & soft-sign)
  1291. SetupTranslator(tr,stress_lengths_ru,stress_amps_ru);
  1292. SetCyrillicLetters(tr);
  1293. SetLetterBits(tr,6,ru_ivowels2);
  1294. tr->langopts.param[LOPT_UNPRONOUNCABLE] = 0x432; // [v] don't count this character at start of word
  1295. tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 1;
  1296. tr->langopts.param[LOPT_REDUCE] = 2;
  1297. tr->langopts.stress_rule = 5;
  1298. tr->langopts.stress_flags = 0x0020; // waas 0x1010
  1299. tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED;
  1300. tr->langopts.numbers2 = 0x2 + NUM2_THOUSANDS_VAR1; // variant numbers before thousands
  1301. tr->langopts.phoneme_change = 1;
  1302. tr->langopts.testing = 2;
  1303. } // end of Translator_Russian
  1304. /*
  1305. typedef struct {
  1306. int flags;
  1307. unsigned char stress; // stress level of this vowel
  1308. unsigned char stress_highest; // the highest stress level of a vowel in this word
  1309. unsigned char n_vowels; // number of vowels in the word
  1310. unsigned char vowel_this; // syllable number of this vowel (counting from 1)
  1311. unsigned char vowel_stressed; // syllable number of the highest stressed vowel
  1312. } CHANGEPH;
  1313. */
  1314. #ifdef RUSSIAN2
  1315. // This is now done in the phoneme data, ph_russian
  1316. int ChangePhonemes_ru(Translator *tr, PHONEME_LIST2 *phlist, int n_ph, int index, PHONEME_TAB *ph, CHANGEPH *ch)
  1317. {//=============================================================================================================
  1318. // Called for each phoneme in the phoneme list, to allow a language to make changes
  1319. // ph The current phoneme
  1320. int variant;
  1321. int vowelix;
  1322. PHONEME_TAB *prev, *next;
  1323. if(ch->flags & 8)
  1324. return(0); // full phoneme translation has already been given
  1325. // Russian vowel softening and reduction rules
  1326. if(ph->type == phVOWEL)
  1327. {
  1328. int prestressed = ch->vowel_stressed==ch->vowel_this+1; // the next vowel after this has the main stress
  1329. #define N_VOWELS_RU 11
  1330. static unsigned int vowels_ru[N_VOWELS_RU] = {'a','V','O','I',PH('I','#'),PH('E','#'),PH('E','2'),
  1331. PH('V','#'),PH('I','3'),PH('I','2'),PH('E','3')};
  1332. static unsigned int vowel_replace[N_VOWELS_RU][6] = {
  1333. // stressed, soft, soft-stressed, j+stressed, j+soft, j+soft-stressed
  1334. /*0*/ {'A', 'I', PH('j','a'), 'a', 'a', 'a'}, // a Uses 3,4,5 columns.
  1335. /*1*/ {'A', 'V', PH('j','a'), 'a', 'V', 'a'}, // V Uses 3,4,5 columns.
  1336. /*2*/ {'o', '8', '8', 'o', '8', '8'}, // O
  1337. /*3*/ {'i', 'I', 'i', 'a', 'I', 'a'}, // I Uses 3,4,5 columns.
  1338. /*4*/ {'i', PH('I','#'), 'i', 'i', PH('I','#'), 'i'}, // I#
  1339. /*5*/ {'E', PH('E','#'), 'E', 'e', PH('E','#'), 'e'}, // E#
  1340. /*6*/ {'E', PH('E','2'), 'E', 'e', PH('E','2'), 'e'}, // E2 Uses 3,4,5 columns.
  1341. /*7*/ {PH('j','a'), 'V', PH('j','a'), 'A', 'V', 'A'}, // V#
  1342. /*8*/ {PH('j','a'), 'I', PH('j','a'), 'e', 'I', 'e'}, // I3 Uses 3,4,5 columns.
  1343. /*9*/ {'e', 'I', 'e', 'e', 'I', 'e'}, // I2
  1344. /*10*/ {'e', PH('E', '2'), 'e', 'e', PH('E','2'), 'e'} // E3
  1345. };
  1346. prev = phoneme_tab[phlist[index-1].phcode];
  1347. next = phoneme_tab[phlist[index+1].phcode];
  1348. // lookup the vowel name to get an index into the vowel_replace[] table
  1349. for(vowelix=0; vowelix<N_VOWELS_RU; vowelix++)
  1350. {
  1351. if(vowels_ru[vowelix] == ph->mnemonic)
  1352. break;
  1353. }
  1354. if(vowelix == N_VOWELS_RU)
  1355. return(0);
  1356. if(prestressed)
  1357. {
  1358. if((vowelix==6)&&(prev->mnemonic=='j'))
  1359. vowelix=8;
  1360. if(vowelix==1)
  1361. vowelix=0;
  1362. if(vowelix==4)
  1363. vowelix=3;
  1364. if(vowelix==6)
  1365. vowelix=5;
  1366. if(vowelix==7)
  1367. vowelix=8;
  1368. if(vowelix==10)
  1369. vowelix=9;
  1370. }
  1371. // do we need a variant of this vowel, depending on the stress and adjacent phonemes ?
  1372. variant = -1;
  1373. int stressed = ch->flags & 2;
  1374. int soft=prev->phflags & phPALATAL;
  1375. if (soft && stressed)
  1376. variant = 2; else
  1377. if (stressed)
  1378. variant = 0; else
  1379. if (soft)
  1380. variant = 1;
  1381. if(variant >= 0)
  1382. {
  1383. if(prev->mnemonic == 'j')
  1384. variant += 3;
  1385. phlist[index].phcode = PhonemeCode(vowel_replace[vowelix][variant]);
  1386. }
  1387. else
  1388. {
  1389. phlist[index].phcode = PhonemeCode(vowels_ru[vowelix]);
  1390. }
  1391. }
  1392. return(0);
  1393. }
  1394. #endif