How to test NPC Parser: Difference between revisions

Content deleted Content added
imported>MartinFuchs
mNo edit summary
imported>MartinFuchs
No edit summary
Line 1:
{{Navigation for Stendhal Top|Contributing}}
{{Navigation for Stendhal Contributors}}
 
 
{{Stendhal Quests}}
Line 10 ⟶ 9:
 
[[Image:npc parser testenv.png]]
 
 
You can launch the dialog with the script "runpte.sh" on Unix/Mac and with "runbte.bat" on windows. This will compile the server and tools part, then launch the Java dialog. It may be even easier or you to run it directly from Eclipse by launching the class games.stendhal.tools.npcparsertestenv.TestEnvDlg .
 
The dialog displays how the conversation parser interprets user input and gives a hint about not yet known words. You can choose one of the predefined example sentences or write your own text into the input field. This way you can design the NPC conversations and test how the parser reacts on user input. CurrentlyYou thecan mostsee importanthow outputthe forparser developersinterprets maythe text, berecognizes the "trigger"words fieldand inmerges thethem rightto bottomlonger ofexpressions. theEach upperexpression "Sentence"is sectionassigned ofan theexpression windowtype like OBJect, SUBject, VERb or ADJective. LookingIf atthe thisparser youdiscovers canany seeunknown whichwords, the triggersurrounding expression is evaluateddisplayed fromin userred input,color. wordYou listshould andadd grammarthese rules.new Thiswords isto usedthe forword matchinglist "words.txt", located in the finitpackage state"games.stendhal.server.entity.npc.parser" machine.
 
In the right window section there are visible the fields Subject, Object, Verb, ... . If the expression type is unique in the sentence, you can immediately see the respective expressions. Otherwise you see the number of expression types.
 
Currently the most important output for developers may be the "trigger" field in the right bottom of the upper "Sentence" section of the window. Looking at this you can see which trigger expression is evaluated from user input, word list and grammar rules. This is used for matching in the finite state machine.
 
In the "Matching" section located at the bottom of the window you can select an expression type and enter a matching expression. After activating "test match" you see if the user input in the upper section matches the expression in the lower section.