Markdown Format | JSON API | MCP Server Tool
Help on package chardet: NAME chardet DESCRIPTION ######################## BEGIN LICENSE BLOCK ######################## # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### PACKAGE CONTENTS big5freq big5prober chardistribution charsetgroupprober charsetprober cli (package) codingstatemachine compat cp949prober enums escprober escsm eucjpprober euckrfreq euckrprober euctwfreq euctwprober gb2312freq gb2312prober hebrewprober jisfreq jpcntx langbulgarianmodel langgreekmodel langhebrewmodel langhungarianmodel langrussianmodel langthaimodel langturkishmodel latin1prober mbcharsetprober mbcsgroupprober mbcssm metadata (package) sbcharsetprober sbcsgroupprober sjisprober universaldetector utf8prober version CLASSES builtins.object chardet.universaldetector.UniversalDetector class UniversalDetector(builtins.object) | UniversalDetector(lang_filter=31) | | The ``UniversalDetector`` class underlies the ``chardet.detect`` function | and coordinates all of the different charset probers. | | To get a ``dict`` containing an encoding and its confidence, you can simply | run: | | .. code:: | | u = UniversalDetector() | u.feed(some_bytes) | u.close() | detected = u.result | | Methods defined here: | | __init__(self, lang_filter=31) | Initialize self. See help(type(self)) for accurate signature. | | close(self) | Stop analyzing the current document and come up with a final | prediction. | | :returns: The ``result`` attribute, a ``dict`` with the keys | `encoding`, `confidence`, and `language`. | | feed(self, byte_str) | Takes a chunk of a document and feeds it through all of the relevant | charset probers. | | After calling ``feed``, you can check the value of the ``done`` | attribute to see if you need to continue feeding the | ``UniversalDetector`` more data, or if it has made a prediction | (in the ``result`` attribute). | | .. note:: | You should always call ``close`` when you're done feeding in your | document if ``done`` is not already ``True``. | | reset(self) | Reset the UniversalDetector and all of its probers back to their | initial states. This is called by ``__init__``, so you only need to | call this directly in between analyses of different documents. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | ESC_DETECTOR = re.compile(b'(\x1b|~{)') | | HIGH_BYTE_DETECTOR = re.compile(b'[\x80-\xff]') | | ISO_WIN_MAP = {'iso-8859-1': 'Windows-1252', 'iso-8859-13': 'Windows-1... | | MINIMUM_THRESHOLD = 0.2 | | WIN_BYTE_DETECTOR = re.compile(b'[\x80-\x9f]') FUNCTIONS detect(byte_str) Detect the encoding of the given byte string. :param byte_str: The byte sequence to examine. :type byte_str: ``bytes`` or ``bytearray`` detect_all(byte_str) Detect all the possible encodings of the given byte string. :param byte_str: The byte sequence to examine. :type byte_str: ``bytes`` or ``bytearray`` DATA VERSION = ['4', '0', '0'] __all__ = ['UniversalDetector', 'detect', 'detect_all', '__version__',... VERSION 4.0.0 FILE /usr/lib/python3/dist-packages/chardet/__init__.py
Generated by phpMan Author: Che Dong Under GNU General Public License
2026-06-02 05:15 @216.73.216.198 CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)