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 recently upgraded a VB 6 project to .net. I'm having a problem with
Having recently discovered this method of development, I'm finding it a rather nice methodology.
Having recently gotten into test driven development I am using the Nunit test runner
Having recently introduced an overload of a method the application started to fail. Finally
This is a weird problem I have started having recently. My team is developing
I have recently started having problems with TortoiseCVS, or more specifically with plink, the
Recently, I've started having a problem with my SQL Server 2005 client running on
Recently, I found myself having to write up some concerns I have about race
We recently switched our Windows software packages from RPM (cygwin) to MSI (wix). Having
Recently I used a class that inherits from a collection instead of having the

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.