Metadata-Version: 2.1
Name: farglot
Version: 0.1.1
Summary: A Transformer-based SocialNLP toolkit for Farcaster
Home-page: https://github.com/michaelhly/FarGlot
License: MIT
Author: michaelhly
Author-email: michaelhly@gmail.com
Requires-Python: >=3.9,<3.11
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.9
Provides-Extra: cli
Requires-Dist: PyNaCl (>=1.5.0,<2.0.0); extra == "cli"
Requires-Dist: blake3 (>=0.3.3,<0.4.0); extra == "cli"
Requires-Dist: datasets (>=2.14.3,<3.0.0)
Requires-Dist: eth-account (>=0.9.0,<0.10.0)
Requires-Dist: faust-streaming-rocksdb (>=0.9.2,<0.10.0); extra == "cli"
Requires-Dist: grpcio (==1.53.0); extra == "cli"
Requires-Dist: protobuf (==4.22.1); extra == "cli"
Requires-Dist: torch (>=2.0.1,<3.0.0)
Requires-Dist: transformers (>=4.31.0,<5.0.0)
Requires-Dist: typer[all] (>=0.9.0,<0.10.0); extra == "cli"
Project-URL: Repository, https://github.com/michaelhly/FarGlot
Description-Content-Type: text/markdown

# FarGlot

A Transformer-based SocialNLP toolkit for [Farcaster](https://www.farcaster.xyz/).

## Installation

```
pip install farglot
```

## Examples

```python
from farglot import CastAnalyzer

sentiment_analyzer=CastAnalyzer.sequence_analzyer_from_model_name(
    hub_address="nemes.farcaster.xyz:2283",
    model_name="pysentimiento/robertuito-sentiment-analysis"
)

sentiment_analyzer.predict_cast(fid=2, hash_hex="0x0bcdcbf006ec22b79f37f2cf2a09c33413883937")
# ...
sentiment_analyzer.predict_casts_by_fid(fid=2)
# [...]
```

## Generate a Training Set from a [Hub](https://github.com/farcasterxyz/hub-monorepo/tree/main/apps/hubble)

### Install the FarGlot CLI

```
pip install farglot[cli]
```

### Define Training Set Columns

```json
{
  "name": "labels",
  "default_value": 1 // optional
}
```

For multilabel classfication:

```json
[
  {
    "name": "column_one",
    "default_value": 1 // optional
  },
  {
    "name": "column_two",
    "default_value": 2 // optional
  },
  {
    "name": "column_three",
    "default_value": 3 // optional
  }
]
```

### Usage

```sh
farglot init
farglot set-columns-path /path/to/column_configs.json
farglot set-hub-db-path /path/to/.rocks/rocks.hub._default
farglot new-training-set --out ./data/training-set.csv
```

This largely is largely adapted off of [pysentimiento](https://github.com/pysentimiento/pysentimiento).

