diff --git a/api/src/data/entities/amr.clj b/api/src/data/entities/amr.clj index e79f9866b..b0ce83d4e 100644 --- a/api/src/data/entities/amr.clj +++ b/api/src/data/entities/amr.clj @@ -14,7 +14,7 @@ :syntax (for [instance syntax] (reduce-kv (fn [m k v] (assoc m k (cond-> v - (not (contains? #{:value :role :roles} k)) + (not (contains? #{:value :role :roles :ret} k)) (keyword)))) {} (into {} instance)))}) diff --git a/api/test/api/end_to_end_test.clj b/api/test/api/end_to_end_test.clj index 5ff51c4c0..cd5738fd9 100644 --- a/api/test/api/end_to_end_test.clj +++ b/api/test/api/end_to_end_test.clj @@ -11,6 +11,10 @@ :name "cut" :phrases ["cut"] :partOfSpeech :VB}) + (dictionary/create-dictionary-item {:key "at-location" + :name "at-location" + :phrases ["arena" "place" "venue"] + :partOfSpeech :NOUN}) (f)) (use-fixtures :each fixtures/clean-db prepare-environment) @@ -64,8 +68,8 @@ (deftest ^:integration authorship-document-plan-bulk-generation (let [data {"9780307743657" {:title "The Shinning" :author "Stephen King"} - "9780575099999" {:title "Horns" :author "Joe Hill"} - "9780099765219" {:title "Fight Club" :author "Chuck Palahniuk"}} + "9780575099999" {:title "Horns" :author "Joe Hill"} + "9780099765219" {:title "Fight Club" :author "Chuck Palahniuk"}} {{result-id :resultId} :body status :status} (generate-bulk "authorship" data)] (is (= 200 status)) (is (some? result-id)) @@ -221,3 +225,15 @@ (is (= 200 status)) (is (some? result-id)) (is (= #{"Computers book."} (-> result-id (get-variants) :sample))))) + +(deftest ^:integration location-amr-plan-generation + (let [{{result-id :resultId} :body status :status} (generate "location-amr" "books.csv")] + (is (= 200 status)) + (is (some? result-id)) + (is (= #{"In the city centre there is a place Alimentum." + "In the city centre there is a venue Alimentum." + "In the city centre there is an arena Alimentum." + "There is a place in the city centre Alimentum." + "There is a venue in the city centre Alimentum." + "There is an Alimentum in the city centre." + "There is an arena in the city centre Alimentum."} (-> result-id (get-variants) :sample))))) diff --git a/api/test/resources/document_plans/location-amr.edn b/api/test/resources/document_plans/location-amr.edn index f544cab1d..4ffd4cda9 100644 --- a/api/test/resources/document_plans/location-amr.edn +++ b/api/test/resources/document_plans/location-amr.edn @@ -1,12 +1,12 @@ {:type "Document-plan" :segments [{:children [{:roles [{:children [{:type "Quote" :srcId "uf:[gtVTc!uQe%WeEy${" - :text "Alimentum"}] - :name "name"} + :text "city centre"}] + :name "objectref"} {:children [{:type "Quote" :srcId "#UU2hr35[NTazfg6d7JV" - :text "city centre"}] - :name "location"}] + :text "Alimentum"}] + :name "locationdata"}] :dictionaryItem {:name "at-location" :type "Dictionary-item" :srcId "5SgtK-{hj)?WV7+(Y=o." diff --git a/api/test/resources/grammar/concept-net/at-location.yaml b/api/test/resources/grammar/concept-net/at-location.yaml new file mode 100644 index 000000000..847490f8e --- /dev/null +++ b/api/test/resources/grammar/concept-net/at-location.yaml @@ -0,0 +1,19 @@ +members: + - place + - venue + - arena +roles: + - objectRef + - locationData +frames: + - example: There is a place in the city center, KFC + syntax: + - type: gf + value: atLocation + roles: + - objectRef + - locationData + ret: + - N + - N + - N diff --git a/api/test/resources/grammar/default.yaml b/api/test/resources/grammar/default.yaml index 5560b48d7..070e2f79d 100644 --- a/api/test/resources/grammar/default.yaml +++ b/api/test/resources/grammar/default.yaml @@ -6,3 +6,4 @@ includes: - library/genre.yaml - other/cut.yaml - other/see.yaml + - concept-net/at-location.yaml diff --git a/core/gf/concept-net/ConceptNet.gf b/core/gf/concept-net/ConceptNet.gf deleted file mode 100644 index 6c441e663..000000000 --- a/core/gf/concept-net/ConceptNet.gf +++ /dev/null @@ -1,8 +0,0 @@ -abstract ConceptNet = { - flags startcat = Message; - - cat Message; - - fun AtLocation : Message; - fun HasProperty: Message; -} \ No newline at end of file diff --git a/core/gf/concept-net/ConceptNetEng.gf b/core/gf/concept-net/ConceptNetEng.gf index 5c4d9510b..ebd15eb34 100644 --- a/core/gf/concept-net/ConceptNetEng.gf +++ b/core/gf/concept-net/ConceptNetEng.gf @@ -1,3 +1,35 @@ -concrete ConceptNetEng of ConceptNet = ConceptNetI with - (Syntax = SyntaxEng), - (LexConceptNet = LexConceptNetEng); \ No newline at end of file +resource ConceptNetEng = open SyntaxEng, ParadigmsEng, UtilsEng in { + + oper -- atLocation + SS : Type = {s : Str} ; + + -- There is a place in the LOCATION + placeInLocation : N -> N -> N -> SS = + \locationDictionary,locationData,objectRef -> + (mkUtt (mkThereIsAThing (mkCN locationDictionary (mkInAdv locationData)) objectRef)) ; + + -- In the LOCATION there is a place + inLocationPlace : N -> N -> N -> SS = + \locationDictionary,locationData,objectRef -> + (mkUtt (mkS (mkInAdv locationData) (mkS presentSimTemp positivePol (mkThereIsAThing locationDictionary objectRef)))) ; + + -- VENUE in the LOCATION + venueInLocation : N -> N -> N -> SS = + \locationDictionary,locationData,objectRef -> + (mkUtt (mkThereIsAThing objectRef (mkInAdv locationData))) ; + + atLocation : N -> N -> N -> SS = + \lexicon,arg0,arg1 -> + ((placeInLocation lexicon arg0 arg1) | (inLocationPlace lexicon arg0 arg1) | (venueInLocation lexicon arg0 arg1)) ; + + oper -- hasProperty + + itHas : A -> N -> SS = + \propertyName,object -> + (mkS presentSimTemp positivePol (mkCl (mkNP object) propertyName)) ; + + hasProperty : A -> N -> SS = + \lexicon,arg0 -> + (mkUtt (itHas lexicon arg0)) ; + +} \ No newline at end of file diff --git a/core/gf/concept-net/ConceptNetI.gf b/core/gf/concept-net/ConceptNetI.gf deleted file mode 100644 index 79913eafe..000000000 --- a/core/gf/concept-net/ConceptNetI.gf +++ /dev/null @@ -1,6 +0,0 @@ -incomplete concrete ConceptNetI of ConceptNet = open Syntax, LexConceptNet in { - lincat Message = Utt ; - - lin AtLocation = atLocation; - lin HasProperty = hasProperty; -} \ No newline at end of file diff --git a/core/gf/concept-net/DictConceptNet.gf b/core/gf/concept-net/DictConceptNet.gf deleted file mode 100644 index 41aa49876..000000000 --- a/core/gf/concept-net/DictConceptNet.gf +++ /dev/null @@ -1,6 +0,0 @@ -interface DictConceptNet = open Syntax in { - oper - locationDictionary : Str; - locationData: Str; - objectRef: Str; -} \ No newline at end of file diff --git a/core/gf/concept-net/DictConceptNetEng.gf b/core/gf/concept-net/DictConceptNetEng.gf deleted file mode 100644 index a22611fb0..000000000 --- a/core/gf/concept-net/DictConceptNetEng.gf +++ /dev/null @@ -1,5 +0,0 @@ -instance DictConceptNetEng of DictConceptNet = open SyntaxEng, ParadigmsEng in { - oper objectRef = "[VENUE_NAME_ARG]"; - oper locationData = "[LOCATION_ARG]"; - oper locationDictionary = "place" | "venue" | "arena"; -} \ No newline at end of file diff --git a/core/gf/concept-net/LexConceptNet.gf b/core/gf/concept-net/LexConceptNet.gf deleted file mode 100644 index 84d3b7483..000000000 --- a/core/gf/concept-net/LexConceptNet.gf +++ /dev/null @@ -1,5 +0,0 @@ -interface LexConceptNet = open Syntax in { - oper - atLocation: Utt; - hasProperty: Utt; -} \ No newline at end of file diff --git a/core/gf/concept-net/LexConceptNetEng.gf b/core/gf/concept-net/LexConceptNetEng.gf deleted file mode 100644 index b513c79c0..000000000 --- a/core/gf/concept-net/LexConceptNetEng.gf +++ /dev/null @@ -1,41 +0,0 @@ -instance LexConceptNetEng of LexConceptNet = open SyntaxEng, ParadigmsEng, UtilsEng, DictConceptNetEng in { - oper - - -- -- - -- At Location - -- -- - - objectRef_N = mkN objectRef; - locationData_N = mkN objectRef; - locationDictionary_N = mkN locationDictionary; - - -- There is a place in the LOCATION - place_in_location = - mkUtt (mkThereIsAThing (mkCN locationDictionary_N (mkInAdv locationData_N)) - objectRef_N); - - -- In the LOCATION there is a place - in_location_place = - mkUtt (mkS (mkInAdv locationData_N) - (mkS presentSimTemp positivePol - (mkThereIsAThing locationDictionary_N objectRef_N))); - - -- VENUE in the LOCATION - venue_in_location = - mkUtt (mkThereIsAThing objectRef_N - (mkInAdv locationData_N)); - - atLocation = place_in_location | in_location_place | venue_in_location; - - -- -- - -- Has Property - -- -- - - object_Pron = mkN "it"; - propertyValue = positivePol; - propertyName_A = mkA "[FF]"; - - itHas = mkS presentSimTemp propertyValue (mkCl (mkNP object_Pron) propertyName_A); - - hasProperty = mkUtt itHas; -} \ No newline at end of file diff --git a/core/src/acc_text/nlg/gf/generator.clj b/core/src/acc_text/nlg/gf/generator.clj index dee098a2f..1d7b41ba8 100644 --- a/core/src/acc_text/nlg/gf/generator.clj +++ b/core/src/acc_text/nlg/gf/generator.clj @@ -53,16 +53,16 @@ (declare join-function-body) -(defn join-expression [expr] +(defn join-expression [expr ret] (if (sequential? expr) - (cond->> (join-function-body expr) + (cond->> (join-function-body expr ret) (< 1 (count expr)) (format "(%s)")) (let [{:keys [type value params]} expr] (case type - :literal (format "\"%s\"" (escape-string value)) + :literal (cond->> (format "\"%s\"" (escape-string value)) + (not= "Str" (second ret)) (format "(mk%s %s)" (second ret))) :function (format "%s.s" value) - :gf #_(format "%s.s" value) - (format "%s %s.s" value (str/join (interleave params (repeat " ")))))))) + :gf (format "(%s %s).s" value (str/join " " (map #(str % ".s") (filter some? params)))))))) (defn get-operator [expr next-expr] (when (some? next-expr) @@ -70,10 +70,10 @@ "|" "++"))) -(defn join-function-body [body] +(defn join-function-body [body ret] (str/join " " (map (fn [expr next-expr] (let [operator (get-operator expr next-expr)] - (cond-> (join-expression expr) + (cond-> (join-expression expr ret) (some? operator) (str " " operator)))) body (concat (rest body) [nil])))) @@ -84,7 +84,7 @@ (inc i) (str/join (interleave params (repeat " "))) (name (nth ret 0)) - (if (seq body) (join-function-body body) "\"\""))) + (if (seq body) (join-function-body body ret) "\"\""))) syntax)) (defn ->abstract [{::grammar/keys [module flags syntax]}] @@ -99,7 +99,7 @@ (format "concrete %s of %s = open %s in {%s\n}" (str (name module) (name instance)) (name module) - "LangFunctionsEng, ConceptNetEng" + "LangFunctionsEng, ConceptNetEng, SyntaxEng, ParadigmsEng" (join-body "param" (parse-param syntax) "lincat" (parse-lincat syntax) diff --git a/core/src/acc_text/nlg/gf/grammar/impl.clj b/core/src/acc_text/nlg/gf/grammar/impl.clj index 1a5882a1f..632dbefd0 100644 --- a/core/src/acc_text/nlg/gf/grammar/impl.clj +++ b/core/src/acc_text/nlg/gf/grammar/impl.clj @@ -15,7 +15,7 @@ (zipmap relations concepts))) (defn attach-selectors [m attrs] - (let [selectors (->> (keys attrs) (remove #{:pos :role :roles :value :type}) (select-keys attrs))] + (let [selectors (->> (keys attrs) (remove #{:pos :role :roles :ret :value :type}) (select-keys attrs))] (cond-> m (seq selectors) (assoc :selectors selectors)))) (defmulti build-function (fn [concept _ _ _] (:type concept))) @@ -28,21 +28,21 @@ :value (concept->name child-concept)}) :ret [:s "Str"]}) -(defmethod build-function :data [{value :value :as concept} _ _ _] +(defmethod build-function :data [{value :value :as concept} _ _ {types :types}] {:name (concept->name concept) :params [] :body [{:type :literal :value (format "{{%s}}" value)}] - :ret [:s "Str"]}) + :ret [:s (get types (concept->name concept) "Str")]}) -(defmethod build-function :quote [{value :value :as concept} _ _ _] +(defmethod build-function :quote [{value :value :as concept} _ _ {types :types}] {:name (concept->name concept) :params [] :body [{:type :literal :value value}] - :ret [:s "Str"]}) + :ret [:s (get types (concept->name concept) "Str")]}) -(defmethod build-function :dictionary-item [{value :value {name :name} :attributes :as concept} _ _ {dictionary :dictionary}] +(defmethod build-function :dictionary-item [{value :value {name :name} :attributes :as concept} _ _ {:keys [types dictionary]}] {:name (concept->name concept) :params [] :body (for [dict-value (let [dict-entry (get dictionary value)] @@ -50,7 +50,7 @@ (empty? dict-entry) (cons (or name value)))))] [{:type :literal :value dict-value}]) - :ret [:s "Str"]}) + :ret [:s (get types (concept->name concept) "Str")]}) (defmethod build-function :modifier [concept children relations _] (let [child-concept (get-child-with-role children relations :child) @@ -83,9 +83,9 @@ :value (get role-map role-key)} (= :gf type) {:type :gf :value value - :params - (cons (concept->name function-concept) (map role-map roles)) - #_(when function-concept (cons (concept->name function-concept) (map role-map roles)))} + :params (cond->> (map (comp role-map str/lower-case) roles) + (some? function-concept) + (cons (concept->name function-concept)))} (some? role) {:type :literal :value (format "{{%s}}" role)} (= pos :AUX) {:type :function @@ -126,12 +126,34 @@ :value (concept->name child-concept)}]) :ret [:s "Str"]}) +(defn find-types [concept-map relation-map {amr :amr}] + (reduce (fn [m {:keys [id value]}] + (let [relations (get relation-map id) + children (map (comp concept-map :to) relations) + function-concept (get-child-with-role children relations :function) + role-map (reduce (fn [m [{role :role {attr-name :name} :attributes} concept]] + (cond-> m + (and (not= :function role) + (some? attr-name)) (assoc (str/lower-case attr-name) (concept->name concept)))) + {} + (zipmap relations children)) + {:keys [ret roles]} (-> amr (get (keyword value)) (:frames) (first) (:syntax) (first))] + (cond-> m + (seq ret) (merge (zipmap (cond->> (map (comp role-map str/lower-case) roles) + (some? function-concept) + (cons (concept->name function-concept))) + ret))))) + {} + (filter #(= :amr (:type %)) (vals concept-map)))) + (defn build-grammar [module instance {::sg/keys [concepts relations]} context] #:acc-text.nlg.gf.grammar{:module module :instance instance :flags {:startcat (concept->name (first concepts))} :syntax (let [concept-map (zipmap (map :id concepts) concepts) - relation-map (group-by :from relations)] + relation-map (group-by :from relations) + type-map (find-types concept-map relation-map context) + context (assoc context :types type-map)] (map (fn [{id :id :as concept}] (let [relations (get relation-map id) children (map (comp concept-map :to) relations)] diff --git a/core/test/acc_text/nlg/gf/generator_test.clj b/core/test/acc_text/nlg/gf/generator_test.clj index 9ab74b7b4..c17b16f5f 100644 --- a/core/test/acc_text/nlg/gf/generator_test.clj +++ b/core/test/acc_text/nlg/gf/generator_test.clj @@ -9,16 +9,21 @@ (deftest ^:integration quote-cases (is (= ["He said: \"GO!\""] (let [semantic-graph (utils/load-test-semantic-graph "quote") - grammar (grammar/build :grammar :1 semantic-graph {})] + grammar (grammar/build :grammar :1 semantic-graph {})] (generate grammar))))) (deftest ^:integration at-location - (is (get (set (generate (grammar/build :AtLoc :1 (utils/load-test-semantic-graph "location-amr") - {:amr - {:at-location - {:frames - [{:examples ["There is a place in the city center"] - :syntax - [{:type :gf :value "AtLocation"}]}]}} - :dictionary {}}))) - "there is a [VENUE_NAME_ARG] in the [LOCATION_ARG]"))) + (is (= ["in the city centre there is a place Alimentum" + "in the city centre there is a venue Alimentum" + "in the city centre there is an arena Alimentum" + "there is a place in the city centre Alimentum" + "there is a venue in the city centre Alimentum" + "there is an Alimentum in the city centre" + "there is an arena in the city centre Alimentum"] + (generate (grammar/build :AtLoc :1 (utils/load-test-semantic-graph "location-amr") + {:amr {:at-location + {:frames [{:syntax [{:type :gf + :value "atLocation" + :roles ["objectRef" "locationData"] + :ret ["N" "N" "N"]}]}]}} + :dictionary {"at-location" ["arena" "place" "venue"]}}))))) diff --git a/core/test/acc_text/nlg/gf/grammar_test.clj b/core/test/acc_text/nlg/gf/grammar_test.clj index ad293b732..3167dc7e6 100644 --- a/core/test/acc_text/nlg/gf/grammar_test.clj +++ b/core/test/acc_text/nlg/gf/grammar_test.clj @@ -23,26 +23,31 @@ :ret [:s "Str"]} {:name "Amr03" :params ["DictionaryItem04" "Quote05" "Quote06"] - :body [[{:type :gf :value "AtLocation" + :body [[{:type :gf + :value "atLocation" :params ["DictionaryItem04" "Quote05" "Quote06"]}]] :ret [:s "Str"]} {:name "DictionaryItem04" :params [] :body [[{:type :literal :value "place"}] - [{:type :literal :value "venue"}]] - :ret [:s "Str"]} + [{:type :literal :value "venue"}] + [{:type :literal :value "arena"}]] + :ret [:s "N"]} {:name "Quote05" :params [] - :body [{:type :literal :value "Alimentum"}] - :ret [:s "Str"]} + :body [{:type :literal :value "city centre"}] + :ret [:s "N"]} {:name "Quote06" :params [] - :body [{:type :literal :value "city centre"}] - :ret [:s "Str"]}]} + :body [{:type :literal :value "Alimentum"}] + :ret [:s "N"]}]} (build-grammar "location-amr" - {:amr {:at-location {:frames [{:syntax [{:type :gf :value "AtLocation" :roles ["name" "location"]}]}]}} - :dictionary {"at-location" ["place" "venue"]}})))) + {:amr {:at-location {:frames [{:syntax [{:type :gf + :value "atLocation" + :roles ["objectRef" "locationData"] + :ret ["N" "N" "N"]}]}]}} + :dictionary {"at-location" ["arena" "place" "venue"]}})))) (deftest grammar-building (is (= #::grammar{:module :module @@ -115,7 +120,7 @@ :ret [:s "Str"]} {:body [[{:type :literal :value "{{co-Agent}}"} {:type :literal :value "is"} - {:type :literal :value "{{...}}" + {:type :literal :value "{{...}}" :selectors {:number :singular :tense :past}} {:type :literal :value "by"} {:type :literal :value "{{Agent}}"}]] diff --git a/core/test/resources/semantic_graphs/location-amr.edn b/core/test/resources/semantic_graphs/location-amr.edn index 91b2e5c5a..de42639fe 100644 --- a/core/test/resources/semantic_graphs/location-amr.edn +++ b/core/test/resources/semantic_graphs/location-amr.edn @@ -1,8 +1,8 @@ #:acc-text.nlg.semantic-graph{:relations [{:from :01 :to :02 :role :segment} {:from :02 :to :03 :role :instance} {:from :03 :to :04 :role :function} - {:from :03 :to :05 :role :ARG0 :attributes {:name "name"}} - {:from :03 :to :06 :role :ARG1 :attributes {:name "location"}}] + {:from :03 :to :05 :role :ARG0 :attributes {:name "objectref"}} + {:from :03 :to :06 :role :ARG1 :attributes {:name "locationdata"}}] :concepts [{:id :01 :type :document-plan} {:id :02 :type :segment} {:id :03 :type :amr :value "at-location"} @@ -10,5 +10,5 @@ :type :dictionary-item :value "at-location" :attributes {:name "at-location"}} - {:id :05 :type :quote :value "Alimentum"} - {:id :06 :type :quote :value "city centre"}]} \ No newline at end of file + {:id :05 :type :quote :value "city centre"} + {:id :06 :type :quote :value "Alimentum"}]} \ No newline at end of file diff --git a/eval/data/bleu-plan.json b/eval/data/bleu-plan.json index 751d13401..615118f57 100644 --- a/eval/data/bleu-plan.json +++ b/eval/data/bleu-plan.json @@ -4,6 +4,6 @@ "name": "BLEU", "uid": "bleu", "blocklyXml": "areanamedname=familyFriendlytruefamily friendlynot family friendly", - "documentPlan": "{\"type\":\"Document-plan\",\"segments\":[{\"children\":[{\"roles\":[{\"children\":[{\"name\":\"area\",\"type\":\"Cell\",\"srcId\":\"F*dqDsh#M_FB+1K=b`Ya\"}],\"name\":\"address\"}],\"type\":\"AMR\",\"srcId\":\"A~(pQhtH@(qj)GwSUCZ2\",\"conceptId\":\"at-location\"},{\"roles\":[{\"children\":[{\"name\":\"name\",\"type\":\"Cell\",\"srcId\":\"#-tf8Bs]cqG;g/VWe}2E\"}],\"name\":\"id\"}],\"dictionaryItem\":{\"type\":\"Quote\",\"srcId\":\"8K6p*to?*eXdVpi=T^_A\",\"text\":\"named\"},\"type\":\"AMR\",\"srcId\":\"Yzq-hXc_66(m4qd+fXju\",\"conceptId\":\"identified-as\"},{\"roles\":[{\"children\":[{\"type\":\"If-then-else\",\"conditions\":[{\"type\":\"If-condition\",\"thenExpression\":{\"type\":\"Quote\",\"srcId\":\"tX%s]z3!swngy`gx6N#k\",\"text\":\"family friendly\"},\"condition\":{\"type\":\"Value-comparison\",\"srcId\":\"`m*_c4}|{-=oTWB23$|H\",\"operator\":\"=\",\"value2\":{\"type\":\"Quote\",\"srcId\":\"85`u]W@`U!(-1tte9iKB\",\"text\":\"true\"},\"value1\":{\"name\":\"familyFriendly\",\"type\":\"Cell\",\"srcId\":\"EzN}#MqqdX6Y^_UL75Bo\"}}},{\"type\":\"Default-condition\",\"thenExpression\":{\"type\":\"Quote\",\"srcId\":\"sS_m-8Y93S?MosIC)])_\",\"text\":\"not family friendly\"}}],\"srcId\":\"=4vbQ~w]0SFA=QYOX?X@\"}],\"name\":\"hyponym\"}],\"type\":\"AMR\",\"srcId\":\"dP*Og|2R2ptk20OE6iMS\",\"conceptId\":\"is-a\"}],\"type\":\"Segment\",\"srcId\":\"lM#b^2*`!Rb@oqJ1wn)@\"}],\"srcId\":\"y+1TsXLUE]4ed[AfXSO^\"}" + "documentPlan": "{\"type\":\"Document-plan\",\"segments\":[{\"children\":[{\"roles\":[{\"children\":[{\"name\":\"area\",\"type\":\"Cell\",\"srcId\":\"F*dqDsh#M_FB+1K=b`Ya\"}],\"name\":\"address\"}],\"type\":\"AMR\",\"srcId\":\"A~(pQhtH@(qj)GwSUCZ2\",\"conceptId\":\"at-location-bleu\"},{\"roles\":[{\"children\":[{\"name\":\"name\",\"type\":\"Cell\",\"srcId\":\"#-tf8Bs]cqG;g/VWe}2E\"}],\"name\":\"id\"}],\"dictionaryItem\":{\"type\":\"Quote\",\"srcId\":\"8K6p*to?*eXdVpi=T^_A\",\"text\":\"named\"},\"type\":\"AMR\",\"srcId\":\"Yzq-hXc_66(m4qd+fXju\",\"conceptId\":\"identified-as\"},{\"roles\":[{\"children\":[{\"type\":\"If-then-else\",\"conditions\":[{\"type\":\"If-condition\",\"thenExpression\":{\"type\":\"Quote\",\"srcId\":\"tX%s]z3!swngy`gx6N#k\",\"text\":\"family friendly\"},\"condition\":{\"type\":\"Value-comparison\",\"srcId\":\"`m*_c4}|{-=oTWB23$|H\",\"operator\":\"=\",\"value2\":{\"type\":\"Quote\",\"srcId\":\"85`u]W@`U!(-1tte9iKB\",\"text\":\"true\"},\"value1\":{\"name\":\"familyFriendly\",\"type\":\"Cell\",\"srcId\":\"EzN}#MqqdX6Y^_UL75Bo\"}}},{\"type\":\"Default-condition\",\"thenExpression\":{\"type\":\"Quote\",\"srcId\":\"sS_m-8Y93S?MosIC)])_\",\"text\":\"not family friendly\"}}],\"srcId\":\"=4vbQ~w]0SFA=QYOX?X@\"}],\"name\":\"hyponym\"}],\"type\":\"AMR\",\"srcId\":\"dP*Og|2R2ptk20OE6iMS\",\"conceptId\":\"is-a\"}],\"type\":\"Segment\",\"srcId\":\"lM#b^2*`!Rb@oqJ1wn)@\"}],\"srcId\":\"y+1TsXLUE]4ed[AfXSO^\"}" } } diff --git a/grammar/all.yaml b/grammar/all.yaml index b633bdece..6397c1ddc 100644 --- a/grammar/all.yaml +++ b/grammar/all.yaml @@ -10,6 +10,8 @@ includes: - other/object-description.yaml - other/attribute-at.yaml - concept-net/at-location.yaml + - concept-net/at-location-bleu.yaml + - concept-net/has-property.yaml - concept-net/capable-of.yaml - concept-net/identified-as.yaml - concept-net/is-a.yaml diff --git a/grammar/concept-net/at-location-bleu.yaml b/grammar/concept-net/at-location-bleu.yaml new file mode 100644 index 000000000..e9e5e7000 --- /dev/null +++ b/grammar/concept-net/at-location-bleu.yaml @@ -0,0 +1,17 @@ +members: +roles: + - address +frames: + - example: There is a place in the city center + syntax: + - pos: LEX + value: "There" + - pos: AUX + - pos: DET + - pos: NP + value: "place" + - pos: ADP + value: "in" + - pos: DET + - pos: NP + role: address diff --git a/grammar/concept-net/at-location.yaml b/grammar/concept-net/at-location.yaml index b32342b99..847490f8e 100644 --- a/grammar/concept-net/at-location.yaml +++ b/grammar/concept-net/at-location.yaml @@ -1,13 +1,19 @@ members: - place + - venue + - arena roles: - - ARG0 - - ARG1 + - objectRef + - locationData frames: - example: There is a place in the city center, KFC syntax: - type: gf - value: AtLocation + value: atLocation roles: - - ARG0 - - ARG1 + - objectRef + - locationData + ret: + - N + - N + - N diff --git a/grammar/concept-net/has-property.yaml b/grammar/concept-net/has-property.yaml new file mode 100644 index 000000000..287ca02f1 --- /dev/null +++ b/grammar/concept-net/has-property.yaml @@ -0,0 +1,14 @@ +members: + - property +roles: + - object +frames: + - example: It has property + syntax: + - type: gf + value: hasProperty + roles: + - object + ret: + - A + - N