Spell Checker solutions and coding questions

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Spell Checker solutions and coding questions

Post by aliasmask »

I'm toying with the idea of having a MapTool spellchecker. It would be nice if there was a built in function, but that's not the case.

The Problem: Sentences with extra or missing spaces.
The Idea: Check the sentences for words and spell check remaining text to see if adding or removing a space makes a word.

I just did a little test where I put in a word list (~84000) and search it for a specific word and it was really fast.

Code: Select all

[frame("test"): {
   [H: index = getMacroIndexes("dictionary")]
   [H: result = listFind(getMacroCommand(index),"the")]
   [R: result]
}]
I did it this way to start because it's easy to manipulate the dictionary. I'll benchmark this vs putting it in to a token property and table entry.

My idea is to take a mashed up sentence and put spaces in to it. For example:

Code: Select all

Theceilingofthiscavernouschambervaultstoaheightofsixtyfeet.
In order to do this I will take the first letter and search db for it. If I get a result then I'll check it's rank for commonly used words. I'll then continue to check for longer words until I'm satisfied I have the most correct word and then add a space and go on to next letters. I'll probably have to create some exceptions or adjustments to ranking like for the really short words like A, I, AN... because they're common but the letters that follow probably make up the correct word or I can do a little back tracking if the next letters don't form a word.

So, I'm looking for other possible solutions, suggestions or insight. The reason? Cutting/Pasting from pdfs really screw up some of the text. I'd be even willing to use a 3rd party app if it can accomplish the same thing, but I looked and didn't really see anything.

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: Spell Checker solutions and coding questions

Post by Full Bleed »

You should hook up with Jamz and see if something like this can be built into the editor in his Nerps fork... which, presumably, will eventually make it into the official MT release.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Spell Checker solutions and coding questions

Post by wolph42 »

silly me, instead of quote I accidentily hit edit... here's my earlier message.

I can see the reason, had the same issue, what would be even more ideal is if you can also create and intelligent 'line' re-constructor. Usually when you copy paste from a pdf all lines are hard linebreak to make a column. These should all be removed and (sometimes) replaced by a space. Then the double linebreaks (usually paragraphs) should be replaced with a single one. I usually do this in notepad++ so you really see how the linebreaks are effecting the text. But would be nice to have it in MT.

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: Spell Checker solutions and coding questions

Post by JamzTheMan »

FYI: IF you wanted, my fork does include sendURL and getURL that you could use to send a payload (like a json or just raw text) and return the results. There probably is an online dictionary that could be used...

I will also check and see if rSyntax has this already which is what I'm using for the macro editor/syntax highlighting/search & replace...
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Spell Checker solutions and coding questions

Post by aliasmask »

Yeah, I may have to check out your build. sendURL and getURL could be a really powerful tool if it's what I think it is.

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: Spell Checker solutions and coding questions

Post by JamzTheMan »

It is and it is....

I use sendURL with a json payload to send XP and other info to my Slack channel via slack webhook ;)

Of course, you could externalize and get all sorts of data from d20pfsrd... and if you do that, let me know! (haven't had the time to make those fancy changes to my framework)

fyi: getURL just gets data from a URL, sendURL does a post but also returns response... You can look at my XP macro for examples on using it. (follow macro to sendToSlack lib function). (I've also used it to retrieve data from files on my google drive thru PHP)

https://drive.google.com/file/d/0B2c01Y ... otQ3M/view
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: Spell Checker solutions and coding questions

Post by Full Bleed »

JamzTheMan wrote:my fork does include sendURL and getURL that you could use to send a payload (like a json or just raw text) and return the results.
This sounds like a cool feature. Are there any inherent security risks with this?
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: Spell Checker solutions and coding questions

Post by JamzTheMan »

A rogue macro could spam? But giving the speed at which macro's run and can only run one at a time, I doubt it would be effective...

I've been meaning to add a whitelist/block/prompt for it and haven't had the time yet.
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

taustinoc
Dragon
Posts: 516
Joined: Mon Aug 03, 2015 6:30 pm

Re: Spell Checker solutions and coding questions

Post by taustinoc »

There's always the possibility of a vulnerability in Java, especially when there's a built in version that doesn't update itself. But that would require that the attacker a) Know you're using MapTool, and a version that includes it's own built-in Java, and b) compromise the web site that you're connecting to.

Seems like a pretty low risk to me, unless your players are a leet hackrz.

User avatar
RPTroll
TheBard
Posts: 3159
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: Spell Checker solutions and coding questions

Post by RPTroll »

I'm a big proponent of moving the send/getURL into MapTool but I'm not sure it will ever happen because of the assumed security risks associated with it. Seems like the whitelist idea would help mitigate some of the concerns and you could build in a throttle to keep from unintentional spamming.

Of course, I'm also a proponent of building a rudimentary web server into MapTool to present maps and chat via browser as well.
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

Post Reply

Return to “Macros”