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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:31:02+00:00 2026-05-19T01:31:02+00:00

Having recently begun working on a project which might need (good) scaling possibilities, I’ve

  • 0

Having recently begun working on a project which might need (good) scaling possibilities, I’ve come up with the following question:

Not taking into account the levensthein algorithm (I’m working with/on different variations), I iterate through each dictionary word and calculate the levensthein distance between the dictionary word and each of the words in my input string. Something along the lines of:

<?php
$input_words = array("this", "is", "a", "test");
foreach ($dictionary_words as $dictionary_word) {
    foreach ($input_words as $input_word) {
        $ld = levenshtein($input_word, $accepted_word);
        if ($ld < $distances[$input_word] || $distances[$word] == NULL) {
            $distances[$input_word] = $ld;
            if ($ld == 0)
                continue;
        }
    }
}
?>

My question is on best practise: Execution time is ~1-2 seconds.
I’m thinking of running a “dictionary server” which, upon startup, loads the dictionary words into memory and then iterates as part of the spell check (as described above) when a request is recieved. Will this decrease exec time or is the slow part the iteration (for loops)? If so, is there anything I can do to optimize properly?

Google’s “Did you mean: ?” doesn’t take several seconds to check the same input string 😉

Thanks in advance, and happy New Year.

  • 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-19T01:31:03+00:00Added an answer on May 19, 2026 at 1:31 am

    Read Norvig’s How to Write a Spelling Corrector. Although the article uses Python, others have implemented it in PHP here and here.

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

Sidebar

Related Questions

I've recently begun working in Sproutcore, which seems to be a really good solution
I have recently begun working on a pre-existing PHP application, and am having a
Having recently worked on a project which required some more IO interaction than I'm
I’m relatively new to working with Scala having recently come from a java background.
I have recently begun working with QT and I'm having a small issue. I
I need help, I'm new to the WCF world having recently made the transition
Recently I've begun working on exploring ways to convert about 16k Corel Paradox 4.0
I've recently started learning python and am having some trouble. The functions in question
Having recently reformatted my hard-drive, I cannot get my local Java/Tomcat/MySQL stack working. This
I've recently started coding in C++ and i'm having doubts about the following code.

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.