Giter VIP home page Giter VIP logo

maadb-project's Introduction

MAADB-project

Progetto d'esame per MAADB

Versione di Python

Python 3.9

Schema di lavoro

Descrizione progetto
Materiale per progetto software su Twitter

Cosa c'è da creare?

Pipeline di preprocessing dei tweets

  • Eliminare USERNAME e URL

  • estrae gli hashtag

  • estrae emoji ed emoticons

  • tokenization, lemmatization and pos tagging con spacy

  • riconoscere le forme di slang e sostituirle con le forme lunghe

  • eliminare stop words

  • rimuove punteggiatura, parole mal formate ed eventuali caratteri speciali

  • trasformare tutto a lower case

Ho usato re e spacy

Oggetto di output
{
  int: {
    "id":i,
    "frase_ripulita": str,
    "hashtags":list(str),
    "emoticons":list(str),
    "emojis":list(str),
    'parole': list(
      {
        token: str,
        lemma: str,
        pos: str,
      }
    )
  }
}

es.

{
  0:{
    'id': 0, 
    'frase_ripulita': " f u what's that spell ? fired up ? noo  haha \n",
     'hashtags': ['#fuckyou'],
      'emoticons': [], 
      'emojis': [],
       'parole': [{'token': "'s", 'lemma': 'be', 'pos': 'VERB'},{'token': 'spell', 'lemma': 'spell', 'pos': 'NOUN'}, {'token': 'fired', 'lemma': 'fire', 'pos': 'VERB'}, {'token': 'noo', 'lemma': 'noo', 'pos': 'VERB'}, {'token': 'haha', 'lemma': 'haha', 'pos': 'NOUN'}]
  },
  1: {
    'id': 1,
     'frase_ripulita': "now all of you roll tide bandwagon fans will hop off alabama's dick . one wor d: overrated . \n", 
     'hashtags': [],
      'emoticons': [], 
      'emojis': [],
       'parole': [{'token': 'roll', 'lemma': 'roll', 'pos': 'VERB'}, {'token': 'tide', 'lemma': 'tide', 'pos': 'NOUN'}, {'token': 'bandwagon', 'lemma': 'bandwagon', 'pos': 'NOUN'}, {'token': 'fans', 'lemma': 'fan', 'pos': 'NOUN'}, {'token': 'hop', 'lemma': 'hop', 'pos': 'VERB'}, {'token': 'alabama', 'lemma': 'alabama', 'pos': 'NOUN'}, {'token': "'s", 'lemma': "'s", 'pos': 'PART'}, {'token': 'dick', 'lemma': 'dick', 'pos': 'NOUN'}, {'token': 'one', 'lemma': 'one', 'pos': 'NUM'}, {'token': 'wor', 'lemma': 'wor', 'pos': 'NOUN'}, {'token': 'overrated', 'lemma': 'overrated', 'pos': 'ADJ'}]
  },
}

Databases

Database di buffer

Database dove mantenere le risorse lessicali e i messaggi di twitter (questi poi verranno recuperati come uno stream teoricamente infinito di dati)

Schema di messaggio_twitter
MongoDB

Per ogni collezione corrispondente ad una emozione abbiamo il seguente schema:

{
    _id: ObjectId(...),
    messaggio: str,
}
MySQL

Schema di risorsa_lessicale
MongoDB

Per ogni collezione corrispondente ad una emozione abbiamo il seguente schema:

{
    _id: ObjectId(...),
    lemma:str,
    risorse: {
        EmoSN: Optional[int],
        NRC: Optional[int],
        sentisense: Optional[int],
        nuova_risorsa: Optional[int],
    }
}
MySQL

Schema di token_twitter
MongoDB

Per ogni collezione corrispondente ad una emozione abbiamo il seguente schema:

{
    _id: ObjectId(...),
    token: str,
    lemma: Optional[str],
    pos: Optional[str],
    tipo: <"word","emoji","emoticon","hashtag">,
}

a cui verrà aggiunto il campo quant (quantità del lemma trovato)

MySQL

parola emoji

emoticon

hashtag

Schema di tokens_aggregati
MongoDB
{
  _id: str,
  quantita: int,
  tipo: str,
}

Database di analytics

database dove mantenere le statistiche elaborate richieste:

  • per ogni emozione (sentimento) dove X è un tipo di risorsa e Y è un sentimento:
    • parole più frequenti nei tweet (graficamente visualizzate con una word cloud)
    • emoji più frequenti nei tweet (graficamente visualizzate con una word cloud)
    • emoticons più frequenti nei tweet (graficamente visualizzate con una word cloud)
    • hashtags più frequenti nei tweet
    • la percentuale delle parole delle risorse lessicali presenti nei tweets: perc_persence_lex_words(X,Y) (visualizzarle con un istogramma)
    • raccogliere le parole nuove presenti nei tweets ma non nelle risorse lessicali (N_twitter_words(Y)- N_shared_words(X,Y))

eventualmente nuova risorsa su DB

Memorizzare le nuove_parole trovate nei tweet ma assenti nelle risorse fornite (se alla fine del conteggio saranno altamente presenti avremo trovato nuova parole da aggiungere alle risorse o avremo creato una risorsa aggiuntiva!) image

Dove fare Map-Reduce

Bisogna ipotizzare che i dati siano sharded, quindi divisi su più server

  1. Quando si ottengono le statistiche (è un'aggregazione, una reduce)
  2. Per aggregare gli stessi lemmi trovati nei messaggi e contarli

Cosa ho usato del materiale messo a disposizione dalla prof

  • emoticons
  • emoji (ho usato una lib)
  • risorse lessicali EmoSN, sentisense, NRC

Osservazioni su Risorse messaggi Twitter

Tag

USERNAME : indica un username di un utente Twitter.
URL : indica un url.

Altri tag potrei cercarli con uno script python

Osservazioni su Risorse lessicali emozioni

Ricordiamo il modello delle emozioni che dobbiamo considerare nel progetto image

Adesso vediamo invece come sono organizzate le risorse a disposizione:

  • Ogni cartella contiene risorse su una determinata emozione ad eccezione di:

    • _MACOSX inutile
    • ConScore contiene tsv file per associare ad ogni valore uno score
    • Neg e Pos contengono parole rispettivamente Negative e Positive
    • Like-Love sembrerebbe contenere parole di queste due emozioni, comunque in file separati
    • Disgust-Hate come sopra
  • Ci sono 3 tipi di file:

    • EmoSN_<emozione>.txt
    • NRC_<emozione>.txt
    • sentisense_<emozione>.txt
  • Le emozioni presenti sono:

    • Anger
    • Anticipation
    • Disgust
    • Hate
    • Fear
    • Hope
    • Joy
    • Like
    • Love
    • Sadness
    • Surprise
    • Trust

Quelle in grassetto sono le emozioni presenti anche nei file di Twitter messaggi col seguente formato dataset_dt_<emozione.lower()>_60k.txt

Descrizione risorse

image

  • EmoSN: EmoSenticNet includes 13,189 entries for the six Ekman’s emotions of Joy, Sadness, Anger, Fear, Surprise and Disgust. The resource was developed by assigning WordNet Affect emotion labels to SenticNet concepts [Poria et al. 2013; Poria et al. 2014]. The last one is a list of common-sense knowledge concepts with a polarity score [Cambria et al. 2014] referring to the multidisciplinary approach of Sentic Computing [Cambria and Hussain 2015].
  • SS: SentiSense is a concept-based affective lexicon with a wide set of categories developed by Carrillo de Albornoz [Carrillo de Albornoz et al. 2012], including 5,496 words and 2,190 synsets from WordNet, labeled with an emotion from a set of 14 categories.
  • ANEW: The dictionary Affective Norms for English Words includes terms rated from 1 to 9 for each of the three dimensions of Valence, Arousal and Dominance.
  • DAL: The Dictionary of Affective Language developed by Whissell [Whissell 2009] contains words belonging to the dimensions of Pleasantness, Activation and Imagery. The 8,742 terms are rated in a three-point scale.

Osservazioni modello dei dati

Modello dei dati

Modello dei dati

Osservazioni

  • Per operare le generalizzazioni è più facile con MongoDB poichè i documenti si adattano più facilmente alle specializzazioni. In un futuro potrebbero aumentare le specializzazioni e quindi il modello di database a documento risulta più flessibile

Informazioni amministrazione database

MongoDB

username

Admin

password

Admin

url

Atlas

mongodb+srv://admin:[email protected]/

Locale

MySQL

username

root

password

nessuna

url

jdbc:mysql://localhost:3306?serverTimezone=UTC

maadb-project's People

Contributors

marcoscale98 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.