Name | marcel-socialsentiment JSON |
Version |
2.9
JSON |
| download |
home_page | None |
Summary | Library to perform Social Sentiment on Unstructured data |
upload_time | 2024-09-22 11:30:34 |
maintainer | None |
docs_url | None |
author | Marcel Tino |
requires_python | None |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
[English](README.md) | [Español](./docs/README.es.md) | [Français](./docs/README.fr.md) | [Deutsch](./docs/README.de.md) | [中文](./docs/README.zh.md) | [Türkçe](./docs/README.tr.md) | [日本語](./docs/README.ja.md) | [한국어](./docs/README.ko.md)
## marcel_socialsentiment
A library will get continous scores using SentProp and Densifier Algorithm. It a part of the original code that will help this algorithm to work in latest python versions
Developed by Marcel Tino @ 2024
You can use this to alter according to your requirements.
Credits to the author for developing such an amazing code
You can find the original code here
https://github.com/williamleif/socialsent
## Examples of How To Use the library
```
##syntax
from marcel_socialsentiment.marcel_socialsentiment import load_model
from marcel_socialsentiment.marcel_socialsentiment import prep_custom_data
from marcel_socialsentiment.marcel_socialsentiment import prep_seed_words
from marcel_socialsentiment.marcel_socialsentiment import random_walk
from marcel_socialsentiment.marcel_socialsentiment import label_propagate_continuous
from marcel_socialsentiment.marcel_socialsentiment import densify
from marcel_socialsentiment.marcel_socialsentiment import view_scores
from marcel_socialsentiment.marcel_socialsentiment import Embedding
from itertools import chain
from itertools import combinations, product
import random
import heapq
import pickle
#==============================PARAMETERS=====================
model="glove-twitter-25"
text="The world economy is currently navigating through a complex landscape, marked by varying levels of growth across regions. While some economies are experiencing robust GDP expansion, others are grappling with the threat of a potential recession, often driven by factors like rising inflation and supply chain disruptions. Central banks in many countries are implementing monetary tightening measures, such as increasing interest rates, in an attempt to curb inflationary pressures. However, these policies run the risk of triggering stagflation, where stagnant growth coincides with high inflation. Global trade deficits and mounting national debts have further strained economic recovery efforts, particularly in emerging markets. Meanwhile, key sectors such as manufacturing and services are seeing uneven recovery rates, leading to concerns over long-term economic stability. The threat of a prolonged bear market and reduced consumer purchasing power continues to cast a shadow on global economic sentiment, with many experts warning that a sustained period of economic contraction could be on the horizon. Despite these challenges, pockets of economic resilience remain, fueled by fiscal stimulus and innovation in sectors like technology and renewable energy."
# Define your seed words
positive_seeds = ['Recovery','Innovation','Stability','growth'] # Replace with your positive seed words
negative_seeds = ['Recession','Inflation','Contraction'] # Replace with your negative seed words
#=============================================================
## To Load the Model
model1=load_model(model)
## To Pre-process the data
embeddings,words,word_to_index=prep_custom_data(text,model1)
## To map seed words and alter seedwords if it is not present in vocabulary
overall_missing_seeds=prep_seed_words(positive_seeds, negative_seeds, word_to_index,model1)
## To get Polarity Scores using SentProp
sentprop_polarity_scores = random_walk(
embeddings=embeddings,
words=words,
word_to_index=word_to_index,
positive_seeds=positive_seeds,
negative_seeds=negative_seeds,
beta=0.9
)
## To get Continous Scores using SentProp
sentprop_continous_scores = label_propagate_continuous(
embeddings=embeddings,
words=words,
word_to_index=word_to_index,
positive_seeds=positive_seeds,
negative_seeds=negative_seeds,
beta=0.9
)
## To get continous Scores using Densifier Algorithm
new_embeddings= Embedding(embeddings, words, normalize=True)
densify_polarity_scores = densify(
embeddings=new_embeddings,
positive_seeds=positive_seeds,
negative_seeds=negative_seeds
)
##To view the final output
df=view_scores(words,sentprop_continous_scores,densify_polarity_scores)
```
+ Share marcel_socialsentiment on these social media platforms if you like it!
[![Reddit](https://img.shields.io/badge/share%20on-reddit-red?style=flat-square&logo=reddit)](https://reddit.com/submit?url=https://github.com/Kanaries/pygwalker&title=Say%20Hello%20to%20pygwalker%3A%20Combining%20Jupyter%20Notebook%20with%20a%20Tableau-like%20UI)
[![HackerNews](https://img.shields.io/badge/share%20on-hacker%20news-orange?style=flat-square&logo=ycombinator)](https://news.ycombinator.com/submitlink?u=https://github.com/Kanaries/pygwalker)
[![Twitter](https://img.shields.io/badge/share%20on-twitter-03A9F4?style=flat-square&logo=twitter)](https://twitter.com/share?url=https://github.com/Kanaries/pygwalker&text=Say%20Hello%20to%20pygwalker%3A%20Combining%20Jupyter%20Notebook%20with%20a%20Tableau-alternative%20UI)
[![Facebook](https://img.shields.io/badge/share%20on-facebook-1976D2?style=flat-square&logo=facebook)](https://www.facebook.com/sharer/sharer.php?u=https://github.com/Kanaries/pygwalker)
[![LinkedIn](https://img.shields.io/badge/share%20on-linkedin-3949AB?style=flat-square&logo=linkedin)](https://www.linkedin.com/shareArticle?url=https://github.com/Kanaries/pygwalker&&title=Say%20Hello%20to%20pygwalker%3A%20Combining%20Jupyter%20Notebook%20with%20a%20Tableau-alternative%20UI)
Raw data
{
"_id": null,
"home_page": null,
"name": "marcel-socialsentiment",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Marcel Tino",
"author_email": "<marceltino92@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/69/1e/41765470e980a378071bc444fb0e35bc115ddf2d5d4e4b7a01b07e0cc2ca/marcel_socialsentiment-2.9.tar.gz",
"platform": null,
"description": "\r\n[English](README.md) | [Espa\u00f1ol](./docs/README.es.md) | [Fran\u00e7ais](./docs/README.fr.md) | [Deutsch](./docs/README.de.md) | [\u4e2d\u6587](./docs/README.zh.md) | [T\u00fcrk\u00e7e](./docs/README.tr.md) | [\u65e5\u672c\u8a9e](./docs/README.ja.md) | [\ud55c\uad6d\uc5b4](./docs/README.ko.md)\r\n\r\n## marcel_socialsentiment\r\n\r\nA library will get continous scores using SentProp and Densifier Algorithm. It a part of the original code that will help this algorithm to work in latest python versions\r\n\r\nDeveloped by Marcel Tino @ 2024\r\n\r\n\r\nYou can use this to alter according to your requirements.\r\n\r\nCredits to the author for developing such an amazing code\r\n\r\nYou can find the original code here\r\nhttps://github.com/williamleif/socialsent\r\n\r\n## Examples of How To Use the library \r\n\r\n```\r\n##syntax\r\nfrom marcel_socialsentiment.marcel_socialsentiment import load_model\r\nfrom marcel_socialsentiment.marcel_socialsentiment import prep_custom_data\r\nfrom marcel_socialsentiment.marcel_socialsentiment import prep_seed_words\r\nfrom marcel_socialsentiment.marcel_socialsentiment import random_walk\r\nfrom marcel_socialsentiment.marcel_socialsentiment import label_propagate_continuous\r\nfrom marcel_socialsentiment.marcel_socialsentiment import densify\r\nfrom marcel_socialsentiment.marcel_socialsentiment import view_scores\r\nfrom marcel_socialsentiment.marcel_socialsentiment import Embedding\r\nfrom itertools import chain\r\nfrom itertools import combinations, product\r\nimport random\r\nimport heapq\r\nimport pickle\r\n\r\n#==============================PARAMETERS=====================\r\nmodel=\"glove-twitter-25\"\r\ntext=\"The world economy is currently navigating through a complex landscape, marked by varying levels of growth across regions. While some economies are experiencing robust GDP expansion, others are grappling with the threat of a potential recession, often driven by factors like rising inflation and supply chain disruptions. Central banks in many countries are implementing monetary tightening measures, such as increasing interest rates, in an attempt to curb inflationary pressures. However, these policies run the risk of triggering stagflation, where stagnant growth coincides with high inflation. Global trade deficits and mounting national debts have further strained economic recovery efforts, particularly in emerging markets. Meanwhile, key sectors such as manufacturing and services are seeing uneven recovery rates, leading to concerns over long-term economic stability. The threat of a prolonged bear market and reduced consumer purchasing power continues to cast a shadow on global economic sentiment, with many experts warning that a sustained period of economic contraction could be on the horizon. Despite these challenges, pockets of economic resilience remain, fueled by fiscal stimulus and innovation in sectors like technology and renewable energy.\"\r\n# Define your seed words\r\npositive_seeds = ['Recovery','Innovation','Stability','growth'] # Replace with your positive seed words\r\nnegative_seeds = ['Recession','Inflation','Contraction'] # Replace with your negative seed words\r\n#=============================================================\r\n\r\n\r\n## To Load the Model\r\nmodel1=load_model(model)\r\n\r\n## To Pre-process the data\r\nembeddings,words,word_to_index=prep_custom_data(text,model1)\r\n\r\n## To map seed words and alter seedwords if it is not present in vocabulary\r\noverall_missing_seeds=prep_seed_words(positive_seeds, negative_seeds, word_to_index,model1)\r\n\r\n\r\n## To get Polarity Scores using SentProp\r\nsentprop_polarity_scores = random_walk(\r\nembeddings=embeddings,\r\nwords=words,\r\nword_to_index=word_to_index,\r\npositive_seeds=positive_seeds,\r\nnegative_seeds=negative_seeds,\r\nbeta=0.9\r\n)\r\n\r\n## To get Continous Scores using SentProp\r\nsentprop_continous_scores = label_propagate_continuous(\r\n embeddings=embeddings,\r\n words=words,\r\n word_to_index=word_to_index,\r\n positive_seeds=positive_seeds,\r\n negative_seeds=negative_seeds,\r\n beta=0.9\r\n)\r\n\r\n\r\n## To get continous Scores using Densifier Algorithm\r\nnew_embeddings= Embedding(embeddings, words, normalize=True)\r\ndensify_polarity_scores = densify(\r\n embeddings=new_embeddings,\r\n positive_seeds=positive_seeds,\r\n negative_seeds=negative_seeds\r\n)\r\n##To view the final output\r\n\r\ndf=view_scores(words,sentprop_continous_scores,densify_polarity_scores)\r\n\r\n```\r\n\r\n\r\n+ Share marcel_socialsentiment on these social media platforms if you like it!\r\n[![Reddit](https://img.shields.io/badge/share%20on-reddit-red?style=flat-square&logo=reddit)](https://reddit.com/submit?url=https://github.com/Kanaries/pygwalker&title=Say%20Hello%20to%20pygwalker%3A%20Combining%20Jupyter%20Notebook%20with%20a%20Tableau-like%20UI)\r\n[![HackerNews](https://img.shields.io/badge/share%20on-hacker%20news-orange?style=flat-square&logo=ycombinator)](https://news.ycombinator.com/submitlink?u=https://github.com/Kanaries/pygwalker)\r\n[![Twitter](https://img.shields.io/badge/share%20on-twitter-03A9F4?style=flat-square&logo=twitter)](https://twitter.com/share?url=https://github.com/Kanaries/pygwalker&text=Say%20Hello%20to%20pygwalker%3A%20Combining%20Jupyter%20Notebook%20with%20a%20Tableau-alternative%20UI)\r\n[![Facebook](https://img.shields.io/badge/share%20on-facebook-1976D2?style=flat-square&logo=facebook)](https://www.facebook.com/sharer/sharer.php?u=https://github.com/Kanaries/pygwalker)\r\n[![LinkedIn](https://img.shields.io/badge/share%20on-linkedin-3949AB?style=flat-square&logo=linkedin)](https://www.linkedin.com/shareArticle?url=https://github.com/Kanaries/pygwalker&&title=Say%20Hello%20to%20pygwalker%3A%20Combining%20Jupyter%20Notebook%20with%20a%20Tableau-alternative%20UI)\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Library to perform Social Sentiment on Unstructured data",
"version": "2.9",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b2648d53232e08699d11fdbdfa85b9e7c729faf00f38b66a99bbb20c60388acf",
"md5": "02ad670922a56ca92b45ade9a81a3964",
"sha256": "c71e20567672e013781675f6269f744bb9132393df44df721fa676e34d9fbbc8"
},
"downloads": -1,
"filename": "marcel_socialsentiment-2.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "02ad670922a56ca92b45ade9a81a3964",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 10056,
"upload_time": "2024-09-22T11:30:33",
"upload_time_iso_8601": "2024-09-22T11:30:33.115226Z",
"url": "https://files.pythonhosted.org/packages/b2/64/8d53232e08699d11fdbdfa85b9e7c729faf00f38b66a99bbb20c60388acf/marcel_socialsentiment-2.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "691e41765470e980a378071bc444fb0e35bc115ddf2d5d4e4b7a01b07e0cc2ca",
"md5": "1bd18e9f9043b46801f41474af416b61",
"sha256": "8601d81ac91ba3ba3e90652417a4276baa6fc5b4ef9bbdaf831d1a096f6a4235"
},
"downloads": -1,
"filename": "marcel_socialsentiment-2.9.tar.gz",
"has_sig": false,
"md5_digest": "1bd18e9f9043b46801f41474af416b61",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12090,
"upload_time": "2024-09-22T11:30:34",
"upload_time_iso_8601": "2024-09-22T11:30:34.444429Z",
"url": "https://files.pythonhosted.org/packages/69/1e/41765470e980a378071bc444fb0e35bc115ddf2d5d4e4b7a01b07e0cc2ca/marcel_socialsentiment-2.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-22 11:30:34",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "marcel-socialsentiment"
}