> bi_grams_c
# A tibble: 33,421 x 2
   bigram                n
   <chr>             <int>
 1 sir thomas          287
 2 miss crawford       215
 3 captain wentworth   170
 4 miss woodhouse      162
 5 frank churchill     132
 6 lady russell        118
 7 lady bertram        114
 8 sir walter          113
 9 miss fairfax        109
10 colonel brandon     108
# ... with 33,411 more rows
> u_bigrams <- bi_swrem %>%
+ unite (bigram, first_part, sec_part, sep = " ")
> u_bigrams
# A tibble: 44,784 x 2
   book                bigram                  
   <fct>               <chr>                   
 1 Sense & Sensibility jane austen             
 2 Sense & Sensibility austen 1811             
 3 Sense & Sensibility 1811 chapter            
 4 Sense & Sensibility chapter 1               
 5 Sense & Sensibility norland park            
 6 Sense & Sensibility surrounding acquaintance
 7 Sense & Sensibility late owner              
 8 Sense & Sensibility advanced age            
 9 Sense & Sensibility constant companion      
10 Sense & Sensibility happened ten            
# ... with 44,774 more rows
> bigram_tfidf <- u_bigrams %>%
+ count (book, bigram)%>%
+ bind_tf_idf (bigram, book, n)%>%
+ arrange (desc(tf_idf))
> bigram_tfidf
# A tibble: 36,217 x 6
   book                bigram                n     tf   idf tf_idf
   <fct>               <chr>             <int>  <dbl> <dbl>  <dbl>
 1 Persuasion          captain wentworth   170 0.0299  1.79 0.0535
 2 Mansfield Park      sir thomas          287 0.0287  1.79 0.0515
 3 Mansfield Park      miss crawford       215 0.0215  1.79 0.0386
 4 Persuasion          lady russell        118 0.0207  1.79 0.0371
 5 Persuasion          sir walter          113 0.0198  1.79 0.0356
 6 Emma                miss woodhouse      162 0.0170  1.79 0.0305
 7 Northanger Abbey    miss tilney          82 0.0159  1.79 0.0286
 8 Sense & Sensibility colonel brandon     108 0.0150  1.79 0.0269
 9 Emma                frank churchill     132 0.0139  1.79 0.0248
10 Pride & Prejudice   lady catherine      100 0.0138  1.79 0.0247
# ... with 36,207 more rows
> 
