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 3796776
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:17:41+00:00 2026-05-19T13:17:41+00:00

My function parses texts and removes short words, such as a, the, in, on,

  • 0

My function parses texts and removes short words, such as “a”, “the”, “in”, “on”, “at”, etc.

The list of these words might be modified in the future. Also, switching between different lists (i.e., for different languages) might also be an option.

So, where should I store such a list?

  • About 50-200 words
  • Many reads every minute
  • Almost no writes (modifications) – for example, once in a few months

I have these options in my mind:

  1. A list inside the code (fastest, but it doesn’t sound like a good practise)
  2. A seperate file “stop_words.txt” (how fast is reading from a file? should I read the same data from the same file every few seconds I call the same function?)
  3. A database table. Would it be really efficient, when the list of words is supposed to be almost static?

I am using Ruby on Rails (if that makes any difference).

  • 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-19T13:17:42+00:00Added an answer on May 19, 2026 at 1:17 pm

    If it’s only about 50-200 words, I’d store it in memory in a data structure that supports fast lookup, such as a hash map (I don’t know what such a structure is called in Ruby).

    You could use option 2 or 3 (persist the data in a file or database table, depending on what’s easier for you), then read the data into memory at the start of your application. Store the time at which the data was read and re-read it from the persistent storage if a request comes in and the data hasn’t been updated for X minutes.

    That’s basically a cache. It might be possible that Ruby on Rails already provides such a mechanism, but I know too little about it to answer that.

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

Sidebar

Related Questions

A library function parses a file and returns an object. If a parser encounters
Python's urlparse function parses an url into six components (scheme, netloc, path and others
I have a recursion function that parses an object/array with a global variable. If
I've got a function which parses a sentence by building up a chart. But
I have created a function in PHP that calls a webservice and parses through
I currently have a function that grabs the browser windows uri, parses out the
I'm writing a function to parse words inline in a contenteditable div and replace
I have this great function that parses a field into a pivot table consisting
I created a function which parses text and I would like it to return
Is there an C# equivalent to the PHP function parse_str ? I couldn't find

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.