如何从R中的数据集语料库中删除网站URL?

时间:2015-09-19 06:07:33

标签: r text-mining tm

我在语料库的文字说明中有很多网址链接。在使用tm_map函数应用标点符号后,它正在形成一个非常大的单词。所以,我想完全从我的文本文档中删除这些网址。

我已将csv文件加载为下面的示例。我应用了tm_map方法来删除puntuation,停止单词如下:

ques<-read.csv("datasets\\data100_.csv") 
ques1<-paste(ques$content,collapse = "")
ques1<-iconv(ques1, "latin1", "ASCII", sub="")
ques1
corpus<-Corpus(VectorSource(ques1))
inspect(corpus)
corpus<-tm_map(corpus,tolower)
corpus<-tm_map(corpus,removePunctuation)
corpus<-tm_map(corpus,removeNumbers)
corpus<-tm_map(corpus,removeWords,stopwords('english'))
corpus<-tm_map(corpus,stripWhitespace)
corpus<-tm_map(corpus,trim)
corpus<-tm_map(corpus,PlainTextDocument)

我的示例文件data100_.csv如下所示:

"user","poston","content"
"drupalnew1",2015-09-15,"Hi,,I added an email component in webform. I selected,for the field,. When I visit my page, I see the label is,. Can you please help?,Thanks,,D"
"drupalnew1",2015-09-15,"Hello,,I am using bootstrap subtheme. I would like to have one image with full screen as background image in the home page. Can you please help?,Thanks,,D"
"drupalnew1",2015-09-15,"Hi,,I am using bootstrap subtheme. I have installed the webform module. I simply like to create a form using the webform module. When people click the link for the form, I like to see the form:,- display in a new window on top of the main screen.,- width should be 1/3 of the main screen.,- height should be 1/3 of the main screen with scroll bar.,I can create a form using the webform. I am not sure how to do it for the above requirements.,Thanks,,D"
"drupalnew1",2015-08-28,"Hi,,My logo size is 250x150. Appearance > Subtheme settings> Uploaded my logo. I can see the actual logo size in desktop. When I view it in phone, the logo does not fit into the screen. It is going beyond the screen. I thought bootstrap will take care of that. How can I make sure the logo is responsive? Do I need to do some coding? Do I need to upload different sizes logo for different devices? I am lost.,Thanks,,D"
"282247",2011-10-14,"Hey guys, Happy Friday!,I know Drupal can already capture the IP address of a computer, because it comes through in messages sent from a Webform form. However, I need to capture and send the IP address when a purchase is completed in Ubercart. I need the IP address to be included in the email that is sent to the store owner. How can this be done? Thanks in advance!"
"drupalnew1",2015-09-03,"Hi,,Currently I am using DATE module in webform. It has 3 different fields YEAR, MONTH, DAY plus calendar. I simply like to have a text field with the current date as default value and the calendar with current and future dates. I don't want to have separate 3 drop down fields YEAR, MONTH, DAY. Can I update the DATE module or is there another module I should use?,Thanks."
"drupalnew1",2015-09-02,"Hi,,I have added,component in webform.,field displays the values as ""Hour, 6am, 7am, 8am,....."" and the,field displays the values as ""Minute,00,30"". Hour field displays 'Hour' as default and Minute field displays 'Minute' as default. After I select an hour and minute, it looks odd(i.e.,). How can I select a time like,instead?,Thanks."
"drupalnew1",2015-08-28,"Hi,,I am using responsive theme bootstrap. I like to add a field with 2 different field types as a collection. So I can place them on a row.,Similar to fieldcollection module. I have used the module in bartik theme. Will it work with current theme/webform module? If not, any help please.,Thanks."
"drupalnew1",2015-09-01,"Hello,,I am using bootstrap theme. I just uploaded the logo. I inspected the page. I see the below html from inspecting:,When I visit the page in different devices, I see the image size remain same. Instead, I would like to change the image width to 100% of screen, when I use mobile device. I wrote the below css and it is not doing anything.,.container>.navbar-header>.logo {,.img {,width:100%;,},}"
"drupalnew1",2015-08-31,"Hi,,I am new to bootstrap. I just added a webform contact page. I have the below css code for the contact page.,I know there are four classes for devices: col-xs-   col-sm-   col-md-   col-lg-,I am using css injector module for styling. I like to do the below:,If mobile device, make all the labels and fields in with red background in the webform. How do I mix the webform class with the device class?In this case, class I have,and,Below css did not work:,Can you please help?"
"drupalnew1",2015-09-01,"Hi,,1.  In contact page(built with webform), I have a date field. I have the month, day, year on the same row using the below css and it looks good in desktop.,2.,If I make the screen smaller, I see month, day on the same row and year field goes to next row. Instead, I would like to make month,day and year in 3 separate rows. Each field should take 100%width of the screen.,Then I used the below code for mobile and it also worked.,#edit-submitted-eventinformation-when-month  {width:80%; float:left;margin:6px; },#edit-submitted-eventinformation-when-day {width:80%; float:left;margin:6px; },#edit-submitted-eventinformation-when-year {width:80%; float:left;margin:6px; },},Because I am using bootstrap theme, I read the doc at,. It says I can use the grid system to apply styling for specific devices. Classes they use for devices are .col-xs- .col-sm- .col-md- .col-lg-,I am trying to understand how to write the css using the grid system classes.,Can I combine my field classes with mobile class (.col-xs-) to write the css that I wrote in step 2? If yes, how?"
"drupalnew1",2015-08-20,"Hello,,I have create a form using the web form module. I have added 5 fields for public users. When public users submit the form, role can see the form result and edit no problem.,I like to add 3 additional fields for a specific role only. When public users use the form they will not see the 3 fields. How can I add these 3 additional fields for a role only?,Thanks."
"282247",2009-05-01,"I've created a view that shows a list of URL titles on the home page. The view setting is set to show the 10 most recent titles. I have More Link = Yes, but the link is not showing. Please see this screenshot of my View settings:,. Thanks."
"drupalnew1",2015-08-27,"Hi,,I like to create a contact form using webform module. I like to put the form on the left and small image slide show on the right. I will be using some responsive theme like bartik, bootstrap. I like to have HEADER, LEFT and RIGHT col, FOOTER. LEFT col for FORM and RIGHT col for IMAGE SLIDESHOW.,How can I do it?,Thanks,,D"
"drupalnew1",2015-08-27,"Hi,,I would like to know how I can design the layout of each page before I start developing any drupal site? Do you recommend any kind of free software?,Thanks,,D"
"drupalnew1",2015-08-26,"Hi,,I am trying to disable css aggregation. I don't have access to phpmyadmin this time to follow the below steps. Can I disable it using any module or from the admin side?,1. Open phpmyadmin and select the database which is used by the drupal instance.,2. Select the ""variables"" table.,3. Search for ""preprocess_css"" in name field.,4. Change the variable value to s:1:""0"";,5. And you are done.,Thanks."
"drupalnew1",2015-08-24,"Hi,,I found two webform modules. Can you please provide me the differences?,Thanks."
"drupalnew1",2015-02-23,"Hi,,1. Installed modules:,7.x-1.0-beta1 TCPDF , 7.x-4.2 WEBFORM , 7.x-4.x-dev WEBFORM2PDF.,2. From TCPDF module page in drupal, extracted the zip file to sites/all/libraries directory,Now, I see TCPDF folder under libraries directory.,3. Submitted a webform.,4. Webform > results > View > Download pdf,I get the url (,) with a blank page. Can you help?,Thanks.,D"
"drupalnew1",2015-08-21,"Hi,,Site1 has the back and restore module installed. I did the back up of the site using the module. Now, I like to restore it into site2 and site3 because I have 3 domains for my business. I have not installed drupal in site2 and site3 yet. What kind of themes and modules and files I have to have in site2 and site3 before I restore to site2 and site3? For example, site1 has 5 themes enabled and 5 modules enabled and all the files. Do I need to have install all of these in site2 and 3 before I restore to site 2 and 3? Or I just install backup and restore module in site 2 and 3, then I can restore?,Thanks,,D"
"drupalnew1",2015-08-12,"Hi,,Steps:,1. Enabled calendar module.,2. Enabled date api, date pop up, date views.,3. Added a content type with a field 'event date' > date > pop up calendar.,4. Added two events (event 1 - aug 12th 11-12. event 2 - aug 13th 01-02),4. Structure > Views > add views template > added views calendar > click views month,I see calendar but I dont see the events on the calendar.,Please help.,D"
"drupalnew1",2015-08-12,"Hi,,View1 > Filter criteria > Fields: DOB, NAME.,I like to give a class name for DOB and class name for NAME.,View2 > Filter criteria > Fields: DOB, DATE.,I like to give a class name for DOB and class name for DATE.,So I can css the filter criteria's field labels and items. How can I give class names?,Thanks,,D"
"drupalnew1",2015-08-13,"Hi - Using the calendar module, I have created a view using the calendar field. The calendar field displays as an event in the calendar. On the calendar, it shows date + start and end time. Instead, I only like to see start and end time. I did go to view and tried to edit the field configuration in view but I could not find any settings to select start and end time.,Please advise.,Thanks,,D"
"drupalnew1",2015-08-12,"Hi,,I am trying to add a field to my content type that allows me to select a available date plus time slots. Do you know any module? I tried availability calendar module. It seems to me it allows to book by the date only not by the date and time slots.,Thanks,,D"
"drupalnew1",2015-08-13,"Hi - I just created a views page. It seems to it has a public access. I like to give access to specific roles to access the views page. I did go to people > permission and I did not see the views page listed there.,Do you know how i can do it?,Thanks,,D"
"drupalnew1",2015-08-12,"Hi,,I have added a content type X and then added few contents. After that I changed the layout by display suite module. I have noticed that field labels dont display.,Then I inspected the page and I saw this:,xxx.com/modules/field/theme/field.css?nszbsv 3,Then I removed the,line from the above code of field.css file and now I am able to see the field labels. But the problem is that I see other field labels from blocks/other contents throughout the site and I dont want that. I just want to display the field labels only for the specific content types. How can I give class name and write the css code just for this content type?,Thanks,,D"
"drupalnew1",2015-08-11,"Hi,,When admin adds a user admin > people > add user, he sees following fields:,I, as admin,  have create a role DCYA. I have added 3 users (John,Mike,Mo) and assigned them to the role.,Each DCYA user should be able to:,- Add new customer using the same/any form as admin sees at,except the user, pw, roles, active fields.,- Update/delete the customer profile that each DCYA user has created.,Why do I want to do it? I am using another module which has a field that allows DCYA users to select a customer that exists in the system. Thats why DCYA users need to be able to add some customers first before they use module so they can see the custoers in the module field to be selected. That means DCYA users will login to the system then add some customers(who has no access to system) then,use the module to select the customers they have created.,How can I do it?,Thanks,,D"
"drupalnew1",2015-08-11,"Hi,,Admin > People > Add user: I only see name, email, password fields. How can I add other fields like phone no, address, etc.,Thanks,,D"
"drupalnew1",2015-08-09,"Hi - When I add reservation using simplereservation module, I see a field 'This reservation is for'. It says to enter a name in that field. I entered 'Mike Smith'. After I save the reservation, I do not see Mike Smith on the reservation page. When I edit the reservation, I see the field is empty as well. I am not sure why it does that. Can you please help?,D"
"drupalnew1",2015-08-02,"Hi,,I have created one page view and one block view. Both views have filter criteria. How can I give different class names to the views filters?,Thanks,,D"
"282247",2010-01-25,"When adding Form Components to the wonderful WebForm node, there is a Description field. This description is appearing AFTER the Form Component (textfield etc) when the webform is viewed. How can I move this description ABOVE the Form Components? I looked the webform-form.tpl.php file in the module, but I didn't see anything available there, unless I overlooked something.,How can I re-order the form components and their descriptions?,Thanks guys."
"carlbowles100",2015-07-21,"I've built two sites for one client - both are ecommerce sites built using Drupal 7 and Commerce 7.x-1.11. One of them sells chilli sauces, and one sells different flavours of mayonnaises.,One the mayonnaise one, I have about 30 products setup. There's nothing really special about how the site is built, it just has the 30 products on there, each around £2.50. On this site, my client would like to do a promotion, so that anyone who places an order over £15 between August 1st and August 31st gets to choose 1 of 4 products on the site for free, so they just need to be able to select one of the four prodducts in order to add it to their cart a price of £0.00.,With the chilli site, there is about 5 products on there, each around £2.99. What my client wants is for between the 1st August and 31st August, all sauces are 2 for £5. So for example, if a visitor buys 2 sauces their total is £5, if they buy 4 it's £10, 6 is £15 and so on..,I think this will have to be done through rules, but just thought I'd post this to see if anyone can give any pointers on how to do these two promotions as I'm getting a little stuck trying to creates rules that can do this.,Thank you so much for reading, and I look forward to any pointers."
"carlbowles100",2013-04-22,"Im running Drupal 7.22 with the Garland theme. Is it possible to change the font ? Ive looked in the style.css for Garland but cant find it. When I go to View source, the page title has   I cant find this tag in the css,thanks"
"drupalnew1",2015-07-26,"Hi,,I have created views-grid format - block. How can I have just an image as background of the views block?,Thanks,,D"
"drupalnew1",2015-07-19,"Hi,,I am using bartik theme. I am trying to apply css to main menu links. Hover/focus is working but not active. I am not getting,background after I click a link in main menu. Can you please help?,style.css file.,},Thanks."
"drupalnew1",2015-07-18,"Hi,,I am using bartik theme. I have uploaded a logo in header which is 1159x196 width. This image shows its original image starting from center to right. I like to see the image as entire header. When i go to bartik settings > i selected black color for header top and bottom. I like to see all black color replaced by the logo. I did inspect and did the following but no luck.,1. themes/bartik/css/style.css,change the image width to 100% but no luck.,2.  themes/bartik/css/layout.css,did change headers width to 1159 but no luck.,Can you please help?,D"
"drupalnew1",2015-07-12,"Hi,,I have created a views slideshow. Slideshow is working fine. I am trying to apply some css to it and I am having the below issue.,1. /themes/bartik,i added the last line:,stylesheets[all][] = css/layout.css,stylesheets[all][] = css/style.css,stylesheets[all][] = css/colors.css,stylesheets[print][] = css/print.css,2. /themes/bartik/css/,I added the blank xpressauto.css file.,3. In xpressauto.css file, i added the below code:,Currently, counters are numbers but i am not seeing the colors in green and font size is not changing.,Can you please help?,I found the below from inspecting the views slideshow.,//This is the container object. I thought,is the parent.,Thanks,,D"
"carlbowles100",2013-11-06,"Hello,I have setup a views slideshow, but is anyone able to help me with centering the images in the middle of the slideshow? Some images are not very wide and they are aligned to the left of the slideshow. I would like all images to be in the center to make it look better.,The site I'm working on is,I have tried adding the following codes to my css but none of them work:,and,I still cant seem to get it working, I've tried a few other css selectors that I found online as well. Im new to drupal views and quite new to Drupal.,Thank you."
NA,2015-07-10,"So far as I can tell not so easy to make panels adaptive. Is there any point in still using it?,Am I missing something?"
"thumbslinger",2015-07-08,"Since it's now 2015 and all I find on this is from 2008/2011, I'm hoping some solid ideas have arrived for this.,We are hosting our actual site both the dev and the live site. I'm not an IT guy and in the past, this stage was all done so I logged on to the dev.xyz.com, made changes then ssh-d into dev.xyz.com and ran a script somebody else had made. Renamed a settings.php file and was done.,We had a dev server and a live server but two different databases on the live server. We also had two separate settings.php files; abc.settings.php and 123.settings.php each which pointed to one of two different databases; abc or 123.,That script:,1. dumped the database of dev.xyz.com,2. checked the settings.php file to see which of the two databases was actually in use, then,3. imported the previously dumped database into the other database on the live server (but not in use),4. synced.,Then, all I did was to renamed the appropriate settings.php file. So if the settings.php file was originally pointing to the ""abc"" database, I'd rename 123.settings.php to settings.php. (As that database would have had the lates dev db imported into it). Had the original (live) settings.php been pointing to the ""123"" database, then I'd rename the abc.settings.php to settings.php,But, I don't have that script. So I'm looking for the ways/means to do this. Is it using sqldump? Backing up is easy and can be done in a myriad of ways but I'm talking about how do I make the connection in 'what kind of script' between a dev server and a live server?,I'd like to dump the db, import it to the live server and be done. I realize I would have to physically add new images but I'm wondering what people are doing BESIDES USING ACQUIA or other hosts?"
"polyspiral",2011-11-16,"Hi, Im using Drupal 7 and I thought it would do this automatically, I have a block with a view in it and it wont hide the block if there is nothing in it, does anyone know what setting I need for this?,thanks"
"drupalnew1",2015-07-03,"Hi,,I have created a content type which has the following fields: Title, Name, Address, phone, and Specialty.,I like to give anonymous users to add the content without the Title field. I am not sure how i can give public users to add the content without the title field.,Can you please help?,Thanks,,D"
NA,2015-06-24,"I am urgently looking for a hierarchical multi level multi select dropdown menu similar to the Drop Button 2 at,or does someone know whether we can implement this menu on Drupal ?"
"drupalnew1",2015-06-21,"Hi,,I created a view. For the image field, output field is linked to its node. I simply entered node/[nid] in the link path field. When i click the image link, I see the node content as node/x in the address bar. Is there way I can change the url with something more meaningful ( may be title of the node)? I did see several tokens. I am not sure where to enter the tokens in views-edit page?,Please help.,D"
"drupalnew1",2015-06-21,"Hello,,I am trying to create a block with the below fields:,Name, PhoneNo, Email, Message,Anonymous users can enter these info. Then they can click the submit button which will send an email notification.,Thank you in advance for your help.,D"
"thumbslinger",2015-06-19,"I know, it may sound crazy... but this question is not about setting up a local server/mysql using MAMP or WAMP and such. It's about being able to save out all html, css and javascript needed to render any given single page from a Drupal site without having to inspect a page with Firebug/Chrome Dev Tools etc. and saving down all the sources.,Is there a faster way of doing such?"
"polyspiral",2011-07-12,"Hi, I have a view with a few fields in it, which has a title. Problem is even if there are no values in the block view the titles still show. So I've been trying to work out how to hide the block/view when the fields are empty. Does anyone out there know how?"
"744482",2013-02-28,"Hi,,I have a content type. This content type can be created by anonymous users. The content type has title, and a text cck field. I have a module to generate automatically the field title using a tokens, so I can hide the title for the creators of a node.,In the configuration of that content type I have selected: ""Automatically generate the title and hide the title field"" I have written the token I wanted to use to generate automatically the title.,So the users do not see the field title, however  when they are going to create a node they can see a text wich says ""Replacement patterns"" and it shows all the tokens.,How can i avoid this text link to all tokens?,thanks a lot!"
NA,2015-06-11,"Apologies if this has already been asked but I am trying to spoiler tag a list of suppliers.,I've installed the ""spoiler"" module but is there no way to change what the text says for it ?,Thanks in advance."
"carlbowles100",2015-06-11,"Hello,I'm using Drupal 7.37 and the latest commerce module. I'm also using the latest Commerce Shipping module.,What I need to do is provide a field somewhere on the checkout for users to enter delivery instructions for their orders. For example 'leave with neighbour', 'left in back garden' etc?,I've searched but can't seem to find any modules to do this,Thank you"
"thumbslinger",2015-06-08,"I want the output of two labels and their values to look like this:,But no matter what I set, I either get both fields and content all inline or they are all 'above' like:,I can't use straight CSS yet because the classes affect all fields in all content types, and even if I use a body.content-type-class then selector, it affect both fields and they all run together.,And it's just to hacky to assign different html mark-up to each field and then style...and what is the actual 'value' of a field called?,I would expect $label = the label and $value = the actual value assigned but of course for whatever reason ""$value"" wasn't used for the actual value variable and I haven' had any luck with:,print $content(['field-location']); in either a node, content-type or page template.,Again, I'm just looking to have the final html mark-up render this in a browser:,Instead of everything all inline. So I can't figure out how to make the second value of the label Department be a block element and then have it's value inline...............they are all inline or block but I want to mix and match"
"thumbslinger",2015-06-09,"how can I link to pages such as ""terms and conditions"" ""privacy"" and the like in a footer where the html mark-up is in a block that's included on all pages in the footer section?,I have those pages already created and the ""Create a menu link"" is NOT selected, automatic path alias is assigned, such as ""content/privacy"" so I'm wondering how, in the block I refer to the pages.,I'm now getting returned paths like"" /content/content/privacy"" where ""content"" is being doubled and I'm figuring it's because I've hard-coded a page like Privacy with href=""/content/privacy"" even though that is the auto alias created by Drupal for the page.,I'm thinking it's because of that hard-coded path being added to rather than 'read' as in a normal menu link.,Also, I guess this is an example of where putting a little php in a block is needed and not such a sin? Or is there a better way to link to pages from html?"
"drupalnew1",2015-06-08,"Hi,,For my one site, I added a select list(text) > check box field type to my content. When I go to manage display tab(using display suite module), in the format column column for the field, I see drop down field with 4 values ( css class, default, key, list). I selected list. Next to that I also see a geared setting where it allows me to make a comma separated list. When I go to front end, I see the values listed separated by commas. It works fine.,I am trying to do the same thing for my other site. But as for the drop down field, I only see default and key. Also, I don't see the geared setting icon to make it comma separated list. I am not sure what I did wrong on my second site. Both site have the same field type. Why am I am not seeing list and css option and the geared setting icon?,Please advise.,Hi,"

我想删除那些包含非法字符的行,包含css,html代码,JavaScript代码和所有Unicode字符的行。

0 个答案:

没有答案