Path: blob/master/thirdparty/chardet/big5prober.py
2992 views
######################## BEGIN LICENSE BLOCK ########################1# The Original Code is Mozilla Communicator client code.2#3# The Initial Developer of the Original Code is4# Netscape Communications Corporation.5# Portions created by the Initial Developer are Copyright (C) 19986# the Initial Developer. All Rights Reserved.7#8# Contributor(s):9# Mark Pilgrim - port to Python10#11# This library is free software; you can redistribute it and/or12# modify it under the terms of the GNU Lesser General Public13# License as published by the Free Software Foundation; either14# version 2.1 of the License, or (at your option) any later version.15#16# This library is distributed in the hope that it will be useful,17# but WITHOUT ANY WARRANTY; without even the implied warranty of18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU19# Lesser General Public License for more details.20#21# You should have received a copy of the GNU Lesser General Public22# License along with this library; if not, write to the Free Software23# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA24# 02110-1301 USA25######################### END LICENSE BLOCK #########################2627from .mbcharsetprober import MultiByteCharSetProber28from .codingstatemachine import CodingStateMachine29from .chardistribution import Big5DistributionAnalysis30from .mbcssm import BIG5_SM_MODEL313233class Big5Prober(MultiByteCharSetProber):34def __init__(self):35super(Big5Prober, self).__init__()36self.coding_sm = CodingStateMachine(BIG5_SM_MODEL)37self.distribution_analyzer = Big5DistributionAnalysis()38self.reset()3940@property41def charset_name(self):42return "Big5"4344@property45def language(self):46return "Chinese"474849