Student Thesis Master’S Level (Second Cycle) Preprocessing Method Comparison and Model Tuning for Natural Language Data

Total Page:16

File Type:pdf, Size:1020Kb

Student Thesis Master’S Level (Second Cycle) Preprocessing Method Comparison and Model Tuning for Natural Language Data Student Thesis Master’s level (second cycle) Preprocessing method comparison and model tuning for natural language data Author: Peter Tempfli ​ Supervisor: William Wei Song and Serena Barakat ​ Examiner: Moudud Alam ​ Subject/main field of study: Microdata Analysis ​ Course code: MI4002 ​ Higher education credits: 15 ECTS-credits ​ Date of examination: 02/06/2020 ​ At Dalarna University it is possible to publish the student thesis in full text in DiVA. The publishing is open access, which means the work will be freely accessible to read and download on the internet. This will significantly increase the dissemination and visibility of the student thesis. Open access is becoming the standard route for spreading scientific and academic information on the internet. Dalarna University recommends that both researchers as well as students publish their work open access. I give my/we give our consent for full text publishing (freely accessible on the internet, open access): Yes X No ☐ ​ ​ Abstract Twitter and other microblogging services are a valuable source for almost real-time marketing, public opinion and brand-related consumer information mining. As such, collection and analysis of user-generated natural language content is in the focus of research regarding automated sentiment analysis. The most successful approach in the field is supervised machine learning, where the three key problems are data cleaning and transformation, feature generation and model choice and training parameter selection. Papers in recent years thoroughly examined the field and there is a agreement that relatively simple techniques as bag-of-words transformation of text and a naive bayes models can generate acceptable results (between 75% and 85% percent F1-scores for an average dataset) and fine tuning can be really difficult and yields relatively small results. However, a few percent in performance even on a middle-size dataset can mean thousands of better classified documents, which can mean thousands of missed sales or angry customers in any business domain. Thus this work presents and demonstrates a framework for better tailored, fine-tuned models for analysing twitter data. The experiments show that Naive Bayes classifiers with domain specific stopword selection work the best (up to 88% F1-score), however the performance dramatically decreases if the data is unbalanced or the classes are not binary. Filtering stopwords is crucial to increase prediction performance; and the experiment shows that a stopword set should be domain-specific. The conclusion is that there is no one best way for model training and stopword selection in sentiment analysis. Thus the work suggests that there is space for using a comparison framework to fine-tune prediction models to a given problem: such a comparison framework should compare different training settings on the same dataset, so the best trained models can be found for a given real-life problem. Keywords Natural language processing, sentiment analysis, machine learning 1 Table of contents 1. Introduction 3 1.1 The aim of this work 4 2. Previous work in the field 6 3. Machine learning approach 8 3.1. Supervised Machine learning 8 3.2. Bag of words methods 8 3.3. TF-IDF weighting 9 4. The dataset 10 4.1. Word frequency in the dataset 13 4.2. POS distribution in classes 17 4.3. Comparison of the predefined classes 17 5. Building the right training dataset 19 5.1. Comparing different dataset sizes with model performance metrics 20 6. Pre-processing 23 6.1. String Normalization 23 6.2. Tokenization 23 6.3. Stopwords 24 6.4. Stemming / Lemmatisation 24 6.5. N-gram converting 25 Infrequent word filtering 25 6.6. Synonyms 26 6.7. Part of Speech tagging 26 7. The experiment 27 7.1. Classifiers 27 7.2. Pre-processing datasets 27 7.3. Comparison matrices 27 8. Discussion 34 9. Conclusions and future work 35 References 36 2 1. Introduction Sentiment analysis is a document classification problem, in the domain of natural language processing. In simple terms, sentiment analysis aims to detect the sentiment of a 'subject' of the communication towards an 'object'. As an example, sentiment of product reviews can be analysed, so an automated system can classify if a product review is positive, negative or neutral. In more advanced classification systems the sentiment itself is not a list of classes (as positive, negative or neutral) or a scale, but rather a multy-dimensional system (as angryness, joy, interest...) on which every dimension can have a value (Snyder and Barzilay, 2007). Also, sentiment analysis is not strictly a classification problem: advanced sentiment analysis problems are often about detecting subjectivity, polarity and subject/object relations in a natural language document. The last problem (subject/object relationship) is also in the domain of the entity detection. The most challenging problems in automated sentiment analysis are mostly connected with linguistic features of the text, which are above the vocabulary level. For example: negotiation, specific word orders which change meaning, modal verbs, sarcasms. This work focuses on the classification problem in the domain of sentiment analysis. Classification of natural language documents as a problem appears not only in the domain of sentiment analysis -- this is a more broad area. In simple terms it can be described as automatically adding labels to a document (one or more), analysing its content. For example, a classification engine can add 'economy', 'politics' or 'culture' tags to newspaper articles; or an email filtering engine can classify emails as 'spam' or 'important'. This problem is very similar to classifying a product review as 'positive' or 'negative'. It is important to mention that there are many ways to classify a document sentiment: on a simple binary (positive/negative) system, on a 3-class system (positive-neutral-negative), or a scale (one-to-ten) or on a many-dimensional system. As many classifier algorithms have many limitations, not all of them can be used for every classification system. Thus before selecting a system for classes, it is important to take into account that this can introduce limitations about choosing the best classifier. The application of sentiment analysis techniques is very wide, and in future new areas might evolve. Some of current domains: ● Marketing and monitoring brand reputation (the dataset of the current work is a typical example of this). The typical process of collecting data is to set up automated keyword-monitoring processes on the critical channels, and then applying pre-trained sentiment analysis classifiers on the collected data. The process can help to point out the critical areas in order to increase brand reputation. ● Public Relations management and prediction. Automated techniques can help find early critical media messages and help to manage brand criticism. Similar to the previous use-case, automated systems can help to find individual critical messages, so the organization can address them early. 3 ● Automated political surveys. Using this sentiment analysis tools high volume tweets can be analysed automatically and show the effects of individual public messages. ● Sentiment-based stock price predictions. There are some attempts to build stock (or other goods) trading systems based on media and social media message analysis. In this area speed is critical and frequent model re-training can be crucial. ● Customer support -- integrated sentiment analysis engine can help to prioritize messages from 'angry' customers, so help-desk agents can solve their cases first. Advanced customer-support and CRM software already have integrated automated text analysis tools. This work focuses on specific kinds of natural-language documents: short 'tweets'. Twitter is a microblogging service started in 2006; currently the most popular of this type. Users share 140-character long messages, so from the sentiment-analysis perspective these observations are rather short and very subjective. This makes it a perfect platform to sentiment analysis; a large amount of research works with data gathered from Twitter. According to Wikipedia, 37% of content is conversational and 40% of the content is 'pointless babble' which also falls under the subjective communication category (Wikipedia, 'Twitter', 2016.05.25.). 1.1 The aim of this work Twitter-gathered data analysis is a relatively well-known area in natural language processing and sentiment analysis, and it has many commercial implementations as well, as it was demonstrated in the previous section. For data gathered from Twitter, it seems that there is a consensus that machine learning algorithms using even relatively simple feature generating methods can create results which are usable not only for research problems, but also in production environments with real-life use-cases. Such applications create very valuable information for organizations, so correct and well-performing implementation is critical. The amount of gathered data from micro-blogging services as Twitter is growing exponentially. Because data gathered using sentiment analysis can have very high business value, even a small improvement in the performance of implementations can create very tangible value. That’s why in this work model tuning is compared, as tailoring models for different business use-cases and specific domains is a real need. In this work, after reviewing the previous work on the topic and pointing out the most effective approaches, the proposed approaches are implemented using the ‘Airlines’ 4 dataset (which is described in The Dataset section). Another dataset is used in order to make sure the findings are generic enough and not specific only to one dataset. At the work’s contribution, a comparison framework is introduced which demonstrates how to implement and fine-tune models. Said that, the research question of this thesis work can be formulated as: How to select features and compare several model performance in an automated, flexible and quick way for analyzing twitter data? 5 2. Previous work in the field Twitter data is well-researched, as Twitter is a very approachable data source for valuable information.
Recommended publications
  • And Others TITLE on the Uses of the Computer for Content Analysis in Educational Research
    DOCUMENT RESUME ED 084 281 TM 003 289 AUTHOR Hiller, Jack H.; And Others TITLE On the Uses of the Computer for Content Analysis in Educational Research. PUB DATE Feb 73 NOTE 21p.; Revised version of paper presented at national conference of Association for Computing Machinery (San Francisco, August 1969) EDRS PRICE MF-$0.65 HC-$3.29 DESCRIPTORS Audiovisual Aids; Classification; *Computer Programs; *Content Analysis; Educational Research; *Measurement Instruments; *Scoring; Social Sciences; *Structural Analysis; Technical Reports ABSTRACT Current efforts to take advantage of the special virtues of the computer as an aid in text analysis are described. Verbal constructs, category construction, and contingency analysis are discussed and illustrated. Mechanical techniques for reducing human labor when studying large quantities of verbal data have been sought at an increasing rate by researchers in the behavioral sciences. Whatever the purpose of research, if it is to have a scientific character, ti must involve an attempt to reduce natural language data, by formal rules, to measures reflecting theoretically relevant properties of the text, its source, or its audience effects. At the present time, there is no one theory or method dominating the field of natural language analysis. Although much work is currently being expended to implement a finite set of rules on the computer, little has been accomplished that is directly useful to researchers in the social sciences. (Author/CK) A. e r-4 csJ U S DEPARTMENT OF HEALTH, EDUCATION & WELFARE NATIONAL INSTITUTE OF EDUCATION CO THIS DOCUMENT HAS BEEN REPRO oucccrExAcrLY AS RECEIVED FROM THE PERSON OR ORGANIZATION ORIGIN O ti NG IT POINTS OF VIEW OR OPINIONS STATED 00 NOT NECESSARILY REPRE SENT OFFICIAL NATIONAL INSTITUTE OF EDUCATION POSITION OR POLICY LiJ On the Uses of theComputer Research' ForContent Analysis in Educational Jack H.
    [Show full text]
  • Download Download
    Christos Kakalis In the Orality/Aurality of the Book Inclusivity and Liturgical Language Abstract This article examines the role of language in the constitution of a common identity through its liturgical use at the Eastern Orthodox church of St Andrew’s in Edinburgh, Scotland. Open to individuals who have relocated, the parish has a rather multination- al character. It is a place of worship for populations that consider Christian Orthodox culture part of their long-established collective identity and for recent converts. Based on ethnographic research, archival work and theoretical contextualisation, the article examines the atmospheric materiality of the written text as performed by the readers, the choir and the clergy. This soundscape is an amalgam of different kinds of reading: prose, chanted prose, chanting and antiphonic, depending the part of the Liturgy being read. The language of the book is performative: the choreography and its symbolisms perform the words of the texts and vice versa. Additionally, the use of at least four languages in every service and two Eastern Orthodox chanting styles in combination with European influences expresses in the most tangible way the religious inclusivity that has been carefully cultivated in this parish. Through closer examination of literary transformation processes, I demonstrate the role of liturgical language in the creation of communal space-times that negotiate ideas of home and belonging in a new land. Keywords Role of Language, Christian Orthodox Culture, Religious Books, Transnational Religious Community, Religious Soundscapes, Atmospheric Materiality, Performance, Belonging Biography Christos Kakalis holds a PhD in architecture from the Edinburgh School of Architecture and Landscape Architecture and is a Senior Lecturer in Architecture at the School of Ar- chitecture, Planning and Landscape of Newcastle University.
    [Show full text]
  • 109969 TESL Vol 25-1 Text
    Inscribing Identity: Insights for Teaching From ESL Students’ Journals Jenny Miller Linguistic minority students in schools must acquire and operate in a second language while negotiating mainstream texts and content areas, along with negotiating an emerging new sense of social identity. This article presents jour- nal data from an Australian ethnographic study that explored the relationship between second-language use, textual practices in school, and the representation of identity. Such texts normally lie outside dominant school discourses, but for students they are a powerful means of negotiating identity and gaining vital language practice. For teachers journals provide critical insights into the experi- ences of their students and into their developing language competence. Les élèves qui forment une minorité linguistique à l’école doivent acquérir une langue seconde et fonctionner dans cette langue en même temps qu’ils assimilent de la matière académique dans la langue dominante et se construisent une nouvelle identité sociale. Cet article présente des données de journaux personnels provenant d’une étude ethnographique en Australie portant sur le rapport entre l’usage d’une langue seconde, les pratiques textuelles à l’école et la représentation de l’identité. Ce genre de textes ne fait habituellement pas partie du discours pédagogique dominant; pourtant, ces textes représentent pour les élèves un puissant moyen de négocier leur identité et de pratiquer leurs habiletés langa- gières. Les journaux personnels fournissent aux enseignants un aperçu impor- tant des expériences de leurs élèves et du développement de leurs compétences langagières. Introduction One of the most critical realities of contemporary education in a globalized world is the growing cultural, racial, and linguistic diversity in schools and the difficulties involved in educating and empowering vast numbers of students who do not speak the majority language.
    [Show full text]
  • United States Patent (19) 11 Patent Number: 5,930,754 Karaali Et Al
    USOO593.0754A United States Patent (19) 11 Patent Number: 5,930,754 Karaali et al. (45) Date of Patent: Jul. 27, 1999 54 METHOD, DEVICE AND ARTICLE OF OTHER PUBLICATIONS MANUFACTURE FOR NEURAL-NETWORK BASED ORTHOGRAPHY-PHONETICS “The Structure and Format of the DARPATIMIT CD-ROM TRANSFORMATION Prototype”, John S. Garofolo, National Institute of Stan dards and Technology. 75 Inventors: Orhan Karaali, Rolling Meadows; “Parallel Networks that Learn to Pronounce English Text' Corey Andrew Miller, Chicago, both Terrence J. Sejnowski and Charles R. Rosenberg, Complex of I11. Systems 1, 1987, pp. 145-168. 73 Assignee: Motorola, Inc., Schaumburg, Ill. Primary Examiner David R. Hudspeth ASSistant Examiner-Daniel Abebe 21 Appl. No.: 08/874,900 Attorney, Agent, or Firm-Darleen J. Stockley 22 Filed: Jun. 13, 1997 57 ABSTRACT A method (2000), device (2200) and article of manufacture (51) Int. Cl. .................................................. G10L 5/06 (2300) provide, in response to orthographic information, 52 U.S. Cl. ............... 704/259; 704/258; 704/232 efficient generation of a phonetic representation. The method 58 Field of Search ..................................... 704/259,258, provides for, in response to orthographic information, effi 704/232 cient generation of a phonetic representation, using the Steps of inputting an Orthography of a word and a predetermined 56) References Cited Set of input letter features, utilizing a neural network that has U.S. PATENT DOCUMENTS been trained using automatic letter phone alignment and predetermined letter features to provide a neural network 4,829,580 5/1989 Church. 5,040.218 8/1991 Vitale et al.. hypothesis of a word pronunciation. 5,668,926 9/1997 Karaali et al.
    [Show full text]
  • Download Tetra En.Pdf
    TextTransformer 1.7.5 © 2002-10 Dr. Detlef Meyer-Eltz 2 TextTransformer Table of Contents Part I About this help 16 Part II Registration 18 Part III Most essential operation elements 21 Part IV Most essential syntax elements 23 Part V How to begin with a new project? 25 1 Practice................................................................................................................................... 27 Part VI Introduction 30 1 How................................................................................................................................... does the TextTransformer work? 30 2 Analysis................................................................................................................................... 30 3 Synthesis................................................................................................................................... 31 4 Regular................................................................................................................................... expressions 31 5 Syntax................................................................................................................................... tree 32 6 Productions................................................................................................................................... or non-terminal symbols 33 7 Productions................................................................................................................................... as functions 33 8 Four..................................................................................................................................
    [Show full text]
  • Optical Character Recognition
    International Journal of Recent Technology and Engineering (IJRTE) ISSN: 2277-3878, Volume-2 Issue-1, March 2013 Optical Character Recognition Ravina Mithe, Supriya Indalkar, Nilam Divekar Most of the character recognition program will be Abstract— The Optical Character Recognition is a mobile recognized through the input image with a scanner or a application. It uses smart mobile phones of android platform. digital camera and computer software. There is a problem in This paper combines the functionality of Optical Character the spatial size of the computer and scanner. If you do not Recognition and speech synthesizer. The objective is to develop have a scanner and a digital camera, a hardware problem user friendly application which performs image to speech occurs. In order to overcome the limitations of computer conversion system using android phones. The OCR takes image occupying a large space, character recognition system based as the input, gets text from that image and then converts it into speech. This system can be useful in various applications like on android phone is proposed [4]. banking, legal industry, other industries, and home and office OCR is a technology that enables you to convert different automation. It mainly designed for people who are unable to types of documents such as scanned paper documents, PDF read any type of text documents. In this paper, the character files or images captured by a digital camera into editable and recognition method is presented by using OCR technology and searchable data. Images captured by a digital camera differ android phone with higher quality camera. from scanned documents or image.
    [Show full text]
  • Experimenting with Analogy for Lyrics Transformation
    WeirdAnalogyMatic: Experimenting with Analogy for Lyrics Transformation Hugo Gonc¸alo Oliveira CISUC, Department of Informatics Engineering University of Coimbra, Portugal [email protected] Abstract Our main goal is thus to explore to what extent we can rely on word embeddings for transforming the semantics This paper is on the transformation of text relying mostly on of a poem, in such a way that its theme shifts according a common analogy vector operation, computed in a distribu- to the seed, while text remains syntactically and semanti- tional model, i.e., static word embeddings. Given a theme, cally coherent. Transforming text, rather than generating it original song lyrics have their words replaced by new ones, related to the new theme as the original words are to the orig- from scratch, should help to maintain the latter. For this, we inal theme. As this is not enough for producing good lyrics, make a rough approximation that the song title summarises towards more coherent and singable text, constraints are grad- its theme and every word in the lyrics is related to this theme. ually applied to the replacements. Human opinions confirmed Relying on this assumption and recalling how analogies can that more balanced lyrics are obtained when there is a one-to- be computed, shifting the theme is a matter of computing one mapping between original words and their replacement; analogies of the kind ‘what is to the new theme as the origi- only content words are replaced; and the replacement has the nal title is to a word used?’. same part-of-speech and rhythm as the original word.
    [Show full text]
  • Antithesis: the Dialectics of Software
    ******************************************************************************************************************************************************************************** ******************************************************************************************************************************************************************************** ******************************************************************************************************************************************************************************** ******************************************************************************************************************************************************************************** ******************************************************************************************************************************************************************************** ********************************************************************************************************************************************************************************ANTITHESIS: THE DIALECTICS OF SOFTWARE ART ART OF SOFTWARE ANTITHESIS: THE DIALECTICS ********************************************************************************************************************************************************************************argues that software art praxis can offer ********************************************************************************************************************************************************************************new critical forms of
    [Show full text]
  • Text to Speech Conversion in Punjabi-A Review
    I J C T A, 9(41), 2016, pp. 373-379 ISSN: 0974-5572 © International Science Press Text to Speech Conversion in Punjabi-A Review Priya* and Amandeep Kaur Gahier** ABSTRACT Speech is the essential method for communication between individuals. Speech is regularly dependent upon natural speech’s concatenation i.e. units which are obtained from a sentence or word. The synthesis of concatenative speech has turned out to be exceptionally well known in these years because of its enhanced affectability to unit context over easier predecessors. Speech synthesis has been worked on for quite a few years from now. Latest progress in speech synthesis has delivered synthesizers having very high comprehensibility.In the process of speech synthesis, the accurateness of information extraction is pivotal in creatingsynthesized speech having very high quality. Speech synthesis incorporates the algorithmic changeof text data which is input to waveforms of speech. The characterization of Speech Synthesizers is done by thetechnique utilized for synthesis, encoding and storage of the speech. The method of synthesis is controlled by the size of vocabulary as every single conceivable utterances of the language which should bemodelled. It is a properly confirmedstatement that TTS (text-to- speech) synthesizersintended for utilization in a confined domain dependably perform superiorto their counterparts which are of general purpose. The outline of such universally useful synthesizers iscomplex by the concept that the sound output requires to be very near to natural speech. In this paper, I have presented a survey on the various techniques of text to speech synthesis system. Keywords: text to speech, NLP, TTS, ASR 1.
    [Show full text]
  • Oral Tradition 12.2
    _____________________________________________________________ Volume 12 October 1997 Number 2 _____________________________________________________________ Editor Editorial Assistants John Miles Foley Michael Barnes Anastasios Daskalopoulos Scott Garner Lori Peterson Marjorie Rubright Aaron Tate Slavica Publishers, Inc. For a complete catalog of books from Slavica, with prices and ordering information, write to: Slavica Publishers, Inc. Indiana University 2611 E. 10th St. Bloomington, IN 47408-2603 ISSN: 0883-5365 Each contribution copyright (c) 1997 by its author. All rights reserved. The editor and the publisher assume no responsibility for statements of fact or opinion by the authors. Oral Tradition seeks to provide a comparative and interdisciplinary focus for studies in oral literature and related fields by publishing research and scholarship on the creation, transmission, and interpretation of all forms of oral traditional expression. As well as essays treating certifiably oral traditions, OT presents investigations of the relationships between oral and written traditions, as well as brief accounts of important fieldwork, a Symposium section (in which scholars may reply at some length to prior essays), review articles, occasional transcriptions and translations of oral texts, a digest of work in progress, and a regular column for notices of conferences and other matters of interest. In addition, occasional issues will include an ongoing annotated bibliography of relevant research and the annual Albert Lord and Milman Parry Lectures on Oral Tradition. OT welcomes contributions on all oral literatures, on all literatures directly influenced by oral traditions, and on non-literary oral traditions. Submissions must follow the list-of reference format (style sheet available on request) and must be accompanied by a stamped, self-addressed envelope for return or for mailing of proofs; all quotations of primary materials must be made in the original language(s) with following English translations.
    [Show full text]
  • Wordstat User's Guide I Appending
    WORDSTAT 9 Text Analytics Software User's Guide Provalis Research 1998-2021 All right Reserved - Provalis Research Table of Contents Introduction to.....................................................................................................................................................1 WordStat 9.0 Program Capabilities.....................................................................................................................................................2 The Content Analysis.....................................................................................................................................................7 & Categorization Process A Quick Tour.....................................................................................................................................................9 Performing................................................................................................................................................................... Content Analysis 9 Starting WordStat.....................................................................................................................................................12 from QDA Miner or SimStat Creating a Project.....................................................................................................................................................14 in WordStat Creating..................................................................................................................................................................
    [Show full text]
  • Frauke Berndt Facing Poetry Paradigms
    Frauke Berndt Facing Poetry Paradigms Literature and the Human Sciences Edited by Rüdiger Campe ‧ Paul Fleming Editorial Board Eva Geulen ‧ Rüdiger Görner ‧ Barbara Hahn Daniel Heller-Roazen ‧ Helmut Müller-Sievers William Rasch ‧ Joseph Vogl ‧ Elisabeth Weber Volume 12 Frauke Berndt Facing Poetry Alexander Gottlieb Baumgarten’s Theory of Literature Translated by Anthony Mahler With an afterword by Gabriel Trop and English translations from the Aesthetica by Maya Maskarinec and Alexandre Roberts The prepress of this publication was funded by the Swiss National Science Foundation. ISBN 978-3-11-062331-4 e-ISBN (PDF) 978-3-11-062451-9 e-ISBN (EPUB) 978-3-11-062348-2 ISSN 2195-2205 DOI https://doi.org/10.1515/9783110624519 This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. For details go to https://creativecommons.org/licenses/by-nc-nd/4.0/. Library of Congress Control Number: 2020910024 Bibliographic information published by the Deutsche Nationalbibliothek The Deutsche Nationalbibliothek lists this publication in the Deutsche Nationalbibliografie; detailed bibliographic data are available on the Internet at http://dnb.dnb.de. © 2020 Frauke Berndt, published by Walter de Gruyter GmbH, Berlin/Boston Cover image: Dieter Asmus, Parzival-Zyklus / “Artus reitet,” 2011. © VG Bild-Kunst, Bonn 2019. Printing and binding: CPI books GmbH, Leck www.degruyter.com Formyfriends Acknowledgements This book is embedded in my research group ETHOS: EthicalPractices in Aesthetic Theoriesofthe EighteenthCentury,which is generously funded by theSwiss National ScienceFoundation. Itspublication wouldnot have been possible with- outAnthony Mahler.Intranslating andworking on themanuscript with me,he always made me feel better understood than Iunderstandmyself.
    [Show full text]