Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I am afraid that there is no perfect answer... As, arnold said, domains like "expertsexbhange.com" can evaluate to "Expert Sex Change.com" as well as "Experts Exchange.com". </p> <p>Not only this, but such a function would be rather intensive on memory and processing power. You would need to have HUGE files to be able to recognize all words, etc. It would be nice to know why you need this, so-as to try and find a different solution.</p> <p>If you have some kind of service that displays information about a website, it is PERFECTLY acceptable to display "Snapnames.com". There is no need to capitalize it, or anything like that.</p> <p>However, if you are hell bent and determined for this behavior, even if it isn't 100% accurate, and rather intense on your server...</p> <p>You first will need to find a way to check if a string is a word. That is an entirely separate kind of question, with a perfectly reasonable answer. You would need to ask that separately, see if you can find a dictionary library for PHP.</p> <p>Basically, iterate backwards through your string until it becomes a word, remove that word from the string, and repeat. For instance:</p> <p>expertsexchange.com, you would check it as so:</p> <p>The first {} is your list of words foubnd. The first "" is all of the letters you have left to check The last "" is the current subset of letters you are checking</p> <pre><code>{} "expertsexchange" "expertsexchange" &lt;-- not a word {} "expertsexchange" "expertsexchang" &lt;-- not a word {} "expertsexchange" "expertsexchan" &lt;-- not a word {} "expertsexchange" "expertsexcha" &lt;-- not a word {} "expertsexchange" "expertsexch" &lt;-- not a word {} "expertsexchange" "expertsexc" &lt;-- not a word {} "expertsexchange" "expertsex" &lt;-- not a word {} "expertsexchange" "expertse" &lt;-- not a word {} "expertsexchange" "experts" &lt;-- WORD! Add it to our list of words {"experts"} "exchange" "exchange" &lt;-- WORD! Add it to our list of words {"experts", "exchange"} "" "" &lt;-- No more letters to check, we have found all of our words. </code></pre> <p>Let's try a different example...</p> <p>hellotherewittlekitty. This has a "word" ("wittle") which would not be recognized by a dictionary. Unfortunately, this is how the algorithm would handle that:</p> <pre><code>{} "hellotherewittlekitty" "hellotherewittlekitty" &lt;-- not a word {} "hellotherewittlekitty" "hellotherewittlekitt" &lt;-- not a word {} "hellotherewittlekitty" "hellotherewittlekit" &lt;-- not a word {} "hellotherewittlekitty" "hellotherewittleki" &lt;-- not a word {} "hellotherewittlekitty" "hellotherewittlek" &lt;-- not a word {} "hellotherewittlekitty" "hellotherewittle" &lt;-- not a word {} "hellotherewittlekitty" "hellotherewittl" &lt;-- not a word {} "hellotherewittlekitty" "hellotherewitt" &lt;-- not a word {} "hellotherewittlekitty" "hellotherewit" &lt;-- not a word {} "hellotherewittlekitty" "hellotherewi" &lt;-- not a word {} "hellotherewittlekitty" "hellotherew" &lt;-- not a word {} "hellotherewittlekitty" "hellothere" &lt;-- not a word {} "hellotherewittlekitty" "hellother" &lt;-- not a word {} "hellotherewittlekitty" "hellothe" &lt;-- not a word {} "hellotherewittlekitty" "helloth" &lt;-- not a word {} "hellotherewittlekitty" "hellot" &lt;-- not a word {} "hellotherewittlekitty" "hello" &lt;-- WORD! add it to list, and remove form main string! {"hello"} "therewittlekitty" "therewittlekitty" &lt;-- not a word {"hello"} "therewittlekitty" "therewittlekitt" &lt;-- not a word {"hello"} "therewittlekitty" "therewittlekit" &lt;-- not a word {"hello"} "therewittlekitty" "therewittleki" &lt;-- not a word {"hello"} "therewittlekitty" "therewittlek" &lt;-- not a word {"hello"} "therewittlekitty" "therewittle" &lt;-- not a word {"hello"} "therewittlekitty" "therewittl" &lt;-- not a word {"hello"} "therewittlekitty" "therewitt" &lt;-- not a word {"hello"} "therewittlekitty" "therewit" &lt;-- not a word {"hello"} "therewittlekitty" "therew" &lt;-- not a word {"hello"} "therewittlekitty" "there" &lt;-- WORD! add it to list, and remove from main string {"hello", "there"} "wittlekitty" "wittlekitty" &lt;-- not a word {"hello", "there"} "wittlekitty" "wittlekitt" &lt;-- not a word {"hello", "there"} "wittlekitty" "wittlekit" &lt;-- not a word {"hello", "there"} "wittlekitty" "wittleki" &lt;-- not a word {"hello", "there"} "wittlekitty" "wittlek" &lt;-- not a word {"hello", "there"} "wittlekitty" "wittle" &lt;-- not a word (even though humans read it as one) {"hello", "there"} "wittlekitty" "wittl" &lt;-- not a word {"hello", "there"} "wittlekitty" "witt" &lt;-- WORD! add to dictionary and remove from string {"hello", "there", "witt"} "lekitty" "lekitty" &lt;-- not a word {"hello", "there", "witt"} "lekitty" "lekitt" &lt;-- not a word {"hello", "there", "witt"} "lekitty" "lekit" &lt;-- not a word {"hello", "there", "witt"} "lekitty" "leki" &lt;-- WORD! (biology, wikipedia) {"hello", "there", "witt", "leki"} "tty" "tty" &lt;-- not a word {"hello", "there", "witt", "leki"} "tty" "tt" &lt;-- not a word {"hello", "there", "witt", "leki"} "tty" "t" &lt;-- not a word {"hello", "there", "witt", "leki"} "tty" "" &lt;-- No more letters, add it to the list! {"hello", "there", "witt", "leki", "tty"} "" "" </code></pre> <p>As such, hellotherewittlekitty would come out as HelloThereWittLekiTty, which would be even worse than just leaving it all lowercase.</p> <p>There ARE further algorithms that are even more intensive on your CPU than this, and require more data, which could possibly provide for you a tad more accuracy. But all in all, for all the work, getting only 30% accuracy is just not worth it. Particularly because when the algorithm fails, it RUINs your words. That means adding this would make 60% of your websites ruined.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload