sbcs.js 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907
  1. var util = require('util'),
  2. Match = require ('../match');
  3. /**
  4. * This class recognizes single-byte encodings. Because the encoding scheme is so
  5. * simple, language statistics are used to do the matching.
  6. */
  7. function NGramParser(theNgramList, theByteMap) {
  8. var N_GRAM_MASK = 0xFFFFFF;
  9. this.byteIndex = 0;
  10. this.ngram = 0;
  11. this.ngramList = theNgramList;
  12. this.byteMap = theByteMap;
  13. this.ngramCount = 0;
  14. this.hitCount = 0;
  15. this.spaceChar;
  16. /*
  17. * Binary search for value in table, which must have exactly 64 entries.
  18. */
  19. this.search = function(table, value) {
  20. var index = 0;
  21. if (table[index + 32] <= value) index += 32;
  22. if (table[index + 16] <= value) index += 16;
  23. if (table[index + 8] <= value) index += 8;
  24. if (table[index + 4] <= value) index += 4;
  25. if (table[index + 2] <= value) index += 2;
  26. if (table[index + 1] <= value) index += 1;
  27. if (table[index] > value) index -= 1;
  28. if (index < 0 || table[index] != value)
  29. return -1;
  30. return index;
  31. };
  32. this.lookup = function(thisNgram) {
  33. this.ngramCount += 1;
  34. if (this.search(this.ngramList, thisNgram) >= 0) {
  35. this.hitCount += 1;
  36. }
  37. };
  38. this.addByte = function(b) {
  39. this.ngram = ((this.ngram << 8) + (b & 0xFF)) & N_GRAM_MASK;
  40. this.lookup(this.ngram);
  41. }
  42. this.nextByte = function(det) {
  43. if (this.byteIndex >= det.fInputLen)
  44. return -1;
  45. return det.fInputBytes[this.byteIndex++] & 0xFF;
  46. }
  47. this.parse = function(det, spaceCh) {
  48. var b, ignoreSpace = false;
  49. this.spaceChar = spaceCh;
  50. while ((b = this.nextByte(det)) >= 0) {
  51. var mb = this.byteMap[b];
  52. // TODO: 0x20 might not be a space in all character sets...
  53. if (mb != 0) {
  54. if (!(mb == this.spaceChar && ignoreSpace)) {
  55. this.addByte(mb);
  56. }
  57. ignoreSpace = (mb == this.spaceChar);
  58. }
  59. }
  60. // TODO: Is this OK? The buffer could have ended in the middle of a word...
  61. this.addByte(this.spaceChar);
  62. var rawPercent = this.hitCount / this.ngramCount;
  63. // TODO - This is a bit of a hack to take care of a case
  64. // were we were getting a confidence of 135...
  65. if (rawPercent > 0.33)
  66. return 98;
  67. return Math.floor(rawPercent * 300.0);
  68. };
  69. };
  70. function NGramsPlusLang(la, ng) {
  71. this.fLang = la;
  72. this.fNGrams = ng;
  73. };
  74. function sbcs() {};
  75. sbcs.prototype.spaceChar = 0x20;
  76. sbcs.prototype.ngrams = function() {};
  77. sbcs.prototype.byteMap = function() {};
  78. sbcs.prototype.match = function(det) {
  79. var ngrams = this.ngrams();
  80. var multiple = (Array.isArray(ngrams) && ngrams[0] instanceof NGramsPlusLang);
  81. if (!multiple) {
  82. var parser = new NGramParser(ngrams, this.byteMap());
  83. var confidence = parser.parse(det, this.spaceChar);
  84. return confidence <= 0 ? null : new Match(det, this, confidence);
  85. }
  86. var bestConfidenceSoFar = -1;
  87. var lang = null;
  88. for (var i = ngrams.length - 1; i >= 0; i--) {
  89. var ngl = ngrams[i];
  90. var parser = new NGramParser(ngl.fNGrams, this.byteMap());
  91. var confidence = parser.parse(det, this.spaceChar);
  92. if (confidence > bestConfidenceSoFar) {
  93. bestConfidenceSoFar = confidence;
  94. lang = ngl.fLang;
  95. }
  96. }
  97. var name = this.name(det);
  98. return bestConfidenceSoFar <= 0 ? null : new Match(det, this, bestConfidenceSoFar, name, lang);
  99. };
  100. module.exports.ISO_8859_1 = function() {
  101. this.byteMap = function() {
  102. return [
  103. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  104. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  105. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  106. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  107. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
  108. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  109. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  110. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  111. 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  112. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
  113. 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
  114. 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
  115. 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  116. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
  117. 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
  118. 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
  119. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  120. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  121. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  122. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  123. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  124. 0x20, 0x20, 0xAA, 0x20, 0x20, 0x20, 0x20, 0x20,
  125. 0x20, 0x20, 0x20, 0x20, 0x20, 0xB5, 0x20, 0x20,
  126. 0x20, 0x20, 0xBA, 0x20, 0x20, 0x20, 0x20, 0x20,
  127. 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
  128. 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
  129. 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0x20,
  130. 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xDF,
  131. 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
  132. 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
  133. 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0x20,
  134. 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
  135. ];
  136. };
  137. this.ngrams = function() {
  138. return [
  139. new NGramsPlusLang('da', [
  140. 0x206166, 0x206174, 0x206465, 0x20656E, 0x206572, 0x20666F, 0x206861, 0x206920,
  141. 0x206D65, 0x206F67, 0x2070E5, 0x207369, 0x207374, 0x207469, 0x207669, 0x616620,
  142. 0x616E20, 0x616E64, 0x617220, 0x617420, 0x646520, 0x64656E, 0x646572, 0x646574,
  143. 0x652073, 0x656420, 0x656465, 0x656E20, 0x656E64, 0x657220, 0x657265, 0x657320,
  144. 0x657420, 0x666F72, 0x676520, 0x67656E, 0x676572, 0x696765, 0x696C20, 0x696E67,
  145. 0x6B6520, 0x6B6B65, 0x6C6572, 0x6C6967, 0x6C6C65, 0x6D6564, 0x6E6465, 0x6E6520,
  146. 0x6E6720, 0x6E6765, 0x6F6720, 0x6F6D20, 0x6F7220, 0x70E520, 0x722064, 0x722065,
  147. 0x722073, 0x726520, 0x737465, 0x742073, 0x746520, 0x746572, 0x74696C, 0x766572
  148. ]),
  149. new NGramsPlusLang('de', [
  150. 0x20616E, 0x206175, 0x206265, 0x206461, 0x206465, 0x206469, 0x206569, 0x206765,
  151. 0x206861, 0x20696E, 0x206D69, 0x207363, 0x207365, 0x20756E, 0x207665, 0x20766F,
  152. 0x207765, 0x207A75, 0x626572, 0x636820, 0x636865, 0x636874, 0x646173, 0x64656E,
  153. 0x646572, 0x646965, 0x652064, 0x652073, 0x65696E, 0x656974, 0x656E20, 0x657220,
  154. 0x657320, 0x67656E, 0x68656E, 0x687420, 0x696368, 0x696520, 0x696E20, 0x696E65,
  155. 0x697420, 0x6C6963, 0x6C6C65, 0x6E2061, 0x6E2064, 0x6E2073, 0x6E6420, 0x6E6465,
  156. 0x6E6520, 0x6E6720, 0x6E6765, 0x6E7465, 0x722064, 0x726465, 0x726569, 0x736368,
  157. 0x737465, 0x742064, 0x746520, 0x74656E, 0x746572, 0x756E64, 0x756E67, 0x766572
  158. ]),
  159. new NGramsPlusLang('en', [
  160. 0x206120, 0x20616E, 0x206265, 0x20636F, 0x20666F, 0x206861, 0x206865, 0x20696E,
  161. 0x206D61, 0x206F66, 0x207072, 0x207265, 0x207361, 0x207374, 0x207468, 0x20746F,
  162. 0x207768, 0x616964, 0x616C20, 0x616E20, 0x616E64, 0x617320, 0x617420, 0x617465,
  163. 0x617469, 0x642061, 0x642074, 0x652061, 0x652073, 0x652074, 0x656420, 0x656E74,
  164. 0x657220, 0x657320, 0x666F72, 0x686174, 0x686520, 0x686572, 0x696420, 0x696E20,
  165. 0x696E67, 0x696F6E, 0x697320, 0x6E2061, 0x6E2074, 0x6E6420, 0x6E6720, 0x6E7420,
  166. 0x6F6620, 0x6F6E20, 0x6F7220, 0x726520, 0x727320, 0x732061, 0x732074, 0x736169,
  167. 0x737420, 0x742074, 0x746572, 0x746861, 0x746865, 0x74696F, 0x746F20, 0x747320
  168. ]),
  169. new NGramsPlusLang('es', [
  170. 0x206120, 0x206361, 0x20636F, 0x206465, 0x20656C, 0x20656E, 0x206573, 0x20696E,
  171. 0x206C61, 0x206C6F, 0x207061, 0x20706F, 0x207072, 0x207175, 0x207265, 0x207365,
  172. 0x20756E, 0x207920, 0x612063, 0x612064, 0x612065, 0x61206C, 0x612070, 0x616369,
  173. 0x61646F, 0x616C20, 0x617220, 0x617320, 0x6369F3, 0x636F6E, 0x646520, 0x64656C,
  174. 0x646F20, 0x652064, 0x652065, 0x65206C, 0x656C20, 0x656E20, 0x656E74, 0x657320,
  175. 0x657374, 0x69656E, 0x69F36E, 0x6C6120, 0x6C6F73, 0x6E2065, 0x6E7465, 0x6F2064,
  176. 0x6F2065, 0x6F6E20, 0x6F7220, 0x6F7320, 0x706172, 0x717565, 0x726120, 0x726573,
  177. 0x732064, 0x732065, 0x732070, 0x736520, 0x746520, 0x746F20, 0x756520, 0xF36E20
  178. ]),
  179. new NGramsPlusLang('fr', [
  180. 0x206175, 0x20636F, 0x206461, 0x206465, 0x206475, 0x20656E, 0x206574, 0x206C61,
  181. 0x206C65, 0x207061, 0x20706F, 0x207072, 0x207175, 0x207365, 0x20736F, 0x20756E,
  182. 0x20E020, 0x616E74, 0x617469, 0x636520, 0x636F6E, 0x646520, 0x646573, 0x647520,
  183. 0x652061, 0x652063, 0x652064, 0x652065, 0x65206C, 0x652070, 0x652073, 0x656E20,
  184. 0x656E74, 0x657220, 0x657320, 0x657420, 0x657572, 0x696F6E, 0x697320, 0x697420,
  185. 0x6C6120, 0x6C6520, 0x6C6573, 0x6D656E, 0x6E2064, 0x6E6520, 0x6E7320, 0x6E7420,
  186. 0x6F6E20, 0x6F6E74, 0x6F7572, 0x717565, 0x72206C, 0x726520, 0x732061, 0x732064,
  187. 0x732065, 0x73206C, 0x732070, 0x742064, 0x746520, 0x74696F, 0x756520, 0x757220
  188. ]),
  189. new NGramsPlusLang('it', [
  190. 0x20616C, 0x206368, 0x20636F, 0x206465, 0x206469, 0x206520, 0x20696C, 0x20696E,
  191. 0x206C61, 0x207065, 0x207072, 0x20756E, 0x612063, 0x612064, 0x612070, 0x612073,
  192. 0x61746F, 0x636865, 0x636F6E, 0x64656C, 0x646920, 0x652061, 0x652063, 0x652064,
  193. 0x652069, 0x65206C, 0x652070, 0x652073, 0x656C20, 0x656C6C, 0x656E74, 0x657220,
  194. 0x686520, 0x692061, 0x692063, 0x692064, 0x692073, 0x696120, 0x696C20, 0x696E20,
  195. 0x696F6E, 0x6C6120, 0x6C6520, 0x6C6920, 0x6C6C61, 0x6E6520, 0x6E6920, 0x6E6F20,
  196. 0x6E7465, 0x6F2061, 0x6F2064, 0x6F2069, 0x6F2073, 0x6F6E20, 0x6F6E65, 0x706572,
  197. 0x726120, 0x726520, 0x736920, 0x746120, 0x746520, 0x746920, 0x746F20, 0x7A696F
  198. ]),
  199. new NGramsPlusLang('nl', [
  200. 0x20616C, 0x206265, 0x206461, 0x206465, 0x206469, 0x206565, 0x20656E, 0x206765,
  201. 0x206865, 0x20696E, 0x206D61, 0x206D65, 0x206F70, 0x207465, 0x207661, 0x207665,
  202. 0x20766F, 0x207765, 0x207A69, 0x61616E, 0x616172, 0x616E20, 0x616E64, 0x617220,
  203. 0x617420, 0x636874, 0x646520, 0x64656E, 0x646572, 0x652062, 0x652076, 0x65656E,
  204. 0x656572, 0x656E20, 0x657220, 0x657273, 0x657420, 0x67656E, 0x686574, 0x696520,
  205. 0x696E20, 0x696E67, 0x697320, 0x6E2062, 0x6E2064, 0x6E2065, 0x6E2068, 0x6E206F,
  206. 0x6E2076, 0x6E6465, 0x6E6720, 0x6F6E64, 0x6F6F72, 0x6F7020, 0x6F7220, 0x736368,
  207. 0x737465, 0x742064, 0x746520, 0x74656E, 0x746572, 0x76616E, 0x766572, 0x766F6F
  208. ]),
  209. new NGramsPlusLang('no', [
  210. 0x206174, 0x206176, 0x206465, 0x20656E, 0x206572, 0x20666F, 0x206861, 0x206920,
  211. 0x206D65, 0x206F67, 0x2070E5, 0x207365, 0x20736B, 0x20736F, 0x207374, 0x207469,
  212. 0x207669, 0x20E520, 0x616E64, 0x617220, 0x617420, 0x646520, 0x64656E, 0x646574,
  213. 0x652073, 0x656420, 0x656E20, 0x656E65, 0x657220, 0x657265, 0x657420, 0x657474,
  214. 0x666F72, 0x67656E, 0x696B6B, 0x696C20, 0x696E67, 0x6B6520, 0x6B6B65, 0x6C6520,
  215. 0x6C6C65, 0x6D6564, 0x6D656E, 0x6E2073, 0x6E6520, 0x6E6720, 0x6E6765, 0x6E6E65,
  216. 0x6F6720, 0x6F6D20, 0x6F7220, 0x70E520, 0x722073, 0x726520, 0x736F6D, 0x737465,
  217. 0x742073, 0x746520, 0x74656E, 0x746572, 0x74696C, 0x747420, 0x747465, 0x766572
  218. ]),
  219. new NGramsPlusLang('pt', [
  220. 0x206120, 0x20636F, 0x206461, 0x206465, 0x20646F, 0x206520, 0x206573, 0x206D61,
  221. 0x206E6F, 0x206F20, 0x207061, 0x20706F, 0x207072, 0x207175, 0x207265, 0x207365,
  222. 0x20756D, 0x612061, 0x612063, 0x612064, 0x612070, 0x616465, 0x61646F, 0x616C20,
  223. 0x617220, 0x617261, 0x617320, 0x636F6D, 0x636F6E, 0x646120, 0x646520, 0x646F20,
  224. 0x646F73, 0x652061, 0x652064, 0x656D20, 0x656E74, 0x657320, 0x657374, 0x696120,
  225. 0x696361, 0x6D656E, 0x6E7465, 0x6E746F, 0x6F2061, 0x6F2063, 0x6F2064, 0x6F2065,
  226. 0x6F2070, 0x6F7320, 0x706172, 0x717565, 0x726120, 0x726573, 0x732061, 0x732064,
  227. 0x732065, 0x732070, 0x737461, 0x746520, 0x746F20, 0x756520, 0xE36F20, 0xE7E36F
  228. ]),
  229. new NGramsPlusLang('sv', [
  230. 0x206174, 0x206176, 0x206465, 0x20656E, 0x2066F6, 0x206861, 0x206920, 0x20696E,
  231. 0x206B6F, 0x206D65, 0x206F63, 0x2070E5, 0x20736B, 0x20736F, 0x207374, 0x207469,
  232. 0x207661, 0x207669, 0x20E472, 0x616465, 0x616E20, 0x616E64, 0x617220, 0x617474,
  233. 0x636820, 0x646520, 0x64656E, 0x646572, 0x646574, 0x656420, 0x656E20, 0x657220,
  234. 0x657420, 0x66F672, 0x67656E, 0x696C6C, 0x696E67, 0x6B6120, 0x6C6C20, 0x6D6564,
  235. 0x6E2073, 0x6E6120, 0x6E6465, 0x6E6720, 0x6E6765, 0x6E696E, 0x6F6368, 0x6F6D20,
  236. 0x6F6E20, 0x70E520, 0x722061, 0x722073, 0x726120, 0x736B61, 0x736F6D, 0x742073,
  237. 0x746120, 0x746520, 0x746572, 0x74696C, 0x747420, 0x766172, 0xE47220, 0xF67220,
  238. ])
  239. ];
  240. };
  241. this.name = function(det) {
  242. return (det && det.fC1Bytes) ? 'windows-1252' : 'ISO-8859-1';
  243. };
  244. };
  245. util.inherits(module.exports.ISO_8859_1, sbcs);
  246. module.exports.ISO_8859_2 = function() {
  247. this.byteMap = function() {
  248. return [
  249. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  250. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  251. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  252. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  253. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
  254. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  255. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  256. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  257. 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  258. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
  259. 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
  260. 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
  261. 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  262. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
  263. 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
  264. 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
  265. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  266. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  267. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  268. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  269. 0x20, 0xB1, 0x20, 0xB3, 0x20, 0xB5, 0xB6, 0x20,
  270. 0x20, 0xB9, 0xBA, 0xBB, 0xBC, 0x20, 0xBE, 0xBF,
  271. 0x20, 0xB1, 0x20, 0xB3, 0x20, 0xB5, 0xB6, 0xB7,
  272. 0x20, 0xB9, 0xBA, 0xBB, 0xBC, 0x20, 0xBE, 0xBF,
  273. 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
  274. 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
  275. 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0x20,
  276. 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xDF,
  277. 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
  278. 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
  279. 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0x20,
  280. 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0x20
  281. ];
  282. }
  283. this.ngrams = function() {
  284. return [
  285. new NGramsPlusLang('cs', [
  286. 0x206120, 0x206279, 0x20646F, 0x206A65, 0x206E61, 0x206E65, 0x206F20, 0x206F64,
  287. 0x20706F, 0x207072, 0x2070F8, 0x20726F, 0x207365, 0x20736F, 0x207374, 0x20746F,
  288. 0x207620, 0x207679, 0x207A61, 0x612070, 0x636520, 0x636820, 0x652070, 0x652073,
  289. 0x652076, 0x656D20, 0x656EED, 0x686F20, 0x686F64, 0x697374, 0x6A6520, 0x6B7465,
  290. 0x6C6520, 0x6C6920, 0x6E6120, 0x6EE920, 0x6EEC20, 0x6EED20, 0x6F2070, 0x6F646E,
  291. 0x6F6A69, 0x6F7374, 0x6F7520, 0x6F7661, 0x706F64, 0x706F6A, 0x70726F, 0x70F865,
  292. 0x736520, 0x736F75, 0x737461, 0x737469, 0x73746E, 0x746572, 0x746EED, 0x746F20,
  293. 0x752070, 0xBE6520, 0xE16EED, 0xE9686F, 0xED2070, 0xED2073, 0xED6D20, 0xF86564,
  294. ]),
  295. new NGramsPlusLang('hu', [
  296. 0x206120, 0x20617A, 0x206265, 0x206567, 0x20656C, 0x206665, 0x206861, 0x20686F,
  297. 0x206973, 0x206B65, 0x206B69, 0x206BF6, 0x206C65, 0x206D61, 0x206D65, 0x206D69,
  298. 0x206E65, 0x20737A, 0x207465, 0x20E973, 0x612061, 0x61206B, 0x61206D, 0x612073,
  299. 0x616B20, 0x616E20, 0x617A20, 0x62616E, 0x62656E, 0x656779, 0x656B20, 0x656C20,
  300. 0x656C65, 0x656D20, 0x656E20, 0x657265, 0x657420, 0x657465, 0x657474, 0x677920,
  301. 0x686F67, 0x696E74, 0x697320, 0x6B2061, 0x6BF67A, 0x6D6567, 0x6D696E, 0x6E2061,
  302. 0x6E616B, 0x6E656B, 0x6E656D, 0x6E7420, 0x6F6779, 0x732061, 0x737A65, 0x737A74,
  303. 0x737AE1, 0x73E967, 0x742061, 0x747420, 0x74E173, 0x7A6572, 0xE16E20, 0xE97320,
  304. ]),
  305. new NGramsPlusLang('pl', [
  306. 0x20637A, 0x20646F, 0x206920, 0x206A65, 0x206B6F, 0x206D61, 0x206D69, 0x206E61,
  307. 0x206E69, 0x206F64, 0x20706F, 0x207072, 0x207369, 0x207720, 0x207769, 0x207779,
  308. 0x207A20, 0x207A61, 0x612070, 0x612077, 0x616E69, 0x636820, 0x637A65, 0x637A79,
  309. 0x646F20, 0x647A69, 0x652070, 0x652073, 0x652077, 0x65207A, 0x65676F, 0x656A20,
  310. 0x656D20, 0x656E69, 0x676F20, 0x696120, 0x696520, 0x69656A, 0x6B6120, 0x6B6920,
  311. 0x6B6965, 0x6D6965, 0x6E6120, 0x6E6961, 0x6E6965, 0x6F2070, 0x6F7761, 0x6F7769,
  312. 0x706F6C, 0x707261, 0x70726F, 0x70727A, 0x727A65, 0x727A79, 0x7369EA, 0x736B69,
  313. 0x737461, 0x776965, 0x796368, 0x796D20, 0x7A6520, 0x7A6965, 0x7A7920, 0xF37720,
  314. ]),
  315. new NGramsPlusLang('ro', [
  316. 0x206120, 0x206163, 0x206361, 0x206365, 0x20636F, 0x206375, 0x206465, 0x206469,
  317. 0x206C61, 0x206D61, 0x207065, 0x207072, 0x207365, 0x2073E3, 0x20756E, 0x20BA69,
  318. 0x20EE6E, 0x612063, 0x612064, 0x617265, 0x617420, 0x617465, 0x617520, 0x636172,
  319. 0x636F6E, 0x637520, 0x63E320, 0x646520, 0x652061, 0x652063, 0x652064, 0x652070,
  320. 0x652073, 0x656120, 0x656920, 0x656C65, 0x656E74, 0x657374, 0x692061, 0x692063,
  321. 0x692064, 0x692070, 0x696520, 0x696920, 0x696E20, 0x6C6120, 0x6C6520, 0x6C6F72,
  322. 0x6C7569, 0x6E6520, 0x6E7472, 0x6F7220, 0x70656E, 0x726520, 0x726561, 0x727520,
  323. 0x73E320, 0x746520, 0x747275, 0x74E320, 0x756920, 0x756C20, 0xBA6920, 0xEE6E20,
  324. ])
  325. ];
  326. };
  327. this.name = function(det) {
  328. return (det && det.fC1Bytes) ? 'windows-1250' : 'ISO-8859-2';
  329. };
  330. };
  331. util.inherits(module.exports.ISO_8859_2, sbcs);
  332. module.exports.ISO_8859_5 = function() {
  333. this.byteMap = function() {
  334. return [
  335. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  336. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  337. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  338. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  339. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
  340. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  341. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  342. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  343. 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  344. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
  345. 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
  346. 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
  347. 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  348. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
  349. 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
  350. 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
  351. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  352. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  353. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  354. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  355. 0x20, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
  356. 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0x20, 0xFE, 0xFF,
  357. 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
  358. 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
  359. 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
  360. 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
  361. 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
  362. 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
  363. 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
  364. 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
  365. 0x20, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
  366. 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0x20, 0xFE, 0xFF
  367. ];
  368. };
  369. this.ngrams = function() {
  370. return [
  371. 0x20D220, 0x20D2DE, 0x20D4DE, 0x20D7D0, 0x20D820, 0x20DAD0, 0x20DADE, 0x20DDD0,
  372. 0x20DDD5, 0x20DED1, 0x20DFDE, 0x20DFE0, 0x20E0D0, 0x20E1DE, 0x20E1E2, 0x20E2DE,
  373. 0x20E7E2, 0x20EDE2, 0xD0DDD8, 0xD0E2EC, 0xD3DE20, 0xD5DBEC, 0xD5DDD8, 0xD5E1E2,
  374. 0xD5E220, 0xD820DF, 0xD8D520, 0xD8D820, 0xD8EF20, 0xDBD5DD, 0xDBD820, 0xDBECDD,
  375. 0xDDD020, 0xDDD520, 0xDDD8D5, 0xDDD8EF, 0xDDDE20, 0xDDDED2, 0xDE20D2, 0xDE20DF,
  376. 0xDE20E1, 0xDED220, 0xDED2D0, 0xDED3DE, 0xDED920, 0xDEDBEC, 0xDEDC20, 0xDEE1E2,
  377. 0xDFDEDB, 0xDFE0D5, 0xDFE0D8, 0xDFE0DE, 0xE0D0D2, 0xE0D5D4, 0xE1E2D0, 0xE1E2D2,
  378. 0xE1E2D8, 0xE1EF20, 0xE2D5DB, 0xE2DE20, 0xE2DEE0, 0xE2EC20, 0xE7E2DE, 0xEBE520
  379. ];
  380. };
  381. this.name = function(det) {
  382. return 'ISO-8859-5';
  383. };
  384. this.language = function() {
  385. return 'ru';
  386. };
  387. };
  388. util.inherits(module.exports.ISO_8859_5, sbcs);
  389. module.exports.ISO_8859_6 = function() {
  390. this.byteMap = function() {
  391. return [
  392. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  393. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  394. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  395. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  396. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
  397. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  398. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  399. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  400. 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  401. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
  402. 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
  403. 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
  404. 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  405. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
  406. 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
  407. 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
  408. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  409. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  410. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  411. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  412. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  413. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  414. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  415. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  416. 0x20, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
  417. 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
  418. 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
  419. 0xD8, 0xD9, 0xDA, 0x20, 0x20, 0x20, 0x20, 0x20,
  420. 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
  421. 0xE8, 0xE9, 0xEA, 0x20, 0x20, 0x20, 0x20, 0x20,
  422. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  423. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
  424. ];
  425. };
  426. this.ngrams = function() {
  427. return [
  428. 0x20C7E4, 0x20C7E6, 0x20C8C7, 0x20D9E4, 0x20E1EA, 0x20E4E4, 0x20E5E6, 0x20E8C7,
  429. 0xC720C7, 0xC7C120, 0xC7CA20, 0xC7D120, 0xC7E420, 0xC7E4C3, 0xC7E4C7, 0xC7E4C8,
  430. 0xC7E4CA, 0xC7E4CC, 0xC7E4CD, 0xC7E4CF, 0xC7E4D3, 0xC7E4D9, 0xC7E4E2, 0xC7E4E5,
  431. 0xC7E4E8, 0xC7E4EA, 0xC7E520, 0xC7E620, 0xC7E6CA, 0xC820C7, 0xC920C7, 0xC920E1,
  432. 0xC920E4, 0xC920E5, 0xC920E8, 0xCA20C7, 0xCF20C7, 0xCFC920, 0xD120C7, 0xD1C920,
  433. 0xD320C7, 0xD920C7, 0xD9E4E9, 0xE1EA20, 0xE420C7, 0xE4C920, 0xE4E920, 0xE4EA20,
  434. 0xE520C7, 0xE5C720, 0xE5C920, 0xE5E620, 0xE620C7, 0xE720C7, 0xE7C720, 0xE8C7E4,
  435. 0xE8E620, 0xE920C7, 0xEA20C7, 0xEA20E5, 0xEA20E8, 0xEAC920, 0xEAD120, 0xEAE620
  436. ];
  437. };
  438. this.name = function(det) {
  439. return 'ISO-8859-6';
  440. };
  441. this.language = function() {
  442. return 'ar';
  443. };
  444. };
  445. util.inherits(module.exports.ISO_8859_6, sbcs);
  446. module.exports.ISO_8859_7 = function() {
  447. this.byteMap = function() {
  448. return [
  449. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  450. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  451. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  452. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  453. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
  454. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  455. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  456. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  457. 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  458. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
  459. 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
  460. 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
  461. 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  462. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
  463. 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
  464. 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
  465. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  466. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  467. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  468. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  469. 0x20, 0xA1, 0xA2, 0x20, 0x20, 0x20, 0x20, 0x20,
  470. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  471. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xDC, 0x20,
  472. 0xDD, 0xDE, 0xDF, 0x20, 0xFC, 0x20, 0xFD, 0xFE,
  473. 0xC0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
  474. 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
  475. 0xF0, 0xF1, 0x20, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
  476. 0xF8, 0xF9, 0xFA, 0xFB, 0xDC, 0xDD, 0xDE, 0xDF,
  477. 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
  478. 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
  479. 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
  480. 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0x20
  481. ];
  482. };
  483. this.ngrams = function() {
  484. return [
  485. 0x20E1ED, 0x20E1F0, 0x20E3E9, 0x20E4E9, 0x20E5F0, 0x20E720, 0x20EAE1, 0x20ECE5,
  486. 0x20EDE1, 0x20EF20, 0x20F0E1, 0x20F0EF, 0x20F0F1, 0x20F3F4, 0x20F3F5, 0x20F4E7,
  487. 0x20F4EF, 0xDFE120, 0xE120E1, 0xE120F4, 0xE1E920, 0xE1ED20, 0xE1F0FC, 0xE1F220,
  488. 0xE3E9E1, 0xE5E920, 0xE5F220, 0xE720F4, 0xE7ED20, 0xE7F220, 0xE920F4, 0xE9E120,
  489. 0xE9EADE, 0xE9F220, 0xEAE1E9, 0xEAE1F4, 0xECE520, 0xED20E1, 0xED20E5, 0xED20F0,
  490. 0xEDE120, 0xEFF220, 0xEFF520, 0xF0EFF5, 0xF0F1EF, 0xF0FC20, 0xF220E1, 0xF220E5,
  491. 0xF220EA, 0xF220F0, 0xF220F4, 0xF3E520, 0xF3E720, 0xF3F4EF, 0xF4E120, 0xF4E1E9,
  492. 0xF4E7ED, 0xF4E7F2, 0xF4E9EA, 0xF4EF20, 0xF4EFF5, 0xF4F9ED, 0xF9ED20, 0xFEED20
  493. ];
  494. };
  495. this.name = function(det) {
  496. return (det && det.fC1Bytes) ? 'windows-1253' : 'ISO-8859-7';
  497. };
  498. this.language = function() {
  499. return 'el';
  500. };
  501. };
  502. util.inherits(module.exports.ISO_8859_7, sbcs);
  503. module.exports.ISO_8859_8 = function() {
  504. this.byteMap = function() {
  505. return [
  506. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  507. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  508. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  509. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  510. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
  511. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  512. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  513. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  514. 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  515. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
  516. 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
  517. 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
  518. 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  519. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
  520. 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
  521. 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
  522. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  523. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  524. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  525. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  526. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  527. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  528. 0x20, 0x20, 0x20, 0x20, 0x20, 0xB5, 0x20, 0x20,
  529. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  530. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  531. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  532. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  533. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  534. 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
  535. 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
  536. 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
  537. 0xF8, 0xF9, 0xFA, 0x20, 0x20, 0x20, 0x20, 0x20
  538. ];
  539. };
  540. this.ngrams = function() {
  541. return [
  542. new NGramsPlusLang('he', [
  543. 0x20E0E5, 0x20E0E7, 0x20E0E9, 0x20E0FA, 0x20E1E9, 0x20E1EE, 0x20E4E0, 0x20E4E5,
  544. 0x20E4E9, 0x20E4EE, 0x20E4F2, 0x20E4F9, 0x20E4FA, 0x20ECE0, 0x20ECE4, 0x20EEE0,
  545. 0x20F2EC, 0x20F9EC, 0xE0FA20, 0xE420E0, 0xE420E1, 0xE420E4, 0xE420EC, 0xE420EE,
  546. 0xE420F9, 0xE4E5E0, 0xE5E020, 0xE5ED20, 0xE5EF20, 0xE5F820, 0xE5FA20, 0xE920E4,
  547. 0xE9E420, 0xE9E5FA, 0xE9E9ED, 0xE9ED20, 0xE9EF20, 0xE9F820, 0xE9FA20, 0xEC20E0,
  548. 0xEC20E4, 0xECE020, 0xECE420, 0xED20E0, 0xED20E1, 0xED20E4, 0xED20EC, 0xED20EE,
  549. 0xED20F9, 0xEEE420, 0xEF20E4, 0xF0E420, 0xF0E920, 0xF0E9ED, 0xF2EC20, 0xF820E4,
  550. 0xF8E9ED, 0xF9EC20, 0xFA20E0, 0xFA20E1, 0xFA20E4, 0xFA20EC, 0xFA20EE, 0xFA20F9,
  551. ]),
  552. new NGramsPlusLang('he', [
  553. 0x20E0E5, 0x20E0EC, 0x20E4E9, 0x20E4EC, 0x20E4EE, 0x20E4F0, 0x20E9F0, 0x20ECF2,
  554. 0x20ECF9, 0x20EDE5, 0x20EDE9, 0x20EFE5, 0x20EFE9, 0x20F8E5, 0x20F8E9, 0x20FAE0,
  555. 0x20FAE5, 0x20FAE9, 0xE020E4, 0xE020EC, 0xE020ED, 0xE020FA, 0xE0E420, 0xE0E5E4,
  556. 0xE0EC20, 0xE0EE20, 0xE120E4, 0xE120ED, 0xE120FA, 0xE420E4, 0xE420E9, 0xE420EC,
  557. 0xE420ED, 0xE420EF, 0xE420F8, 0xE420FA, 0xE4EC20, 0xE5E020, 0xE5E420, 0xE7E020,
  558. 0xE9E020, 0xE9E120, 0xE9E420, 0xEC20E4, 0xEC20ED, 0xEC20FA, 0xECF220, 0xECF920,
  559. 0xEDE9E9, 0xEDE9F0, 0xEDE9F8, 0xEE20E4, 0xEE20ED, 0xEE20FA, 0xEEE120, 0xEEE420,
  560. 0xF2E420, 0xF920E4, 0xF920ED, 0xF920FA, 0xF9E420, 0xFAE020, 0xFAE420, 0xFAE5E9,
  561. ])
  562. ];
  563. };
  564. this.name = function(det) {
  565. return (det && det.fC1Bytes) ? 'windows-1255' : 'ISO-8859-8';
  566. };
  567. this.language = function() {
  568. return 'he';
  569. };
  570. };
  571. util.inherits(module.exports.ISO_8859_8, sbcs);
  572. module.exports.ISO_8859_9 = function() {
  573. this.byteMap = function() {
  574. return [
  575. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  576. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  577. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  578. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  579. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
  580. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  581. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  582. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  583. 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  584. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
  585. 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
  586. 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
  587. 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  588. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
  589. 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
  590. 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
  591. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  592. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  593. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  594. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  595. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  596. 0x20, 0x20, 0xAA, 0x20, 0x20, 0x20, 0x20, 0x20,
  597. 0x20, 0x20, 0x20, 0x20, 0x20, 0xB5, 0x20, 0x20,
  598. 0x20, 0x20, 0xBA, 0x20, 0x20, 0x20, 0x20, 0x20,
  599. 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
  600. 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
  601. 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0x20,
  602. 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0x69, 0xFE, 0xDF,
  603. 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
  604. 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
  605. 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0x20,
  606. 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
  607. ];
  608. };
  609. this.ngrams = function() {
  610. return [
  611. 0x206261, 0x206269, 0x206275, 0x206461, 0x206465, 0x206765, 0x206861, 0x20696C,
  612. 0x206B61, 0x206B6F, 0x206D61, 0x206F6C, 0x207361, 0x207461, 0x207665, 0x207961,
  613. 0x612062, 0x616B20, 0x616C61, 0x616D61, 0x616E20, 0x616EFD, 0x617220, 0x617261,
  614. 0x6172FD, 0x6173FD, 0x617961, 0x626972, 0x646120, 0x646520, 0x646920, 0x652062,
  615. 0x65206B, 0x656469, 0x656E20, 0x657220, 0x657269, 0x657369, 0x696C65, 0x696E20,
  616. 0x696E69, 0x697220, 0x6C616E, 0x6C6172, 0x6C6520, 0x6C6572, 0x6E2061, 0x6E2062,
  617. 0x6E206B, 0x6E6461, 0x6E6465, 0x6E6520, 0x6E6920, 0x6E696E, 0x6EFD20, 0x72696E,
  618. 0x72FD6E, 0x766520, 0x796120, 0x796F72, 0xFD6E20, 0xFD6E64, 0xFD6EFD, 0xFDF0FD
  619. ];
  620. };
  621. this.name = function(det) {
  622. return (det && det.fC1Bytes) ? 'windows-1254' : 'ISO-8859-9';
  623. };
  624. this.language = function() {
  625. return 'tr';
  626. };
  627. };
  628. util.inherits(module.exports.ISO_8859_9, sbcs);
  629. module.exports.windows_1251 = function() {
  630. this.byteMap = function() {
  631. return [
  632. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  633. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  634. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  635. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  636. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
  637. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  638. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  639. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  640. 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  641. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
  642. 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
  643. 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
  644. 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  645. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
  646. 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
  647. 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
  648. 0x90, 0x83, 0x20, 0x83, 0x20, 0x20, 0x20, 0x20,
  649. 0x20, 0x20, 0x9A, 0x20, 0x9C, 0x9D, 0x9E, 0x9F,
  650. 0x90, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  651. 0x20, 0x20, 0x9A, 0x20, 0x9C, 0x9D, 0x9E, 0x9F,
  652. 0x20, 0xA2, 0xA2, 0xBC, 0x20, 0xB4, 0x20, 0x20,
  653. 0xB8, 0x20, 0xBA, 0x20, 0x20, 0x20, 0x20, 0xBF,
  654. 0x20, 0x20, 0xB3, 0xB3, 0xB4, 0xB5, 0x20, 0x20,
  655. 0xB8, 0x20, 0xBA, 0x20, 0xBC, 0xBE, 0xBE, 0xBF,
  656. 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
  657. 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
  658. 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
  659. 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
  660. 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
  661. 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
  662. 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
  663. 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
  664. ];
  665. };
  666. this.ngrams = function() {
  667. return [
  668. 0x20E220, 0x20E2EE, 0x20E4EE, 0x20E7E0, 0x20E820, 0x20EAE0, 0x20EAEE, 0x20EDE0,
  669. 0x20EDE5, 0x20EEE1, 0x20EFEE, 0x20EFF0, 0x20F0E0, 0x20F1EE, 0x20F1F2, 0x20F2EE,
  670. 0x20F7F2, 0x20FDF2, 0xE0EDE8, 0xE0F2FC, 0xE3EE20, 0xE5EBFC, 0xE5EDE8, 0xE5F1F2,
  671. 0xE5F220, 0xE820EF, 0xE8E520, 0xE8E820, 0xE8FF20, 0xEBE5ED, 0xEBE820, 0xEBFCED,
  672. 0xEDE020, 0xEDE520, 0xEDE8E5, 0xEDE8FF, 0xEDEE20, 0xEDEEE2, 0xEE20E2, 0xEE20EF,
  673. 0xEE20F1, 0xEEE220, 0xEEE2E0, 0xEEE3EE, 0xEEE920, 0xEEEBFC, 0xEEEC20, 0xEEF1F2,
  674. 0xEFEEEB, 0xEFF0E5, 0xEFF0E8, 0xEFF0EE, 0xF0E0E2, 0xF0E5E4, 0xF1F2E0, 0xF1F2E2,
  675. 0xF1F2E8, 0xF1FF20, 0xF2E5EB, 0xF2EE20, 0xF2EEF0, 0xF2FC20, 0xF7F2EE, 0xFBF520
  676. ];
  677. };
  678. this.name = function(det) {
  679. return 'windows-1251';
  680. };
  681. this.language = function() {
  682. return 'ru';
  683. };
  684. };
  685. util.inherits(module.exports.windows_1251, sbcs);
  686. module.exports.windows_1256 = function() {
  687. this.byteMap = function() {
  688. return [
  689. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  690. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  691. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  692. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  693. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
  694. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  695. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  696. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  697. 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  698. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
  699. 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
  700. 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
  701. 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  702. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
  703. 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
  704. 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
  705. 0x20, 0x81, 0x20, 0x83, 0x20, 0x20, 0x20, 0x20,
  706. 0x88, 0x20, 0x8A, 0x20, 0x9C, 0x8D, 0x8E, 0x8F,
  707. 0x90, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  708. 0x98, 0x20, 0x9A, 0x20, 0x9C, 0x20, 0x20, 0x9F,
  709. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  710. 0x20, 0x20, 0xAA, 0x20, 0x20, 0x20, 0x20, 0x20,
  711. 0x20, 0x20, 0x20, 0x20, 0x20, 0xB5, 0x20, 0x20,
  712. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  713. 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
  714. 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
  715. 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0x20,
  716. 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
  717. 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
  718. 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
  719. 0x20, 0x20, 0x20, 0x20, 0xF4, 0x20, 0x20, 0x20,
  720. 0x20, 0xF9, 0x20, 0xFB, 0xFC, 0x20, 0x20, 0xFF
  721. ];
  722. };
  723. this.ngrams = function() {
  724. return [
  725. 0x20C7E1, 0x20C7E4, 0x20C8C7, 0x20DAE1, 0x20DDED, 0x20E1E1, 0x20E3E4, 0x20E6C7,
  726. 0xC720C7, 0xC7C120, 0xC7CA20, 0xC7D120, 0xC7E120, 0xC7E1C3, 0xC7E1C7, 0xC7E1C8,
  727. 0xC7E1CA, 0xC7E1CC, 0xC7E1CD, 0xC7E1CF, 0xC7E1D3, 0xC7E1DA, 0xC7E1DE, 0xC7E1E3,
  728. 0xC7E1E6, 0xC7E1ED, 0xC7E320, 0xC7E420, 0xC7E4CA, 0xC820C7, 0xC920C7, 0xC920DD,
  729. 0xC920E1, 0xC920E3, 0xC920E6, 0xCA20C7, 0xCF20C7, 0xCFC920, 0xD120C7, 0xD1C920,
  730. 0xD320C7, 0xDA20C7, 0xDAE1EC, 0xDDED20, 0xE120C7, 0xE1C920, 0xE1EC20, 0xE1ED20,
  731. 0xE320C7, 0xE3C720, 0xE3C920, 0xE3E420, 0xE420C7, 0xE520C7, 0xE5C720, 0xE6C7E1,
  732. 0xE6E420, 0xEC20C7, 0xED20C7, 0xED20E3, 0xED20E6, 0xEDC920, 0xEDD120, 0xEDE420
  733. ];
  734. };
  735. this.name = function(det) {
  736. return 'windows-1256';
  737. };
  738. this.language = function() {
  739. return 'ar';
  740. };
  741. };
  742. util.inherits(module.exports.windows_1256, sbcs);
  743. module.exports.KOI8_R = function() {
  744. this.byteMap = function() {
  745. return [
  746. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  747. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  748. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  749. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  750. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
  751. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  752. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  753. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  754. 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  755. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
  756. 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
  757. 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
  758. 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  759. 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
  760. 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
  761. 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20,
  762. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  763. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  764. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  765. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  766. 0x20, 0x20, 0x20, 0xA3, 0x20, 0x20, 0x20, 0x20,
  767. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  768. 0x20, 0x20, 0x20, 0xA3, 0x20, 0x20, 0x20, 0x20,
  769. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
  770. 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
  771. 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
  772. 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
  773. 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
  774. 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
  775. 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
  776. 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
  777. 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF
  778. ];
  779. };
  780. this.ngrams = function() {
  781. return [
  782. 0x20C4CF, 0x20C920, 0x20CBC1, 0x20CBCF, 0x20CEC1, 0x20CEC5, 0x20CFC2, 0x20D0CF,
  783. 0x20D0D2, 0x20D2C1, 0x20D3CF, 0x20D3D4, 0x20D4CF, 0x20D720, 0x20D7CF, 0x20DAC1,
  784. 0x20DCD4, 0x20DED4, 0xC1CEC9, 0xC1D4D8, 0xC5CCD8, 0xC5CEC9, 0xC5D3D4, 0xC5D420,
  785. 0xC7CF20, 0xC920D0, 0xC9C520, 0xC9C920, 0xC9D120, 0xCCC5CE, 0xCCC920, 0xCCD8CE,
  786. 0xCEC120, 0xCEC520, 0xCEC9C5, 0xCEC9D1, 0xCECF20, 0xCECFD7, 0xCF20D0, 0xCF20D3,
  787. 0xCF20D7, 0xCFC7CF, 0xCFCA20, 0xCFCCD8, 0xCFCD20, 0xCFD3D4, 0xCFD720, 0xCFD7C1,
  788. 0xD0CFCC, 0xD0D2C5, 0xD0D2C9, 0xD0D2CF, 0xD2C1D7, 0xD2C5C4, 0xD3D120, 0xD3D4C1,
  789. 0xD3D4C9, 0xD3D4D7, 0xD4C5CC, 0xD4CF20, 0xD4CFD2, 0xD4D820, 0xD9C820, 0xDED4CF
  790. ];
  791. };
  792. this.name = function(det) {
  793. return 'KOI8-R';
  794. };
  795. this.language = function() {
  796. return 'ru';
  797. };
  798. };
  799. util.inherits(module.exports.KOI8_R, sbcs);
  800. /*
  801. module.exports.ISO_8859_7 = function() {
  802. this.byteMap = function() {
  803. return [
  804. ];
  805. };
  806. this.ngrams = function() {
  807. return [
  808. ];
  809. };
  810. this.name = function(det) {
  811. if (typeof det == 'undefined')
  812. return 'ISO-8859-7';
  813. return det.fC1Bytes ? 'windows-1253' : 'ISO-8859-7';
  814. };
  815. this.language = function() {
  816. return 'el';
  817. };
  818. };
  819. util.inherits(module.exports.ISO_8859_7, sbcs);
  820. */