R text file and text mining…how to load data

后端 未结 6 1091
星月不相逢
星月不相逢 2020-12-13 10:51

I am using the R package tm and I want to do some text mining. This is one document and is treated as a bag of words.

I don\'t understand the documenta

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-13 11:19

    I actually found this quite tricky to begin with, so here's a more comprehensive explanation.

    First, you need to set up a source for your text documents. I found that the easiest way (especially if you plan on adding more documents, is to create a directory source that will read all of your files in.

    source <- DirSource("yourdirectoryname/") #input path for documents
    YourCorpus <- Corpus(source, readerControl=list(reader=readPlain)) #load in documents
    

    You can then apply the StemDocument function to your Corpus. HTH.

提交回复
热议问题