§
    |ØjW	  ã                   óR   — d Z ddlZdej        dej        dedefd„Zded	edefd
„ZdS )u…  The hot scoring kernel, shared by the pure-Python and compiled builds.

This module is ordinary Python with no third-party imports: it runs as-is on
PyPy and in pure-Python installs.  When a compiled wheel is built,
``_kernel.pxd`` supplies C type declarations for these same functions and
Cython compiles this file to native code â€” the ``.py`` stays the one and only
implementation.

Note: ``from __future__ import annotations`` is intentionally omitted to match
the modules mypyc compiles, which import from here.

``dot_packed`` reads the profile's parallel ``array('i')`` buffers rather than
its dense 65536-entry table.  Compiled, that is the difference between a gather
through a Python list and a C loop over two contiguous int32 buffers.  The
interpreter pays for it â€” ``array`` indexing boxes an int where a list returns
a cached one â€” which is the trade this build makes deliberately.
é    NÚidxÚvalsÚmodelÚreturnc                 ó€   — d}t          | ¦  «        }t          |¦  «        D ]}||| |                  ||         z  z  }Œ|S )a«  Return the dot product of a packed bigram profile with a model table.

    :param idx: ``array('i')`` of bigram indices, in first-encounter order.
        Deliberately *not* sorted --- do not add a binary search or an
        early exit over it.
    :param vals: ``array('i')`` of weights, parallel to *idx*.
    :param model: 65536-byte model lookup table.
    :returns: Sum of ``model[idx[k]] * vals[k]`` over all ``k``.
    r   )ÚlenÚrange)r   r   r   ÚdotÚnÚis         ú„/Users/tedpeters/Documents/Projects/Claude Projects/Misc Tools/notename-sheets/.venv/lib/python3.11/site-packages/chardet/_kernel.pyÚ
dot_packedr      sK   € ð €CÝˆC‰Œ€AÝ�1‰XŒXð 'ð 'ˆØˆu�S˜”VŒ}˜t AœwÑ&Ñ&ˆˆØ€Jó    ÚnonzeroÚfreqc                 óà   — t          j         ddg¦  «        t          | ¦  «        z  }t          | ¦  «        }t          |¦  «        D ]}|| |                  ||<   Œt          j         d| ¦  «        |fS )ad  Return parallel ``array('i')`` index/value buffers for a dense profile.

    ``int32`` holds any weight a truncated input can produce: statistical
    scoring caps its input at 16384 bytes, so no weight exceeds ``255 * 16383``
    (about 4.2 million) against an int32 ceiling of 2.1 billion.  The bound is
    the caller's to keep --- see :class:`~chardet.models.BigramProfile`, which
    documents the input limit that makes it hold.

    :param nonzero: Bigram indices with non-zero weight.
    :param freq: Dense 65536-entry weight table.
    :returns: An ``(idx, vals)`` tuple of ``array('i')`` buffers.
    r   r   )Úarrayr   r	   )r   r   r   r   r   s        r   Úpack_profiler   '   sm   € õ Œ;�s˜Q˜CÑ Ô ¥3 w¡<¤<Ñ/€DÝˆG‰Œ€AÝ�1‰XŒXð #ð #ˆØ�w˜q”zÔ"ˆˆQ‰ˆÝŒ;�s˜GÑ$Ô$ dÐ*Ð*r   )Ú__doc__r   ÚbytesÚintr   ÚlistÚtupler   © r   r   ú<module>r      s�   ððð ð$ €€€ð�E”Kð  u¤{ð ¸5ð ÀSð ð ð ð ð"+˜$ð + dð +¨uð +ð +ð +ð +ð +ð +r   