OpenQuizz
Une application de gestion des contenus pédagogiques
|
Public Member Functions | |
def | __init__ (self, lang_filter=LanguageFilter.ALL) |
def | reset (self) |
def | feed (self, byte_str) |
def | close (self) |
Data Fields | |
result | |
done | |
lang_filter | |
logger | |
Static Public Attributes | |
MINIMUM_THRESHOLD | |
HIGH_BYTE_DETECTOR | |
ESC_DETECTOR | |
WIN_BYTE_DETECTOR | |
ISO_WIN_MAP | |
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
def __init__ | ( | self, | |
lang_filter = LanguageFilter.ALL |
|||
) |
def 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`.
def 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``.
def 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.
done |
|
static |
|
static |
|
static |
lang_filter |
logger |
|
static |
result |
|
static |