3 m�da�* � @ sz d dl Z d dlmZ d dlmZmZ d dlmZ d dlm Z m Z mZmZ ddl mZ ddlmZmZmZ dd lmZ dd lmZ ddlmZmZmZmZmZ ee e d�d d�Zee e d�dd�Ze� ee e d�dd��Z e� ee e d�dd��Z!d)e e e"e e d�dd�Z#ee e e$d�dd�Z%ee e d�dd�Z&e e ed �d!d"�Z'ed#d$�d*ee$ee ed&�d'd(��Z(dS )+� N)�IncrementalDecoder)�Counter�OrderedDict)� lru_cache)�Dict�List�Optional�Tuple� )�FREQUENCIES)�KO_NAMES�TOO_SMALL_SEQUENCE�ZH_NAMES)� is_suspiciously_successive_range)�CoherenceMatches)�is_accentuated�is_latin�is_multi_byte_encoding�is_unicode_range_secondary� unicode_range)� iana_name�returnc s� t | �rtd��tjdj| ��j}|dd�}i �d� xltdd�D ]^}|jt|g��}|r@t |�}|dkrjq@t |�d kr@|�kr�d�|<