<commit_before># Pycept
## A python client for the CEPT API

This is a *very* minimal HTTP client library for the [CEPT API](https://cept.3scale.net/docs). Currently, it only converts words into standard distributed representations based on the bitmap values return by the [/term2bitmap](https://cept.3scale.net/docs#/term2bitmap) endpoint.

### Installation

    python setup.py install

### Usage

#### Retrieve SDR string for term

    import pycept
    ceptClient = pycept.Cept("your_app_id", "your_app_key")
    catSdr = ceptClient.getSdr("cat")

#### Retrieve bitmap representation of SDR for term

    catBitmap = ceptClient.getBitmap("cat")

#### Convert bitmap SDR to closest terms

    similarTerms = ceptClient.bitmapToTerms(
      catBitmap['width'], 
      catBitmap['height'], 
      catBitmap['positions']
    )

### Run Tests

    nosetests<commit_msg>updated readme with caching instructions.<commit_after># Pycept
## A python client for the CEPT API

This is a *very* minimal HTTP client library for the [CEPT API](https://cept.3scale.net/docs). Currently, it only converts words into standard distributed representations based on the bitmap values return by the [/term2bitmap](https://cept.3scale.net/docs#/term2bitmap) endpoint.

### Installation

    python setup.py install

### Usage

#### Retrieve SDR string for term

    import pycept
    ceptClient = pycept.Cept("your_app_id", "your_app_key")
    catSdr = ceptClient.getSdr("cat")

#### Retrieve bitmap representation of SDR for term

    catBitmap = ceptClient.getBitmap("cat")

#### Convert bitmap SDR to closest terms

    similarTerms = ceptClient.bitmapToTerms(
      catBitmap['width'], 
      catBitmap['height'], 
      catBitmap['positions']
    )

### Caching

To prevent duplicate requests to the CEPT API, pycept will cache SDR responses by default to `/tmp/pycept`. You can provide your own cache directory location by specifying a `cache_dir` value to the constructor:

    pycept.Cept("your_app_id", "your_app_key", cache_dir="./my-cache")

### Run Tests

    nosetests
{'fraction_non_alphanumeric': 0.10572259941804074, 'fraction_numerical': 0.0038797284190106693, 'mean_word_length': 4.08128078817734, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '433360', 'n_tokens_mistral': 615, 'n_tokens_neox': 592, 'n_words': 200}