Zay*_*iwa 4 regex text text-processing r text-mining
我正在尝试处理一个文本文件。总的来说,我有一个想要分析的语料库。为了使用 tm 包(R 中的文本挖掘包)创建一个语料库对象,我需要使该段落成为一个巨大的向量,以便能够正确阅读。
我有一个段落
Commercial exploitation over the past two hundred years drove
the great Mysticete whales to near extinction. Variation in
the sizes of populations prior to exploitation, minimal
population size during exploitation and current population
sizes permit analyses of the effects of differing levels of
exploitation on species with different biogeographical
distributions and life-history characteristics.
Run Code Online (Sandbox Code Playgroud)
我使用了 scan 和 readLine 方法,它处理文本的方式如下:
[28]“过去两百年的商业开发使
巨须鲸濒临灭绝”
[30]“开发前种群规模极小”
有没有办法摆脱换行符?或者将文本文件作为一个巨大的向量读取?
到目前为止,发布的所有解决方案都很棒,谢谢。