4.1.3. Most frequent words. Tables and plots
French panel
All the French words ordered by frequency. Two ways.
res.TD.Fr.Before <-TextData(baseFr,var.text=c(1:ncol(baseFr)), stop.word.user=str.Fr.stopworduser,Fmin=1)
res.TD.Fr.Before$indexW
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
Frequency N.Documents boisé 30 8 fruit 28 7 fruité 24 7 tanin 19 8 puissant 17 8 tannique 17 7 mûr 14 7 équilibré 13 6 très 13 6 vin 13 8 bois 12 5 vanillé 11 6 animal 9 5 épice 9 5 nonboisé 9 6 alcool 8 6 bouche 8 7 léger 8 4 long 8 6 souple 8 4 sucrosité 8 6 asséchant 7 4 évent 7 4 fraîcheur 7 5 défaut 6 5 fort 6 6 longueur 6 5 présent 6 5 velouté 6 6 astringent 5 4 charpenté 5 3 plus 5 4 sec 5 4 acétate 4 4 ample 4 3 aspect 4 4 attendre 4 4 beau 4 4 chaleureux 4 4 crayon 4 4 cuit 4 4 degarde 4 4 évolution 4 4 farineux 4 4 fin 4 3 finale 4 3 floral 4 4 fondu 4 4 gras 4 4 mou 4 4 neuf 4 2 noir 4 3 petitegarde 4 4 plat 4 4 réduction 4 4 rond 4 3 taille 4 4 toasté 4 3 vert 4 4 acidulé 3 3 agressif 3 3 caramel 3 3 chair 3 3 dominé 3 2 doux 3 3 épicé 3 3 évolué 3 3 frais 3 3 garrigue 3 2 jeune 3 3 lacté 3 3 nez 3 3 onctueux 3 3 peu 3 3 réglisse 3 3 sécheresse 3 3 végétal 3 3 acide 2 2 acidité 2 2 agréable 2 2 agrume 2 2 amer 2 2 amertume 2 2 bon 2 2 carignan 2 2 carton 2 2 cerise 2 2 complexe 2 2 concentré 2 2 curieux 2 2 cyste 2 2 emy 2 2 équilibre 2 1 étable 2 2 final 2 2 fraîche 2 2 fumée 2 2 généreux 2 2 grenache 2 2 humide 2 2 kirché 2 2 lactique 2 2 limite 2 2 matière 2 2 minéral 2 2 olive 2 2 particulier 2 2 peutannique 2 2 rafle 2 2 résine 2 2 rouge 2 2 sucrée 2 2 vif 2 2 astringence 1 1 cassis 1 1 compoté 1 1 concentration 1 1 confituré 1 1 dur 1 1 encens 1 1 extrême 1 1 gouleyant 1 1 gourmand 1 1 grillé 1 1 manquedefondu 1 1 moins 1 1 mûre 1 1 neutre 1 1 prédominance 1 1 prononcé 1 1 pruneau 1 1 puissance 1 1 râpeux 1 1 structuré 1 1 touche 1 1 trop 1 1 type 1 1 |
summary(res.TD.Fr.Before, ndoc=0, nword=Inf, info=FALSE)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
TextData summary Before After Documents 8.00 8.00 Occurrences 655.00 611.00 Words 149.00 137.00 Mean-length 81.88 76.38 Index of the words Word Frequency N.Documents 1 boisé 30 8 2 fruit 28 7 3 fruité 24 7 4 tanin 19 8 5 puissant 17 8 6 tannique 17 7 7 mûr 14 7 8 équilibré 13 6 9 très 13 6 10 vin 13 8 11 bois 12 5 12 vanillé 11 6 13 animal 9 5 14 épice 9 5 15 nonboisé 9 6 16 alcool 8 6 17 bouche 8 7 18 léger 8 4 19 long 8 6 20 souple 8 4 21 sucrosité 8 6 22 asséchant 7 4 23 évent 7 4 24 fraîcheur 7 5 25 défaut 6 5 26 fort 6 6 27 longueur 6 5 28 présent 6 5 29 velouté 6 6 30 astringent 5 4 31 charpenté 5 3 32 plus 5 4 33 sec 5 4 34 acétate 4 4 35 ample 4 3 36 aspect 4 4 37 attendre 4 4 38 beau 4 4 39 chaleureux 4 4 40 crayon 4 4 41 cuit 4 4 42 degarde 4 4 43 évolution 4 4 44 farineux 4 4 45 fin 4 3 46 finale 4 3 47 floral 4 4 48 fondu 4 4 49 gras 4 4 50 mou 4 4 51 neuf 4 2 52 noir 4 3 53 petitegarde 4 4 54 plat 4 4 55 réduction 4 4 56 rond 4 3 57 taille 4 4 58 toasté 4 3 59 vert 4 4 60 acidulé 3 3 61 agressif 3 3 62 caramel 3 3 63 chair 3 3 64 dominé 3 2 65 doux 3 3 66 épicé 3 3 67 évolué 3 3 68 frais 3 3 69 garrigue 3 2 70 jeune 3 3 71 lacté 3 3 72 nez 3 3 73 onctueux 3 3 74 peu 3 3 75 réglisse 3 3 76 sécheresse 3 3 77 végétal 3 3 78 acide 2 2 79 acidité 2 2 80 agréable 2 2 81 agrume 2 2 82 amer 2 2 83 amertume 2 2 84 bon 2 2 85 carignan 2 2 86 carton 2 2 87 cerise 2 2 88 complexe 2 2 89 concentré 2 2 90 curieux 2 2 91 cyste 2 2 92 emy 2 2 93 équilibre 2 1 94 étable 2 2 95 final 2 2 96 fraîche 2 2 97 fumée 2 2 98 généreux 2 2 99 grenache 2 2 100 humide 2 2 101 kirché 2 2 102 lactique 2 2 103 limite 2 2 104 matière 2 2 105 minéral 2 2 106 olive 2 2 107 particulier 2 2 108 peutannique 2 2 109 rafle 2 2 110 résine 2 2 111 rouge 2 2 112 sucrée 2 2 113 vif 2 2 114 astringence 1 1 115 cassis 1 1 116 compoté 1 1 117 concentration 1 1 118 confituré 1 1 119 dur 1 1 120 encens 1 1 121 extrême 1 1 122 gouleyant 1 1 123 gourmand 1 1 124 grillé 1 1 125 manquedefondu 1 1 126 moins 1 1 127 mûre 1 1 128 neutre 1 1 129 prédominance 1 1 130 prononcé 1 1 131 pruneau 1 1 132 puissance 1 1 133 râpeux 1 1 134 structuré 1 1 135 touche 1 1 136 trop 1 1 137 type 1 1 |
Static ggplot barchart with frequency of words before stopwords
plot(res.TD.Fr.Before, nword=15, sel="word", col.fill="#CC0000", interact=FALSE,
title="Most frequent French words")
Interactive (plotly) barchart with frequency of words, % of the word before and after stopwords:
plot(res.TD.Fr.Before, nword=15, sel="word", col.fill="#CC0000", interact=TRUE, title="Most frequent French words")
To translate the name of 15 most frequent Frech words.
- Building a copy of res.TD.Fr.Before object and creating a vector (original.Fr) with the 15 most frequent French words.
res.Fr.Trans <- res.TD.Fr.Before
original.Fr <- rownames(res.TD.Fr.Before$indexW[1:15,])
cat(original.Fr)
1 |
boisé fruit fruité tanin puissant tannique mûr équilibré très vin bois vanillé animal épice nonboisé |
- Creating a vector translation.Fr with the words in English with the same order than original.Fr
translation.Fr <- c("boisé (woody)", "fruit (fruit)", "fruité (fruity)", "tanin (tannin)", "puissant (powerful)", "tannique (tannic)", "mûr (mature/ripe)", "équilibré (balanced)", "très (very)", "vin (wine)", "bois (wood)", "vanillé (vanillin)", "animal (animal)","épice (spicy)", "nonboisé (unwooded)")
- Creating a data frame with the original words and translation:
df.Fr15Change <- data.frame(original.Fr, translation.Fr)
df.Fr15Change
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
original.Fr translation.Fr 1 boisé boisé (woody) 2 fruit fruit (fruit) 3 fruité fruité (fruity) 4 tanin tanin (tannin) 5 puissant puissant (powerful) 6 tannique tannique (tannic) 7 mûr mûr (mature/ripe) 8 équilibré équilibré (balanced) 9 très très (very) 10 vin vin (wine) 11 bois bois (wood) 12 vanillé vanillé (vanillin) 13 animal animal (animal) 14 épice épice (spicy) 15 nonboisé nonboisé (unwooded) |
- To change French DocTerm object (only for the 15 most frequent words)
res.Fr.Trans$DocTerm$dimnames$Terms[match(df.Fr15Change$original.Fr , res.Fr.Trans$DocTerm$dimnames$Terms)] <- df.Fr15Change$translation.Fr
- To change indexW with the frequencies (only for the 15 most frequent words)
rownames(res.Fr.Trans$indexW)[match(df.Fr15Change$original.Fr , rownames(res.Fr.Trans$indexW))] <- df.Fr15Change$translation.Fr
res.Fr.Trans$indexW[1:15,]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Frequency N.Documents boisé (woody) 30 8 fruit (fruit) 28 7 fruité (fruity) 24 7 tanin (tannin) 19 8 puissant (powerful) 17 8 tannique (tannic) 17 7 mûr (mature/ripe) 14 7 équilibré (balanced) 13 6 très (very) 13 6 vin (wine) 13 8 bois (wood) 12 5 vanillé (vanillin) 11 6 animal (animal) 9 5 épice (spicy) 9 5 nonboisé (unwooded) 9 6 |
- Other way to check changes
summary(res.Fr.Trans, ndoc=0, nword=15, info=FALSE)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
TextData summary Before After Documents 8.00 8.00 Occurrences 655.00 611.00 Words 149.00 137.00 Mean-length 81.88 76.38 Index of the 15 most frequent words Word Frequency N.Documents 1 boisé (woody) 30 8 2 fruit (fruit) 28 7 3 fruité (fruity) 24 7 4 tanin (tannin) 19 8 5 puissant (powerful) 17 8 6 tannique (tannic) 17 7 7 mûr (mature/ripe) 14 7 8 équilibré (balanced) 13 6 9 très (very) 13 6 10 vin (wine) 13 8 11 bois (wood) 12 5 12 vanillé (vanillin) 11 6 13 animal (animal) 9 5 14 épice (spicy) 9 5 15 nonboisé (unwooded) 9 6 |
- Building a dataframe with the frequency of French words. Two ways:
df.FrW <- data.frame(res.Fr.Trans$indexW[1:15,]) df.FrW <- data.frame(rownames(df.FrW), df.FrW) df.FrW
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
rownames.df.FrW. Frequency N.Documents boisé (woody) boisé (woody) 30 8 fruit (fruit) fruit (fruit) 28 7 fruité (fruity) fruité (fruity) 24 7 tanin (tannin) tanin (tannin) 19 8 puissant (powerful) puissant (powerful) 17 8 tannique (tannic) tannique (tannic) 17 7 mûr (mature/ripe) mûr (mature/ripe) 14 7 équilibré (balanced) équilibré (balanced) 13 6 très (very) très (very) 13 6 vin (wine) vin (wine) 13 8 bois (wood) bois (wood) 12 5 vanillé (vanillin) vanillé (vanillin) 11 6 animal (animal) animal (animal) 9 5 épice (spicy) épice (spicy) 9 5 nonboisé (unwooded) nonboisé (unwooded) 9 6 |
- Building the table
row.names(df.FrW) <- NULL colnames(df.FrW) <- c("Words", "Count", "No.docs") df.FrW
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Words Count No.docs 1 boisé (woody) 30 8 2 fruit (fruit) 28 7 3 fruité (fruity) 24 7 4 tanin (tannin) 19 8 5 puissant (powerful) 17 8 6 tannique (tannic) 17 7 7 mûr (mature/ripe) 14 7 8 équilibré (balanced) 13 6 9 très (very) 13 6 10 vin (wine) 13 8 11 bois (wood) 12 5 12 vanillé (vanillin) 11 6 13 animal (animal) 9 5 14 épice (spicy) 9 5 15 nonboisé (unwooded) 9 6 |
Table 2.a. Most frequent French words