<commit_before># Fluent Server

A server-based API for interacting with [Fluent](https://github.com/chetan51/nupic.fluent).

## Installation

Requirements:

- [Fluent](https://github.com/chetan51/nupic.fluent)

Install other requirements:

    pip install -r requirements.txt

## Usage

Run:

    python server.py 9090

Then visit `http://localhost:9090`.

## API

You can use `curl` to test out the API:

    curl http://localhost:9090/_models/m123/feed/cat --data ""
    # => [{'term': {'string': ''}, 'type': 'term'}]
    curl http://localhost:9090/_models/m123/feed/likes --data ""
    # => [{'term': {'string': ''}, 'type': 'term'}]
    curl http://localhost:9090/_models/m123/feed/milk --data ""
    # => [{'term': {'string': ''}, 'type': 'term'}]
    curl http://localhost:9090/_models/m123/reset --data ""
    # => [{'type': 'reset'}]

    => curl http://localhost:9090/_models/m123/feed/cat --data ""
    # => [{'term': {'string': 'likes'}, 'type': 'term'}]
    curl http://localhost:9090/_models/m123/feed/likes --data ""
    # => [{'term': {'string': 'milk'}, 'type': 'term'}]

_Note: You can use any alphanumeric string as the model ID, and a model will be created if it doesn't already exist. In the above example, we used `m123`._

### Reference

* Feed a term into the model and get a prediction

        POST /_models/{model_id}/feed/{term}

    Returns: List of dictionaries, one for each predicted term

        [
            {
                'type': 'term',
                'term': {'string': term_string}
            },
            ...
        ]

* Reset sequence on model

        POST /_models/{model_id}/reset

    Returns: List of one dictionary

        [
            {'type': 'reset'}
        ]<commit_msg>Added note to README<commit_after># Fluent Server

A server-based API for interacting with [Fluent](https://github.com/chetan51/nupic.fluent).

## Installation

Requirements:

- [Fluent](https://github.com/chetan51/nupic.fluent)

Install other requirements:

    pip install -r requirements.txt

## Usage

Run:

    python server.py 9090

Then visit `http://localhost:9090`.

## API

You can use `curl` to test out the API:

    curl http://localhost:9090/_models/m123/feed/cat --data ""
    # => [{'term': {'string': ''}, 'type': 'term'}]
    curl http://localhost:9090/_models/m123/feed/likes --data ""
    # => [{'term': {'string': ''}, 'type': 'term'}]
    curl http://localhost:9090/_models/m123/feed/milk --data ""
    # => [{'term': {'string': ''}, 'type': 'term'}]
    curl http://localhost:9090/_models/m123/reset --data ""
    # => [{'type': 'reset'}]

    => curl http://localhost:9090/_models/m123/feed/cat --data ""
    # => [{'term': {'string': 'likes'}, 'type': 'term'}]
    curl http://localhost:9090/_models/m123/feed/likes --data ""
    # => [{'term': {'string': 'milk'}, 'type': 'term'}]

_Note: You can use any alphanumeric string as the model ID, and a model will be created if it doesn't already exist. In the above example, we used `m123`._

### Reference

* Feed a term into the model and get a prediction

        POST /_models/{model_id}/feed/{term}

    Returns: List of dictionaries, one for each predicted term

        [
            {
                'type': 'term',
                'term': {'string': term_string}
            },
            ...
        ]

    _Note: Currently, only one prediction is returned._

* Reset sequence on model

        POST /_models/{model_id}/reset

    Returns: List of one dictionary

        [
            {'type': 'reset'}
        ]
{'fraction_non_alphanumeric': 0.17705382436260622, 'fraction_numerical': 0.03229461756373938, 'mean_word_length': 2.6141248720573182, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '2154986', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1112, 'n_words': 308}