Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

SL Dictionary??

Kain Cleaver
Registered User
Join date: 24 Jan 2006
Posts: 178
12-18-2008 21:28
Is there a script out there to find out if a word would be part of an official dictionary word? i dont know if anyone has programed a dictionary in SL but if someone can guide me i would appreciate it. im looking to have a word spelled and check if it is spelled correctly and really is a word.
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
12-18-2008 23:47
You probably want to interface out to a friendly web dictionary that can return the info you need in under 2k.

You could do it inworld -- i guess you could (using a mono compiled storage script) store about 2000(or so?) words per script.

If you store in lower case and llToLower(), a link message you could efficiently have an A script, a B script, etc that checks the first letter and if it's targeted for that "letter" script, it would search its list of words to find out whether that word is there, and then obviously return a link message showing success or failure.

Compiling the list of words would probably take longer than crafting the scripts needed...

/esc
_____________________
http://slurl.com/secondlife/Together
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
12-19-2008 07:19
Http request to an external web page with cgi script that runs unix "spell" would be the straightforward way.

Escort's suggestion is impractical for any natural language due to the number of words an the fact that they're not evenly distributed by first letter. He's proposing a radix sort on the first letter, but you'd find far too many common words that begin with certain letters. So, you'd need to hash the first two letters to get a more even distribution to the helper scripts. Assuming you can have 2K words per script, you'd probably want at least 20 or 30 helper scripts -- either that or you'd have a limited dictionary that would disallow a lot of erudite words.

And as mentioned, putting the lists together would be nontrivial.

Note that when lexicographers talk about the number of words in a language or that people use, they're usually not counting variations of the word with different endings (for pluralization, adjectivizing, etc). But with the simple method you'd need every word in every form.

I wouldn't want to do this in LSL, especially since it's reasonably done already in many UNIX distributions. I don't know if the typical web server out there inclues "spell"; it might not be in the common Linux distributions. But that would be my first try.

I recommend against trying to use most onine dictionaries, because the free ones like 'dictionary.reference.com' return too much stuff (including ads). But if you can find a simple one where success/failure is easy to determine, bingo.
Kain Cleaver
Registered User
Join date: 24 Jan 2006
Posts: 178
12-19-2008 09:07
i didnt wanna go web based because its going to be a game im doing it for. using a base of words from 3 to 6 or 7 letters long. i was hoping i didnt have to type in a ton of words but its looking like i will have to ... you guys sure SL doesnt have some kind of built in dictionary function? like a spell check or something? just curious
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
12-19-2008 10:13
See http://www.wordbyletter.com/words_by_length.php for word lists you'll need.

Word lists for scrabble and boggle contain 70K to 90K entries. From http://home.teleport.com/~stevena/scrabble/faqtext.html:

Here are the relative sizes of the lexicons of TWL and OSW, showing that OSW is a richer lexicon at all lengths. "SOWPODS" is a common abbreviation for the union of the two, combining the letters of OSPD and OSW.


length TWL OSW TWL+OSW
2 96 110 121
3 972 1130 1229
4 3903 4790 5155
5 8636 10743 11812
6 15232 18534 20964
7 23109 26673 31229
8 28419 30924 38043
9 24792 30705 36846

total 80367 92904 108553 (for 2-8 -- dunno why that site left out 9-letter words in this total)

=================

Admittedly, these contain a number of very obscure words. For 3-6 letter words, the total is about 30K.

I still think that an HTTP request to a cgi script is what you should use. I don't see why that isn't appropriate for a game.
Dudeney Ge
EduNation Archipelago
Join date: 21 Jul 2006
Posts: 95
Dictionary
12-19-2008 15:01
From: Kain Cleaver
Is there a script out there to find out if a word would be part of an official dictionary word? i dont know if anyone has programed a dictionary in SL but if someone can guide me i would appreciate it. im looking to have a word spelled and check if it is spelled correctly and really is a word.


My WordUp game (free) has a dictionary HUD for the presenter which allows for the following queries:

define factory (as an example)
Returns a partial definition of factory from an online dictionary using a combination of php and magic parser

anagram werstedgh 6
Returns all possible anagrams of six of more letters from the letters given, using the same method

YOu can find it here:

http://slurl.com/secondlife/EduNation%20II/130/221/30

Gavin
Kain Cleaver
Registered User
Join date: 24 Jan 2006
Posts: 178
12-20-2008 12:19
is it modable ? lol can i look at the scripts to see how you do it?