Caso não tenhas as bibliotecas utilizadas pode ser utilizado o comando abaixo:
#install.packages("NOMEDOPACOTE")
library("tm")
## Loading required package: NLP
library("wordcloud")
## Loading required package: RColorBrewer
library("readr")
library("RColorBrewer")
documentario <- read_lines("./documentario.txt")
document <- paste(documentario, collapse = " ")
corpus <- VCorpus(VectorSource(document))
corpus <- tm_map(corpus, content_transformer(tolower))
corpus <- tm_map(corpus, content_transformer(removePunctuation))
corpus <- tm_map(corpus, content_transformer(removeNumbers))
corpus <- tm_map(corpus, content_transformer(stripWhitespace))
corpus <- tm_map(corpus, content_transformer(removeWords), stopwords('portuguese'))
tdm <- as.matrix(TermDocumentMatrix((corpus)))
fre <- sort(rowSums(tdm), decreasing = T)
library("tm")
library("wordcloud")
library("readr")
library("RColorBrewer")
library("twitteR")
library("syuzhet")
De posse das chaves da API do Twitter (https://developer.twitter.com/apps), executar o comando abaixo:
setup_twitter_oauth(consumer_key, consumer_secret, access_token, access_secret)
## [1] "Using direct authentication"
Buscando os 500 twitters com a hashtag “BlackLiveMatters”:
tweets <- searchTwitter("#BlackLiveMatters", n=500, lang = "en")
## Warning in doRppAPICall("search/tweets", n, params = params, retryOnRateLimit =
## retryOnRateLimit, : 500 tweets were requested but the API can only return 387
tweets<- twListToDF(tweets)
tweets_t <- paste(tweets$text,collapse= " ")
Criando o curpus à partir dos tweets:
corpus <- VCorpus(VectorSource(tweets_t))
corpus <- tm_map(corpus, content_transformer(tolower))
#Remove pontuação
corpus <- tm_map(corpus, content_transformer(removePunctuation))
#Remove espaços extras em branco
corpus <- tm_map(corpus, content_transformer(stripWhitespace))
#Remove palavras ruído
corpus <- tm_map(corpus, content_transformer(removeWords), stopwords("en"))
# removeURLs
removeURL <- function(x)gsub("http[^[:space:]]*", "",x)> corpus <-tm_map(corpus,removeURL)
# remove qualquer coisa que não seja letras em português e espaço.
removeNumPunct <- function(x)gsub("[^[:alpha:][:space:]]*", "",x)
corpus <-tm_map(corpus,content_transformer(removeNumPunct))
dtm<-TermDocumentMatrix(corpus)
dtm<- as.matrix(dtm)
frq <-sort(rowSums(dtm), decreasing = T)
## Warning in wordcloud(corpus, min.freq = 1, max.words = 60, random.order =
## FALSE, : blacklivematters could not be fit on page. It will not be plotted.
Usando a biblioteca: syuzhet para análise de sentimentos:
tweets <- searchTwitter("#BlackLiveMatters", n=500, lang = "en")
## Warning in doRppAPICall("search/tweets", n, params = params, retryOnRateLimit =
## retryOnRateLimit, : 500 tweets were requested but the API can only return 387
tweets <- twListToDF(tweets)
tweets <- tweets$text
sent <-get_nrc_sentiment(tweets)
## Warning: `filter_()` is deprecated as of dplyr 0.7.0.
## Please use `filter()` instead.
## See vignette('programming') for more help
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.
## Warning: `group_by_()` is deprecated as of dplyr 0.7.0.
## Please use `group_by()` instead.
## See vignette('programming') for more help
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.
## Warning: `data_frame()` is deprecated as of tibble 1.1.0.
## Please use `tibble()` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.
Plotando os dados em um gráfico
barplot(colSums(sent), las=2, col=rainbow(10), ylab ="Quantidade", main= "pontuação dos sentimentos para os twittes de Black Lives Matter")
Matrizes \[\begin{equation} \label{eqn:queda_tensao_terminal_g_gl} \left[ {\begin{array}{*{20}{c}} {\begin{array}{*{20}{c}} {{V_{ag}} - {V_{a'g'}}} \\ {{V_{bg}} - {V_{b'g'}}} \\ {{V_{cg}} - {V_{c'g'}}} \end{array}} \\ {\begin{array}{*{20}{c}} {{V_{1g}} - {V_{1'g'}}} \\ {{V_{2g}} - {V_{2'g'}}} \\ {{V_{3g}} - {V_{3'g'}}} \end{array}} \end{array}} \right] = \left[ {\begin{array}{*{20}{c}} {\begin{array}{*{20}{c}} {{z_{aa}}}&{{z_{ab}}}&{{z_{ac}}} \\ {{z_{ab}}}&{{z_{bb}}}&{{z_{bc}}} \\ {{z_{ac}}}&{{z_{bc}}}&{{z_{cc}}} \end{array}}&{\begin{array}{*{20}{c}} {{z_{a1}}}&{{z_{a2}}}&{{z_{a3}}} \\ {{z_{b1}}}&{{z_{b2}}}&{{z_{b3}}} \\ {{z_{c1}}}&{{z_{c2}}}&{{z_{c3}}} \end{array}} \\ {\begin{array}{*{20}{c}} {{z_{a1}}}&{{z_{b1}}}&{{z_{c1}}} \\ {{z_{a2}}}&{{z_{b2}}}&{{z_{c2}}} \\ {{z_{a3}}}&{{z_{b3}}}&{{z_{c3}}} \end{array}}&{\begin{array}{*{20}{c}} {{z_{11}}}&{{z_{12}}}&{{z_{13}}} \\ {{z_{21}}}&{{z_{22}}}&{{z_{23}}} \\ {{z_{31}}}&{{z_{32}}}&{{z_{33}}} \end{array}} \end{array}} \right]\left[ {\begin{array}{*{20}{c}} {\begin{array}{*{20}{c}} {{I_a}} \\ {{I_b}} \\ {{I_c}} \end{array}} \\ {\begin{array}{*{20}{c}} {{I_1}} \\ {{I_2}} \\ {{I_3}} \end{array}} \end{array}} \right] \end{equation}\]
Pode-se montar frações, tais como: \({1\over z}\), \({1\over\displaystyle 1+{1\over x}}\)
_ usar letras gregas: \(\alpha\), \(\beta\), \(\gamma\), \(\Gamma\), \(\varphi\)
Image: Pdusit - stock.adobe.com
alt text here
Talavera et al. (2017)
Blah blah (GUERRERO-IBAÑEZ et al. 2017)
(Giorgetti et al. 2016)
(Ray 2017)
Chen and Jin (2012) diz…
Chen, Xian-Yi, and Zhi-Gang Jin. 2012. “Research on Key Technology and Applications for Internet of Things.” Physics Procedia 33: 561–66. https://doi.org/10.1016/j.phpro.2012.05.104.
Giorgetti, Andrea, Matteo Lucchi, Emanuele Tavelli, Marco Barla, Giovanni Gigli, Nicola Casagli, Marco Chiani, and Davide Dardari. 2016. “A Robust Wireless Sensor Network for Landslide Risk Analysis: System Design, Deployment, and Field Testing.” IEEE Sensors Journal 16 (16): 6374–86. https://doi.org/10.1109/jsen.2016.2579263.
GUERRERO-IBAÑEZ, Juan A., Fermín P. ESTRADA-GONZALEZ, Miguel A. MEDINA-TEJEDA, Ma. G. RIVERA-GUTIERREZ, Juan M. ALCARAZ-AGUIRRE, Celso A. MALDONADO-MENDOZA, David TOLEDO-ZUÑIGA, and Victor I. LOPEZ-GONZALEZ. 2017. “SGReenH-IOT: PLataforma IOT Para AGricultura de Precisión.” SISTEMAS, CIBERNÉTICA E INFORMÁTICA 14 (2).
Ray, Partha Pratim. 2017. “Internet of Things for Smart Agriculture: Technologies, Practices and Future Direction.” Journal of Ambient Intelligence and Smart Environments 9 (4): 395–420. https://doi.org/10.3233/AIS-170440.
Talavera, Jesús Martı́n, Luis Eduardo Tobón, Jairo Alejandro Gómez, Marı́a Alejandra Culman, Juan Manuel Aranda, Diana Teresa Parra, Luis Alfredo Quiroz, Adolfo Hoyos, and Luis Ernesto Garreta. 2017. “Review of IoT Applications in Agro-Industrial and Environmental Fields.” Computers and Electronics in Agriculture 142 (November): 283–97. https://doi.org/10.1016/j.compag.2017.09.015.