Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3426848
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:45:55+00:00 2026-05-18T06:45:55+00:00

After using a keyword API to get popular keywords and phrases, I get also

  • 0

After using a keyword API to get popular keywords and phrases, I get also a lot of “dirty” terms with too much extra words (“the”, “a”, etc.).

I’d also like to isolate names in search terms.

Is there a Ruby library to clean up keyword lists? Does such an algorithm exist at all?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T06:45:55+00:00Added an answer on May 18, 2026 at 6:45 am

    You’re talking about “stopwords”, which are articles of speech, such as “the” and “a”, plus words that are encountered so often that they are worthless.

    Stopword lists exist; Wordnet has one if I remember right and there might be one in Lingua or the Ruby Wordnet for Ruby or readablity modules, but really they’re pretty easy to generate yourself. And, you probably need to since the junk words vary depending on a particular subject matter.

    The easiest thing to do is run a preliminary pass with several sample documents and split your text into words, then loop over them, and for each one increment a counter. When you’re finished look for the words that are two to four letters long and are disproportionately higher counts. Those are good candidates for stopwords.

    Then run passes over your target documents, splitting the text like you did previously, counting occurrences as you go. You can either ignore words in your stopword list and not add them to your hash, or process everything then delete the stopwords.

    text = <<EOT
    You have reached this web page by typing "example.com", "example.net","example.org"
    or "example.edu" into your web browser.
    
    These domain names are reserved for use in documentation and are not available
    for registration. See RFC 2606, Section 3.
    EOT
    
    # do this against several documents to build a stopword list. Tweak as necessary to fine-tune the words.
    stopwords = text.downcase.split(/\W+/).inject(Hash.new(0)) { |h,w| h[w] += 1; h }.select{ |n,v| n.length < 5 }
    
    print "Stopwords => ", stopwords.keys.sort.join(', '), "\n"
    
    # >> Stopwords => 2606, 3, and, are, by, com, edu, for, have, in, into, net, not, or, org, page, rfc, see, this, use, web, you, your
    

    Then, you’re ready to do some keyword gathering:

    text = <<EOT
    You have reached this web page by typing "example.com", "example.net","example.org"
    or "example.edu" into your web browser.
    
    These domain names are reserved for use in documentation and are not available
    for registration. See RFC 2606, Section 3.
    EOT
    
    stopwords = %w[2606 3 and are by com edu for have in into net not or org page rfc see this use web you your]
    
    keywords = text.downcase.split(/\W+/).inject(Hash.new(0)) { |h,w| h[w] += 1; h }
    stopwords.each { |s| keywords.delete(s) }
    
    # output in order of most often seen to least often seen.
    keywords.keys.sort{ |a,b| keywords[b] <=> keywords[a] }.each { |k| puts "#{k} => #{keywords[k]}"}
    # >> example => 4
    # >> names => 1
    # >> reached => 1
    # >> browser => 1
    # >> these => 1
    # >> domain => 1
    # >> typing => 1
    # >> reserved => 1
    # >> documentation => 1
    # >> available => 1
    # >> registration => 1
    # >> section => 1
    

    After you’ve narrowed down your list of words you can run the candidates through WordNet and find synonyms, homonyms, word relations, strip plurals, etc. If you’re doing this to a whole lot of text you’ll want to keep your stopwords in a database where you can continually fine-tune them. The same thing applies to your keywords, because from those you can start to determine tone and other semantic goodness.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the After Effects CS3 Javascript API to dynamically create and change text
After using the ebay API recently, I was expecting it to be as simple
After using AS2 for several years, I'm getting started with writing applications in AS3
After using them a while I can't help but feel that the hoops you're
After using array_unique , an array without the duplicate values is removed. However, it
I've been using Subversion for a few years and after using SourceSafe , I
if Form.Release is called after using the form, it will free all related memory
When I create a graph after using range.copy and range.paste it leaves the paste
I'm always surprised that even after using C# for all this time now, I
After logging in using the Login control the browser loses the session. This only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.