From 005fd9808692adea17c203ef773ca3f3faf03c48 Mon Sep 17 00:00:00 2001 From: Jehan Date: Sat, 28 Nov 2015 02:14:39 +0100 Subject: [PATCH] Add initial support for French with ISO-8859-1 and ISO-8859-15. Mostly generated with a script from Wikipedia data (only the typical positive ratio is slightly modified). This is a first test before adding my generating script to the main tree. --- src/CMakeLists.txt | 1 + src/LangModels/LangFrenchModel.cpp | 244 +++++++++++++++++++++++++++++ src/nsSBCSGroupProber.cpp | 3 + src/nsSBCSGroupProber.h | 2 +- src/nsSBCharSetProber.h | 2 + test/CMakeLists.txt | 1 - 6 files changed, 251 insertions(+), 2 deletions(-) create mode 100644 src/LangModels/LangFrenchModel.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0b75525..b3e641a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,6 +10,7 @@ set( JpCntx.cpp LangModels/LangBulgarianModel.cpp LangModels/LangCyrillicModel.cpp + LangModels/LangFrenchModel.cpp LangModels/LangGreekModel.cpp LangModels/LangHungarianModel.cpp LangModels/LangHebrewModel.cpp diff --git a/src/LangModels/LangFrenchModel.cpp b/src/LangModels/LangFrenchModel.cpp new file mode 100644 index 0000000..c4df4c0 --- /dev/null +++ b/src/LangModels/LangFrenchModel.cpp @@ -0,0 +1,244 @@ +/* -*- 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. + * + * 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" + +/********* Language model for: French *********/ +/* Generated (mostly) by script. + * On: 2015-11-26 02:14:05.384439 + */ + +/* Character Mapping Table: + * ILL: illegal character. + * CTR: control character. + * RET: carriage/return. + * SYM: symbol (punctuation) that does not belong to word. + * INT: 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 Iso_8859_15_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, 26, 34, 27, 33, 36, 38, 41, 46, 30, 47, 53, 21, 32, 39, 50, /* 4X */ + 31, 63, 37, 29, 40, 48, 45, 55, 51, 64, 65,SYM,SYM,SYM,SYM,SYM, /* 5X */ + SYM, 2, 18, 11, 10, 0, 17, 16, 20, 3, 28, 35, 7, 12, 4, 8, /* 6X */ + 13, 19, 5, 1, 6, 9, 15, 54, 23, 25, 44,SYM,SYM,SYM,SYM,CTR, /* 7X */ + CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ + CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ + SYM,SYM,SYM,SYM,SYM,SYM, 85,SYM, 82,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ + SYM,SYM,SYM,SYM,119,SYM,SYM,SYM, 86,SYM,SYM,SYM, 73, 62,120,SYM, /* BX */ + 61, 78, 70,121,122, 83,123, 84, 87, 49, 88,124,125, 91, 74,126, /* CX */ + 127, 92,128,129, 81,130, 89,SYM, 93,131,132,133,134,135, 94, 95, /* DX */ + 24, 67, 57, 76, 79,136, 80, 42, 22, 14, 43, 66,137, 68, 58, 60, /* EX */ + 138, 77,139, 69, 52, 96, 75,SYM, 97, 59, 72, 56, 71,140, 90, 98, /* FX */ +}; + +/*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ +static const unsigned char Iso_8859_1_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, 26, 34, 27, 33, 36, 38, 41, 46, 30, 47, 53, 21, 32, 39, 50, /* 4X */ + 31, 63, 37, 29, 40, 48, 45, 55, 51, 64, 65,SYM,SYM,SYM,SYM,SYM, /* 5X */ + SYM, 2, 18, 11, 10, 0, 17, 16, 20, 3, 28, 35, 7, 12, 4, 8, /* 6X */ + 13, 19, 5, 1, 6, 9, 15, 54, 23, 25, 44,SYM,SYM,SYM,SYM,CTR, /* 7X */ + CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ + CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ + SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ + SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,200,200,200,SYM, /* BX */ + 61, 78, 70, 99,100, 83,101, 84, 87, 49, 88,102,103, 91, 74,104, /* CX */ + 105, 92,106,107, 81,108, 89,SYM, 93,109,110,111,112,113, 94, 95, /* DX */ + 24, 67, 57, 76, 79,114, 80, 42, 22, 14, 43, 66,115, 68, 58, 60, /* EX */ + 116, 77,117, 69, 52, 96, 75,SYM, 97, 59, 72, 56, 71,118, 90, 98, /* FX */ +}; +/*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ + +static const PRUint8 FrenchLangModel[] = +{ + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,2,2,2,0,3,0,3,1,1,2,1,0,1, + 3,3,3,2,2,2,0,3,0,3,1,1,2,1,0,1,1,1,1,2,0,1,0,0,1,0,2,0,3,2,1,0, + 3,3,3,3,2,3,3,3,3,3,1,3,3,3,3,1,2,3,2,3,3,2,2,0,0,3,0,1,2,0,0,1, + 2,3,2,3,3,2,2,0,0,3,0,1,2,0,0,1,0,0,0,3,0,0,0,1,1,0,0,0,2,0,0,1, + 2,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,0,3,0,3,0,0,3,0,0,1, + 3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"ISO-8859-15" +}; + +const SequenceModel Iso_8859_1FrenchModel = +{ + Iso_8859_1_CharToOrderMap, + FrenchLangModel, + (float)0.99, + PR_TRUE, + "ISO-8859-1" +}; diff --git a/src/nsSBCSGroupProber.cpp b/src/nsSBCSGroupProber.cpp index 2bdc444..7e7029f 100644 --- a/src/nsSBCSGroupProber.cpp +++ b/src/nsSBCSGroupProber.cpp @@ -78,6 +78,9 @@ nsSBCSGroupProber::nsSBCSGroupProber() } } + mProbers[14] = new nsSingleByteCharSetProber(&Iso_8859_1FrenchModel); + mProbers[15] = new nsSingleByteCharSetProber(&Iso_8859_15FrenchModel); + // disable latin2 before latin1 is available, otherwise all latin1 // will be detected as latin2 because of their similarity. //mProbers[10] = new nsSingleByteCharSetProber(&Latin2HungarianModel); diff --git a/src/nsSBCSGroupProber.h b/src/nsSBCSGroupProber.h index cfbf7e1..62feaba 100644 --- a/src/nsSBCSGroupProber.h +++ b/src/nsSBCSGroupProber.h @@ -40,7 +40,7 @@ #define nsSBCSGroupProber_h__ -#define NUM_OF_SBCS_PROBERS 14 +#define NUM_OF_SBCS_PROBERS 16 class nsCharSetProber; class nsSBCSGroupProber: public nsCharSetProber { diff --git a/src/nsSBCharSetProber.h b/src/nsSBCharSetProber.h index 9098c9f..50c6e56 100644 --- a/src/nsSBCharSetProber.h +++ b/src/nsSBCharSetProber.h @@ -133,6 +133,8 @@ extern const SequenceModel Latin2HungarianModel; extern const SequenceModel Win1250HungarianModel; extern const SequenceModel Win1255Model; extern const SequenceModel TIS620ThaiModel; +extern const SequenceModel Iso_8859_15FrenchModel; +extern const SequenceModel Iso_8859_1FrenchModel; #endif /* nsSingleByteCharSetProber_h__ */ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6e48cab..c745751 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -37,7 +37,6 @@ foreach(dir ${dirs}) if ("${lang}:${charset}" STREQUAL "hu:iso-8859-2" OR "${lang}:${charset}" STREQUAL "el:windows-1253" OR "${lang}:${charset}" STREQUAL "ru:windows-1251" OR - "${lang}:${charset}" STREQUAL "fr:iso-8859-1" OR "${lang}:${charset}" STREQUAL "he:iso-8859-8") message(STATUS "Skipping test ${lang}:${charset} (known broken)") else()