2016-07-20 18 views
0

コーパスから作成したストップワードのリストを削除しようとしています。私はストップワードリストからすべての特殊文字を削除し、コーパス上のテキストクリーニングを完了したので何が起こっているのか分かりません。どんな助けでも大歓迎です。コードとエラーメッセージは以下のとおりです。ユーザー定義の単語を停止すると、CSVは以下のとおりです:GSUBで Stop Wordstmパッケージを使用してストップワードを削除する(Gsubエラー)

myCorpus <- Corpus(VectorSource(c("blank", "blank", "blank", "blank", "blank", "blank", "blank", 
"blank", "blank", "blank", "blank", "blank", "blank", "<br />Key skills:<br />Octopus Deploy, MS Build, PowerShell, Azure, NuGet, CI/CD concepts, release management<br /><br /> * Minimum 5 years plus relevant experience in Application Development lifecycle, Automation and Release and Configuration Management<br /> * Considerable experience in the following disciplines - TFS (Team Foundation Server), DevOps, Continuous Delivery, Release Engineering, Application Architect, Database Architect, Information Modeling, Service Oriented Architecture (SOA), Quality Assurance, Branch Management, Network setup and troubleshooting, Server setup, configuration, maintenance and patching<br /> * Solid understanding of Software Development Life Cycle, Test Driven Development, Continuous Integration and Continuous Delivery<br /> * Solid understanding and experience working with high availability and high performance, multi-data center systems and hybrid cloud environments.<br /> * Proficient with Agile methodologies and working closely within small teams and vendors<br /> * Knowledge of Deployment and configuration automation platforms<br /> * Extensive PowerShell experience<br /> * Extensive knowledge of Windows based systems including hardware, software and .NET applications<br /> * Strong ability to troubleshoot complex issues ranging from system resources to application stack traces<br /><br />REQUIRED SKILLS:<br />Bachelor's degree & 5-10 years of relevant work experience.", 
    "blank"))) 

for (j in seq(myCorpus)) { 
    myCorpus[[j]] <- gsub("<.*>", " ", myCorpus[[j]]) 
    myCorpus[[j]] <- gsub("\\b[[:alnum:]]{20,}\\b", " ", myCorpus[[j]], perl=T) 
    myCorpus[[j]] <- gsub("[[:punct:]]", " ", myCorpus[[j]]) 
} 

#Clean Corpus 
myCorpus <- tm_map(myCorpus, PlainTextDocument) 
myCorpus <- tm_map(myCorpus, content_transformer(tolower)) 
myCorpus <- tm_map(myCorpus, removePunctuation) 
myCorpus <- tm_map(myCorpus, removeNumbers) 
myCorpus <- tm_map(myCorpus, stripWhitespace) 

#User defined stop word 
manualStopwords <- read.csv("r_stop.csv", header = TRUE) 
myStopwords <- paste(manualStopwords[,1]) 
myStopwords <- str_replace_all(myStopwords, "[[:punct:]]", "") 
myStopwords <- gsub("\\+", "plus", myStopwords) 
myStopwords <- gsub("\\$", "dollars", myStopwords) 

myCorpus <- tm_map(myCorpus, removeWords, myStopwords) 

最初のエラー

エラー(はsprintf( "(* UCP)\ bの(%sの)B \ 」、ペースト(ソート(言葉、= TRUEの減少)、: 無効な正規表現「(* UCP)\ bの(ツィンマーマン|歳|年|ホードは| .....ストップワード

の残りの部分

追加のエラーに加えて

:メッセージ警告:GSUBで を(はsprintf( "(* UCP)\ bの(%s)は\ bの"、ペースト(ソート(言葉、= TRUEの減少)、: PCREのパターンコンパイルエラー 「正規表現は大きすぎる」

+1

他の人があなたを助けることができるように、[再現性の例](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)を提供してください。 –

+0

私が持っているストップワードのリストは約4000ワードですが、問題が発生している場所だと思います。私はキーが追加のエラーにあると思う。 ''はgsubを投げ捨てているようだ。ここにデータセット全体を掲載することはできません。 – Stewpants

+0

@Stewpantsエラーの原因となっているプロセスの部分を絞り込み、再現可能なデータを使用して再現可能な例を作成することができます。 –

答えて

1

「」で私は小さいバケットに私のストップワードを破ることができたとコードが走りました。メモリに問題があった可能性があります。

chunk <- 500 
n <- length(myStopwords) 
r <- rep(1:ceiling(n/chunk),each=chunk)[1:n] 
d <- split(myStopwords,r) 

for (i in 1:length(d)) { 
    myCorpus <- tm_map(myCorpus, removeWords, c(paste(d[[i]]))) 
} 
関連する問題