使用tm_map的停用词会产生奇怪的问题:
它正在从'as'
移除'fast'
,'ft'
离开'the'
,稍后在语料库中删除'they'
,docs <- Corpus(docsSource)
> docs[[1]]$content
[1] "Super fast and best for gamers and arch students This product of Amazon has been mentioned with wrong specifications. I have checked the other online shopping sites for this laptop and they are showing some specifications of this laptop that are...(Intel Core i7 6700HQ/16 GB DDR4 RAM/1 TB HDD/128 GB SSD/Windows 10/Nvidia GeForce GTX 960M 4 GB GDDR5 Graphics). I think that these are the right specifications! After all. Perhaps! I strongly recommend every gamers to buy this laptop for entry level gaming of nowadays. Really very good128 gb ssd for fast Os processing and booting1TB hard disk 7400 rpm for data storageGood 4 gb ram graphics for gaming16 gb ddr4 ram 2300mhz for multi taskingExcellent 4core i7 6th gen processor Very happy with laptop and amazon Best in class Performance, durability, display, look, (got a lot of compliments), with only one draw back of heating, sometimes I use it as a heater. Best Laptop for High Intense Work Like Gaming/Video Editing. As of Now the ASUS ... <truncated>"
docsRemovePunctuation <- tm_map(docs, removePunctuation)
docsToLower <- tm_map(docsRemovePunctuation,content_transformer(tolower))
docsStrpSpc <- tm_map(docsToLower,stripWhitespace)
#Till this point all works fine
> docsStrpSpc[[1]]$content
[1] "super fast and best for gamers and arch students this product of amazon has been mentioned with wrong specifications i have checked the other online shopping sites for this laptop and they are showing some specifications of this laptop that areintel core i7 6700hq16 gb ddr4 ram1 tb hdd128 gb ssdwindows 10nvidia geforce gtx 960m 4 gb gddr5 graphics i think that these are the right specifications after all perhaps i strongly recommend every gamers to buy this laptop for entry level gaming of nowadays really very good128 gb ssd for fast os processing and booting1tb hard disk 7400 rpm for data storagegood 4 gb ram graphics for gaming16 gb ddr4 ram 2300mhz for multi taskingexcellent 4core i7 6th gen processor very happy with laptop and amazon best in class performance durability display look got a lot of compliments with only one draw back of heating sometimes i use it as a heater best laptop for high intense work like gamingvideo editing as of now the asus rog gl552vw is the best wind... <truncated>"
docsStopwords <- tm_map(docsStrpSpc , removeWords, c(stopwords("english"),saveSearchTerm,"the", "this","if","of","you","is","where","my","too","it","have","with","up","no","are"))
#Stopwords now messes things
> docsStopwords[[1]]$content
[1] "super ft st gers rch students this product of zon h mentioned with wrong specificions i hve checked the other online shopping sites this lptop they showing some specificions of this lptop th intel i7 6700hq16 gb ddr4 r1 tb hdd128 gb ssdwinws 10nvidi gece gtx 960m 4 gb gddr5 grphics i think th these the right specificions perhps i strongly recommend every gers to buy this lptop entry level ging of nowdys rey very good128 gb ssd ft os processing booting1tb hrd disk 7400 rpm d storgegood 4 gb r grphics ging16 gb ddr4 r 2300mhz multi tkingexcellent 4 i7 6th gen processor very hppy with lptop zon st in cls permce durbility disply look got lot of compliments with only one drw bck of heing sometimes i use it heer st lptop high intense work like gingvideo editing of now the rog gl552vw is the st winws lptop under â\u0082 1 lkh unboxing ssd speed test my honest opinions serch chnel ne vi7shl on youtu with title rog gl552vwcn430t or go to bit t ly vishl or else you... <truncated>"
...
以下是代码:
#include <stdio.h>
#define fctrl(N) ( (N==1)? (N) : (N*fctrl(N-1)) )
int main()
{
int m,n=7;
m = fctrl(n);
printf("fctrl is %d\n",m);
return 0;
}