This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Dictionary? speechles if you don' mind? :D [SOLVED]

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Dictionary? speechles if you don' mind? :D [SOLVED]

Post by holycrap »

Hello,

I know this is a dumb request. But can anyone make a simple dictionary pulling the definitions from this site? http://wordnet.princeton.edu/ It's very reliable and they don't change the layout much or at all. There are a few dictionaries in the archive but the output is very messy.

This is what I'm looking for and I'm sure others will find this useful as well.

1. Set in the script how many definitions to get.
2. Able to message the bot and use the command as well.
Example: /msg bot !define <word>
3.If !define null
Notice user: !define <word>
4. If can't find a word due to spelling.
Notice user: Please check your spelling.

Would greatly appreciated if someone work on this. If anyone I know speechles can tackle this. Would be a great Christmas present for me. :D

Thank You!

:D
Last edited by holycrap on Thu May 07, 2009 11:06 am, edited 1 time in total.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

If I were to entertain the idea of creating a script just for that site, what would the output look like? It consists of several types with several definitions for each type.
If you click here you can see it's got nouns and verbs with several definitions thrown in there. To create a script like this two things are needed.

Firstly, how will the command work and allow switches? Eggdrop style double hypens, aka long flags (--) or the way the google script does it, using periods (.)? The switches are needed to choose noun, verb, etc.. If no switch is given (ie, .define egg) and a list of types appears instead of one, list the types available (ie, noun; verb) and ask for a requery using a switch (ie, .define --noun egg)?

Secondly, how are we going to display to the user? There are several ways to do this and knowing how the input and output are makes it much easier. I prefer to cram everything into a single line and break it onto irc segemented but anything is possible... ;)
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Post by holycrap »

Those are some very interesting questions that you have raised. I choose this particular dictionary because the definitions are short and simple and won't flood the channel. I will go with whatever you think might work best. If it's too much trouble and time, you can just output the first definition with the nouns. I'll be happy as is.

:D
a
achilles1900
Voice
Posts: 30
Joined: Mon Apr 21, 2008 5:40 am

RE: Dictionary Script Request

Post by achilles1900 »

Hi,

I think this is a great script request , I would also love to run a dictionary tcl, that functions like inciths weather.

Just type in a word and in gives you the meaning. Great.

I hope someone could write on. Thanks

Achilles
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Then you will be happy to know that one has been created based upon incith's templates and namespaces. It has only been tested with wordnetweb.princeton.edu but may work with other sites.
<speechles> !dict --adj3 red
<sp33chy> Adjective (1) S: (adj) red, reddish, ruddy, blood-red, carmine, cerise, cherry, cherry-red, crimson, ruby, ruby-red, scarlet (of a color at the end of the color spectrum (next to orange); resembling the color of blood or cherries or tomatoes or rubies)
<sp33chy> Adjective (2) S: (adj) crimson, red, violent (characterized by violence or bloodshed) "writes of crimson deeds and barbaric days"- Andrea Parke; "fann'd by Conquest's crimson wing"- Thomas Gray; "convulsed with red rage"- Hudson Strode
<sp33chy> Adjective (3) S: (adj) crimson, red, reddened, red-faced, flushed ((especially of the face) reddened or suffused with or as if with blood from emotion or exertion) "crimson with fury"; "turned red from exertion"; "with puffy reddened eyes"; "red-faced and violent"; "flushed (or crimson) with embarrassment"
<sp33chy> red: Noun 4; Adjective 3 @ http://wordnetweb.princeton.edu/perl/webwn?s=red

<speechles> !dict
<sp33chy> !dict [--<noun/verb/adjective/adverb/all>][<number of results start-end>] <word>

<speechles> !dict --v3-5 red
<sp33chy> red: No results found for verb 3 -> 5.
<sp33chy> red: Noun 4; Adjective 3 @ http://wordnetweb.princeton.edu/perl/webwn?s=red

<speechles> !dict asd^#$^$%&
<sp33chy> asd^#$^$%&: Sorry(?) your search can only contain letters(?) numbers(?) spaces(?) hyphens(?) periods(?) slashes(?) and(?)or apostrophes.

<speechles> !dict --v1-1 egg
<sp33chy> Verb (1) S: (v) egg (throw eggs at)
<sp33chy> egg: Noun 3; Verb 2 @ http://wordnetweb.princeton.edu/perl/webwn?s=egg

<speechles> !dict tree
<sp33chy> Noun (1) S: (n) tree (a tall perennial woody plant having a main trunk and branches forming a distinct elevated crown; includes both gymnosperms and angiosperms)
<sp33chy> Noun (2) S: (n) tree, tree diagram (a figure that branches from a single root) "genealogical tree"
<sp33chy> Noun (3) S: (n) Tree, Sir Herbert Beerbohm Tree (English actor and theatrical producer noted for his lavish productions of Shakespeare (1853-1917))
<sp33chy> Verb (1) S: (v) corner, tree (force a person or an animal into a position from which he cannot escape)
<sp33chy> Verb (2) S: (v) tree (plant with trees) "this lot should be treed so that the house will be shaded in summer"
<sp33chy> Maximum limit of 5 reached..refine search to see more.
<sp33chy> tree: Noun 3; Verb 4 @ http://wordnetweb.princeton.edu/perl/webwn?s=tree

<speechles> !dict --all1 egg
<sp33chy> Noun (1) S: (n) egg (animal reproductive body consisting of an ovum or embryo together with nutritive and protective envelopes; especially the thin-shelled reproductive body laid by e.g. female birds)
<sp33chy> Verb (1) S: (v) egg (throw eggs at)
<sp33chy> egg: Noun 3; Verb 2 @ http://wordnetweb.princeton.edu/perl/webwn?s=egg
Try it out HERE and let me know what you think. There are bound to be bugs, but for the most part I tried to make it robust as possible. There are settings within the config to control a few things. Enjoy and have a fun... ;)
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Post by holycrap »

You guys are just the greatest! Thanks much for your time! :D

I would like to report some bugs and requests.

1. I keep getting this:
"Tcl error [incith::dictionary::public_message]: wrong # args: should be "puthelp text ?options?""

2. Can you remove the "S:" before every result?

3. Anything besides the definition, "notice" the user instead of messaging the channel. For example: no results found, null input, or anything else that's not the definition.

Thanks!

:D
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

holycrap wrote:You guys are just the greatest! Thanks much for your time! :D

I would like to report some bugs and requests.

1. I keep getting this:
"Tcl error [incith::dictionary::public_message]: wrong # args: should be "puthelp text ?options?""

2. Can you remove the "S:" before every result?

3. Anything besides the definition, "notice" the user instead of messaging the channel. For example: no results found, null input, or anything else that's not the definition.

Thanks!

:D
#1. Weird, none of the puthelp's are done incorrectly... I've tripled checked them all.
#2. Done. Let me know if this works for you.
#3. Done. Everything non 'definition' is now noticed to the user.

Also, how does the switching system it uses work for you? The --noun1-5 kind of stuff?

Get the modified version here. Most important, HAVE A PHUN :D
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Post by holycrap »

Thanks for the quick response.

The error is gone so is the "S:".

I found the switch confusing and most of the users do as well.

Here is a simple suggestion.

1.

<user>!define help
<bot> (n) aid ...definition continues...
-bot- help: noun 4; verb 8 "this is noticeed and bold what is needed to search, adjective, and adverb"

That would be all they would see. Then:

<user>!define n2 help
<bot>[n 2/4]"would show the 2nd definition of help for noun"

or

<user!define v6 help
<bot>[v 6/8]"would show the 6th definition of help for verb"

Basically, it shows one output at a time and they can jump into the next one if they choose to.

2.

If !define "null"
-bot- !define [n/v/adj/adv]result <word>

For "all" it will show the variablemax set in the config file. Exe: !define adjall red "will show definition of all red in adjective" if !define nall red "will show definition of all red in noun"

This is a hefty/detailed request, but I have faith in you. Oh, yes, please, anything besides the definition is "notice". :)

Thanks!

:D
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Well.. I've taken into consideration the things you mentioned and figured, that perhaps there would be even more problems. That being said, I've added an overwhelming amount of configuration into the script. Most of it is quite basic and is merely overall cosmetic templates, basically you can tailor all of the output to look however you like. I've changed the behavior of direct index now as well. Before if you used --noun6, you got 6 noun definitions. Now if you use --noun6 you get the sixth noun definition only. You can still use ranges --verb2-3 and see just those sections. You can also now do --allall, which basically says yeah, you want to see all sections and all results. Also.. this is the best part, the switch, that -- is no longer hard coded. You can make it ~ or $ or even get rid of it entirely, the script will still work just fine. If you find something you cannot customize it is probably a short coming of the website this script scrapes more-so than this scripts fault.

If you want to try it out, click the link below let me know what you think. ;)
Incith Tribute: Incith-Dictionary v1.2

Enjoy holycrap ;)
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Post by holycrap »

This is just way too awesome! It's everything that I was looking for and more. Thank you so much for this wonderful present! Please upload this script to the archive so others can enjoy it as well.

Have a wonderful xmas, speechles!

Thanks again!

:D
s
sk-4
Halfop
Posts: 51
Joined: Sat Oct 06, 2007 6:37 am

Post by sk-4 »

im getting error in script

<+sk4> !dict love
Tcl error [incith::dictionary::public_message]: can't read "state(body)": no such variable
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

sk-4 wrote:im getting error in script

<+sk4> !dict love
Tcl error [incith::dictionary::public_message]: can't read "state(body)": no such variable
Yep.. I neglected to script any kind of socket/timeout detection for some reason :?. The real problem is the website isn't connecting which creates a situation where the http package cannot retrieve the body of the html. The error you are seeing happens the instant the script attempts to do anything with the unretrieved body. I'll script up some kind of error detection for these later on tonight. ;)
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Post by holycrap »

Please don't change to a different site. I think it's cause the holiday and they shut down their server or something.

:D
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

holycrap wrote:Please don't change to a different site. I think it's cause the holiday and they shut down their server or something.

:D
Correct you are. It's working properly once again. But for those times when this does happen again. The script will now detect both socket and timeout errors and new config displays are added for these allowing you to customize those messages as well.

Incith:Dictionary v1.3
This one should be perfect ;)
User avatar
incith
Master
Posts: 275
Joined: Sat Apr 23, 2005 2:16 am
Location: Canada

Post by incith »

speechles wrote:Incith:Dictionary v1.3
This one should be perfect ;)
I learned to stop saying that ages ago my friend. It will never be perfect. It will always break. Someone will want something, so on and so forth.

P.S. Thank you for attaching my name to yet another script :P
Post Reply