Diğer kelime bulutları ve kelime ağları

R ile Bag-of-Words ile Metin Madenciliği

Ted Kwartler

Instructor

Ortaklık bulutları

 

ortaklık.png

R ile Bag-of-Words ile Metin Madenciliği

Ortaklık bulutları

# Her iki derlemeyi birleştirin: all_tweets
all_coffee <- paste(coffee_tweets$text,
                    collapse = "")
all_chardonnay <- paste(chardonnay_tweets$text,
                        collapse = "")

all_tweets <- c(all_coffee, all_chardonnay)
# all_tweets verisini temizleyin all_tweets <- VectorSource(all_tweets) all_corpus <- VCorpus(all_tweets) all_clean <- clean_corpus(all_corpus) all_dm <- TermDocumentMatrix(all_clean) all_m <- as.matrix(all_tdm)
# Ortaklık bulutu oluşturun commonality.cloud(all_m, colors = "steelblue1", max.words = 100)

ortaklık_bulutu.png

R ile Bag-of-Words ile Metin Madenciliği

Karşılaştırma bulutları

 

karşılaştırma.png

R ile Bag-of-Words ile Metin Madenciliği

Karşılaştırma bulutları

# Her iki derlemeyi birleştirin: all_tweets
all_coffee <- paste(coffee_tweets$text, 
                    collapse = "")
all_chardonnay <- paste(chardonnay_tweets$text, 
                       collapse = "")
all_tweets <- c(all_coffee, all_chardonnay)

# all_tweets verisini temizleyin all_tweets <- VectorSource(all_tweets) all_corpus <- VCorpus(all_tweets) all_clean <- clean_corpus(all_corpus) all_tdm <- TermDocumentMatrix(all_clean)
colnames(all_tdm) <- c("coffee", "chardonnay")
all_m <- as.matrix(all_tdm) # Karşılaştırma bulutu oluşturun comparison.cloud(all_m, colors = c("orange", "blue"), max.words = 50)

karşılaştırma bulutu

R ile Bag-of-Words ile Metin Madenciliği

Piramit grafikler

# Her iki belgede ortak terimleri belirleyin
common_words <- subset(
  all_tdm_m,
  all_tdm_m[, 1] > 0 & all_tdm_m[, 2] > 0
)

# En yaygın ortak kelimeleri bulun difference <- abs(common_words[, 1] - common_words[, 2])
common_words <- cbind(common_words, difference) common_words <- common_words[order(common_words[, 3], decreasing = TRUE), ] top25_df <- data.frame(x = common_words[1:25, 1], y = common_words[1:25, 2], labels = rownames(common_words[1:25, ]))
R ile Bag-of-Words ile Metin Madenciliği

Piramit grafikler

# Piramit grafiği oluşturun
pyramid.plot(top25_df$x, top25_df$y, 
             labels = top25_df$labels, 
             main = "Words in Common",
             gap = 8, laxly = NULL, 
             raxlab = NULL, unit = NULL,
             top.labels = c("Chardonnay", 
                            "Words", 
                            "Coffee")
)

piramit_grafik.png

R ile Bag-of-Words ile Metin Madenciliği

Kelime ağları

# Kelime ağı oluşturun
word_associate(coffee_tweets$text,
    match.string = c("barista"), 
    stopwords = c(Top200Words, "coffee", "amp"), 
    network.plot = TRUE, 
    cloud.colors = c("gray85", "darkred"))

# Başlık ekleyin
title(main = "Barista Coffee Tweet Associations")

kelime_ağı.png

R ile Bag-of-Words ile Metin Madenciliği

Hadi pratik yapalım!

R ile Bag-of-Words ile Metin Madenciliği

Preparing Video For Download...