Joshua1808 commited on
Commit
1b4e97e
1 Parent(s): e7fc6e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -40
app.py CHANGED
@@ -26,34 +26,7 @@ access_token_secret = "pqQ5aFSJxzJ2xnI6yhVtNjQO36FOu8DBOH6DtUrPAU54J"
26
  auth = tw.OAuthHandler(consumer_key, consumer_secret)
27
  auth.set_access_token(access_token, access_token_secret)
28
  api = tw.API(auth, wait_on_rate_limit=True)
29
-
30
- def preprocess(text):
31
- #text=text.lower()
32
- # remove hyperlinks
33
- text = re.sub(r'https?:\/\/.*[\r\n]*', '', text)
34
- text = re.sub(r'http?:\/\/.*[\r\n]*', '', text)
35
- #Replace &amp, &lt, &gt with &,<,> respectively
36
- text=text.replace(r'&amp;?',r'and')
37
- text=text.replace(r'&lt;',r'<')
38
- text=text.replace(r'&gt;',r'>')
39
- #remove hashtag sign
40
- #text=re.sub(r"#","",text)
41
- #remove mentions
42
- text = re.sub(r"(?:\@)\w+", '', text)
43
- #text=re.sub(r"@","",text)
44
- #remove non ascii chars
45
- text=text.encode("ascii",errors="ignore").decode()
46
- #remove some puncts (except . ! ?)
47
- text=re.sub(r'[:"#$%&\*+,-/:;<=>@\\^_`{|}~]+','',text)
48
- text=re.sub(r'[!]+','!',text)
49
- text=re.sub(r'[?]+','?',text)
50
- text=re.sub(r'[.]+','.',text)
51
- text=re.sub(r"'","",text)
52
- text=re.sub(r"\(","",text)
53
- text=re.sub(r"\)","",text)
54
- text=" ".join(text.split())
55
- return text
56
-
57
  def limpieza_datos(tweet):
58
  # Eliminar emojis
59
  tweet = re.sub(r'[\U0001F600-\U0001F64F]', '', tweet)
@@ -84,21 +57,21 @@ st.markdown('<style>body{background-color: Blue;}</style>',unsafe_allow_html=Tru
84
 
85
  #colT1,colT2 = st.columns([2,8])
86
 
87
- #st.title('Analisis de comentarios sexistas en Twitter')
88
- st.markdown(""" <style> .font {
89
- font-size:40px ; font-family: 'Cooper Black'; color: #06bf69;}
90
- </style> """, unsafe_allow_html=True)
91
- st.markdown('<p class="font">An谩lisis de comentarios sexistas en Twitter</p>', unsafe_allow_html=True)
92
 
93
- st.markdown(""" <style> .font1 {
94
- font-size:28px ; font-family: 'Times New Roman'; color: #8d33ff;}
95
- </style> """, unsafe_allow_html=True)
96
 
97
- st.markdown(""" <style> .font2 {
98
- font-size:18px ; font-family: 'Times New Roman'; color: #00000;}
99
- </style> """, unsafe_allow_html=True)
100
 
101
- st.markdown('<p class="font2">Este proyecto consiste en una aplicaci贸n web que utiliza la biblioteca Tweepy de Python para descargar tweets de Twitter, permitiendo buscar Tweets por usuario y por localidad. Luego, utiliza modelos de lenguaje basados en Transformers para analizar los tweets y detectar comentarios sexistas. Los resultados se almacenan en un dataframe para su posterior visualizaci贸n y an谩lisis. El objetivo del proyecto es identificar y proporcionar informaci贸n sobre el discurso sexista en l铆nea para combatir la discriminaci贸n y el acoso hacia las mujeres y otros grupos marginados, y as铆 informar pol铆ticas y pr谩cticas que promuevan la igualdad de g茅nero y la inclusi贸n.</p>',unsafe_allow_html=True)
102
 
103
 
104
  def tweets_usuario(usuario, cant_de_tweets):
 
26
  auth = tw.OAuthHandler(consumer_key, consumer_secret)
27
  auth.set_access_token(access_token, access_token_secret)
28
  api = tw.API(auth, wait_on_rate_limit=True)
29
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  def limpieza_datos(tweet):
31
  # Eliminar emojis
32
  tweet = re.sub(r'[\U0001F600-\U0001F64F]', '', tweet)
 
57
 
58
  #colT1,colT2 = st.columns([2,8])
59
 
60
+ #st.title('Analisis de comentarios sexistas en Twitter')
61
+ st.markdown(""" <style> .font {
62
+ font-size:40px ; font-family: 'Cooper Black'; color: #06bf69;}
63
+ </style> """, unsafe_allow_html=True)
64
+ st.markdown('<p class="font">An谩lisis de comentarios sexistas en Twitter</p>', unsafe_allow_html=True)
65
 
66
+ st.markdown(""" <style> .font1 {
67
+ font-size:28px ; font-family: 'Times New Roman'; color: #8d33ff;}
68
+ </style> """, unsafe_allow_html=True)
69
 
70
+ st.markdown(""" <style> .font2 {
71
+ font-size:18px ; font-family: 'Times New Roman'; color: #00000;}
72
+ </style> """, unsafe_allow_html=True)
73
 
74
+ st.markdown('<p class="font2">Este proyecto consiste en una aplicaci贸n web que utiliza la biblioteca Tweepy de Python para descargar tweets de Twitter, permitiendo buscar Tweets por usuario y por localidad. Luego, utiliza modelos de lenguaje basados en Transformers para analizar los tweets y detectar comentarios sexistas. Los resultados se almacenan en un dataframe para su posterior visualizaci贸n y an谩lisis. El objetivo del proyecto es identificar y proporcionar informaci贸n sobre el discurso sexista en l铆nea para combatir la discriminaci贸n y el acoso hacia las mujeres y otros grupos marginados, y as铆 informar pol铆ticas y pr谩cticas que promuevan la igualdad de g茅nero y la inclusi贸n.</p>',unsafe_allow_html=True)
75
 
76
 
77
  def tweets_usuario(usuario, cant_de_tweets):