Open Lguyogiro opened 5 years ago
I wasn't able to solve it using the exact syntax in the tutorial, but this worked for me:
(rule $Expr ($PHRASE) (IdentityFn))
(rule $Operator (length of) (ConstantFn (lambda x (call .length (var x)))))
(rule $Expr ($Operator $Expr) (JoinFn forward))
Note that you should also have added all the other grammar rules that come prior to Exercise 2.1 in the tutorial.
Thank you very much for your help @brinaseidel ! Using your solution, I was able to get it working following the tutorial's recommended syntax with just adding the following:
(rule $Function (length of) (ConstantFn (lambda x (call .length (var x)))))
(rule $Expr ($Function $PHRASE) (JoinFn forward))
So my attempt above was missing the ConstantFn
in the first rule.
I will leave this issue open for now as I still think it would be valuable to have the solutions provided along with the tutorial.
@brinaseidel I am getting this error while running the Sempre for songs domain.
Exception in thread "main" java.lang.NumberFormatException: For input string: "lazy" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043) at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110) at java.lang.Double.parseDouble(Double.java:538) at fig.basic.OptInfo.interpretValue(OptionsParser.java:179) at fig.basic.OptInfo.set(OptionsParser.java:344) at fig.basic.OptionsParser.parse(OptionsParser.java:771) at fig.exec.Execution.init(Execution.java:212) at fig.exec.Execution.runWithObjArray(Execution.java:330) at fig.exec.Execution.run(Execution.java:325) at edu.stanford.nlp.sempre.Main.main(Main.java:50) Command failed: fig/bin/qcreate java -ea -Dmodules=core,overnight -Xms8G -Xmx10G -cp libsempre/:lib/ edu.stanford.nlp.sempre.Main --execDir _OUTPATH
That looks like an issue with command line option parsing. Could you provide (1) the full command and (2) the expanded command (the first line that run
prints after running the command)?
It would be great if possible solutions to the tutorial exercises were included. I'm aware that there are likely many possible solutions to a given exercise, but It would be helpful to have at least one correct solution when working through the tutorial.
In my case specifically, I haven't been able to follow the hints for exercise 2.1 to produce rules that can parse utterances into the category $Expr, since it isn't clear to me how to reference and apply the $FUNCTION type. My best attempts, which do not seem to work, are the following: