1 Difinições da sessão

#-----------------------------------------------------------------------
# Pacotes.

library(tm)       # Mineração de texto.
library(udpipe)   # Alguns recursos de NLP.
# ls("package:udpipe")

library(text2vec) # Tokenizers, GloVe, LDA, etc.
# ls("package:text2vec")

# Natural Language Processing.
library(NLP) # Tokenizadores, anotadores, etc.
# ls("package:NLP")

library(openNLP)
ls("package:openNLP")
## [1] "Maxent_Chunk_Annotator"      "Maxent_Entity_Annotator"    
## [3] "Maxent_POS_Tag_Annotator"    "Maxent_Sent_Token_Annotator"
## [5] "Maxent_Word_Token_Annotator" "Parse_Annotator"
# TIP: para instalar o pacote treinado para português.
# install.packages("openNLPmodels.pt", repos = "http://datacube.wu.ac.at/")
library(openNLPmodels.pt)

# Informações da sessão.
sessionInfo()
## R version 3.6.1 (2019-07-05)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 16.04.6 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/libblas/libblas.so.3.6.0
## LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
## 
## locale:
##  [1] LC_CTYPE=pt_BR.UTF-8          LC_NUMERIC=C                 
##  [3] LC_TIME=pt_BR.UTF-8           LC_COLLATE=en_US.UTF-8       
##  [5] LC_MONETARY=pt_BR.UTF-8       LC_MESSAGES=en_US.UTF-8      
##  [7] LC_PAPER=pt_BR.UTF-8          LC_NAME=pt_BR.UTF-8          
##  [9] LC_ADDRESS=pt_BR.UTF-8        LC_TELEPHONE=pt_BR.UTF-8     
## [11] LC_MEASUREMENT=pt_BR.UTF-8    LC_IDENTIFICATION=pt_BR.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices datasets  utils     methods   base     
## 
## other attached packages:
## [1] openNLPmodels.pt_1.5-2 openNLP_0.2-7          text2vec_0.5.1        
## [4] udpipe_0.8.3           tm_0.7-6               NLP_0.2-0             
## [7] rmarkdown_1.14         knitr_1.23            
## 
## loaded via a namespace (and not attached):
##  [1] Rcpp_1.0.3           mlapi_0.1.0          xml2_1.2.0          
##  [4] magrittr_1.5         lattice_0.20-38      R6_2.4.0            
##  [7] rlang_0.4.0          foreach_1.4.4        stringr_1.4.0       
## [10] tools_3.6.1          parallel_3.6.1       grid_3.6.1          
## [13] data.table_1.12.2    xfun_0.8             lambda.r_1.2.4      
## [16] futile.logger_1.4.3  iterators_1.0.10     htmltools_0.4.0     
## [19] yaml_2.2.0           RcppParallel_4.4.3   digest_0.6.21       
## [22] Matrix_1.2-17        rJava_0.9-11         openNLPdata_1.5.3-4 
## [25] formatR_1.7          futile.options_1.0.1 codetools_0.2-16    
## [28] evaluate_0.14        slam_0.1-45          stringi_1.4.3       
## [31] compiler_3.6.1

2 Segmentação por sentença

A segmentação ou divisão de cadeias de caracteres pode sentença é útil em diversos contextos. O processo consiste de quebrar uma cadeia de caracteres supostamente contendo várias sentenças nas sentenças constituintes. Isso permite fazer análise de texto com a sentença sendo a unidade documental. Dessa forma, por exemplo, a associação de entidades (pessoas, locais, datas) torna-se mais realista visto que as entidades que tiverem alta associação são porque ocorrem nas mesmas sentenças.

#-----------------------------------------------------------------------
# Segmentação de texto com detecção de sentenças.

# Uma string.
s <- "O Sr. quer mais café? Não. Mas aceito cerveja."
s <- as.String(s)

# Classe e métodos.
class(s)
## [1] "String"
methods(class = "String")
## [1] as.String print     [         *         +        
## see '?methods' for accessing help and source code
# Anotador/delimitador de sentenças.
sent_tk_ann <- Maxent_Sent_Token_Annotator(language = "pt")

# Classe e métodos.
class(sent_tk_ann)
## [1] "Simple_Sent_Token_Annotator" "Annotator"
methods(class = "Annotator")
## [1] as.Annotator_Pipeline as.Span_Tokenizer     as.Token_Tokenizer   
## [4] format                meta<-                meta                 
## [7] print                
## see '?methods' for accessing help and source code
# Delimitando a sentença.
a <- sent_tk_ann(s)
a
##  id type     start end features
##   1 sentence     1  21 
##   2 sentence    23  26 
##   3 sentence    28  46
# Classe, métodos e conteúdo.
class(a)
## [1] "Annotation" "Span"
methods(class = "Annotation")
##  [1] [             [[            $<-           as.Annotation as.data.frame
##  [6] as.list       as.Span       c             duplicated    format       
## [11] length        merge         meta<-        meta          names        
## [16] print         subset        unique       
## see '?methods' for accessing help and source code
# Quebrando o documento em sentenças.
cbind(s[a])
##      [,1]                   
## [1,] "O Sr. quer mais café?"
## [2,] "Não."                 
## [3,] "Mas aceito cerveja."

Infelizmente (ou felizmente, depende do ponto de vista), não existe extrator de entidades nomeadas para o português no pacote openNLPmodels.pt. Para exemplos de uso no idioma inglês, visite Mastering text Mining with R · Entity recognition.

# Isso irá produzir uma mensagem de erro.
entity_ann_person <- Maxent_Entity_Annotator(language = "pt",
                                             kind = "person",
                                             probs = FALSE,
                                             model = NULL)
Error in Maxent_Simple_Entity_Detector(language, kind, probs, model) :
  Could not find model file for language 'pt' and kind 'person'.
Apparently, package 'openNLPmodels.pt' is installed
but does not provide this model.

3 Rotulação de partes do discurso

A rotulação de partes do discurso é muito útil em várias atividades baseadas em texto. É algo que pode ser utilizado para a construção de características. Agrupamento de documentos podem ser feito olhando apenas para os termos que sejam adjetivos, substantivos e verbos, por exemplo. O mesmo pode ser feito para criação de características para a modelagem preditiva de imóveis que pode considerar apenas a ocorrência das classes gramaticais acima mencionadas.

O código mostrado abaixo é uma edição para uso no idioma português do conteúdo disponível em https://tm4ss.github.io/docs/Tutorial_8_NER_POS.html.

3.1 Anotação em um documento

#-----------------------------------------------------------------------
# Rotulação -> determinar as classes gramaticais.

# Anotador/delimitador de palavras.
word_tk_ann <- Maxent_Word_Token_Annotator(language = "pt")
class(word_tk_ann)
## [1] "Simple_Word_Token_Annotator" "Annotator"
# Aplica o anotador sobre o documento.
w <- word_tk_ann(s = s, a = a)
w
##  id type     start end features
##   1 sentence     1  21 constituents=<<integer,6>>
##   2 sentence    23  26 constituents=<<integer,2>>
##   3 sentence    28  46 constituents=<<integer,4>>
##   4 word         1   1 
##   5 word         3   4 
##   6 word         5   5 
##   7 word         7  10 
##   8 word        12  15 
##   9 word        17  21 
##  10 word        23  25 
##  11 word        26  26 
##  12 word        28  30 
##  13 word        32  37 
##  14 word        39  45 
##  15 word        46  46
# Classe e métodos.
class(w)
## [1] "Annotation" "Span"
methods(class = "Span")
##  [1] as.Annotation as.data.frame as.list       as.Span       c            
##  [6] duplicated    format        length        names         Ops          
## [11] print         [             [[            $<-           unique       
## see '?methods' for accessing help and source code
# Quebrando nas sentenças.
cbind(s[w[w$type == "sentence"]])
##      [,1]                   
## [1,] "O Sr. quer mais café?"
## [2,] "Não."                 
## [3,] "Mas aceito cerveja."
# Quebrando nas palavras.
cbind(s[w[w$type == "word"]])
##       [,1]     
##  [1,] "O"      
##  [2,] "Sr"     
##  [3,] "."      
##  [4,] "quer"   
##  [5,] "mais"   
##  [6,] "café?"  
##  [7,] "Não"    
##  [8,] "."      
##  [9,] "Mas"    
## [10,] "aceito" 
## [11,] "cerveja"
## [12,] "."
# Anotador/rotulador de partes do discurso.
pos_tg_ann <- Maxent_POS_Tag_Annotator(language = "pt")
class(pos_tg_ann)
## [1] "Simple_POS_Tag_Annotator" "Annotator"
# Aplica o rotulador (pos tagger).
pos <- pos_tg_ann(s = s, a = w)
pos
##  id type start end features
##   4 word     1   1 POS=art
##   5 word     3   4 POS=prop
##   6 word     5   5 POS=punc
##   7 word     7  10 POS=v-fin
##   8 word    12  15 POS=adv
##   9 word    17  21 POS=n
##  10 word    23  25 POS=adv
##  11 word    26  26 POS=punc
##  12 word    28  30 POS=conj-c
##  13 word    32  37 POS=art
##  14 word    39  45 POS=n
##  15 word    46  46 POS=punc
# Classe e métodos.
class(pos)
## [1] "Annotation" "Span"
methods(class = "Annotation")
##  [1] [             [[            $<-           as.Annotation as.data.frame
##  [6] as.list       as.Span       c             duplicated    format       
## [11] length        merge         meta<-        meta          names        
## [16] print         subset        unique       
## see '?methods' for accessing help and source code
# Cria a tabela com os rótulos.
cbind(token = s[pos], as.data.frame(pos))
##      token id type start end features
## 1        O  4 word     1   1      art
## 2       Sr  5 word     3   4     prop
## 3        .  6 word     5   5     punc
## 4     quer  7 word     7  10    v-fin
## 5     mais  8 word    12  15      adv
## 6    café?  9 word    17  21        n
## 7      Não 10 word    23  25      adv
## 8        . 11 word    26  26     punc
## 9      Mas 12 word    28  30   conj-c
## 10  aceito 13 word    32  37      art
## 11 cerveja 14 word    39  45        n
## 12       . 15 word    46  46     punc

3.2 Anotação de um corpus

# Sequência de operações para fazer o POS tagging.
annotator_pipeline <-
    Annotator_Pipeline(sent_tk_ann,
                       word_tk_ann,
                       pos_tg_ann)
class(annotator_pipeline)
## [1] "Annotator_Pipeline"
# Executa as 3 etapas em sequência na string de exemplo.
annotate(s, annotator_pipeline)
##  id type     start end features
##   1 sentence     1  21 constituents=<<integer,6>>
##   2 sentence    23  26 constituents=<<integer,2>>
##   3 sentence    28  46 constituents=<<integer,4>>
##   4 word         1   1 POS=art
##   5 word         3   4 POS=prop
##   6 word         5   5 POS=punc
##   7 word         7  10 POS=v-fin
##   8 word        12  15 POS=adv
##   9 word        17  21 POS=n
##  10 word        23  25 POS=adv
##  11 word        26  26 POS=punc
##  12 word        28  30 POS=conj-c
##  13 word        32  37 POS=art
##  14 word        39  45 POS=n
##  15 word        46  46 POS=punc
doc <- s
rm(doc)

# Função para fazer em um corpus.
annotateDocuments <- function(doc, pos_filter = NULL) {
    # Documento de classe `String`.
    doc <- as.String(doc)
    # Aplica as anotações.
    doc_with_annotations <- annotate(doc, annotator_pipeline)
    # Filtra para as palavras.
    ann <- subset(doc_with_annotations, type == "word")
    # Tabela com os tokens.
    tokens <- cbind(token = doc[ann], as.data.frame(ann))
    # Filtra se for especificado.
    if (!is.null(pos_filter)) {
        tokens <- subset(tokens, unlist(features) %in% pos_filter)
    }
    return(tokens)
}

# Termos e suas classes gramaticais.
annotateDocuments(doc = s)
##      token id type start end features
## 1        O  4 word     1   1      art
## 2       Sr  5 word     3   4     prop
## 3        .  6 word     5   5     punc
## 4     quer  7 word     7  10    v-fin
## 5     mais  8 word    12  15      adv
## 6    café?  9 word    17  21        n
## 7      Não 10 word    23  25      adv
## 8        . 11 word    26  26     punc
## 9      Mas 12 word    28  30   conj-c
## 10  aceito 13 word    32  37      art
## 11 cerveja 14 word    39  45        n
## 12       . 15 word    46  46     punc
# Só os termos das classes indicadas.
annotateDocuments(doc = s, pos_filter = c("adv", "n", "v-fin"))
##      token id type start end features
## 4     quer  7 word     7  10    v-fin
## 5     mais  8 word    12  15      adv
## 6    café?  9 word    17  21        n
## 7      Não 10 word    23  25      adv
## 11 cerveja 14 word    39  45        n

O pacote udpipe também possui recursos para POS tagging. Comparado com os recursos fornecidos pelo openNLP, o udpipe é bem mais simples de usar. Além disso, contém mais informações sobre os termos classificados como a polaridade negativa.

# Faz aquisição do modelo para pt-BR (baixa na hora).
# browseURL("https://github.com/jwijffels/udpipe.models.ud.2.4")
udp_model <- udpipe_download_model(language = 'portuguese')
## Downloading udpipe model from https://raw.githubusercontent.com/jwijffels/udpipe.models.ud.2.4/master/inst/udpipe-ud-2.4-190531/portuguese-bosque-ud-2.4-190531.udpipe to /home/walmes/Projects/mintex/tutorials/portuguese-bosque-ud-2.4-190531.udpipe
## Visit https://github.com/jwijffels/udpipe.models.ud.2.4 for model license details
str(udp_model)
## 'data.frame':    1 obs. of  5 variables:
##  $ language        : chr "portuguese-bosque"
##  $ file_model      : chr "/home/walmes/Projects/mintex/tutorials/portuguese-bosque-ud-2.4-190531.udpipe"
##  $ url             : chr "https://raw.githubusercontent.com/jwijffels/udpipe.models.ud.2.4/master/inst/udpipe-ud-2.4-190531/portuguese-bo"| __truncated__
##  $ download_failed : logi FALSE
##  $ download_message: chr "OK"
# Carrega o modelo a partir do arquivo `*.uppipe` baixado.
udp_model <- udpipe::udpipe_load_model(file = udp_model$file_model)
class(udp_model)
## [1] "udpipe_model"
# Aplicação das anotações em uma string.
x <- udpipe::udpipe_annotate(udp_model, x = as.character(s))
x <- as.data.frame(x)
x[, c("token", "upos", "feats")]
##      token  upos                                                 feats
## 1        O   DET     Definite=Def|Gender=Masc|Number=Sing|PronType=Art
## 2      Sr.  NOUN                               Gender=Masc|Number=Sing
## 3     quer  VERB Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin
## 4     mais   DET                  Gender=Masc|Number=Sing|PronType=Ind
## 5     café  NOUN                               Gender=Masc|Number=Sing
## 6        ? PUNCT                                                  <NA>
## 7      Não   ADV                                          Polarity=Neg
## 8        . PUNCT                                                  <NA>
## 9      Mas CCONJ                                                  <NA>
## 10  aceito  VERB Mood=Ind|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin
## 11 cerveja  NOUN                                Gender=Fem|Number=Sing
## 12       . PUNCT                                                  <NA>

4 Aplicação nos dados imobiliários

4.1 Importação

#-----------------------------------------------------------------------
# Pacotes.

library(tidyverse)
#-----------------------------------------------------------------------
# Importação.

# Dataset com mais de 70 mil registros!
url <- paste0("http://leg.ufpr.br/~walmes/data",
              "/TCC_Brasil_Neto/ImoveisWeb-Realty.csv")
tb <- read_csv2(url, locale = locale(encoding = "latin1"))
## Using ',' as decimal and '.' as grouping mark. Use read_delim() for more control.
## Parsed with column specification:
## cols(
##   .default = col_double(),
##   url = col_character(),
##   type = col_character(),
##   title = col_character(),
##   description = col_character(),
##   address = col_character(),
##   advertiser = col_character(),
##   CRECI = col_character()
## )
## See spec(...) for full column specifications.
str(tb, give.attr = FALSE, vec.len = 1)
## Classes 'spec_tbl_df', 'tbl_df', 'tbl' and 'data.frame': 71316 obs. of  22 variables:
##  $ id         : num  1 2 ...
##  $ url        : chr  "propriedades/excelente-oportunidade-no-boulevard-iguacu-2-quartos-2937271131.html" ...
##  $ type       : chr  "Apartamento" ...
##  $ title      : chr  "excelente oportunidade no boulevard iguaçu - 2 quartos semi mobiliado novo" ...
##  $ description: chr  "\nDescrição O Boulevard Iguaçu é um empreendimento completíssimo, na charmosa Avenida Iguaçu. Projeto paisagísi"| __truncated__ ...
##  $ address    : chr  "Avenida Iguaçu, Água Verde, Curitiba" ...
##  $ lat        : num  -25.4 ...
##  $ lon        : num  -49.3 ...
##  $ pictures   : num  31 8 ...
##  $ iptu       : num  720 NA ...
##  $ condominium: num  430 NA ...
##  $ usefulArea : num  75 107 ...
##  $ totalArea  : num  95 107 ...
##  $ bedroom    : num  2 3 ...
##  $ suite      : num  1 1 ...
##  $ bathroom   : num  2 1 ...
##  $ garage     : num  2 1 ...
##  $ price      : num  649900 ...
##  $ years      : num  5 NA ...
##  $ publishment: num  2 31 ...
##  $ advertiser : chr  "PRIME SOHO IMÓVEIS P33" ...
##  $ CRECI      : chr  NA ...

4.2 Usando udpipe

#-----------------------------------------------------------------------
# Cria função para determinar a proporção das classes gramaticais por
# documento.

# Aplica no primeiro documento.
s <- head(tb$description, n = 1)
cat(str_wrap(s, width = 72), "\n")
## Descrição O Boulevard Iguaçu é um empreendimento completíssimo, na
## charmosa Avenida Iguaçu. Projeto paisagísitico exclusivo, piscina,
## quadra esportiva, lan house, salao de festas infantil integrado ao
## playground. Brinquedoteca. Salão de festas adulto com integração ao
## espaço gourmet, churrasqueira, ampla área para prática de atividades
## físicas, espaço pet e bistrô. Neste charmoso e completo empreendimento
## você encontrará disponível para venda o belíssimo apartamento 2
## dormitórios, decorado com muito capricho e semi novo, pois foi muito
## pouco usado, além de muito bem cuidado. Semi mobiliado, com armários
## Todeschini nos quartos, cozinha, área de serviço e sala. Decoração
## com papel de parede na sala e quartos, com projeto de iluminação que
## harmoniza o ambiente. Sacada com churrasqueira a carvão. Área de serviço
## e 2 vagas de garagem. Sol da manhã ilumina e aquece o apartamento.
## Próximo ao Colégio Dom Bosco e Marista Paranaense, Restaurantes,
## Supermercados como Casa Fiesta e Angeloni, Agencias bancárias, entre
## outros comércios, além de fácil acesso a linhas de transporte público. 2
## vagas cobertas completa o diferencial deste belo apartamentos 2 quartos.
x <- udpipe::udpipe_annotate(udp_model, x = as.character(s))
x <- as.data.frame(x)
str(x)
## 'data.frame':    222 obs. of  14 variables:
##  $ doc_id       : chr  "doc1" "doc1" "doc1" "doc1" ...
##  $ paragraph_id : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ sentence_id  : int  1 2 2 2 2 2 2 2 2 2 ...
##  $ sentence     : chr  "Descrição" "O Boulevard Iguaçu é um empreendimento completíssimo, na charmosa Avenida Iguaçu." "O Boulevard Iguaçu é um empreendimento completíssimo, na charmosa Avenida Iguaçu." "O Boulevard Iguaçu é um empreendimento completíssimo, na charmosa Avenida Iguaçu." ...
##  $ token_id     : chr  "1" "1" "2" "3" ...
##  $ token        : chr  "Descrição" "O" "Boulevard" "Iguaçu" ...
##  $ lemma        : chr  "descrição" "o" "Boulevard" "Iguaçu" ...
##  $ upos         : chr  "NOUN" "DET" "PROPN" "PROPN" ...
##  $ xpos         : chr  NA NA NA NA ...
##  $ feats        : chr  "Gender=Fem|Number=Sing" "Definite=Def|Gender=Masc|Number=Sing|PronType=Art" "Gender=Masc|Number=Sing" "Number=Sing" ...
##  $ head_token_id: chr  "0" "2" "6" "2" ...
##  $ dep_rel      : chr  "root" "det" "nsubj" "flat:name" ...
##  $ deps         : chr  NA NA NA NA ...
##  $ misc         : chr  "SpacesBefore=\\n" NA NA NA ...
# Determina o lema e a classe gramatical.
x[, c("token", "lemma", "upos")]
##              token          lemma  upos
## 1        Descrição      descrição  NOUN
## 2                O              o   DET
## 3        Boulevard      Boulevard PROPN
## 4           Iguaçu         Iguaçu PROPN
## 5                é            ser   AUX
## 6               um             um   DET
## 7   empreendimento empreendimento  NOUN
## 8    completíssimo       completo   ADJ
## 9                ,              , PUNCT
## 10              na           <NA>  <NA>
## 11              em             em   ADP
## 12               a              o   DET
## 13        charmosa       charmoso  NOUN
## 14         Avenida        avenida PROPN
## 15          Iguaçu         Iguaçu PROPN
## 16               .              . PUNCT
## 17         Projeto        projeto   ADP
## 18   paisagísitico  paisagísitico  NOUN
## 19       exclusivo      exclusivo   ADJ
## 20               ,              , PUNCT
## 21         piscina        piscina  NOUN
## 22               ,              , PUNCT
## 23          quadra         quadra  NOUN
## 24       esportiva      esportivo   ADJ
## 25               ,              , PUNCT
## 26             lan            lan  NOUN
## 27           house          house   ADJ
## 28               ,              , PUNCT
## 29           salao          salao  NOUN
## 30              de             de   ADP
## 31          festas          festa  NOUN
## 32        infantil       infantil   ADJ
## 33       integrado       integrar  VERB
## 34              ao           <NA>  <NA>
## 35               a              a   ADP
## 36               o              o   DET
## 37      playground     playground  NOUN
## 38               .              . PUNCT
## 39   Brinquedoteca  Brinquedoteca PROPN
## 40               .              . PUNCT
## 41           Salão          Salão  NOUN
## 42              de             de   ADP
## 43          festas          festa  NOUN
## 44          adulto         adulto   ADV
## 45             com            com   ADP
## 46      integração     integração  NOUN
## 47              ao           <NA>  <NA>
## 48               a              a   ADP
## 49               o              o   DET
## 50          espaço         espaço  NOUN
## 51         gourmet        gourmet     X
## 52               ,              , PUNCT
## 53   churrasqueira  churrasqueira   ADJ
## 54               ,              , PUNCT
## 55           ampla         amplar  VERB
## 56            área           área  NOUN
## 57            para           para   ADP
## 58         prática        prática  NOUN
## 59              de             de   ADP
## 60      atividades      atividade  NOUN
## 61         físicas         físico   ADJ
## 62               ,              , PUNCT
## 63          espaço         espaço  NOUN
## 64             pet            pet  NOUN
## 65               e              e CCONJ
## 66          bistrô         bistrô  NOUN
## 67               .              . PUNCT
## 68           Neste           <NA>  <NA>
## 69              Em             em   ADP
## 70            este           este   DET
## 71        charmoso       charmoso   ADJ
## 72               e              e CCONJ
## 73        completo       completo   ADJ
## 74  empreendimento empreendimento  NOUN
## 75            você           você  PRON
## 76      encontrará      encontrar  VERB
## 77      disponível     disponível   ADJ
## 78            para           para   ADP
## 79           venda          venda  NOUN
## 80               o              o   DET
## 81       belíssimo      belíssimo   ADJ
## 82     apartamento    apartamento  NOUN
## 83               2              2   NUM
## 84     dormitórios     dormitório  NOUN
## 85               ,              , PUNCT
## 86        decorado        decorar  VERB
## 87             com            com   ADP
## 88           muito          muito   DET
## 89        capricho       capricho  NOUN
## 90               e              e CCONJ
## 91            semi           semi  NOUN
## 92            novo           novo   ADJ
## 93               ,              , PUNCT
## 94            pois           pois SCONJ
## 95             foi            ser   AUX
## 96           muito          muito   ADV
## 97           pouco          pouco  PRON
## 98           usado           usar  VERB
## 99               ,              , PUNCT
## 100           além           além   ADV
## 101             de             de   ADP
## 102          muito          muito  PRON
## 103            bem            bem   ADP
## 104        cuidado        cuidado  NOUN
## 105              .              . PUNCT
## 106           Semi       Semilhão PROPN
## 107      mobiliado      mobiliado  VERB
## 108              ,              , PUNCT
## 109            com            com   ADP
## 110       armários        armário   DET
## 111     Todeschini     Todeschini PROPN
## 112            nos           <NA>  <NA>
## 113             em             em   ADP
## 114             os              o   DET
## 115        quartos         quarto  NOUN
## 116              ,              , PUNCT
## 117        cozinha        cozinha  NOUN
## 118              ,              , PUNCT
## 119           área           área  NOUN
## 120             de             de   ADP
## 121        serviço        serviço  NOUN
## 122              e              e CCONJ
## 123           sala           sala  NOUN
## 124              .              . PUNCT
## 125      Decoração      decoração  NOUN
## 126            com            com   ADP
## 127          papel          papel  NOUN
## 128             de             de   ADP
## 129         parede         parede  NOUN
## 130             na           <NA>  <NA>
## 131             em             em   ADP
## 132              a              o   DET
## 133           sala           sala  NOUN
## 134              e              e CCONJ
## 135        quartos         quarto  NOUN
## 136              ,              , PUNCT
## 137            com            com   ADP
## 138        projeto        projeto  NOUN
## 139             de             de   ADP
## 140     iluminação     iluminação  NOUN
## 141            que            que  PRON
## 142      harmoniza     harmonizar  VERB
## 143              o              o   DET
## 144       ambiente       ambiente  NOUN
## 145              .              . PUNCT
## 146         Sacada          Sacar  VERB
## 147            com            com   ADP
## 148  churrasqueira  churrasqueira  NOUN
## 149              a              o   ADP
## 150         carvão         carvão  NOUN
## 151              .              . PUNCT
## 152           Área           área  NOUN
## 153             de             de   ADP
## 154        serviço        serviço  NOUN
## 155              e              e CCONJ
## 156              2              2   NUM
## 157          vagas           vaga  NOUN
## 158             de             de   ADP
## 159        garagem        garagem  NOUN
## 160              .              . PUNCT
## 161            Sol            sol  NOUN
## 162             da           <NA>  <NA>
## 163             de             de   ADP
## 164              a              o   DET
## 165          manhã          manhã  NOUN
## 166        ilumina       iluminar   ADJ
## 167              e              e CCONJ
## 168         aquece        aquecer  VERB
## 169              o              o   DET
## 170    apartamento    apartamento  NOUN
## 171              .              . PUNCT
## 172        Próximo        próximo   ADV
## 173             ao           <NA>  <NA>
## 174              a              a   ADP
## 175              o              o   DET
## 176        Colégio        Colégio PROPN
## 177            Dom            Dom PROPN
## 178          Bosco          Bosco PROPN
## 179              e              e CCONJ
## 180        Marista        Marista PROPN
## 181     Paranaense     Paranaense PROPN
## 182              ,              , PUNCT
## 183   Restaurantes   restaurantes PROPN
## 184              ,              , PUNCT
## 185  Supermercados  supermercados  VERB
## 186           como           como   ADP
## 187           Casa           Casa PROPN
## 188         Fiesta         Fiesta PROPN
## 189              e              e CCONJ
## 190       Angeloni       Angeloni PROPN
## 191              ,              , PUNCT
## 192       Agencias        Agencia PROPN
## 193      bancárias       bancário PROPN
## 194              ,              , PUNCT
## 195          entre          entre   ADP
## 196         outros          outro   DET
## 197      comércios      comércios  NOUN
## 198              ,              , PUNCT
## 199           além           além   ADV
## 200             de             de   ADP
## 201          fácil          fácil   ADJ
## 202         acesso         acesso  NOUN
## 203              a              o   ADP
## 204         linhas          linha  NOUN
## 205             de             de   ADP
## 206     transporte     transporte  NOUN
## 207        público        público   ADJ
## 208              .              . PUNCT
## 209              2              2   NUM
## 210          vagas           vaga  NOUN
## 211       cobertas         cobrir   ADJ
## 212       completa       completo  VERB
## 213              o              o   DET
## 214    diferencial    diferencial  NOUN
## 215          deste           <NA>  <NA>
## 216             de             de   ADP
## 217           este           este   DET
## 218           belo           belo  NOUN
## 219   apartamentos    apartamento   ADJ
## 220              2              2   NUM
## 221        quartos         quarto  NOUN
## 222              .              . PUNCT
# Converte para tabela de frequência.
as.data.frame(table(x$upos))
##     Var1 Freq
## 1    ADJ   17
## 2    ADP   34
## 3    ADV    5
## 4    AUX    2
## 5  CCONJ    9
## 6    DET   18
## 7   NOUN   57
## 8    NUM    4
## 9   PRON    4
## 10 PROPN   18
## 11 PUNCT   32
## 12 SCONJ    1
## 13  VERB   11
## 14     X    1
# Função para extrair a contagem das classes gramaticais.
getPOStagging_freqs <- function(s) {
    x <- udpipe::udpipe_annotate(udp_model, x = as.character(s))
    pos <- as.data.frame(x)$upos
    as.data.frame(table(pos))
}

#-----------------------------------------------------------------------
# Aplicação em vários documentos.

# Usar amostra para não demorar demais.
tbs <- sample_n(select(tb, description), size = 200)

# Aplicação.
# Essa fase é demorada. Faça com execução paralela.
tbs <- tbs %>%
    mutate(tb_pos = map(description, getPOStagging_freqs)) %>%
    unnest()
## Warning in bind_rows_(x, .id): Unequal factor levels: coercing to character
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
# Tabela de frequência.
tbs %>%
    count(pos, wt = Freq, sort = TRUE) %>%
    mutate(f = 100 * n/sum(n))
## # A tibble: 17 x 3
##    pos       n       f
##    <chr> <int>   <dbl>
##  1 NOUN   6468 24.4   
##  2 PUNCT  5004 18.9   
##  3 ADP    3788 14.3   
##  4 PROPN  2385  8.98  
##  5 DET    1925  7.25  
##  6 VERB   1805  6.80  
##  7 ADJ    1688  6.36  
##  8 NUM    1418  5.34  
##  9 CCONJ   869  3.27  
## 10 ADV     518  1.95  
## 11 AUX     327  1.23  
## 12 PRON    172  0.648 
## 13 SYM      96  0.362 
## 14 X        53  0.200 
## 15 SCONJ    16  0.0603
## 16 PART      7  0.0264
## 17 INTJ      6  0.0226
# Filtrar para as classes relevantes para construção das
# características.
tbs <- tbs %>%
    filter(pos %in% c("NOUN", "VERB", "ADJ")) %>%
    spread(key = "pos", value = "Freq", fill = 0)
tbs[, -1]
## # A tibble: 200 x 3
##      ADJ  NOUN  VERB
##    <dbl> <dbl> <dbl>
##  1     5    26    10
##  2     1     7     2
##  3     6    34    14
##  4    24    63    23
##  5     9    21     6
##  6     8    16     4
##  7    12    39    10
##  8     6    30     7
##  9     3    11     3
## 10     3    11     4
## # … with 190 more rows
biplot(princomp(tbs[, -1], cor = TRUE))

4.3 Usando openNLP

# Anotador/delimitador de sentenças.
sent_tk_ann <- Maxent_Sent_Token_Annotator(language = "pt")

# Anotador/delimitador de palavras.
word_tk_ann <- Maxent_Word_Token_Annotator(language = "pt")

# Anotador/rotulador de partes do discurso.
pos_tg_ann <- Maxent_POS_Tag_Annotator(language = "pt")

# Sequência de operações para fazer o POS tagging.
annotator_pipeline <-
    Annotator_Pipeline(sent_tk_ann,
                       word_tk_ann,
                       pos_tg_ann)

# Função para fazer em um corpus.
getPOStagging_freqs <- function(doc) {
    # Documento de classe `String`.
    doc <- as.String(doc)
    # Aplica as anotações.
    doc_with_annotations <- NLP::annotate(doc, annotator_pipeline)
    # Filtra para as palavras.
    ann <- subset(doc_with_annotations, type == "word")
    # Tabela com os tokens.
    tokens <- cbind(token = doc[ann], as.data.frame(ann))
    tokens$features <- unlist(tokens$features)
    # Eliminar os detalhamentos: v-pcp, v-fin, v-inf, v-ger, etc.
    tokens$features <- sub("-.*$", "", tokens$features)
    return(as.data.frame(table(tokens$features)))
}

# Usar amostra para não demorar demais.
tbs <- sample_n(select(tb, description), size = 200)

# Aplicando em um documento.
getPOStagging_freqs(tb$description[1])
##    Var1 Freq
## 1   adj   20
## 2   adv    9
## 3   art    6
## 4  conj   10
## 5    in    1
## 6     n   53
## 7   num    4
## 8  pron    6
## 9  prop   18
## 10  prp   26
## 11 punc   32
## 12    v   19
# Aplicação.
# Essa fase é demorada. Faça com execução paralela.
tbs <- tbs %>%
    mutate(tb_pos = map(description, getPOStagging_freqs)) %>%
    unnest()
## Warning in bind_rows_(x, .id): Unequal factor levels: coercing to character
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
names(tbs)
## [1] "description" "Var1"        "Freq"
# Tabela de frequência.
tbs %>%
    count(Var1, wt = Freq, sort = TRUE) %>%
    mutate(f = 100 * n/sum(n))
## # A tibble: 13 x 3
##    Var1      n        f
##    <chr> <int>    <dbl>
##  1 n      6356 25.8    
##  2 punc   4784 19.4    
##  3 prp    2999 12.2    
##  4 v      2512 10.2    
##  5 prop   2077  8.43   
##  6 adj    1918  7.79   
##  7 num    1361  5.53   
##  8 conj    860  3.49   
##  9 art     642  2.61   
## 10 pron    578  2.35   
## 11 adv     508  2.06   
## 12 pp       28  0.114  
## 13 in        1  0.00406
# Filtrar para as classes relevantes para construção das
# características.
tbs <- tbs %>%
    filter(Var1 %in% c("n", "v", "adj")) %>%
    spread(key = "Var1", value = "Freq", fill = 0)
tbs[, -1]
## # A tibble: 200 x 3
##      adj     n     v
##    <dbl> <dbl> <dbl>
##  1     8    20     5
##  2     4    25    10
##  3     7    25    11
##  4     4    34     9
##  5    11    24    10
##  6     6    20     3
##  7    18    55    28
##  8    16    61     9
##  9     7    23     5
## 10     5    19     9
## # … with 190 more rows
biplot(princomp(tbs[, -1], cor = TRUE))


#-----------------------------------------------------------------------
# Versões dos pacotes e data do documento.

devtools::session_info()
## ─ Session info ──────────────────────────────────────────────────────────
##  setting  value                       
##  version  R version 3.6.1 (2019-07-05)
##  os       Ubuntu 16.04.6 LTS          
##  system   x86_64, linux-gnu           
##  ui       X11                         
##  language en_US                       
##  collate  en_US.UTF-8                 
##  ctype    pt_BR.UTF-8                 
##  tz       America/Sao_Paulo           
##  date     2019-12-06                  
## 
## ─ Packages ──────────────────────────────────────────────────────────────
##  package          * version date       lib source        
##  assertthat         0.2.1   2019-03-21 [3] CRAN (R 3.6.1)
##  backports          1.1.4   2019-04-10 [3] CRAN (R 3.6.1)
##  broom              0.5.2   2019-04-07 [3] CRAN (R 3.6.1)
##  callr              3.3.1   2019-07-18 [3] CRAN (R 3.6.1)
##  cellranger         1.1.0   2016-07-27 [3] CRAN (R 3.6.1)
##  cli                1.1.0   2019-03-19 [3] CRAN (R 3.6.1)
##  codetools          0.2-16  2018-12-24 [4] CRAN (R 3.5.2)
##  colorspace         1.4-1   2019-03-18 [3] CRAN (R 3.6.1)
##  crayon             1.3.4   2017-09-16 [3] CRAN (R 3.6.1)
##  data.table         1.12.2  2019-04-07 [3] CRAN (R 3.6.1)
##  desc               1.2.0   2018-05-01 [3] CRAN (R 3.6.1)
##  devtools           2.1.0   2019-07-06 [3] CRAN (R 3.6.1)
##  digest             0.6.21  2019-09-20 [3] CRAN (R 3.6.1)
##  dplyr            * 0.8.3   2019-07-04 [3] CRAN (R 3.6.1)
##  evaluate           0.14    2019-05-28 [3] CRAN (R 3.6.1)
##  fansi              0.4.0   2018-10-05 [3] CRAN (R 3.6.1)
##  forcats          * 0.4.0   2019-02-17 [3] CRAN (R 3.6.1)
##  foreach            1.4.4   2017-12-12 [3] CRAN (R 3.6.1)
##  formatR            1.7     2019-06-11 [3] CRAN (R 3.6.1)
##  fs                 1.3.1   2019-05-06 [3] CRAN (R 3.6.1)
##  futile.logger      1.4.3   2016-07-10 [3] CRAN (R 3.6.1)
##  futile.options     1.0.1   2018-04-20 [3] CRAN (R 3.6.1)
##  generics           0.0.2   2018-11-29 [3] CRAN (R 3.6.1)
##  ggplot2          * 3.2.0   2019-06-16 [3] CRAN (R 3.6.1)
##  glue               1.3.1   2019-03-12 [3] CRAN (R 3.6.1)
##  gtable             0.3.0   2019-03-25 [3] CRAN (R 3.6.1)
##  haven              2.1.1   2019-07-04 [3] CRAN (R 3.6.1)
##  hms                0.5.0   2019-07-09 [3] CRAN (R 3.6.1)
##  htmltools          0.4.0   2019-10-04 [3] CRAN (R 3.6.1)
##  httr               1.4.0   2018-12-11 [3] CRAN (R 3.6.1)
##  iterators          1.0.10  2018-07-13 [3] CRAN (R 3.6.1)
##  jsonlite           1.6     2018-12-07 [3] CRAN (R 3.6.1)
##  knitr            * 1.23    2019-05-18 [3] CRAN (R 3.6.1)
##  lambda.r           1.2.4   2019-09-18 [3] CRAN (R 3.6.1)
##  lattice            0.20-38 2018-11-04 [4] CRAN (R 3.5.1)
##  lazyeval           0.2.2   2019-03-15 [3] CRAN (R 3.6.1)
##  lubridate          1.7.4   2018-04-11 [3] CRAN (R 3.6.1)
##  magrittr           1.5     2014-11-22 [3] CRAN (R 3.6.1)
##  Matrix             1.2-17  2019-03-22 [4] CRAN (R 3.6.1)
##  memoise            1.1.0   2017-04-21 [3] CRAN (R 3.6.1)
##  mlapi              0.1.0   2017-12-17 [3] CRAN (R 3.6.1)
##  modelr             0.1.4   2019-02-18 [3] CRAN (R 3.6.1)
##  munsell            0.5.0   2018-06-12 [3] CRAN (R 3.6.1)
##  nlme               3.1-140 2019-05-12 [3] CRAN (R 3.6.1)
##  NLP              * 0.2-0   2018-10-18 [3] CRAN (R 3.6.1)
##  openNLP          * 0.2-7   2019-10-26 [3] CRAN (R 3.6.1)
##  openNLPdata        1.5.3-4 2017-11-12 [3] CRAN (R 3.6.1)
##  openNLPmodels.pt * 1.5-2   2019-11-29 [3] local         
##  pillar             1.4.2   2019-06-29 [3] CRAN (R 3.6.1)
##  pkgbuild           1.0.3   2019-03-20 [3] CRAN (R 3.6.1)
##  pkgconfig          2.0.2   2018-08-16 [3] CRAN (R 3.6.1)
##  pkgload            1.0.2   2018-10-29 [3] CRAN (R 3.6.1)
##  prettyunits        1.0.2   2015-07-13 [3] CRAN (R 3.6.1)
##  processx           3.4.1   2019-07-18 [3] CRAN (R 3.6.1)
##  ps                 1.3.0   2018-12-21 [3] CRAN (R 3.6.1)
##  purrr            * 0.3.2   2019-03-15 [3] CRAN (R 3.6.1)
##  R6                 2.4.0   2019-02-14 [3] CRAN (R 3.6.1)
##  Rcpp               1.0.3   2019-11-08 [3] CRAN (R 3.6.1)
##  RcppParallel       4.4.3   2019-05-22 [3] CRAN (R 3.6.1)
##  readr            * 1.3.1   2018-12-21 [3] CRAN (R 3.6.1)
##  readxl             1.3.1   2019-03-13 [3] CRAN (R 3.6.1)
##  remotes            2.1.0   2019-06-24 [3] CRAN (R 3.6.1)
##  rJava              0.9-11  2019-03-29 [3] CRAN (R 3.6.1)
##  rlang              0.4.0   2019-06-25 [3] CRAN (R 3.6.1)
##  rmarkdown        * 1.14    2019-07-12 [3] CRAN (R 3.6.1)
##  rprojroot          1.3-2   2018-01-03 [3] CRAN (R 3.6.1)
##  rstudioapi         0.10    2019-03-19 [3] CRAN (R 3.6.1)
##  rvest              0.3.4   2019-05-15 [3] CRAN (R 3.6.1)
##  scales             1.0.0   2018-08-09 [3] CRAN (R 3.6.1)
##  sessioninfo        1.1.1   2018-11-05 [3] CRAN (R 3.6.1)
##  slam               0.1-45  2019-02-26 [3] CRAN (R 3.6.1)
##  stringi            1.4.3   2019-03-12 [3] CRAN (R 3.6.1)
##  stringr          * 1.4.0   2019-02-10 [3] CRAN (R 3.6.1)
##  testthat           2.2.0   2019-07-22 [3] CRAN (R 3.6.1)
##  text2vec         * 0.5.1   2018-01-11 [3] CRAN (R 3.6.1)
##  tibble           * 2.1.3   2019-06-06 [3] CRAN (R 3.6.1)
##  tidyr            * 0.8.3   2019-03-01 [3] CRAN (R 3.6.1)
##  tidyselect         0.2.5   2018-10-11 [3] CRAN (R 3.6.1)
##  tidyverse        * 1.2.1   2017-11-14 [3] CRAN (R 3.6.1)
##  tm               * 0.7-6   2018-12-21 [3] CRAN (R 3.6.1)
##  udpipe           * 0.8.3   2019-07-05 [3] CRAN (R 3.6.1)
##  usethis            1.5.1   2019-07-04 [3] CRAN (R 3.6.1)
##  utf8               1.1.4   2018-05-24 [3] CRAN (R 3.6.1)
##  vctrs              0.2.0   2019-07-05 [3] CRAN (R 3.6.1)
##  withr              2.1.2   2018-03-15 [3] CRAN (R 3.6.1)
##  xfun               0.8     2019-06-25 [3] CRAN (R 3.6.1)
##  xml2               1.2.0   2018-01-24 [3] CRAN (R 3.6.1)
##  yaml               2.2.0   2018-07-25 [3] CRAN (R 3.6.1)
##  zeallot            0.1.0   2018-01-28 [3] CRAN (R 3.6.1)
## 
## [1] /home/walmes/R/x86_64-pc-linux-gnu-library/3.6
## [2] /usr/local/lib/R/site-library
## [3] /usr/lib/R/site-library
## [4] /usr/lib/R/library
Sys.time()
## [1] "2019-12-06 18:03:32 -03"