Submitted:
14 August 2024
Posted:
15 August 2024
You are already at the latest version
Abstract
Python, a versatile programming language, holds vast potential for Sentiment Analysis (SA). Leveraging the Requests and TextBlob libraries, we have crafted a user-friendly code that enables Industrial Engineers (IE) and managers, particularly those who are new to Python, to extract and analyze sentiment efficiently. We aim to provide IE/managers in service companies requiring SA capabilities with a simple yet effective Python solution. While machine learning resources like PyTorch/TensorFlow are commonly utilized in SA, offering pre-built algorithms and tools for training, and implementing machine learning models, we sought to exploit Python's versatility by integrating additional web-scraping libraries. Thus, by using a lexicon-based approach, we intend to deliver an informative and practical article. The code in this article is twofold; firstly, it can be easily adapted by IE/managers possessing basic Python skills; secondly, we aim to inspire junior IE/managers to develop their own customized coding solutions tailored to specific organizational needs.
Keywords:
1. Introduction
2. Literature Review
2.1. Overview of Sentiment Analysis and Its Subjectivity
- Sentence 1. "Today it is raining”.
- Sentence 2. "I love the rain outside".
2.2. Sentiment Analysis with Machine Learning- or Lexicon-Based Approach
3. Materials and Methods
4. Results and Discussion
- pip install requests textblob
- import requests
- from textblob import TextBlob
- def analyze_sentiment (text):
- blob = TextBlob (text)
- sentiment = blob.sentiment.polarity
- if sentiment > 0:
- return `Positive`
- elif sentiment < 0:
- return `Negative`
- else:
- return `Neutral`
- # Add as many URLs as needed
- response = requests.get(url)
- if response.status_code == 200
- webpage_content = response.text
- sentiment = analyze_sentiment(webpage_content)
- print (`Sentiment`, sentiment)
- print (`Error:`, response.status_code)
5. Conclusion
5.1. Theoretical Contributions
5.2. Managerial Contributions
5.3. Limitations and Suggestions for Future Research
Author Contributions
Funding
Conflicts of Interest
References
- L. Collins, P. D. Hannon, e A. Smith, «Enacting entrepreneurial intent: the gaps between student needs and higher education capability», Educ. Train., vol. 46, n.o 8/9, pp. 454–463, out. 2004. [CrossRef]
- M. Barrett e E. Davidson, «Exploring the Diversity of Service Worlds in the Service Economy», In Information Technology in the Service Economy: Challenges and Possibilities for the 21st Century, vol. 267, M. Barrett, E. Davidson, C. Middleton, e J. I. DeGross, Eds., In IFIP — The International Federation for Information Processing, vol. 267, Boston, MA: Springer US, 2008, pp. 1–10. [CrossRef]
- D. Soto Setzke, T. Riasanow, M. Böhm, e H. Krcmar, «Pathways to Digital Service Innovation: The Role of Digital Transformation Strategies in Established Organizations», Inf. Syst. Front., vol. 25, n.o 3, pp. 1017–1037, jun. 2023. [CrossRef]
- J. Reis e N. Melão, «Digital transformation: A meta-review and guidelines for future research», Heliyon, vol. 9, n.o 1, p. e12834, jan. 2023. [CrossRef]
- S. Gupta, W. Ghardallou, D. K. Pandey, e G. P. Sahu, «Artificial intelligence adoption in the insurance industry: Evidence using the technology–organization–environment framework», Res. Int. Bus. Finance, vol. 63, p. 101757, dez. 2022. [CrossRef]
- P. C. Marques, J. Reis, e R. Santos, «Artificial Intelligence and Disruptive Technologies in Service Systems: A Bibliometric Analysis», Int. J. Innov. Technol. Manag., p. 2330003, jun. 2023. [CrossRef]
- R. Maruta, «The creation and management of organizational knowledge», Knowl.-Based Syst., vol. 67, pp. 26–34, set. 2014. [CrossRef]
- Kolmos, R. G. Hadgraft, e J. E. Holgaard, «Response strategies for curriculum change in engineering», Int. J. Technol. Des. Educ., vol. 26, n.o 3, pp. 391–411, ago. 2016. [CrossRef]
- Benis, S. Amador Nelke, e M. Winokur, «Training the Next Industrial Engineers and Managers about Industry 4.0: A Case Study about Challenges and Opportunities in the COVID-19 Era», Sensors, vol. 21, n.o 9, p. 2905, abr. 2021. [CrossRef]
- J. Reis, P. E. Santo, e N. Melão, «Artificial Intelligence in Government Services: A Systematic Literature Review», In New Knowledge in Information Systems and Technologies, vol. 930, Á. Rocha, H. Adeli, L. P. Reis, e S. Costanzo, Eds., In Advances in Intelligent SystIns and Computing, vol. 930. Cham: Springer International Publishing, 2019, pp. 241–252. https://doi.org/10.1007/978-3-030-16181-1_23. [CrossRef]
- Sambamurthy, Bharadwaj, e Grover, «Shaping Agility through Digital Options: Reconceptualizing the Role of Information Technology in Contemporary Firms», MIS Q., vol. 27, n.o 2, p. 237, 2003. [CrossRef]
- W. He, H. Wu, G. Yan, V. Akula, e J. Shen, «A novel social media competitive analytics framework with sentiment benchmarks», Inf. Manage., vol. 52, n.o 7, pp. 801–812, nov. 2015. [CrossRef]
- J. Serrano-Guerrero, J. A. Olivas, F. P. Romero, e E. Herrera-Viedma, «Sentiment analysis: A review and comparative analysis of web services», Inf. Sci., vol. 311, pp. 18–38, ago. 2015. [CrossRef]
- S. Schmunk, W. Höpken, M. Fuchs, e M. Lexhagen, «Sentiment Analysis: Extracting Decision-Relevant Knowledge from UGC», In Information and Communication Technologies in Tourism 2014, Z. Xiang e I. Tussyadiah, Eds., Cham: Springer International Publishing, 2013, pp. 253–265. https://doi.org/10.1007/978-3-319-03973-2_19. [CrossRef]
- Z. Wang, L. Wang, Y. Ji, L. Zuo, e S. Qu, «A novel data-driven weighted sentiment analysis based on information entropy for perceived satisfaction», J. Retail. Consum. Serv., vol. 68, p. 103038, set. 2022. [CrossRef]
- D. N. Mishra e R. K. Panda, «Decoding customer experiences in rail transport service: application of hybrid sentiment analysis», Public Transp., vol. 15, n.o 1, pp. 31–60, mar. 2023. [CrossRef]
- S. Farzadnia e I. Raeesi Vanani, «Identification of opinion trends using sentiment analysis of airlines passengers’ reviews», J. Air Transp. Manag., vol. 103, p. 102232, ago. 2022. [CrossRef]
- S.-W. Lee, G. Jiang, H.-Y. Kong, e C. Liu, «A difference of multimedia consumer’s rating and review through sentiment analysis», Multimed. Tools Appl., vol. 80, n.o 26–27, pp. 34625–34642, nov. 2021. [CrossRef]
- J. Jussila, V. Vuori, J. Okkonen, e N. Helander, «Reliability and Perceived Value of Sentiment Analysis for Twitter Data», In Strategic Innovative Marketing, A. Kavoura, D. P. Sakas, e P. Tomaras, Eds., In Springer Proceedings in Business and Economics. , Cham: Springer International Publishing, 2017, pp. 43–48. [CrossRef]
- M. McGuire e C. Kampf, «Using social media sentiment analysis to understand audiences: A new skill for technical communicators? In 2015 IEEE International Professional Communication Conference (IPCC), Limerick, Ireland: IEEE, jul. 2015, pp. 1–7. [CrossRef]
- S. Bird, E. Klein, e E. Loper, Natural language processing with Python, 1st ed. Beijing; Cambridge [Mass.]: O’Reilly, 2009.
- E. Loper e S. Bird, «NLTK: The Natural Language Toolkit», 2002. [CrossRef]
- J. Wang, B. Xu, e Y. Zu, «Deep learning for Aspect-based Sentiment Analysis», In 2021 International Conference on Machine Learning and Intelligent Systems Engineering (MLISE), Chongqing, China: IEEE, jul. 2021, pp. 267–271. [CrossRef]
- S. Behdenna, F. Barigou, e G. Belalem, «Sentiment Analysis at Document Level», In Smart Trends in Information Technology and Computer Communications, vol. 628, A. Unal, M. Nayak, D. K. Mishra, D. Singh, e A. Joshi, Eds., In Communications in Computer and Information Science, vol. 628. , Singapore: Springer Singapore, 2016, pp. 159–168. [CrossRef]
- W. Medhat, A. Hassan, e H. Korashy, «Sentiment analysis algorithms and applications: A survey», Ain Shams Eng. J., vol. 5, n.o 4, pp. 1093–1113, dez. 2014. [CrossRef]
- S. Park, S. Strover, J. Choi, e M. Schnell, «Mind games: A temporal sentiment analysis of the political messages of the Internet Research Agency on Facebook and Twitter», New Media Soc., vol. 25, n.o 3, pp. 463–484, mar. 2023. [CrossRef]
- S. E. Bestvater e B. L. Monroe, «Sentiment is Not Stance: Target-Aware Opinion Classification for Political Text Analysis», Polit. Anal., vol. 31, n.o 2, pp. 235–256, abr. 2023. [CrossRef]
- Y. Xu e V. Keselj, «Stock Prediction using Deep Learning and Sentiment Analysis», In 2019 IEEE International Conference on Big Data (Big Data), Los Angeles, CA, USA: IEEE, dez. 2019, pp. 5573–5580. [CrossRef]
- F. J. Ramírez-Tinoco, G. Alor-Hernández, J. L. Sánchez-Cervantes, M. D. P. Salas-Zárate, e R. Valencia-García, «Use of Sentiment Analysis Techniques in Healthcare Domain», In Current Trends in Semantic Web Technologies: Theory and Practice, vol. 815, G. Alor-Hernández, J. L. Sánchez-Cervantes, A. Rodríguez-González, e R. Valencia-García, Eds., In Studies in Computational Intelligence, vol. 815. , Cham: Springer International Publishing, 2019, pp. 189–212. [CrossRef]
- K. Denecke e Y. Deng, «Sentiment analysis in medical settings: New opportunities and challenges», Artif. Intell. Med., vol. 64, n.o 1, pp. 17–27, mai. 2015. [CrossRef]
- E. Haddi, X. Liu, e Y. Shi, «The Role of Text Pre-processing in Sentiment Analysis», Procedia Comput. Sci., vol. 17, pp. 26–32, 2013. [CrossRef]
- M. Taboada, J. Brooke, M. Tofiloski, K. Voll, e M. Stede, «Lexicon-Based Methods for Sentiment Analysis», Comput. Linguist., vol. 37, n.o 2, pp. 267–307, jun. 2011. [CrossRef]
- M. S. Neethu e R. Rajasree, «Sentiment analysis in twitter using machine learning techniques», In 2013 Fourth International Conference on Computing, Communications and Networking Technologies (ICCCNT), Tiruchengode: IEEE, jul. 2013, pp. 1–5. [CrossRef]
- Das, S. Bandyopadhyay, e B. Gambäck, «Sentiment analysis: what is the end user’s requirement? In Proceedings of the 2nd International Conference on Web Intelligence, Mining and Semantics, Craiova Romania: ACM, jun. 2012, pp. 1–10. [CrossRef]
- M. Javed e S. Kamal, «Normalization of Unstructured and Informal Text in Sentiment Analysis», Int. J. Adv. Comput. Sci. Appl., vol. 9, n.o 10, 2018. [CrossRef]
- T. Nasukawa e J. Yi, «Sentiment analysis: capturing favorability using natural language processing», In Proceedings of the 2nd international conference on Knowledge capture, Sanibel Island FL USA: ACM, out. 2003, pp. 70–77. [CrossRef]
- Kamath, R. Guhekar, M. Makwana, e S. N. Dhage, «Sarcasm Detection Approaches Survey», In Advances in Computer, Communication and Computational Sciences, vol. 1158, S. K. Bhatia, S. Tiwari, S. Ruidan, M. C. Trivedi, e K. K. Mishra, Eds., In Advances in Intelligent Systems and Computing, vol. 1158. , Singapore: Springer Singapore, 2021, pp. 593–609. [CrossRef]
- Balahur, R. Mihalcea, e A. Montoyo, «Computational approaches to subjectivity and sentiment analysis: Present and envisaged methods and applications», Comput. Speech Lang., vol. 28, n.o 1, pp. 1–6, jan. 2014. [CrossRef]
- K. Ravi e V. Ravi, «A survey on opinion mining and sentiment analysis: Tasks, approaches and applications», Knowl.-Based Syst., vol. 89, pp. 14–46, nov. 2015. [CrossRef]
- Gang Li e Fei Liu, «A clustering-based approach on sentiment analysis», In 2010 IEEE International Conference on Intelligent Systems and Knowledge Engineering, Hangzhou, China: IEEE, nov. 2010, pp. 331–337. [CrossRef]
- Y. He e D. Zhou, «Self-training from labeled features for sentiment analysis», Inf. Process. Manag., vol. 47, n.o 4, pp. 606–616, jul. 2011. https://doi.org/10.1016/j.ipm.2010.11.003. [CrossRef]
- S. Pradha, M. N. Halgamuge, e N. Tran Quoc Vinh, «Effective Text Data Preprocessing Technique for Sentiment Analysis in Social Media Data», In 2019 11th International Conference on Knowledge and Systems Engineering (KSE), Da Nang, Vietnam: IEEE, out. 2019, pp. 1–8. [CrossRef]
- R. Ahuja, A. Chug, S. Kohli, S. Gupta, e P. Ahuja, «The Impact of Features Extraction on the Sentiment Analysis», Procedia Comput. Sci., vol. 152, pp. 341–348, 2019. [CrossRef]
- M. Avinash e E. Sivasankar, «A Study of Feature Extraction Techniques for Sentiment Analysis», In Emerging Technologies in Data Mining and Information Security, vol. 814, A. Abraham, P. Dutta, J. K. Mandal, A. Bhattacharya, e S. Dutta, Eds., In Advances in Intelligent Systems and Computing, vol. 814. , Singapore: Springer Singapore, 2019, pp. 475–486. [CrossRef]
- K. Baktha e B. K. Tripathy, «Investigation of recurrent neural networks in the field of sentiment analysis», In 2017 International Conference on Communication and Signal Processing (ICCSP), Chennai: IEEE, abr. 2017, pp. 2047–2050. [CrossRef]
- S. Sachin, A. Tripathi, N. Mahajan, S. Aggarwal, e P. Nagrath, «Sentiment Analysis Using Gated Recurrent Neural Networks», SN Comput. Sci., vol. 1, n.o 2, p. 74, mar. 2020. https://doi.org/10.1007/s42979-020-0076-y. [CrossRef]
- H. Fei, T.-S. Chua, C. Li, D. Ji, M. Zhang, e Y. Ren, «On the Robustness of Aspect-based Sentiment Analysis: Rethinking Model, Data, and Training», ACM Trans. Inf. Syst., vol. 41, n.o 2, pp. 1–32, abr. 2023. https://doi.org/10.1145/3564281. [CrossRef]
- M. Wankhade, A. C. S. Rao, e C. Kulkarni, «A survey on sentiment analysis methods, applications, and challenges», Artif. Intell. Rev., vol. 55, n.o 7, pp. 5731–5780, out. 2022. [CrossRef]
- S. Jindal e S. Singh, «Image sentiment analysis using deep convolutional neural networks with domain specific fine tuning», In 2015 International Conference on Information Processing (ICIP), Pune, India: IEEE, dez. 2015, pp. 447–451. [CrossRef]
- N. Mukhtar, M. A. Khan, e N. Chiragh, «Lexicon-based approach outperforms Supervised Machine Learning approach for Urdu Sentiment Analysis in multiple domains», Telemat. Inform., vol. 35, n.o 8, pp. 2173–2183, dez. 2018. [CrossRef]
- F. Zarisfi Kermani, F. Sadeghi, e E. Eslami, «Solving the twitter sentiment analysis problem based on a machine learning-based approach», Evol. Intell., vol. 13, n.o 3, pp. 381–398, set. 2020. [CrossRef]
- H.-T. Duong e T.-A. Nguyen-Thi, «A review: preprocessing techniques and data augmentation for sentiment analysis», Comput. Soc. Netw., vol. 8, n.o 1, p. 1, dez. 2021. [CrossRef]
- Dhaoui, C. M. Webster, e L. P. Tan, «Social media sentiment analysis: lexicon versus machine learning», J. Consum. Mark., vol. 34, n.o 6, pp. 480–488, set. 2017. [CrossRef]
- J. Yi, T. Nasukawa, R. Bunescu, e W. Niblack, «Sentiment analyzer: extracting sentiments about a given topic using natural language processing techniques», In Third IEEE International Conference on Data Mining, Melbourne, FL, USA: IEEE Comput. Soc, 2003, pp. 427–434. [CrossRef]
- oreo, M. Romero, J. L. Castro, e J. M. Zurita, «Lexicon-based Comments-oriented News Sentiment Analyzer system», Expert Syst. Appl., vol. 39, n.o 10, pp. 9166–9180, ago. 2012. [CrossRef]
- Hogenboom, B. Heerschop, F. Frasincar, U. Kaymak, e F. De Jong, «Multi-lingual support for lexicon-based sentiment analysis guided by semantics», Decis. Support Syst., vol. 62, pp. 43–53, jun. 2014. [CrossRef]
- F. Chiarello, A. Bonaccorsi, e G. Fantoni, «Technical Sentiment Analysis. Measuring Advantages and Drawbacks of New Products Using Social Media», Comput. Ind., vol. 123, p. 103299, dez. 2020. [CrossRef]
- Python. Available online: https://www.python.org/downloads/ (accessed on 11, June 2023).
- Visual Studio Code. Available online: https://code.visualstudio.com (accessed on 11, June 2023).
- Portal da Queixa. Available online: hhttps://portaldaqueixa.com (accessed on 17, June 2023).
- W. Pang et al., «Innovative growth and development of a neurological surgery residency cadaveric skull base simulation training program: A single institution experience», Clin. Neurol. Neurosurg., vol. 225, p. 107585, fev. 2023. [CrossRef]
- S. Park e Y.-K. Suh, «A Comprehensive Analysis of COVID-19 Vaccine Discourse by Vaccine Brand on Twitter in Korea: Topic and Sentiment Analysis», J. Med. Internet Res., vol. 25, p. e42623, jan. 2023. [CrossRef]
- Q. Liu et al., «Health Communication Through News Media During the Early Stage of the COVID-19 Outbreak in China: Digital Topic Modeling Approach», J. Med. Internet Res., vol. 22, n.o 4, p. e19118, abr. 2020. [CrossRef]
- N. Kewsuwun e S. Kajornkasirat, «A sentiment analysis model of Agritech startup on Facebook comments using naive Bayes classifier», Int. J. Electr. Comput. Eng. IJECE, vol. 12, n.o 3, p. 2829, jun. 2022. [CrossRef]
- Leitch e M. Sherif, «Twitter mood, CEO succession announcements and stock returns», J. Comput. Sci., vol. 21, pp. 1–10, jul. 2017. https://doi.org/10.1016/j.jocs.2017.04.002. [CrossRef]
- J. R. Saura, A. Reyes-Menendez, e D. R. Bennett, «How to Extract Meaningful Insights from UGC: A Knowledge-Based Method Applied to Education», Appl. Sci., vol. 9, n.o 21, p. 4603, out. 2019. [CrossRef]
- Y. Choi, Y. Kim, e S.-H. Myaeng, «Domain-specific sentiment analysis using contextual feature generation», In Proceedings of the 1st international CIKM workshop on Topic-sentiment analysis for mass opinion, Hong Kong China: ACM, nov. 2009, pp. 37–44. [CrossRef]
- N. J. Prottasha et al., «Transfer Learning for Sentiment Analysis Using BERT Based Supervised Fine-Tuning», Sensors, vol. 22, n.o 11, p. 4157, mai. 2022. [CrossRef]
- P. Gonçalves, M. Araújo, F. Benevenuto, e M. Cha, «Comparing and combining sentiment analysis methods», In Proceedings of the first ACM conference on Online social networks, Boston Massachusetts USA: ACM, out. 2013, pp. 27–38. [CrossRef]


Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).