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 (dict): The dict returned by chardet.detect_all().
  • encoding (str): The encoding detected, in lowercase.
  • confidence (float): Confidence score from 0.0 to 100.0.
  • confidence_text (Text): Rich Text object representing the confidence with styling.
  • language (Optional[str]): The detected language, if any.
  • encoding_label (Text): Rich Text object for displaying the encoding with optional language info.

method __init__

__init__(assessment: dict) → None

Args:

  • assessment (dict): The dict returned by chardet.detect_all().

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: Optional[str]) → None

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

Args:

  • alt_text (Optional[str]): Text to display along with the encoding (often the inferred language)

This file was automatically generated via lazydocs.