2016-12-07 5 views
1

テキストと、同じテキストから抽出された頻度(頻度> 200に基づいて抽出された)との間の相関分析を試みています。テキストから抽出されたテキストと特定の単語との間のCorelationsを見つける

私はRを使ってどのように行うことができますか分かりません。ここで

は【選択メインデータはRのレベルとして(デフォルトでは)私がしようとしています

head(label) 
[1] "2016" "action" "activis" "actual" "alreadi" "also" 

清掃テキストコーパスから分析

head(data) 
[1] Call of star wars a halos destiny              
[2] I thought of an new call of duty name CALL OF DUTY: The road of ARK GIANT    
[3] Activation must be destroyed for the sake of video games. Boycott those pieces of shits. 
[4] Futuristic˜                   
[5] 1:09 is that the XM 53  

いくつかのキーワードをコード化されたデータの抜粋ですどのように単語がテキストに含まれているかを調べる相関マトリックスを達成し、最後にその相関マトリックスを使用してコミュニティを検出するためのネットワークグラフを作成する

しかし、my aiこの時点で、mは、すべてのデータテキストに同様

           star destroyed duty 
Call of star wars a halo destiny     1  0  0 
Activation must be destroyed for the sake .... 0  1  0 
I thought of new call of duty star    1  0  1 

以下のようなテーブルやマトリックスを作成することである[13281行の合計]、ラベル[202個の単語の合計)

+0

実際に何を達成しようとしているのかについて詳細をご記入ください。データシートのラベルの存在(1)または不在(0)すでに何をしているのですか? – figurine

+0

ちょっとした置物に、私は投稿を編集して、自分の出力をRで見たいのスクリーンショットを貼り付けました。見てください –

答えて

0

そのあなたと仮定すると

data <- c('Call of star wars a halo destiny', 
     'I thought of an new call of duty star', 
     'Activation must be destroyed for the sake .... ', 
     'Futuristic˜', 
     '1:09 is that the XM 53') 
label <- c("2016","action","activis","actual", "alreadi","also", "star", "destroyed", "duty") 

vgrepl <- Vectorize(grepl, 'pattern', SIMPLIFY = TRUE) 
df <- +(vgrepl(tolower(label), tolower(data))) # case insensitive 
rownames(df) <- data 

df 

               2016 action activis actual alreadi also star destroyed duty 
Call of star wars a halo destiny     0  0  0  0  0 0 1   0 0 
I thought of an new call of duty star    0  0  0  0  0 0 1   0 1 
Activation must be destroyed for the sake ....  0  0  0  0  0 0 0   1 0 
Futuristic˜          0  0  0  0  0 0 0   0 0 
1:09 is that the XM 53        0  0  0  0  0 0 0   0 0 
関連する問題