xmoonproductions.org https://www.xmoonproductions.org/ |
|
Additional options in nlp*.txt files https://www.xmoonproductions.org/viewtopic.php?f=27&t=4038 |
Page 1 of 1 |
Author: | GoobyDoo [ Thu Aug 06, 2015 7:21 pm ] |
Post subject: | Additional options in nlp*.txt files |
Hi all, I'm new to the game and modding in general so bare with me. I'm looking to make changes to the nlp*.txt files to allow for the phrase "who is your master?" as the most detailed response I can see in trace.txt for it is: "who". Is it possible to add new options like the below in or are these set in the core code? Effectively I'm after adding form,actor,adj,tense. "qc_ac_have_adj_obj(have,*,*,*,*) : if (form),&1(actor),&2(adj),&3(object),&4(tense)" |
Author: | xpadmin [ Thu Aug 06, 2015 8:10 pm ] |
Post subject: | Re: Additional options in nlp*.txt files |
Yes that is possible. It does require some adds to the nlp. First add this to the "nlp_attr.txt": Code: #actor_attr = <master> : master This will create an actor attribute value for an actor. Then add this to the "nlp_obj_attr.txt": Code: ////////////////////////////////////////// // Actor who attribute ////////////////////////////////////////// #nquestion1 = <who * #qis * #qacattr> : ^qn_who_is_ac_attr(&1,present) #nquestion1 = <who * #qacattr * #qis> : ^qn_who_is_ac_attr(&0,present) #nquestion1 = <who * #qcan * be * #qacattr> : ^qn_who_is_ac_attr(&1,present) #nquestion1 = <who * #qcan * #qacattr * be> : ^qn_who_is_ac_attr(&1,present) #nquestion1 = <who * #qacattr * #qcan * be> : ^qn_who_is_ac_attr(&0,present) #nquestion1 = <who * #qwas * #qacattr> : ^qn_who_is_ac_attr(&1,past) #nquestion1 = <who * #qacattr * #qwas> : ^qn_who_is_ac_attr(&0,past) #nquestion1 = <who * is * been * #qacattr> : ^qn_who_is_ac_attr(&0,past) #nquestion1 = <who * is * #qacattr * been> : ^qn_who_is_ac_attr(&0,past) #nquestion1 = <who * #qacattr * is * been> : ^qn_who_is_ac_attr(&0,past) #nquestion1 = <who * #qhas * been * #qacattr> : ^qn_who_is_ac_attr(&1,past) #nquestion1 = <who * #qhas * #qacattr * been> : ^qn_who_is_ac_attr(&1,past) #nquestion1 = <who * #qacattr * #qhas * been> : ^qn_who_is_ac_attr(&0,past) #nquestion1 = <who * #qcan * have * been * #qacattr> : ^qn_who_is_ac_attr(&1,past) #nquestion1 = <who * #qcan * #qacattr * have * been> : ^qn_who_is_ac_attr(&1,past) #nquestion1 = <who * #qacattr * #qcan * have * been> : ^qn_who_is_ac_attr(&0,past) #nquestion1 = <who * #qcan * going * to * be * #qacattr> : ^qn_who_is_ac_attr(&1,future) #nquestion1 = <who * #qcan * #qacattr * going * to * be> : ^qn_who_is_ac_attr(&1,future) #nquestion1 = <who * #qacattr * #qcan * going * to * be> : ^qn_who_is_ac_attr(&0,future) #nquestion1 = <who * #qis * going * to * be * #qacattr> : ^qn_who_is_ac_attr(&1,future) #nquestion1 = <who * #qis * #qacattr * going * to * be> : ^qn_who_is_ac_attr(&1,future) #nquestion1 = <who * #qacattr * #qis * going * to * be> : ^qn_who_is_ac_attr(&0,future) This will create all sentences that use the 'who' question in combination with an actors attribute. They are not all needed but allow questions like: Who is going to be your master? Then add this to the "result.txt" (after qn_what_is_ac_attr): Code: qn_who_is_ac_attr(*,*,*) : get(form),&0(actor),&1(attr),&2(tense) This will create a result for the sentence. Now when you ask the question or similar one you get a good result for it. React on it by e.g. adding this to the "basic_ref_command.dat": Code: master.you.get = { talk.s = "You are {^gname}"; } Hope this helps |
Author: | GoobyDoo [ Thu Aug 06, 2015 8:18 pm ] |
Post subject: | Re: Additional options in nlp*.txt files |
Excellent, that is what I was aiming for. I've spent time over the past few days trying to get my head around how all the calls and files relate and have a rough idea of how everything relates although I obviously have little clue how much is actually done C++ side. The main bits that tripped me up were: * Whether the "qn_who_is_ac_attr" has to be a specific format or whether it's just set that way based on convention. * How the &0, &1, &2 are set and what values they relate to (Ie. are they the same for every result or are they relative to the calling question. * Whether there is a function that can be called for tracing/logging within the text files like Trace("") in the .dat files. |
Author: | xpadmin [ Thu Aug 06, 2015 8:41 pm ] |
Post subject: | Re: Additional options in nlp*.txt files |
Yes the nlp can be somewhat overwhelming at first. In retrospect it has a lot more options then are currently needed. * Whether the "qn_who_is_ac_attr" has to be a specific format or whether it's just set that way based on convention. In code like: Code: #nquestion1 = <who * #qcan * be * #qacattr> : ^qn_who_is_ac_attr(&1,present) the parameter &1 is the second parameter (it starts with &0). So in this case #qacattr is given to qn_who_is_ac_attr (#qcan or &0 is not used). Because #qacattr has two values (the #actor_s and the #actor_attr) the the total amount of parameters in qn_who_is_ac_attr is 3 (instead of 2 as it appears to have). Therefore the result code: Code: qn_who_is_ac_attr(*,*,*) : get(form),&0(actor),&1(attr),&2(tense) has 3 attributes to generate the result. In this case the first attribute is the actor, the second the attribute and the third is the tense. So the result is: get.actor.attr.tense or when used in a sentence get.you.master.present. * How the &0, &1, &2 are set and what values they relate to (Ie. are they the same for every result or are they relative to the calling question. See previous. * Whether there is a function that can be called for tracing/logging within the text files like Trace("") in the .dat files. In the trace.txt the result is traced when debug mode is on. Also see wiki for that. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |