Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 95 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,96 @@
# classifier
# Classifier

AI engine for classifying market sentiment, topics, and trustworthiness from raw data.
AI engine for classifying market sentiment, topics, and trustworthiness from raw data using OpenAI and Redis.

## Features

- **Market Sentiment Analysis**: Classifies posts and data for positive, negative, or neutral sentiment.
- **Topic Classification**: Identifies and groups posts by relevant topics.
- **Trustworthiness Scoring**: Evaluates the reliability of content.
- **OpenAI Integration**: Uses OpenAI models for advanced NLP tasks.
- **Redis Support**: Caches and deduplicates processed data for efficiency.

## Project Structure

- `src/` — Main source code
- `analyzeSentiment.ts` — Sentiment analysis logic
- `classifyWithOpenAI.ts` — OpenAI classification integration
- `completePostAnalysis.ts` — Full post analysis pipeline
- `redisClient.ts`, `redisDedupeListener.ts` — Redis utilities
- `lib/utils.ts` — Utility functions
- `data/` — Sample and seed data
- `run-classifier.ts` — Entry point for running the classifier

## Getting Started

### Prerequisites

- Node.js (v18 or later recommended)
- npm or yarn
- Access to OpenAI API (API key required)
- Redis server (for caching/deduplication)

### Installation

1. Clone the repository:
```bash
git clone https://github.com/Sentiopulse/classifier.git
cd classifier
```
2. Install dependencies:
```bash
npm install
# or
yarn install
```
Comment on lines +36 to +45
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Replace hard tabs with spaces in the fenced code blocks.

markdownlint flags MD010 on these lines. Swap the leading tab characters for spaces so the snippets stay aligned without tripping the lint rule.

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

36-36: Hard tabs
Column: 1

(MD010, no-hard-tabs)


37-37: Hard tabs
Column: 1

(MD010, no-hard-tabs)


38-38: Hard tabs
Column: 1

(MD010, no-hard-tabs)


39-39: Hard tabs
Column: 1

(MD010, no-hard-tabs)


41-41: Hard tabs
Column: 1

(MD010, no-hard-tabs)


42-42: Hard tabs
Column: 1

(MD010, no-hard-tabs)


43-43: Hard tabs
Column: 1

(MD010, no-hard-tabs)


44-44: Hard tabs
Column: 1

(MD010, no-hard-tabs)


45-45: Hard tabs
Column: 1

(MD010, no-hard-tabs)

🤖 Prompt for AI Agents
In README.md around lines 36 to 45, the fenced code blocks currently use leading
tab characters which trigger markdownlint MD010; replace those leading tabs with
spaces (e.g., 4 spaces) inside the fenced blocks so the block contents remain
aligned and linting passes—update both code fences shown (the git clone/cd block
and the npm/yarn install block) to use spaces instead of tabs.


### Configuration

Set your OpenAI API key and Redis connection details as environment variables:

```bash
export OPENAI_API_KEY=your_openai_api_key
export REDIS_URL=redis://localhost:6379
```

You can also use a `.env` file with [dotenv](https://www.npmjs.com/package/dotenv) if preferred.

### Usage

To run the classifier on sample data:

```bash
npx ts-node run-classifier.ts
```

Or build and run with Node.js:

```bash
npm run build
node dist/run-classifier.js
```

## Development

- Source code is in TypeScript (`src/`)
- Lint, test, and format code before submitting PRs

### Scripts

- `npm run build` — Compile TypeScript
- `npm run lint` — Lint code
- `npm test` — Run tests (if available)

## Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.

1. Fork the repo
2. Create your feature branch (`git checkout -b feature/your-feature`)
3. Commit your changes
4. Push to the branch (`git push origin feature/your-feature`)
5. Open a pull request

## License

See the [LICENSE](LICENSE) file for details.