Author Topic: Said String Generator  (Read 9790 times)

0 Members and 1 Guest are viewing this topic.

Offline gumby

Said String Generator
« on: December 15, 2010, 07:39:15 PM »
Okay, it's on.  I've scrapped my current tool (which generates all possible permutations of a user inputted string into said() statements) and I've moved on.

My current endeavor is to accept a 'user input' string, like 'drop the scepter off the cliff'.  The application would look up all the inputted words in the vocabulary to determine parts of speech, then run them through the rules located in the 'black box'... and out will pop the appropriate Said() string, ready for you to plug into the code for your game. 

It will also support 'batch processing', accepting input from a file, so you can load up multiple user input strings in there.


In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline Collector

Re: Said String Generator
« Reply #1 on: December 15, 2010, 08:53:23 PM »
That sounds like a real time and drudgery saving tool.
KQII Remake Pic

Offline gumby

Re: Said String Generator
« Reply #2 on: December 24, 2010, 10:41:16 AM »
Update:

I've got the user-input parsing working properly & generating a parse tree.  But, I just hit a speedbump - and I should have seen it sooner.  The process described in the documentation is this:

1.  Parse the user input string (example: 'take troll to game')
2.  Parse the said string (example: take<to/troll/game )
3.  Match the user input parse tree to the said string parse tree.

Which is all fine.  However, a user input string can match multiple said strings (I wish I had some examples here, but I certainly saw it with my work on generating all possible permutations of said strings).  And I'm not just referring to 'optional' words - like in this case 'to', or adjectives.  The documentation is based on having some said() string that is being evaluated for a match to a particular user input - something I do not have & am trying to generate.

EDIT:  I may be wrong about this. Perhaps I need to walk my semantically parsed input string through the said() parse tree...

I can probably plow ahead & come up with something that works properly, but my approach may have to change.
« Last Edit: December 24, 2010, 10:53:01 AM by gumby »
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline gumby

Re: Said String Generator
« Reply #3 on: December 24, 2010, 01:03:34 PM »
I've totally re-thought this.  I will retain the parsing of the input string to validate that we are not wasting our time attempting to build something invalid, but I'm going to assemble the said() without using the said spec.

I think I can do it with just a few rules:

Steps:
1.  Dissect user input into parts of speech.
2.  Collapse consecutive nouns & adjectives - last noun leads.  Subject or subject & suffix if we have 2 sets of noun/adj sets.
3.  Pair adverbs & prepositions with the verb - verb leads.  Predicate part.  Preposition indicates a (possible) split between subject & suffix.

Additional conditions:
1.  If multiple parts of speech are defined for a word, we need to set an order of precedence & resolve it to a single part of speech
2.  If specified, articles can be discarded?

Precedence:
1.  Nouns take precedence over prepositions (as in 'of')
2.  Verbs take precedence over nouns (maybe only if there are no other verbs specified in input?)

Examples:
1. 'quickly play short game of checkers again' => adverb/verb/adj/noun/noun/noun/adverb (note that 'of' is being treated as noun)
2  Subject = checkers < short < game < of
3. Predicate = play < quickly < again
4. Assemble:  Predicate/Subject =  play < quickly < again / checkers < short < game < of

1. 'give food to dog' => verb/noun/prep/noun
2a. Subject = food
2b. Suffix = dog
3. Predicate = give < to
4. Assemble: Predicate/Subject/Suffix = give < to / food / dog

« Last Edit: December 24, 2010, 01:05:28 PM by gumby »
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline gumby

Re: Said String Generator
« Reply #4 on: December 25, 2010, 10:19:41 PM »
Rule update:  an article also acts like a preposition in step 3.  It will separate a subject from a suffix.
« Last Edit: December 25, 2010, 11:11:38 PM by gumby »
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline gumby

Re: Said String Generator
« Reply #5 on: December 26, 2010, 01:08:53 PM »
Another rule:  The first imperative verb found is the only one allowed in the input.  Any other imp. verb found must be a different word class.
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline gumby

Re: Said String Generator
« Reply #6 on: December 26, 2010, 04:25:56 PM »
Here it is.  It's (once again) a Perl script, which I've also compiled into an executable.  I've tested this against variations of from the 'comprehensive said() string examples' in our how-to against a stock vocab file from a template game.  

Oh, I made one change to the 'stock vocab' file - made 'of' a noun (as well as a preposition).  The vocab file I used for developing/testing is also included.

It's all 'batch process' oriented - I didn't think that it made sense to allow for interactive input of user strings.  Input is provided from 'userInputs.txt' file - I've included the sample I was testing against as well.  The output is to screen & to a file 'saidStrings.txt'.

The application also verifies that the input string can be successfully parsed by the vocab.900 (the 'black box') and that all words are in the vocabulary before attempting to generate a Said() string.

I'm sure there are some 'valid' user inputs that this tool cannot handle (especially regarding words that have multiple word classes & the 'special' word classes).  I'd appreciate feedback (and additional testing)!

http://www.mediafire.com/?4zpnyy3f7gai3qu

Hopefully we can get this hosted here & in our wiki?


EDIT:  Ha, the compilation process failed to include a dependency, so I've fixed it and now it's hosted on our wiki:  http://www.sierrahelp.com/SCI/Wiki/index.php?title=SCI_Resource_Utilities#Gumby.27s_SCI_Tools
« Last Edit: December 27, 2010, 02:05:17 PM by gumby »
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline MusicallyInspired

Re: Said String Generator
« Reply #7 on: December 26, 2010, 06:03:34 PM »
Nice! I'll try and find time in the next few weeks to put some practice on this baby.
Brass Lantern Prop Competition

Offline Collector

Re: Said String Generator
« Reply #8 on: December 26, 2010, 08:51:06 PM »
I could create an FTP account on SHP for you to upload all of the tools you are working on and then you can make a page for them on the Wiki's Tools section and link to them.
KQII Remake Pic

Offline gumby

Re: Said String Generator
« Reply #9 on: December 26, 2010, 08:56:18 PM »
I could create an FTP account on SHP for you to upload all of the tools you are working on and then you can make a page for them on the Wiki's Tools section and link to them.
Sure, I don't mind doing the uploading & linking into the Wiki.  Let me know & I'll go to town.
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline Collector

Re: Said String Generator
« Reply #10 on: December 26, 2010, 10:20:20 PM »
Login and link info in a PM to you on SHP.
KQII Remake Pic

Offline gumby

Re: Said String Generator
« Reply #11 on: December 28, 2010, 01:35:02 PM »
Made another update to the application.  Now word suffixes are supported.  I've re-uploaded it to the wiki.
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline Collector

Re: Said String Generator
« Reply #12 on: December 28, 2010, 02:38:42 PM »
If all of the links go to your folder, you can maintain it yourself.
KQII Remake Pic

Offline gumby

Re: Said String Generator
« Reply #13 on: December 28, 2010, 02:50:47 PM »
If all of the links go to your folder, you can maintain it yourself.
Yeah, I think you might have skimmed my last post.  I was able to re-upload it to the wiki,..
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline Collector

Re: Said String Generator
« Reply #14 on: December 28, 2010, 04:31:22 PM »
No, I caught that. I was more or less just "thinking aloud" because that is not where I would keep it if I were maintaining it.
KQII Remake Pic


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.068 seconds with 23 queries.