[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  Thesaurus plugin

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Thesaurus plugin
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please)
Maximum of 6000 characters. Text only please, no HTML.
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Lmclarke   (7 posts)  [Biography] bio
Date Sun 04 Mar 2012 08:19 PM (UTC)  quote  ]
Message
Ah! Thanks so much. It's working swimmingly.
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Sun 04 Mar 2012 06:40 PM (UTC)  quote  ]
Message
It's because of the sandbox. Read this:

http://www.gammon.com.au/security

You need to disable the sandbox to let it read files.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Lmclarke   (7 posts)  [Biography] bio
Date Sun 04 Mar 2012 06:55 AM (UTC)  quote  ]

Amended on Sun 04 Mar 2012 08:23 PM (UTC) by Lmclarke

Message
This is the only plugin I use terribly often, and I can't seem to get it to work since reinstalling MUSHclient on a new computer.

What I install the plugin:

[code]Run-time error
Plugin: Thesaurus (called from world: LAbN)
Function/Sub: OnPluginInstall called by Plugin Thesaurus
Reason: Executing plugin Thesaurus sub OnPluginInstall
[string "Plugin"]:4: Function 'io.input' disabled in Lua sandbox - see MUSHclient global preferences
stack traceback:
[C]: in function 'error'
[string "Sandbox"]:39: in function 'input'
[string "Plugin"]:4: in function <[string "Plugin"]:1>
Error context in script:
1 : function OnPluginInstall ()
2 : thes = {}
3 : local name = GetInfo (66) .. "mobythes.aur"
4*: thes_file = io.input (name)
5 : repeat
6 : local pos = thes_file:seek () --> where we are
7 : local line = thes_file:read () --> read a line
8 : if line then[/code]


The plugin is okayed in the Lua global preferences as per the initial post up there by Mr. Gammon. Thesaurus.xml is in the worlds/plugins folder, copied from the post above... And mobythes.aur is in the same folder as MUSHClient.exe.

I'm not sure what I've done wrong. Any help is appreciated!
[Go to top] top

Posted by Morat   (18 posts)  [Biography] bio
Date Tue 05 Jan 2010 04:23 AM (UTC)  quote  ]
Message
Thanks Nick! It's working fine now.
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Mon 04 Jan 2010 11:28 PM (UTC)  quote  ]
Message
Yes I can reproduce that. It seems that the download of the words is now a Macintosh format file (with line-endings being only 0x0D). That means that when it reads the file in, it does not find any line endings (usually, 0x0A).

To save posting a lengthy work-around (it is easy if you have a suitable conversion program), I have fixed the line-endings and made a copy available here:

http://www.gammon.com.au/files/mushclient/mobythes.zip

That is 8.8 Mb. You just need to unzip that and use the file in it (mobythes.aur).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Morat   (18 posts)  [Biography] bio
Date Mon 04 Jan 2010 10:31 AM (UTC)  quote  ]
Message
I can't get the thesaurus plugin to work.

Every word I lookup gives the word is not in the thesaurus msgbox.

Here is how I'm installing the plugin:

C:\Program Files\MUSHclient\mobythes.aur
C:\Program Files\MUSHclient\worlds\plugins\Thesaurus.xml

File > Global Preferences > Lua

trust_all_worlds = true
trust_all_plugins = true

File > Plugins > Add > Thesaurus.xml (see "Thesaurus loaded" message)
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Thu 12 Oct 2006 11:11 PM (UTC)  quote  ]

Amended on Mon 04 Jan 2010 11:31 PM (UTC) by Nick Gammon

Message
Below is a simple plugin that lets you access a Thesaurus from MUSHclient.

You need to find the actual thesaurus yourself, I used one from this page:

http://www.dcs.shef.ac.uk/research/ilash/Moby/mthes.html

If you download the file 'mthes.tar.Z' (and unzip it with WinZip or similar) you will find two files inside it. The one used in the plugin is 'mobythes.aur', which the plugin expects to find in the same directory as the MUSHclient.exe program. You can modify the plugin if you want to put the thesaurus file somewhere else.

[EDIT]

That file may not work if it has "Mac" line endings. If you have trouble with it, try this file:

http://www.gammon.com.au/files/mushclient/mobythes.zip (8.8 Mb)


When the plugin is loaded it reads the entire thesaurus file, building up an "index" of where each word is in the file. This takes about a second.

After that, you can lookup any word by typing "lookup word".

Or, you can type "lookup" on its own to be prompted for the word.

If the word is found, a listbox is presented showing all the words found in the thesaurus matching that word. If you select one and click OK it will be copied to the clipboard.

In order for the plugin to be able to use the Lua io table to do the reading of the file, you have to mark the plugin as "trusted" in the Global Preferences -> Lua, like this:


  local trusted_plugins = {
     [""] = "",            -- trust main script (ie. if no plugin running)
     ["03ca99c4e98d2a3e6d655c7d"] = "Chat",  
     ["982581e59ab42844527eec80"] = "Random_Socials", 
     ["4a267cd69ba59b5ecefe42d8"] = "Installer_sumcheck",  
     ["83beba4e37b3d0e7f63cedbc"] = "Reconnecter",   
     ["fed86e24fd1ed8a47d97ecb6"] = "Thesaurus",  --> add this line
     }  -- end of trusted_plugins 


This is the plugin, copy between the lines and save it as Thesaurus.xml, then install that using the Plugin installer under the File menu:


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Friday, October 13, 2006, 8:55 AM -->
<!-- MuClient version 3.80 -->

<!-- Plugin "Thesaurus" generated by Plugin Wizard -->

<muclient>
<plugin
   name="Thesaurus"
   author="Nick Gammon"
   id="fed86e24fd1ed8a47d97ecb6"
   language="Lua"
   purpose="Lookup a word in a thesaurus"
   date_written="2006-10-13 08:54:06"
   requires="3.80"
   version="1.0"
   >
<description trim="y">
<![CDATA[
Type:

lookup

or

lookup <word>

eg. 

lookup eat
]]>
</description>

</plugin>


<!--  Aliases  -->

<aliases>
  <alias
   match="^lookup( (?P&lt;word&gt;.*)){0,1}$"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>-- find the word they want
local word = "%&lt;word&gt;"

if #word == 0 then
  word = utils.inputbox ("Word to lookup in Thesaurus?", "Thesaurus")
end -- word not supplied

-- nil if dialog cancelled
if not word then
  return
end -- cancelled dialog

-- see if in index
local pos = thes [word:lower ()]

-- don't know that word?
if not pos then
  utils.msgbox ("The word '" .. word .. "' is not in the Thesaurus", "Not Found")
  return
end -- not found

-- seek to it in the main file
thes_file:seek ("set", pos)

-- read that line
local line = thes_file:read ()

-- convert into table
local t = utils.split (line, ",")

-- display in list box
local choice = utils.listbox (
  "Matching words for '" .. word .. 
  "'\\n\\nClick OK to copy to the clipboard", -- message
  "Thesaurus: " .. word,  -- title
  t)  -- table of words

if choice then
  SetClipboard (t [choice])
end -- if one chosen
</send>
  </alias>
</aliases>

<!--  Plugin help  -->

<aliases>
  <alias
   script="OnHelp"
   match="Thesaurus:help"
   enabled="y"
  >
  </alias>
</aliases>

<script>
<![CDATA[

function OnPluginInstall ()
thes = {}
local name = GetInfo (66) .. "mobythes.aur"
thes_file = io.input (name)
repeat
  local pos = thes_file:seek ()  --> where we are
  local line = thes_file:read ()  --> read a line
  if line then
    local w = string.match (line, "[^,]+")
    thes [w:lower ()] = pos
  end -- of having a line
until not line 

ColourNote ("white", "blue", "Thesaurus loaded")

end -- OnPluginInstall 

function OnHelp ()
  world.Note (world.GetPluginInfo (world.GetPluginID (), 3))
end
]]>
</script> 

</muclient>

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


5,222 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]