Skip to content

module encoding_assessment

Helps with chardet library.

Global Variables

  • ENCODING
  • DIM_COUNTRY_THRESHOLD
  • CONFIDENCE
  • LANGUAGE

class EncodingAssessment

Class to smooth some of the rough edges around the dicts returned by chardet.detect_all().

Attributes:

  • assessment (ResultDict): The dict returned by chardet.detect_all().
  • confidence_text (Text): Rich Text object representing the confidence with styling.
  • encoding_label (Text): Rich Text object for displaying the encoding with optional language info.

method __init__

__init__(assessment: dict) → None

property confidence

Shift chardet confidence from 0-1.0 scale to 0-100.0 scale


property encoding

The encoding detected in lowercase.


property language

The language detected by chardet (if any).


classmethod dummy_encoding_assessment

dummy_encoding_assessment(encoding: str) → EncodingAssessment

Construct an empty EncodingAssessment to use as a dummy when chardet gives us nothing.

Args:

  • encoding (str): The encoding to use for the dummy assessment.

method set_encoding_label

set_encoding_label(alt_text: str | None) → None

Alt text is displayed below the encoding in slightly dimmer font.

Args:

  • alt_text (str | None): Text to display along with the encoding (often the inferred language)

This file was automatically generated via lazydocs.