# PerSent - Persian Sentiment Analyzer
[](README.fa.md)

## Introduction
PerSent is a Python library designed for Persian sentiment analysis. The name stands for "Persian Sentiment Analyzer". Currently in its early testing phase, PerSent provides tools for analyzing sentiment in Persian text, particularly useful for product reviews and service feedback.
## Features
- Sentiment classification into three categories:
- `recommended`
- `not_recommended`
- `no_idea`
- Single text analysis
- Batch processing from CSV files
- Summary report generation
## Installation
Install the latest version using pip:
```bash
pip install PerSent
```
For a specific version:
``` bash
pip install PerSent==<VERSION_NUMBER>
```
## Basic Usage
### Single Text Analysis
``` bash
from PerSent import CommentAnalyzer
# Initialize analyzer
analyzer = CommentAnalyzer()
# Load pre-trained model
analyzer.load_model()
# Analyze text
text = "کیفیت عالی داشت"
result = analyzer.predict(text)
print(f"Sentiment: {result}")
# Output: Sentiment: recommended
```
### Training Your Own Model
``` bash
'''
Train the model using a CSV file containing:
- Comments
- Recommendation status (recommended/not_recommended/no_idea)
'''
analyzer.train("train.csv")
```
## Batch Processing
### CSV Processing
``` bash
analyzer.csvPredict(
input_csv="comments.csv",
output_path="results.csv"
)
```
### Advanced CSV Processing Options
``` bash
# Using column index
analyzer.csvPredict("comments.csv", "results.csv", None, 0)
# Using column name
analyzer.csvPredict("comments.csv", "results.csv", None, "Comments")
# With summary report
analyzer.csvPredict("comments.csv", "results.csv", "summary.csv")
```
## Dataset
A sample training dataset is available:
[Download Dataset](https://github.com/RezaGooner/Sentiment-Survey-Analyzer/tree/main/Dataset/big_train)
## Contribution
We welcome contributions and feedback:
- [Fork Repository & Pull Request](https://github.com/RezaGooner/PerSent/fork)
- [Make Issue](https://github.com/RezaGooner/PerSent/issues/new)
- E-Mail : ```RezaAsadiProgrammer@gmail.com```
- Telegram : ```@RezaGooner```
Raw data
{
"_id": null,
"home_page": "https://github.com/RezaGooner/PerSent",
"name": "PerSent",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "persian sentiment analysis nlp",
"author": "RezaGooner",
"author_email": "RezaAsadiProgrammer@Gmail.com",
"download_url": null,
"platform": null,
"description": "# PerSent - Persian Sentiment Analyzer\r\n[](README.fa.md)\r\n\r\n\r\n\r\n\r\n## Introduction\r\nPerSent is a Python library designed for Persian sentiment analysis. The name stands for \"Persian Sentiment Analyzer\". Currently in its early testing phase, PerSent provides tools for analyzing sentiment in Persian text, particularly useful for product reviews and service feedback.\r\n\r\n## Features\r\n- Sentiment classification into three categories:\r\n - `recommended`\r\n - `not_recommended` \r\n - `no_idea`\r\n- Single text analysis\r\n- Batch processing from CSV files\r\n- Summary report generation\r\n\r\n## Installation\r\nInstall the latest version using pip:\r\n\r\n```bash\r\npip install PerSent\r\n```\r\nFor a specific version:\r\n\r\n``` bash\r\npip install PerSent==<VERSION_NUMBER>\r\n```\r\n\r\n## Basic Usage\r\n### Single Text Analysis\r\n``` bash\r\nfrom PerSent import CommentAnalyzer\r\n\r\n# Initialize analyzer\r\nanalyzer = CommentAnalyzer()\r\n\r\n# Load pre-trained model\r\nanalyzer.load_model()\r\n\r\n# Analyze text\r\ntext = \"\u06a9\u06cc\u0641\u06cc\u062a \u0639\u0627\u0644\u06cc \u062f\u0627\u0634\u062a\"\r\nresult = analyzer.predict(text)\r\nprint(f\"Sentiment: {result}\")\r\n# Output: Sentiment: recommended\r\n```\r\n\r\n### Training Your Own Model\r\n``` bash\r\n'''\r\nTrain the model using a CSV file containing:\r\n- Comments\r\n- Recommendation status (recommended/not_recommended/no_idea)\r\n'''\r\nanalyzer.train(\"train.csv\")\r\n```\r\n\r\n## Batch Processing\r\n### CSV Processing\r\n\r\n``` bash\r\nanalyzer.csvPredict(\r\n input_csv=\"comments.csv\",\r\n output_path=\"results.csv\"\r\n)\r\n```\r\n\r\n### Advanced CSV Processing Options\r\n``` bash\r\n# Using column index\r\nanalyzer.csvPredict(\"comments.csv\", \"results.csv\", None, 0)\r\n\r\n# Using column name \r\nanalyzer.csvPredict(\"comments.csv\", \"results.csv\", None, \"Comments\")\r\n\r\n# With summary report\r\nanalyzer.csvPredict(\"comments.csv\", \"results.csv\", \"summary.csv\")\r\n```\r\n\r\n## Dataset\r\nA sample training dataset is available:\r\n[Download Dataset](https://github.com/RezaGooner/Sentiment-Survey-Analyzer/tree/main/Dataset/big_train)\r\n\r\n## Contribution\r\nWe welcome contributions and feedback:\r\n\r\n- [Fork Repository & Pull Request](https://github.com/RezaGooner/PerSent/fork)\r\n- [Make Issue](https://github.com/RezaGooner/PerSent/issues/new)\r\n- E-Mail : ```RezaAsadiProgrammer@gmail.com```\r\n- Telegram : ```@RezaGooner```\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Persian Sentiment Analysis Toolkit",
"version": "1.0.2000",
"project_urls": {
"Homepage": "https://github.com/RezaGooner/PerSent"
},
"split_keywords": [
"persian",
"sentiment",
"analysis",
"nlp"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "8eda2f3fec7e1cc6757e2d00fe84bee8a4484ed17c90ac7a03569a6a5360ee4c",
"md5": "06e4061bdcc3c7711f99de05ed4fd515",
"sha256": "64563ae28d5c370f1c78ea2be9d83cd261a976026baedf11d8a0ccd36ff15f95"
},
"downloads": -1,
"filename": "persent-1.0.2000-py3-none-any.whl",
"has_sig": false,
"md5_digest": "06e4061bdcc3c7711f99de05ed4fd515",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 54453121,
"upload_time": "2025-03-28T11:12:26",
"upload_time_iso_8601": "2025-03-28T11:12:26.975332Z",
"url": "https://files.pythonhosted.org/packages/8e/da/2f3fec7e1cc6757e2d00fe84bee8a4484ed17c90ac7a03569a6a5360ee4c/persent-1.0.2000-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-03-28 11:12:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "RezaGooner",
"github_project": "PerSent",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "hazm",
"specs": [
[
">=",
"0.7.0"
]
]
},
{
"name": "gensim",
"specs": [
[
">=",
"4.0.0"
]
]
},
{
"name": "scikit-learn",
"specs": [
[
">=",
"1.0.0"
]
]
},
{
"name": "pandas",
"specs": [
[
">=",
"1.3.0"
]
]
},
{
"name": "tqdm",
"specs": [
[
">=",
"4.62.0"
]
]
},
{
"name": "joblib",
"specs": [
[
">=",
"1.1.0"
]
]
}
],
"lcname": "persent"
}