ThirdParty/CharDet/chardet/euckrprober.py

Fri, 25 Apr 2014 22:07:19 +0200

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Fri, 25 Apr 2014 22:07:19 +0200
changeset 3537
7662053c3906
parent 12
1d8dd9706f46
child 5714
90c57b50600f
permissions
-rw-r--r--

updated CharDet to 2.2.1, updated changelog

3537
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
1 ######################## BEGIN LICENSE BLOCK ########################
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
2 # The Original Code is mozilla.org code.
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
3 #
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
4 # The Initial Developer of the Original Code is
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
5 # Netscape Communications Corporation.
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
6 # Portions created by the Initial Developer are Copyright (C) 1998
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
7 # the Initial Developer. All Rights Reserved.
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
8 #
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
9 # Contributor(s):
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
10 # Mark Pilgrim - port to Python
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
11 #
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
12 # This library is free software; you can redistribute it and/or
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
13 # modify it under the terms of the GNU Lesser General Public
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
14 # License as published by the Free Software Foundation; either
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
15 # version 2.1 of the License, or (at your option) any later version.
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
16 #
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
17 # This library is distributed in the hope that it will be useful,
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
20 # Lesser General Public License for more details.
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
21 #
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
22 # You should have received a copy of the GNU Lesser General Public
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
23 # License along with this library; if not, write to the Free Software
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
24 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
25 # 02110-1301 USA
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
26 ######################### END LICENSE BLOCK #########################
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
27
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
28 from .mbcharsetprober import MultiByteCharSetProber
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
29 from .codingstatemachine import CodingStateMachine
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
30 from .chardistribution import EUCKRDistributionAnalysis
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
31 from .mbcssm import EUCKRSMModel
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
32
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
33
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
34 class EUCKRProber(MultiByteCharSetProber):
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
35 def __init__(self):
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
36 MultiByteCharSetProber.__init__(self)
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
37 self._mCodingSM = CodingStateMachine(EUCKRSMModel)
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
38 self._mDistributionAnalyzer = EUCKRDistributionAnalysis()
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
39 self.reset()
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
40
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
41 def get_charset_name(self):
7662053c3906 updated CharDet to 2.2.1, updated changelog
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 12
diff changeset
42 return "EUC-KR"

eric ide

mercurial