टोकनाइज़िंग और क्लीनिंग

R में Text Analysis परिचय

Maham Faisal Khan

Senior Data Science Content Developer

tidytext का उपयोग

R में Text Analysis परिचय

टोकनाइज़िंग टेक्स्ट

कुछ Natural Language Processing (NLP) शब्दावली:

  • Bag of words: किसी दस्तावेज़ में शब्द एक-दूसरे से स्वतंत्र होते हैं
  • हर अलग टेक्स्ट बॉडी एक दस्तावेज़ है
  • हर यूनिक शब्द एक term है
  • term की हर occurrence एक token है
  • Bag of words बनाना tokenizing कहलाता है
R में Text Analysis परिचय

unnest_tokens() का उपयोग

tidy_review <- review_data %>% 
  unnest_tokens(word, review)

tidy_review
# A tibble: 229,481 x 4
   date    product                    stars word   
   <chr>   <chr>                      <dbl> <chr>  
 1 2/28/15 iRobot Roomba 650 for Pets     5 you    
 2 2/28/15 iRobot Roomba 650 for Pets     5 would  
 3 2/28/15 iRobot Roomba 650 for Pets     5 not    
# … with 229,478 more rows
R में Text Analysis परिचय

शब्द गिनना

tidy_review %>% 
  count(word) %>% 
  arrange(desc(n))
# A tibble: 10,310 x 2
   word      n
   <chr> <int>
 1 the   11785
 2 it     7905
 3 and    6794
# … with 10,307 more rows
R में Text Analysis परिचय

anti_join() का उपयोग

  • हम अपने tidy data frame से stop words हटाना चाहते हैं
  • इसके लिए हम joins का उपयोग करेंगे

R में Text Analysis परिचय

anti_join() का उपयोग

tidy_review2 <- review_data %>% 
  unnest_tokens(word, review) %>% 
  anti_join(stop_words)

tidy_review2
# A tibble: 78,868 x 4
   date     product                    stars word       
   <chr>    <chr>                      <dbl> <chr>      
 1 1/12/15  iRobot Roomba 650 for Pets     4 walk       
 2 1/12/15  iRobot Roomba 650 for Pets     4 rest       
# … with 78,866 more rows
R में Text Analysis परिचय

फिर से शब्द गिनना

tidy_review2 %>% 
  count(word) %>% 
  arrange(desc(n))
# A tibble: 9,672 x 2
   word         n
   <chr>    <int>
 1 roomba    2286
 2 clean     1204
 3 vacuum     989
# … with 9,669 more rows
R में Text Analysis परिचय

अभ्यास करते हैं!

R में Text Analysis परिचय

Preparing Video For Download...