{"id":20859413,"url":"https://github.com/vndee/sentivi","last_synced_at":"2025-06-15T12:34:03.062Z","repository":{"id":57465590,"uuid":"298537702","full_name":"vndee/sentivi","owner":"vndee","description":"A Simple Tool For Sentiment Analysis","archived":false,"fork":false,"pushed_at":"2024-12-26T17:14:43.000Z","size":202,"stargazers_count":16,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-02T11:07:21.560Z","etag":null,"topics":["deep-learning","machine-learning","sentiment-analysis","text-classification"],"latest_commit_sha":null,"homepage":"https://sentivi.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vndee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-09-25T10:12:16.000Z","updated_at":"2025-04-09T10:16:54.000Z","dependencies_parsed_at":"2025-05-12T10:30:55.260Z","dependency_job_id":null,"html_url":"https://github.com/vndee/sentivi","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vndee%2Fsentivi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vndee%2Fsentivi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vndee%2Fsentivi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vndee%2Fsentivi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vndee","download_url":"https://codeload.github.com/vndee/sentivi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vndee%2Fsentivi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258798885,"owners_count":22759748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","machine-learning","sentiment-analysis","text-classification"],"created_at":"2024-11-18T04:49:47.527Z","updated_at":"2025-06-15T12:34:02.989Z","avatar_url":"https://github.com/vndee.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## A Simple Tool For Sentiment Analysis\n\n[![PyPI Downloads](https://static.pepy.tech/badge/sentivi)](https://pepy.tech/projects/sentivi)\n\n**Sentivi** - a simple tool for sentiment analysis which is a wrapper of [scikit-learn](https://scikit-learn.org) and\n[PyTorch Transformers](https://huggingface.co/transformers/) models (for more specific purpose, it is recommend to use native library instead). It is made for easy and faster pipeline to train and evaluate several\nclassification algorithms.\n\nDocumentation: https://sentivi.readthedocs.io/en/latest/index.html\n\n### Classifiers\n\n- [x] Decision Tree\n- [x] Gaussian Naive Bayes\n- [x] Gaussian Process\n- [x] Nearest Centroid\n- [x] Support Vector Machine\n- [x] Stochastic Gradient Descent\n- [ ] Character Convolutional Neural Network\n- [x] Multi-Layer Perceptron\n- [x] Long Short Term Memory\n- [x] Text Convolutional Neural Network\n- [x] Transformer\n- [ ] Ensemble\n- [ ] Lexicon-based \n\n### Text Encoders\n\n- [x] One-hot\n- [x] Bag of Words\n- [x] Term Frequency - Inverse Document Frequency\n- [x] Word2Vec\n- [x] Transformer Tokenizer (for Transformer classifier only)\n- [ ] WordPiece\n- [ ] SentencePiece\n\n### Install\n- Install standard version from PyPI:\n    ```bash\n    pip install sentivi\n    ```\n\n- Install latest version from source:\n    ```bash\n    git clone https://github.com/vndee/sentivi\n    cd sentivi\n    pip install .\n    ```\n\n### Example\n\n```python\nfrom sentivi import Pipeline\nfrom sentivi.data import DataLoader, TextEncoder\nfrom sentivi.classifier import SVMClassifier\nfrom sentivi.text_processor import TextProcessor\n\ntext_processor = TextProcessor(methods=['word_segmentation', 'remove_punctuation', 'lower'])\n\npipeline = Pipeline(DataLoader(text_processor=text_processor, n_grams=3),\n                    TextEncoder(encode_type='one-hot'),\n                    SVMClassifier(num_labels=3))\n\ntrain_results = pipeline(train='./data/dev.vi', test='./data/dev_test.vi')\nprint(train_results)\n\npipeline.save('./weights/pipeline.sentivi')\n_pipeline = Pipeline.load('./weights/pipeline.sentivi')\n\npredict_results = _pipeline.predict(['hàng ok đầu tuýp có một số không vừa ốc siết. chỉ được một số đầu thôi .cần '\n                                    'nhất đầu tuýp 14 mà không có. không đạt yêu cầu của mình sử dụng',\n                                    'Son đẹpppp, mùi hương vali thơm nhưng hơi nồng, chất son mịn, màu lên chuẩn, '\n                                    'đẹppppp'])\nprint(predict_results)\nprint(f'Decoded results: {_pipeline.decode_polarity(predict_results)}')\n```\nTake a look at more examples in [example/](https://github.com/vndee/sentivi/tree/master/example).\n\n### Pipeline Serving\n\nSentivi use [FastAPI](https://fastapi.tiangolo.com/) to serving pipeline. Simply run a web service as follows:\n\n```python\n# serving.py\nfrom sentivi import Pipeline, RESTServiceGateway\n\npipeline = Pipeline.load('./weights/pipeline.sentivi')\nserver = RESTServiceGateway(pipeline).get_server()\n\n```\n\n```bash\n# pip install uvicorn python-multipart\nuvicorn serving:server --host 127.0.0.1 --port 8000\n```\nAccess Swagger at http://127.0.0.1:8000/docs or Redoc http://127.0.0.1:8000/redoc. For example, you can use\n[curl](https://curl.haxx.se/) to send post requests:\n\n```bash\ncurl --location --request POST 'http://127.0.0.1:8000/get_sentiment/' \\\n     --form 'text=Son đẹpppp, mùi hương vali thơm nhưng hơi nồng'\n\n# response\n{ \"polarity\": 2, \"label\": \"#POS\" }\n```\n\n#### Deploy using Docker\n```dockerfile\nFROM tiangolo/uvicorn-gunicorn-fastapi:python3.7\n\nCOPY . /app\n\nENV PYTHONPATH=/app\nENV APP_MODULE=serving:server\nENV WORKERS_PER_CORE=0.75\nENV MAX_WORKERS=6\nENV HOST=0.0.0.0\nENV PORT=80\n\nRUN pip install -r requirements.txt\n```\n\n```bash\ndocker build -t sentivi .\ndocker run -d -p 8000:80 sentivi\n```\n\n### Future Releases\n\n- Lexicon-based\n- CharCNN\n- Ensemble learning methods\n- Model serving (Back-end and Front-end)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvndee%2Fsentivi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvndee%2Fsentivi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvndee%2Fsentivi/lists"}