diff --git a/lib/haskell/natural4/src/LS/XPile/ExportTypes.hs b/lib/haskell/natural4/src/LS/XPile/ExportTypes.hs index d08ee6456..9c59d79bf 100644 --- a/lib/haskell/natural4/src/LS/XPile/ExportTypes.hs +++ b/lib/haskell/natural4/src/LS/XPile/ExportTypes.hs @@ -426,8 +426,9 @@ instance ShowTypesJson JSchemaExp where nest 4 (brackets (hsep (punctuate comma (map (dquotes . pretty) enums)))) )) showTypesJson (ExpTypeRecord tn fds) = - pprintJsonObj tn fds requiredFds - where requiredFds = "," <> nest 4 (showRequireds fds) + pprintJsonObj tn fds "" + -- "" + -- where requiredFds = "," <> nest 4 (showRequireds fds) pprintJsonObj :: (Pretty a, ShowTypesJson b) => a -> [b] -> Doc ann -> Doc ann pprintJsonObj key values final = diff --git a/lib/haskell/natural4/test/Testcases/LogicalEnglish/filter-nla-atoms-subbed/actual.le b/lib/haskell/natural4/test/Testcases/LogicalEnglish/filter-nla-atoms-subbed/actual.le new file mode 100644 index 000000000..283f11291 --- /dev/null +++ b/lib/haskell/natural4/test/Testcases/LogicalEnglish/filter-nla-atoms-subbed/actual.le @@ -0,0 +1,115 @@ +the target language is: prolog. + +the templates are: + *a some var* pred *a some var* 10, + *a number* <= *a number*, + *a date* is before *a date*, + *a date* is after *a date*, + *a date* is strictly before *a date*, + *a date* is strictly after *a date*, + *a class*'s *a field* is *a value*, + *a class*'s nested *a list of fields* is *a value*, + *a class*'s *a field0*'s *a field1* is *a value*, + *a class*'s *a field0*'s *a field1*'s *a field2* is *a value*, + *a class*'s *a field0*'s *a field1*'s *a field2*'s *a field3* is *a value*, + *a class*'s *a field0*'s *a field1*'s *a field2*'s *a field3*'s *a field4* is *a value*, + *a number* is a lower bound of *a list*, + *a number* is an upper bound of *a list*, + *a number* is the minimum of *a number* and the maximum of *a number* and *a number*, + the sum of *a list* does not exceed the minimum of *a list*, + *a number* does not exceed the minimum of *a list*. + + +% Predefined stdlib for translating natural4 -> LE. +the knowledge base lib includes: + a number <= an other number + if number =< other number. + + % Note: LE's parsing of [H | T] is broken atm because it transforms that + % into [H, T] rather than the Prolog term [H | T]. + + % a class's nested [] is a value. + + % a class's nested [a field | a fields] is a value + % if the class's the field is an other class + % and the other class's nested the fields is the value. + + a d0 is before a d1 + if d0 is a n days before d1 + and n >= 0. + + a d0 is strictly before a d1 + if d0 is a n days before d1 + and n > 0. + + a d0 is after a d1 + if d1 is before d0. + + a d0 is strictly after a d1 + if d1 is strictly before d0. + + % Nested accessor predicates. + a class's a field is a value + if field is different from name + and field is different from id + and a class0's name is class + or class0's id is class + and class0's field is value. + + a class's a field0's a field1 is a value + if class's field0 is a class0 + and class0's field1 is value. + + a class's a field0's a field1's a field2 is a value + if class's field0 is a class0 + and class0's field1 is a class1 + and class1's field2 is value. + + a class's a field0's a field1's a field2's a field3 is a value + if class's field0 is a class0 + and class0's field1 is a class1 + and class1's field2 is a class2 + and class2's field3 is value. + + a class's a field0's a field1's a field2's a field3's a field4 is a value + if the class's field0 is a class0 + and class0's field1 is a class1 + and class1's field2 is a class2 + and class2's field3 is a class3 + and class3's field4 is value. + + % Arithmetic predicates. + a number is an upper bound of a list + if for all cases in which + a X is in list + it is the case that + X is [a class, a field] + and class's field is a value + and number >= value + or number >= X. + + a number is a lower bound of a list + if for all cases in which + a X is in list + it is the case that + X is [a class, a field] + and class's field is a value + and number =< value + or number =< X. + + % number = min(x, max(y, z)) + a number is the minimum of a x and the maximum of a y and a z + if a m is the maximum of [y, z] + and number is the minimum of [x, m]. + + a number does not exceed the minimum of a list of numbers + if a min is the minimum of list of numbers + and number =< min. + + the sum of a list does not exceed the minimum of a other list + if a x is the sum of list + and x does not exceed the minimum of other list. + +the knowledge base rules includes: + subbed by something pred a some var 10 + if some var pred some var 10. \ No newline at end of file diff --git a/lib/haskell/natural4/test/Testcases/LogicalEnglish/filter-nla-atoms-subbed/config.yml b/lib/haskell/natural4/test/Testcases/LogicalEnglish/filter-nla-atoms-subbed/config.yml new file mode 100644 index 000000000..fb25fe855 --- /dev/null +++ b/lib/haskell/natural4/test/Testcases/LogicalEnglish/filter-nla-atoms-subbed/config.yml @@ -0,0 +1,2 @@ +description: "two conditions that are the same, except that one param in one condition got subbed by an atom / constant" +enabled: true \ No newline at end of file diff --git a/lib/haskell/natural4/test/Testcases/LogicalEnglish/filter-nla-atoms-subbed/expected.le b/lib/haskell/natural4/test/Testcases/LogicalEnglish/filter-nla-atoms-subbed/expected.le new file mode 100644 index 000000000..283f11291 --- /dev/null +++ b/lib/haskell/natural4/test/Testcases/LogicalEnglish/filter-nla-atoms-subbed/expected.le @@ -0,0 +1,115 @@ +the target language is: prolog. + +the templates are: + *a some var* pred *a some var* 10, + *a number* <= *a number*, + *a date* is before *a date*, + *a date* is after *a date*, + *a date* is strictly before *a date*, + *a date* is strictly after *a date*, + *a class*'s *a field* is *a value*, + *a class*'s nested *a list of fields* is *a value*, + *a class*'s *a field0*'s *a field1* is *a value*, + *a class*'s *a field0*'s *a field1*'s *a field2* is *a value*, + *a class*'s *a field0*'s *a field1*'s *a field2*'s *a field3* is *a value*, + *a class*'s *a field0*'s *a field1*'s *a field2*'s *a field3*'s *a field4* is *a value*, + *a number* is a lower bound of *a list*, + *a number* is an upper bound of *a list*, + *a number* is the minimum of *a number* and the maximum of *a number* and *a number*, + the sum of *a list* does not exceed the minimum of *a list*, + *a number* does not exceed the minimum of *a list*. + + +% Predefined stdlib for translating natural4 -> LE. +the knowledge base lib includes: + a number <= an other number + if number =< other number. + + % Note: LE's parsing of [H | T] is broken atm because it transforms that + % into [H, T] rather than the Prolog term [H | T]. + + % a class's nested [] is a value. + + % a class's nested [a field | a fields] is a value + % if the class's the field is an other class + % and the other class's nested the fields is the value. + + a d0 is before a d1 + if d0 is a n days before d1 + and n >= 0. + + a d0 is strictly before a d1 + if d0 is a n days before d1 + and n > 0. + + a d0 is after a d1 + if d1 is before d0. + + a d0 is strictly after a d1 + if d1 is strictly before d0. + + % Nested accessor predicates. + a class's a field is a value + if field is different from name + and field is different from id + and a class0's name is class + or class0's id is class + and class0's field is value. + + a class's a field0's a field1 is a value + if class's field0 is a class0 + and class0's field1 is value. + + a class's a field0's a field1's a field2 is a value + if class's field0 is a class0 + and class0's field1 is a class1 + and class1's field2 is value. + + a class's a field0's a field1's a field2's a field3 is a value + if class's field0 is a class0 + and class0's field1 is a class1 + and class1's field2 is a class2 + and class2's field3 is value. + + a class's a field0's a field1's a field2's a field3's a field4 is a value + if the class's field0 is a class0 + and class0's field1 is a class1 + and class1's field2 is a class2 + and class2's field3 is a class3 + and class3's field4 is value. + + % Arithmetic predicates. + a number is an upper bound of a list + if for all cases in which + a X is in list + it is the case that + X is [a class, a field] + and class's field is a value + and number >= value + or number >= X. + + a number is a lower bound of a list + if for all cases in which + a X is in list + it is the case that + X is [a class, a field] + and class's field is a value + and number =< value + or number =< X. + + % number = min(x, max(y, z)) + a number is the minimum of a x and the maximum of a y and a z + if a m is the maximum of [y, z] + and number is the minimum of [x, m]. + + a number does not exceed the minimum of a list of numbers + if a min is the minimum of list of numbers + and number =< min. + + the sum of a list does not exceed the minimum of a other list + if a x is the sum of list + and x does not exceed the minimum of other list. + +the knowledge base rules includes: + subbed by something pred a some var 10 + if some var pred some var 10. \ No newline at end of file diff --git a/lib/haskell/natural4/test/Testcases/LogicalEnglish/filter-nla-atoms-subbed/filter-nla-atoms-subbed.csv b/lib/haskell/natural4/test/Testcases/LogicalEnglish/filter-nla-atoms-subbed/filter-nla-atoms-subbed.csv new file mode 100644 index 000000000..95594dbf0 --- /dev/null +++ b/lib/haskell/natural4/test/Testcases/LogicalEnglish/filter-nla-atoms-subbed/filter-nla-atoms-subbed.csv @@ -0,0 +1,3 @@ +GIVEN,some var, +DECIDE,subbed by something,pred,some var,10, +IF,some var,pred,some var,10, \ No newline at end of file diff --git a/lib/haskell/natural4/test/Testcases/LogicalEnglish/filtering-will-not-remove-all-nlas-in-eq-class/actual.le b/lib/haskell/natural4/test/Testcases/LogicalEnglish/filtering-will-not-remove-all-nlas-in-eq-class/actual.le index 0972752e5..9e1e2c55b 100644 --- a/lib/haskell/natural4/test/Testcases/LogicalEnglish/filtering-will-not-remove-all-nlas-in-eq-class/actual.le +++ b/lib/haskell/natural4/test/Testcases/LogicalEnglish/filtering-will-not-remove-all-nlas-in-eq-class/actual.le @@ -1,7 +1,7 @@ the target language is: prolog. the templates are: - + *a add savings* bleh 100, *a number* <= *a number*, *a date* is before *a date*, *a date* is after *a date*, @@ -111,5 +111,5 @@ the knowledge base lib includes: and x does not exceed the minimum of other list. the knowledge base rules includes: - a total savings is 100 - if a add savings is 200. \ No newline at end of file + a total savings bleh 100 + if a add savings bleh 100. \ No newline at end of file diff --git a/lib/haskell/natural4/test/Testcases/LogicalEnglish/filtering-will-not-remove-all-nlas-in-eq-class/expected.le b/lib/haskell/natural4/test/Testcases/LogicalEnglish/filtering-will-not-remove-all-nlas-in-eq-class/expected.le index 0972752e5..9e1e2c55b 100644 --- a/lib/haskell/natural4/test/Testcases/LogicalEnglish/filtering-will-not-remove-all-nlas-in-eq-class/expected.le +++ b/lib/haskell/natural4/test/Testcases/LogicalEnglish/filtering-will-not-remove-all-nlas-in-eq-class/expected.le @@ -1,7 +1,7 @@ the target language is: prolog. the templates are: - + *a add savings* bleh 100, *a number* <= *a number*, *a date* is before *a date*, *a date* is after *a date*, @@ -111,5 +111,5 @@ the knowledge base lib includes: and x does not exceed the minimum of other list. the knowledge base rules includes: - a total savings is 100 - if a add savings is 200. \ No newline at end of file + a total savings bleh 100 + if a add savings bleh 100. \ No newline at end of file diff --git a/lib/haskell/natural4/test/Testcases/LogicalEnglish/filtering-will-not-remove-all-nlas-in-eq-class/filtering-will-not-remove-all-nlas-in-eq-class.csv b/lib/haskell/natural4/test/Testcases/LogicalEnglish/filtering-will-not-remove-all-nlas-in-eq-class/filtering-will-not-remove-all-nlas-in-eq-class.csv index cda52fb9d..fb94598fc 100644 --- a/lib/haskell/natural4/test/Testcases/LogicalEnglish/filtering-will-not-remove-all-nlas-in-eq-class/filtering-will-not-remove-all-nlas-in-eq-class.csv +++ b/lib/haskell/natural4/test/Testcases/LogicalEnglish/filtering-will-not-remove-all-nlas-in-eq-class/filtering-will-not-remove-all-nlas-in-eq-class.csv @@ -1,4 +1,4 @@ GIVEN,total savings,IS A,Total Savings ,add savings,IS A,Add Savings -DECIDE,total savings,IS,100 -IF,add savings,IS,200 \ No newline at end of file +DECIDE,total savings,bleh,100 +IF,add savings,bleh,100 \ No newline at end of file