semvec/pypi-packages huggingface dataset:
xia-scw-template 0.0.6
X-I-A
Requires Python: >=3.9

.. image:: https://img.shields.io/pypi/v/xia-scw-template.svg?color=blue
   :alt: PyPI-Server
   :target: https://pypi.org/project/xia-scw-template/

====================================
X-I-A
====================================



Quick start
=============================

Install the package::

    pip install
scs-re 1.0.3
Modification of cpython `re` module in which patterns match any string that is a prefix of a matching string under its regex

# Modified Regex for Syntactically Constrained LLM Sampling

The `scs_re` package is a modified version of the python `re` module that returns a match for any prefix of a string matching the original regex pattern. For example, the pattern `^abcd` matches the string `abc`. This behavior is used to consider the validity of beams under a particular regex pattern during a language model's output generation.

**Note**: This behavior is only expected for patterns that begin with `^` and end with `$` and therefore define a match contstraint over all characters in a sequence.

### Building from source

We use the _sre module from the python 3.11 branch of Python/cpython/Modules/_sre. You can clone the original source by running

```bash
svn export https://github.com/python/cpython/branches/3.11/Modules/_sre _sre
```

The module requires python 3.11 headers to compile. To install run

```bash
wget https://www.python.org/ftp/python/3.11.3/Python-3.11.3.tar.xz
tar xf Python-3.11.3.tar.xz
cd Python-3.11.3
./configure --enable-optimizations --enable-shared
make -j$(nproc)
sudo make altinstall
```

Then you can install the package with `sudo python3.11 setup.py install` to install. **The python version you install to must be the same version whose headers were compiled against**.