script, src, test: add Ukrainian support.

UTF-8 and Windows-1251 support for now.

This actually breaks ru:windows-1251 test but same as Bulgarian, I never
generated Russian models with my scripts, so the models we currently use
are quite outdated. It will obviously be a lot better once we have new
Russian models.

The test file contents comes from 'Бабак' page on Wikipedia in
Ukrainian.
This commit is contained in:
Jehan 2022-12-17 21:24:59 +01:00
parent 0fffc109b5
commit 60dcec8a82
13 changed files with 609 additions and 3 deletions

View File

@ -195,6 +195,9 @@ uchardet started as a C language binding of the original C++ implementation of t
* UTF-8 * UTF-8
* ISO-8859-3 * ISO-8859-3
* ISO-8859-9 * ISO-8859-9
* Ukrainian:
* UTF-8
* WINDOWS-1251
* Vietnamese: * Vietnamese:
* UTF-8 * UTF-8
* VISCII * VISCII

View File

@ -0,0 +1,279 @@
= Logs of language model for Ukrainian (uk) =
- Generated by BuildLangModel.py
- Started: 2022-12-17 18:44:33.402117
- Maximum depth: 4
- Max number of pages: 200
== Parsed pages ==
Операція_«Зільберфукс» (revision 37680420)
Транспортне судно (revision 35090984)
23 серпня (revision 36966610)
Операція «Кілгол» (revision 35031376)
Битва при Монте-Кассіно (revision 37799244)
Планування операції (revision 36655146)
Протитанкова гармата (revision 34967926)
Радянські фронти часів Другої світової війни (revision 37075701)
Операція «Везерюбунг» (revision 37799544)
Поранений у бою (revision 37150681)
Олександр Солженіцин (revision 37802645)
Німецька імперія (revision 37724957)
Радіаційний, хімічний, біологічний захист (revision 35207698)
Артилерійський вогонь (revision 35906728)
Океанографічне судно (revision 37766409)
Wayback Machine (revision 37596310)
1773 (revision 30421919)
Рубіж (військова справа) (revision 18710733)
Аспект (revision 36757836)
Режим Віші (revision 36482509)
Інформація (revision 37609117)
Громадянська війна в Іспанії (revision 37006495)
Друга світова війна (revision 37694876)
День (revision 35387803)
НКВС (revision 37782988)
План «Гельб» (revision 36323339)
13 жовтня (revision 37425950)
Франція в Другій світовій війні (revision 37765912)
Бакинська армія ППО (revision 36396350)
Особливі заслуги перед Україною (revision 34996039)
6 червня (revision 36967247)
Фортифікаційне обладнання (revision 36658341)
НАТО (revision 37663357)
Інженерні війська (revision 37760820)
Військово-лікарські комісії України (revision 37338993)
Каспійська флотилія ВМФ СРСР (revision 36265095)
Загін (військова справа) (revision 37118075)
Рейнська операція (revision 34987656)
Технічне забезпечення (revision 36658293)
Операція «Едельвейс» (revision 25052827)
Зріджений природний газ (revision 37234389)
10 лютого (revision 36969165)
Підполковник (revision 37429136)
20 червня (revision 36974362)
23 березня (revision 37424209)
Вінстон Черчилль (revision 37617124)
Батальйон (revision 37579056)
Зниклий безвісти (revision 37150728)
16 квітня (revision 37544630)
Житомирсько-Бердичівська операція (revision 37765688)
Артилерійська система (revision 35906687)
Україна в Другій світовій війні (revision 35102511)
СРСР (revision 37786142)
Військова справа (revision 36081819)
Медвеж'єгорська оперативна група (revision 35139881)
1-ша піхотна дивізія (Канада) (revision 36888484)
Репатріація (revision 37609719)
Операція «Календа» (revision 34691025)
19 серпня (revision 37161110)
Контейнеровоз (revision 36075092)
Бойовий статут (revision 36634840)
Рефрижераторне судно (revision 37766332)
6-та гвардійська танкова армія (СРСР) (revision 36484600)
Гастарбайтер (revision 36108975)
За поранення (нагрудний знак) (revision 34927306)
Єльнинсько-Дорогобузька операція (revision 35793148)
Ролкер (revision 37766334)
ЗІС-2 (revision 33263795)
Обчислювальна техніка (revision 37425821)
Спеціальні війська (revision 35033617)
Радіовежа (revision 34350408)
Операція «Тезей» (revision 33350126)
Видача козаків у Лієнці (revision 37351799)
Операція «Вігорос» (revision 37509297)
Протягання під кілем (revision 26271627)
Еріх Редер (revision 37407936)
Друга Яссько-Кишинівська операція (revision 37802348)
2-й Прибалтійський фронт (revision 35908523)
Битва у затоці Сидра (1941) (revision 37678820)
Ракетний удар (revision 37295254)
Допоміжне військове судно (revision 31395394)
Балкер (revision 35942310)
Перша словацька республіка (revision 37240751)
Інвалід війни (revision 36724722)
Matilda II (revision 35665157)
Операція «Тайфун» (revision 27726969)
Велика Британія (revision 37721780)
Воєнний час (revision 36741277)
Військові втрати (revision 36544558)
Нарвік (revision 36746700)
Пакет-судно (revision 37442334)
Поранення (revision 37241274)
Інтернування (revision 35910578)
План операції (revision 36655146)
Військовий жаргон (revision 36133497)
Європа (revision 37605430)
Окупація Греції країнами Осі (revision 35923077)
Туапсинський оборонний район (revision 35096716)
Вітебсько-Оршанська операція (revision 36546532)
Військова операція (revision 36634889)
Військове транспортне судно (revision 31110210)
Прибалтійська операція (1944) (revision 37573989)
Міністерство соціальної політики України (revision 36827291)
Пором (revision 37766348)
Операція «Мінсміт» (revision 37680451)
Командувач (revision 35052770)
Танк (revision 37751071)
Пурпурне Серце (США) (revision 35444570)
4 січня (revision 37356925)
Ялтинська конференція (revision 36551994)
Зброя (revision 35324714)
27 вересня (revision 37209489)
КВ-1 (revision 34967853)
1673 (revision 33487225)
16 червня (revision 36967399)
Неділя (revision 36755940)
Поранений в бою (revision 37150681)
Експеримент із часом (revision 34883427)
Плавуча база (revision 37766371)
Сталін і релігія (revision 37743071)
Калузька операція (revision 35801942)
Кавказ (revision 37660429)
Сінгапурська оборона (revision 36249620)
Мир (revision 35400124)
Розпад СРСР (revision 37763852)
Операція «Уайт» (revision 35770525)
Бурове судно (revision 37766395)
Огаденська війна (revision 34632675)
Кашкет (revision 37362104)
РСЧА (revision 37509859)
Стратегічні бомбардування в період Другої світової війни (revision 35170307)
Окупація Австрії союзниками (revision 33198050)
Шієн (revision 35537380)
Посадження на палю (revision 30927864)
5 січня (revision 36973301)
1936 (revision 36692601)
22 грудня (revision 37790943)
Тактика (revision 35077432)
Практика (revision 29380696)
Місцеві вибори в Україні (revision 35930899)
Вальтер Гевель (revision 36247972)
2 червня (revision 36973908)
Міжнародне космічне право (revision 35500957)
Сленг (revision 37309330)
M15/42 (revision 36995811)
Союз Радянських Соціалістичних Республік (revision 37786142)
Берестейська унія (revision 37281794)
Шемшученко Юрій Сергійович (revision 36970654)
Владислав Реймонт (revision 36305880)
План «Гертруда» (revision 28888567)
1-ша гвардійська армія (СРСР) (revision 36396299)
Перемовини про обмеження стратегічних озброєнь (revision 37364095)
Війни початку сучасної епохи (revision 34001433)
Циркон (ракета) (revision 37517270)
Стратегічна оборонна операція (revision 35056822)
26 листопада (revision 37656690)
Скрипниченко Дмитро Федорович (revision 33953482)
Женевський саміт (1955) (revision 35669111)
Митна енциклопедія (revision 35408437)
Інженерний батальйон штурму та розгородження (revision 36185501)
Прожитковий мінімум (revision 37547840)
Регіон (revision 37055617)
Бойова техніка (revision 35977735)
1944 (revision 36506280)
Тилове забезпечення (revision 36658279)
Німецька мова (revision 36867771)
Музичний розмір (revision 33593201)
Лепель (revision 37644747)
16 січня (revision 37357430)
Нафтоналивні танкери (revision 31054818)
Ніколаєв Андріян Григорович (revision 37590029)
Німецько-радянська війна (revision 37509302)
Чортків (revision 37780071)
Відеогра (revision 37487609)
Повітряно-десантні війська (revision 36977054)
256-та піхотна дивізія (Третій Рейх) (revision 35318281)
Закони та звичаї війни (revision 37544276)
Ежен Мішель Антоніаді (revision 37531874)
Сербська мова (revision 36916280)
Німеччина (revision 37763492)
Навчальний корабель (revision 35139505)
Антикомінтернівський пакт (revision 37497934)
Фундація Альфреда Слоуна (revision 35417522)
Крилов Микола Іванович (revision 37099460)
9-та армія (Третій Рейх) (revision 35332833)
Нагрудний знак (revision 34887537)
Арсеній Яценюк (revision 37794125)
HMS Valiant (1914) (revision 35630087)
Зовнішні Гебридські острови (revision 35058803)
Диліжанс (revision 37205155)
Х-59 (revision 37749210)
Четвертування (revision 35201022)
== End of Parsed pages ==
- Wikipedia parsing ended at: 2022-12-17 18:48:43.498304
70 characters appeared 1713745 times.
Most Frequent characters:
[ 0] Char о: 8.849624652442458 %
[ 1] Char а: 8.07704763544168 %
[ 2] Char н: 7.530700308388938 %
[ 3] Char і: 6.208800025674765 %
[ 4] Char р: 5.607893823176727 %
[ 5] Char и: 5.474151638662695 %
[ 6] Char в: 5.214836513016814 %
[ 7] Char т: 4.518992032070115 %
[ 8] Char е: 4.39878745087513 %
[ 9] Char с: 4.367102456899947 %
[10] Char к: 3.8551826555292648 %
[11] Char л: 3.499120347542954 %
[12] Char у: 3.166690493626531 %
[13] Char д: 3.067025724363893 %
[14] Char п: 2.82644150675859 %
[15] Char м: 2.7081625329322625 %
[16] Char я: 2.1060309439268967 %
[17] Char з: 2.019495315814196 %
[18] Char ь: 1.87939279180975 %
[19] Char г: 1.5261897190072033 %
[20] Char б: 1.4648036901639392 %
[21] Char й: 1.4100114077648658 %
[22] Char ч: 1.1883915051539173 %
[23] Char х: 1.0766479260333364 %
[24] Char ц: 0.9475738805948377 %
[25] Char ї: 0.946290142349066 %
[26] Char ю: 0.7253704605994474 %
[27] Char ж: 0.655931891850888 %
[28] Char ш: 0.5775655071203709 %
[29] Char ф: 0.41569778467624996 %
[30] Char є: 0.39264884799080374 %
[31] Char e: 0.2995778251723564 %
[32] Char i: 0.28358944883865456 %
[33] Char a: 0.282013951900662 %
[34] Char щ: 0.25488039352412406 %
[35] Char n: 0.2371414650370971 %
[36] Char r: 0.19460304771129894 %
[37] Char s: 0.18100709265380788 %
[38] Char t: 0.1762806018398303 %
[39] Char o: 0.16595234413521265 %
[40] Char c: 0.14325351788043145 %
[41] Char h: 0.11687853210366769 %
[42] Char l: 0.11506962821189849 %
[43] Char m: 0.10269905966173497 %
[44] Char d: 0.09663047886354154 %
[45] Char b: 0.09487992671021651 %
[46] Char u: 0.07801627429985208 %
[47] Char w: 0.06774636833367859 %
[48] Char k: 0.06161943579704099 %
[49] Char p: 0.05905195930549761 %
[50] Char y: 0.056776241506175065 %
[51] Char g: 0.05304173024574835 %
[52] Char f: 0.046973149447554916 %
[53] Char v: 0.03985423735736647 %
[54] Char x: 0.02404091623899705 %
[55] Char ы: 0.01651354197969943 %
[56] Char z: 0.016338486764366927 %
[57] Char ґ: 0.01312914114993771 %
The first 58 characters have an accumulated ratio of 0.9998016040892901.
The first 6 characters have an accumulated ratio of 0.4174821808378726.
All characters whose order is over 30 have an accumulated ratio of 0.032775587966704496.
1538 sequences found.
First 818 (typical positive ratio): 0.9950006474582738
Next 269 (1087-818): 0.004005190805257075
Rest: 0.0009941617364691568
- Processing end: 2022-12-17 18:48:43.660343

58
script/langs/uk.py Normal file
View File

@ -0,0 +1,58 @@
#!/bin/python3
# -*- coding: utf-8 -*-
# ##### BEGIN LICENSE BLOCK #####
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Jehan <jehan@girinstud.io>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ##### END LICENSE BLOCK #####
import re
## Mandatory Properties ##
name = 'Ukrainian'
code = 'uk'
use_ascii = False
charsets = [ 'WINDOWS-1251' ]
## Optional Properties ##
# Alphabet characters.
alphabet = 'абвгґдеєжзиіїйклмнопрстуфхцчшщьюя'
# A starred page which was rewarded on the main page when I created
# the data.
start_pages = ['Операція_«Зільберфукс»']
wikipedia_code = code
case_mapping = True

View File

@ -38,6 +38,7 @@ set(
LangModels/LangSpanishModel.cpp LangModels/LangSpanishModel.cpp
LangModels/LangThaiModel.cpp LangModels/LangThaiModel.cpp
LangModels/LangTurkishModel.cpp LangModels/LangTurkishModel.cpp
LangModels/LangUkrainianModel.cpp
LangModels/LangVietnameseModel.cpp LangModels/LangVietnameseModel.cpp
LangModels/LangNorwegianModel.cpp LangModels/LangNorwegianModel.cpp
nsHebrewProber.cpp nsHebrewProber.cpp

View File

@ -0,0 +1,258 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "../nsSBCharSetProber.h"
#include "../nsLanguageDetector.h"
/********* Language model for: Ukrainian *********/
/**
* Generated by BuildLangModel.py
* On: 2022-12-17 18:48:43.498701
**/
/* Character Mapping Table:
* ILL: illegal character.
* CTR: control character specific to the charset.
* RET: carriage/return.
* SYM: symbol (punctuation) that does not belong to word.
* NUM: 0 - 9.
*
* Other characters are ordered by probabilities
* (0 is the most common character in the language).
*
* Orders are generic to a language. So the codepoint with order X in
* CHARSET1 maps to the same character as the codepoint with the same
* order X in CHARSET2 for the same language.
* As such, it is possible to get missing order. For instance the
* ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1
* even though they are both used for French. Same for the euro sign.
*/
static const unsigned char Windows_1251_CharToOrderMap[] =
{
CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */
CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */
SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */
NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */
SYM, 33, 45, 40, 44, 31, 52, 51, 41, 32, 58, 48, 42, 43, 35, 39, /* 4X */
49, 60, 36, 37, 38, 46, 53, 47, 54, 50, 56,SYM,SYM,SYM,SYM,SYM, /* 5X */
SYM, 33, 45, 40, 44, 31, 52, 51, 41, 32, 58, 48, 42, 43, 35, 39, /* 6X */
49, 60, 36, 37, 38, 46, 53, 47, 54, 50, 56,SYM,SYM,SYM,SYM,CTR, /* 7X */
67, 70,SYM, 71,SYM,SYM,SYM,SYM,SYM,SYM, 68,SYM, 66, 72, 65, 69, /* 8X */
67,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM, 68,SYM, 66, 73, 65, 69, /* 9X */
SYM, 64, 64, 63,SYM, 57,SYM,SYM, 61,SYM, 30,SYM,SYM,SYM,SYM, 25, /* AX */
SYM,SYM, 3, 3, 57,SYM,SYM,SYM, 61,SYM, 30,SYM, 63, 74, 75, 25, /* BX */
1, 20, 6, 19, 13, 8, 27, 17, 5, 21, 10, 11, 15, 2, 0, 14, /* CX */
4, 9, 7, 12, 29, 23, 24, 22, 28, 34, 62, 55, 18, 59, 26, 16, /* DX */
1, 20, 6, 19, 13, 8, 27, 17, 5, 21, 10, 11, 15, 2, 0, 14, /* EX */
4, 9, 7, 12, 29, 23, 24, 22, 28, 34, 62, 55, 18, 59, 26, 16, /* FX */
};
/*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */
static const int Unicode_Char_size = 116;
static const unsigned int Unicode_CharOrder[] =
{
65, 33, 66, 45, 67, 40, 68, 44, 69, 31, 70, 52, 71, 51, 72, 41,
73, 32, 75, 48, 76, 42, 77, 43, 78, 35, 79, 39, 80, 49, 82, 36,
83, 37, 84, 38, 85, 46, 86, 53, 87, 47, 88, 54, 89, 50, 90, 56,
97, 33, 98, 45, 99, 40, 100, 44, 101, 31, 102, 52, 103, 51, 104, 41,
105, 32, 107, 48, 108, 42, 109, 43, 110, 35, 111, 39, 112, 49, 114, 36,
115, 37, 116, 38, 117, 46, 118, 53, 119, 47, 120, 54, 121, 50, 122, 56,
1028, 30, 1030, 3, 1031, 25, 1040, 1, 1041, 20, 1042, 6, 1043, 19,1044, 13,
1045, 8, 1046, 27, 1047, 17, 1048, 5, 1049, 21, 1050, 10, 1051, 11,1052, 15,
1053, 2, 1054, 0, 1055, 14, 1056, 4, 1057, 9, 1058, 7, 1059, 12,1060, 29,
1061, 23, 1062, 24, 1063, 22, 1064, 28, 1065, 34, 1067, 55, 1068, 18,1070, 26,
1071, 16, 1072, 1, 1073, 20, 1074, 6, 1075, 19, 1076, 13, 1077, 8,1078, 27,
1079, 17, 1080, 5, 1081, 21, 1082, 10, 1083, 11, 1084, 15, 1085, 2,1086, 0,
1087, 14, 1088, 4, 1089, 9, 1090, 7, 1091, 12, 1092, 29, 1093, 23,1094, 24,
1095, 22, 1096, 28, 1097, 34, 1099, 55, 1100, 18, 1102, 26, 1103, 16,1108, 30,
1110, 3, 1111, 25, 1168, 57, 1169, 57,
};
/* Model Table:
* Total considered sequences: 1538 / 3364
* - Positive sequences: first 818 (0.9950006474582738)
* - Probable sequences: next 269 (1087-818) (0.004005190805257075)
* - Neutral sequences: last 2277 (0.0009941617364691568)
* - Negative sequences: 1826 (off-ratio)
* Negative sequences: TODO
*/
static const PRUint8 UkrainianLangModel[] =
{
3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,3,3,3,3,3,
3,3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
3,3,3,1,3,1,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,3,3,3,3,3,
3,3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,3,3,3,3,1,3,3,3,1,3,3,3,
3,3,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,2,
3,3,3,2,3,0,3,3,2,3,3,3,2,3,3,3,3,3,0,3,3,3,3,3,3,3,3,3,3,
3,3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,
3,2,0,1,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,
2,2,3,1,3,3,3,3,3,3,3,3,2,3,3,3,3,3,0,3,3,3,3,3,3,3,2,3,3,
3,3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,1,3,3,3,1,1,3,3,
0,2,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,
3,3,3,3,3,3,3,3,3,3,3,3,3,2,1,3,3,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,2,1,1,1,2,3,1,0,1,1,1,0,0,1,0,0,1,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,3,3,3,0,2,3,2,1,2,0,2,2,1,1,1,2,1,0,1,1,1,1,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,3,3,3,0,1,3,1,2,3,0,1,2,1,0,1,2,1,0,1,1,1,3,0,0,0,1,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,3,3,3,0,2,1,1,1,3,1,0,1,0,1,0,2,0,0,1,1,0,0,1,1,0,0,0,
0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,1,3,1,0,0,0,0,2,1,1,0,0,0,1,1,0,0,0,2,1,0,1,3,3,0,0,0,
0,0,1,0,0,0,1,1,3,1,1,2,0,0,1,1,0,0,0,0,1,2,1,3,0,0,0,0,1,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,3,3,2,0,1,0,0,1,1,0,1,0,0,0,1,2,2,2,1,1,0,0,0,0,0,1,0,
2,2,1,2,3,1,1,1,2,1,0,1,2,1,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
const SequenceModel Windows_1251UkrainianModel =
{
Windows_1251_CharToOrderMap,
UkrainianLangModel,
58,
(float)0.9990058382635308,
PR_FALSE,
"WINDOWS-1251",
"uk"
};
const LanguageModel UkrainianModel =
{
"uk",
Unicode_CharOrder,
116,
UkrainianLangModel,
58,
6,
(float)0.4174821808378726,
30,
(float)0.032775587966704496,
};

View File

@ -156,6 +156,7 @@ extern const LanguageModel SpanishModel;
extern const LanguageModel SwedishModel; extern const LanguageModel SwedishModel;
extern const LanguageModel ThaiModel; extern const LanguageModel ThaiModel;
extern const LanguageModel TurkishModel; extern const LanguageModel TurkishModel;
extern const LanguageModel UkrainianModel;
extern const LanguageModel VietnameseModel; extern const LanguageModel VietnameseModel;
#endif /* nsLanguageDetector_h__ */ #endif /* nsLanguageDetector_h__ */

View File

@ -123,6 +123,7 @@ nsMBCSGroupProber::nsMBCSGroupProber(PRUint32 aLanguageFilter)
langDetectors[i][j++] = new nsLanguageDetector(&SwedishModel); langDetectors[i][j++] = new nsLanguageDetector(&SwedishModel);
langDetectors[i][j++] = new nsLanguageDetector(&ThaiModel); langDetectors[i][j++] = new nsLanguageDetector(&ThaiModel);
langDetectors[i][j++] = new nsLanguageDetector(&TurkishModel); langDetectors[i][j++] = new nsLanguageDetector(&TurkishModel);
langDetectors[i][j++] = new nsLanguageDetector(&UkrainianModel);
langDetectors[i][j++] = new nsLanguageDetector(&VietnameseModel); langDetectors[i][j++] = new nsLanguageDetector(&VietnameseModel);
langDetectors[i][j++] = new nsCJKDetector(); langDetectors[i][j++] = new nsCJKDetector();
} }

View File

@ -49,7 +49,7 @@
#include "nsEUCTWProber.h" #include "nsEUCTWProber.h"
#define NUM_OF_PROBERS 8 #define NUM_OF_PROBERS 8
#define NUM_OF_LANGUAGES 33 #define NUM_OF_LANGUAGES 34
class nsMBCSGroupProber: public nsCharSetProber { class nsMBCSGroupProber: public nsCharSetProber {
public: public:

View File

@ -217,6 +217,8 @@ nsSBCSGroupProber::nsSBCSGroupProber()
mProbers[n++] = new nsSingleByteCharSetProber(&Windows_1251BelarusianModel); mProbers[n++] = new nsSingleByteCharSetProber(&Windows_1251BelarusianModel);
mProbers[n++] = new nsSingleByteCharSetProber(&Iso_8859_5BelarusianModel); mProbers[n++] = new nsSingleByteCharSetProber(&Iso_8859_5BelarusianModel);
mProbers[n++] = new nsSingleByteCharSetProber(&Windows_1251UkrainianModel);
Reset(); Reset();
} }

View File

@ -40,7 +40,7 @@
#define nsSBCSGroupProber_h__ #define nsSBCSGroupProber_h__
#define NUM_OF_SBCS_PROBERS 111 #define NUM_OF_SBCS_PROBERS 112
class nsCharSetProber; class nsCharSetProber;
class nsSBCSGroupProber: public nsCharSetProber { class nsSBCSGroupProber: public nsCharSetProber {

View File

@ -271,5 +271,6 @@ extern const SequenceModel Iso_8859_1NorwegianModel;
extern const SequenceModel Windows_1252NorwegianModel; extern const SequenceModel Windows_1252NorwegianModel;
extern const SequenceModel Ibm865NorwegianModel; extern const SequenceModel Ibm865NorwegianModel;
#endif /* nsSingleByteCharSetProber_h__ */ extern const SequenceModel Windows_1251UkrainianModel;
#endif /* nsSingleByteCharSetProber_h__ */

1
test/uk/utf-8.txt Normal file
View File

@ -0,0 +1 @@
Бабак[1][2], байбак[1], бобак[3] (Marmota Blumenbach, 1779) — рід гризунів родини вивіркових (Sciuridae) поширених в Євразії та Північній Америці. Бабаки в основному їдять зелень і багато видів трав, ягід, лишайники, мохи, коріння і квіти. Як правило, живуть у норах і перебувають у сплячці впродовж зими. Більшість бабаків дуже соціальні. У залежності від виду, довжина голови й тіла становить від 30 до 60 сантиметрів, довжина хвоста — від 10 до 25 см, вага становить від 3 до 7 кілограмів[4].

1
test/uk/windows-1251.txt Normal file
View File

@ -0,0 +1 @@
Бабак[1][2], байбак[1], бобак[3] (Marmota Blumenbach, 1779) — рід гризунів родини вивіркових (Sciuridae) поширених в Євразії та Північній Америці. Бабаки в основному їдять зелень і багато видів трав, ягід, лишайники, мохи, коріння і квіти. Як правило, живуть у норах і перебувають у сплячці впродовж зими. Більшість бабаків дуже соціальні. У залежності від виду, довжина голови й тіла становить від 30 до 60 сантиметрів, довжина хвоста — від 10 до 25 см, вага становить від 3 до 7 кілограмів[4].