en.sor 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. ^0 zero
  2. 1 one
  3. 2 two
  4. 3 three
  5. 4 four
  6. 5 five
  7. 6 six
  8. 7 seven
  9. 8 eight
  10. 9 nine
  11. 10 ten
  12. 11 eleven
  13. 12 twelve
  14. 13 thirteen
  15. 15 fifteen
  16. 18 eighteen
  17. 1(\d) $1teen
  18. 2(\d) twenty[-$1]
  19. 3(\d) thirty[-$1]
  20. 4(\d) forty[-$1]
  21. 5(\d) fifty[-$1]
  22. 8(\d) eighty[-$1]
  23. (\d)(\d) $1ty[-$2]
  24. # separator function
  25. :0+ # one million
  26. :0*\d?\d " and " # one million and twenty-two
  27. :\d+ ", " # one million, one thousand
  28. (\d)(\d\d) $1 hundred[ and $2] # one hundred and one [:en-AU:] [:en-GB:] [:en-IE:] [:en-NZ:]
  29. (\d)(\d\d) $1 hundred[ $2] # default: one hundred one
  30. (\d{1,2})([1-9]\d\d) $1 thousand[ $2] # ten thousand two hundred
  31. (\d{1,2})(\d{3}) $1 thousand$(:\2)$2 # [:en-IN:] one hundred thousand, two hundred
  32. (\d{1,2})(000\d\d) $1 lakh$(:\2)$2 # [:en-IN:] one lakh and two
  33. (\d{1,2})(\d{5}) $1 lakh[ $2] # [:en-IN:] one lakh two hundred
  34. (\d{1,4})(\d{7}) $1 crore$(:\2)$2 # [:en-IN:]
  35. (\d{1,3})(\d{3}) $1 thousand$(:\2)$2 # one hundred thousand, two hundred
  36. (\d{1,3})(\d{6}) $1 million$(:\2)$2
  37. (\d{1,3})(\d{9}) $1 billion$(:\2)$2
  38. (\d{1,3})(\d{12}) $1 trillion$(:\2)$2
  39. (\d{1,3})(\d{15}) $1 quadrillion$(:\2)$2
  40. (\d{1,3})(\d{18}) $1 quintillion$(:\2)$2
  41. (\d{1,3})(\d{21}) $1 sextillion$(:\2)$2
  42. (\d{1,3})(\d{24}) $1 septillion$(:\2)$2
  43. (\d{1,3})(\d{27}) $1 octillion$(:\2)$2
  44. (\d{1,3})(\d{30}) $1 nonillion$(:\2)$2
  45. (\d{1,3})(\d{33}) $1 decillion$(:\2)$2
  46. (\d{1,3})(\d{36}) $1 undecillion$(:\2)$2
  47. (\d{1,3})(\d{39}) $1 duodecillion$(:\2)$2
  48. (\d{1,3})(\d{42}) $1 tredecillion$(:\2)$2
  49. # negative number
  50. [-−](\d+) negative |$1
  51. # decimals
  52. 0[.,] point
  53. ([-−]?\d+)[.,] $1| point
  54. ([-−]?\d+[.,]\d*)(\d) $1| |$2
  55. # currency
  56. # unit/subunit singular/plural
  57. us:([^,]*),([^,]*),([^,]*),([^,]*) \1
  58. up:([^,]*),([^,]*),([^,]*),([^,]*) \2
  59. ss:([^,]*),([^,]*),([^,]*),([^,]*) \3
  60. sp:([^,]*),([^,]*),([^,]*),([^,]*) \4
  61. AUD:(\D+) $(\1: Australian dollar, Australian dollars, cent, cents)
  62. BGN:(\D+) $(\1: lev, leva, stotinka, stotinki)
  63. BWP:(\D+) $(\1: pula, pula, thebe, thebe)
  64. BZD:(\D+) $(\1: Belize dollar, Belize dollars, cent, cents)
  65. CAD:(\D+) $(\1: Canadian dollar, Canadian dollars, cent, cents)
  66. CHF:(\D+) $(\1: Swiss franc, Swiss francs, centime, centimes)
  67. CNY:(\D+) $(\1: Chinese yuan, Chinese yuan, fen, fen)
  68. CZK:(\D+) $(\1: Czech koruna, Czech koruny, halér, halére)
  69. DKK:(\D+) $(\1: Danish krone, Danish kroner, øre, øre)
  70. EEK:(\D+) $(\1: kroon, kroonid, sent, senti)
  71. EUR:(\D+) $(\1: euro, euro, cent, cents)
  72. GBP:(\D+) $(\1: pound sterling, pounds sterling, penny, pence)
  73. GHS:(\D+) $(\1: Ghana cedi, Ghana cedis, pesewa, pesewas)
  74. GMD:(\D+) $(\1: dalasi, dalasi, butut, bututs)
  75. HKD:(\D+) $(\1: Hong Kong dollar, Hong Kong dollars, cent, cents)
  76. HRK:(\D+) $(\1: kuna, kuna, lipa, lipa)
  77. HUF:(\D+) $(\1: forint, forint, fillér, fillér)
  78. ILS:(\D+) $(\1: Israeli shekel, Israeli shekels, agora, agoras)
  79. INR:(\D+) $(\1: Indian rupee, Indian rupees, paisa, paise)
  80. JMD:(\D+) $(\1: Jamaica dollar, Jamaica dollars, cent, cents)
  81. JPY:(\D+) $(\1: Japanese yen, Japanese yen, sen, sen)
  82. KES:(\D+) $(\1: Kenyan shilling, Kenyan shillings, cent, cents)
  83. KRW:(\D+) $(\1: Korean won, Korean won, jeon, jeon)
  84. LKR:(\D+) $(\1: Sri Lankan rupee, Sri Lankan rupees, cent, cents)
  85. LRD:(\D+) $(\1: Liberian dollar, Liberian dollars, cent, cents)
  86. LSL:(\D+) $(\1: loti, maloti, sente, lisente)
  87. LTL:(\D+) $(\1: litas, litai, centas, centai)
  88. LVL:(\D+) $(\1: lats, lati, santims, santimi)
  89. MGA:(\D+) $(\1: ariary, ariaries, iraimbilanja, iraimbilanja)
  90. MUR:(\D+) $(\1: Mauritian rupee, Mauritian rupees, cent, cents)
  91. MXN:(\D+) $(\1: Mexican peso, Mexican pesos, centavo, centavos)
  92. MWK:(\D+) $(\1: Malawian kwacha, Malawian kwacha, tambala, tambala)
  93. MYR:(\D+) $(\1: Ringgit, Ringgit, cent, cents)
  94. NAD:(\D+) $(\1: Namibian dollar, Namibian dollars, cent, cents)
  95. NGN:(\D+) $(\1: naira, naira, kobo, kobo)
  96. NZD:(\D+) $(\1: New Zealand dollar, New Zealand dollars, cent, cents)
  97. PGK:(\D+) $(\1: kina, kina, toea, toea)
  98. PHP:(\D+) $(\1: Philippine peso, Philippine pesos, centavo, centavos)
  99. PKR:(\D+) $(\1: Pakistani rupee, Pakistani rupees, paisa, paise)
  100. PLN:(\D+) $(\1: zloty, zlotys, grosz, groszy)
  101. RON:(\D+) $(\1: Romanian leu, Romanian lei, ban, bani)
  102. RSD:(\D+) $(\1: Serbian dinar, Serbian dinars, para, para)
  103. RUB:(\D+) $(\1: Russian ruble, Russian rubles, kopek, kopeks)
  104. RWF:(\D+) $(\1: Rwandese franc, Rwandese francs, centime, centimes)
  105. SDG:(\D+) $(\1: Sudanese pound, Sudanese pounds, piastre, piastres)
  106. SGD:(\D+) $(\1: Singapore dollar, Singapore dollars, cent, cents)
  107. SLL:(\D+) $(\1: leone, leones, cent, cents)
  108. SZL:(\D+) $(\1: lilangeni, emalangeni, cent, cents)
  109. THB:(\D+) $(\1: baht, baht, satang, satang)
  110. TRY:(\D+) $(\1: Turkish lira, Turkish lira, kurus, kurus)
  111. TTD:(\D+) $(\1: Trinidad and Tobago dollar, Trinidad and Tobago dollars, cent, cents)
  112. TZS:(\D+) $(\1: Tanzanian shilling, Tanzanian shillings, cent, cents)
  113. UAH:(\D+) $(\1: hryvnia, hryvnia, kopiyka, kopiyka)
  114. UGX:(\D+) $(\1: Uganda shilling, Uganda shillings, cent, cents)
  115. USD:(\D+) $(\1: U.S. dollar, U.S. dollars, cent, cents)
  116. X[AO]F:(\D+) $(\1: CFA franc, CFA francs, centime, centimes)
  117. ZAR:(\D+) $(\1: South African rand, South African rand, cent, cents)
  118. ZMW:(\D+) $(\1: Zambian kwacha, Zambian kwacha, ngwee, ngwee)
  119. ZW[DL]:(\D+) $(\1: Zimbabwe dollar, Zimbabwe dollars, cent, cents)
  120. "(JPY [-−]?\d+)[.,](\d\d)0" $1
  121. "(JPY [-−]?\d+[.,]\d\d)(\d)" $1 $2 rin
  122. "([A-Z]{3}) ([-−]?1)([.,]00?)?" $2$(\1:us)
  123. "([A-Z]{3}) ([-−]?\d+)([.,]00?)?" $2$(\1:up)
  124. "(CNY [-−]?\d+)[.,](\d)0?" $1 $2 jiao
  125. "(CNY [-−]?\d+[.,]\d)(\d)" $1 $2 fen
  126. "((MGA|MRO) [-−]?\d+)[.,]0" $1
  127. "((MGA|MRO) [-−]?\d+)[.,]2" $1 and |$(1)$(\2:ss)
  128. "((MGA|MRO) [-−]?\d+)[.,]4" $1 and |$(2)$(\2:sp)
  129. "((MGA|MRO) [-−]?\d+)[.,]6" $1 and |$(3)$(\2:sp)
  130. "((MGA|MRO) [-−]?\d+)[.,]8" $1 and |$(4)$(\2:sp)
  131. "(([A-Z]{3}) [-−]?\d+)[.,](01)" $1 and |$(1)$(\2:ss)
  132. "(([A-Z]{3}) [-−]?\d+)[.,](\d)" $1 and |$(\30)$(\2:sp)
  133. "(([A-Z]{3}) [-−]?\d+)[.,](\d\d)" $1 and |$3$(\2:sp)
  134. == money ==
  135. "(JPY [-−]?\d+)[.,](\d\d)0" $1
  136. "(JPY [-−]?\d+[.,]\d\d)(\d)" $1 $2 rin
  137. "([A-Z]{3}) ([-−]?1)([.,]00?)?" $2$(\1:us)
  138. "([A-Z]{3}) ([-−]?\d+)([.,]00?)?" $2$(\1:up)
  139. "(CNY [-−]?\d+)[.,](\d)0?" $1 $2 jiao
  140. "(CNY [-−]?\d+[.,]\d)(\d)" $1 $2 fen
  141. "(MGA|MRO) ([-−]?\d+)[.,]0" $2$(\1:us)
  142. "(MGA|MRO) ([-−]?\d+)[.,]2" $2 and 1/5$(\1:us)
  143. "(MGA|MRO) ([-−]?\d+)[.,]4" $2 and 2/5$(\1:up)
  144. "(MGA|MRO) ([-−]?\d+)[.,]6" $2 and 3/5$(\1:up)
  145. "(MGA|MRO) ([-−]?\d+)[.,]8" $2 and 4/5$(\1:up)
  146. "([A-Z]{3}) ([-−]?1)" $2$(\1:us)
  147. "([A-Z]{3}) ([-−]?\d+)" $2$(\1:up)
  148. "(([A-Z]{3}) ([-−]?\d+))[.,](01)" $3 and 1/100$(\2:us)
  149. "(([A-Z]{3}) ([-−]?\d+))[.,](\d)" $3 and \40/100$(\2:up)
  150. "(([A-Z]{3}) ([-−]?\d+))[.,](\d\d)" $3 and \4/100$(\2:up)
  151. "(([A-Z]{3}) ([-−]?\d+))[.,](\d\d\d)" $3 and \4/1000$(\2:up)
  152. == ordinal ==
  153. # convert to text, and recall to convert
  154. # cardinal names to ordinal ones
  155. ([-−]?\d+) $(ordinal |$1)
  156. (.*)one \1first
  157. (.*)two \1second
  158. (.*)three \1third
  159. (.*)five \1fifth
  160. (.*)eight \1eighth
  161. (.*)nine \1ninth
  162. (.*)twelve \1twelfth
  163. (.*)y \1ieth
  164. (.*) \1th
  165. == ordinal-number ==
  166. (.*1\d) \1th
  167. (.*1) \1st
  168. (.*2) \1nd
  169. (.*3) \1rd
  170. (.*) \1th
  171. == year ==
  172. (1[1-9])00 $1 hundred
  173. (1[1-9])([0-9][0-9]) $1 $2
  174. (.*) $(year-remove-and $1)
  175. == year-remove-and ==
  176. "(.*) and (.*)" \1 \2
  177. (.*) \1
  178. == help ==
  179. "" $(1)|, $(2), $(3)\n$(\0 ordinal)$(\0 ordinal-number)year: $(year 1999), two thousand, $(year 2001)\ncurrency \(for example, USD\): $(USD 2.5)\nmoney USD: $(money USD 2.5)
  180. "(ordinal(-number)?|USD)" \1: $(\1 1), $(\1 2), $(\1 3)\n