diff --git a/lib/haskell/natural4/grammars/CustomSyntax.gf b/lib/haskell/natural4/grammars/CustomSyntax.gf index 4cafe558a..fc3928d5e 100644 --- a/lib/haskell/natural4/grammars/CustomSyntax.gf +++ b/lib/haskell/natural4/grammars/CustomSyntax.gf @@ -1,30 +1,34 @@ abstract CustomSyntax = Numeral , Grammar [ - N, N2, CN, UseN, NP, Det, DetCN, MassNP - , V, VV, V2, VS, VP - , A, A2, AP, AdjCN, PositA + N, N2, CN, PN, NP, UseN, ComplN2, UsePN, Num, NumSg, NumPl, Det, DetCN, MassNP + , V, VV, V2, VS, VP, UseV + , A, A2, AP, AdjCN, PositA, ComplA2 , Comp, Adv, VP, UseComp, CompNP, CompAP, CompAdv -- is a public agency , Prep, PrepNP, AdvVP - , AdA, AdAdv + , AdA, AdAdv, Card, CAdv, AdN, AdNum, AdnCAdv + , Dig, Digits, NumDigits, IDig, IIDig, D_0, D_1, D_2, D_3, D_4, D_5, D_6, D_7, D_8, D_9 , ListAdv, BaseAdv, ConsAdv, ConjAdv , ListAP, BaseAP, ConsAP, ConjAP , ListNP, BaseNP, ConsNP, ConjNP , ListS, BaseS, ConsS, ConjS - , S, QS, Conj + , S, QS, Conj, Subj, SubjS + , RS, RP, IdRP, RelCN ] , Structural [ Prep, to_Prep, for_Prep, from_Prep, on_Prep, before_Prep, after_Prep, possess_Prep , VV, must_VV + , AdN, CAdv, less_CAdv, more_CAdv, at_least_AdN, at_most_AdN + , Subj, because_Subj ] , Extend [ VPS, MkVPS, ListVPS, BaseVPS, ConsVPS, ConjVPS , VPI, MkVPI --, [VPI], BaseVPI, ConsVPI, ConjVPI , VP, Tense, Ant, Temp, Pol, Conj -- for VPS -- , GenRP -- nice to have in the future? - , ByVP - , S, PredVPS - , NP, GerundNP + , ByVP, N, CompoundN + , S, PredVPS, RelVPS + , NP, GerundNP, Num, GenModNP ] ** { ----------------------------------------------------------------------------- @@ -55,7 +59,9 @@ abstract CustomSyntax = MayHave : VP -> VPS ; -- getting "may have occurred" with pure RGL is a pain ReferenceNP : NP -> S ; -- it is NP — reference to a previous NP + WhileDoing : VP -> Adv ; -- while travelling in a public transport -- ExpletiveVP : VP -> S ; -- it is raining — dummy subject it (TODO: restrict usage of this and above from HS) + CNwhereS : CN -> NP -> VPS -> CN ; -- premise where school activities take place presAnt, -- has occurred presSimul, -- occurs @@ -68,6 +74,7 @@ abstract CustomSyntax = theSg : Det ; thePl : Det ; aSg : Det ; + aPl : Det ; your : Det ; about_Prep : Prep ; diff --git a/lib/haskell/natural4/grammars/CustomSyntaxChi.gf b/lib/haskell/natural4/grammars/CustomSyntaxChi.gf index 3d438b113..c6ae01f99 100644 --- a/lib/haskell/natural4/grammars/CustomSyntaxChi.gf +++ b/lib/haskell/natural4/grammars/CustomSyntaxChi.gf @@ -1,27 +1,31 @@ concrete CustomSyntaxChi of CustomSyntax = NumeralChi , GrammarChi [ - N, N2, CN, UseN, NP, Det, DetCN, MassNP - , V, VV, V2, VS, VP, AdvVP + N, N2, CN, PN, NP, UseN, ComplN2, UsePN, Num, NumSg, NumPl, Det, DetCN, MassNP + , V, VV, V2, VS, VP, UseV, AdvVP , A, A2, AP, PositA , Comp, Adv, VP, UseComp, CompAP, CompAdv -- is a public agency - , AdA, AdAdv -- only (within the organisation) + , AdA, AdAdv, Card, CAdv, AdN, AdNum, AdnCAdv + , Dig, Digits, NumDigits, IDig, IIDig, D_0, D_1, D_2, D_3, D_4, D_5, D_6, D_7, D_8, D_9 -- only (within the organisation) , ListAdv, BaseAdv, ConsAdv, ConjAdv , ListAP, BaseAP, ConsAP, ConjAP , ListNP, BaseNP, ConsNP, ConjNP , ListS, BaseS, ConsS, ConjS - , S, QS, Conj + , S, QS, Conj, Subj, SubjS + , RS, RP, IdRP, RelCN ] , StructuralChi [ VV, must_VV + , AdN, CAdv, less_CAdv, more_CAdv, at_least_AdN, at_most_AdN + , Subj, because_Subj ] , ExtendChi [ VPS, MkVPS, mkVPS, ListVPS, BaseVPS, ConsVPS, ConjVPS, baseVPS , VPI, MkVPI, mkVPI --, [VPI], BaseVPI, ConsVPI, ConjVPI , VP, Tense, Ant, Temp, Pol, Conj -- for VPS - , ByVP - , S, PredVPS - , NP, GerundNP -- by performing NDB qualification + , ByVP, N, CompoundN + , S, PredVPS, RelVPS + , NP, GerundNP, Num, GenModNP -- by performing NDB qualification ] ** open SyntaxChi diff --git a/lib/haskell/natural4/grammars/CustomSyntaxEng.gf b/lib/haskell/natural4/grammars/CustomSyntaxEng.gf index fa67649f8..82d970d27 100644 --- a/lib/haskell/natural4/grammars/CustomSyntaxEng.gf +++ b/lib/haskell/natural4/grammars/CustomSyntaxEng.gf @@ -1,29 +1,33 @@ concrete CustomSyntaxEng of CustomSyntax = NumeralEng , GrammarEng [ - N, N2, CN, UseN, NP, Det, DetCN, MassNP - , V, VV, V2, VS, VP - , A, A2, AP, AdjCN, PositA + N, N2, CN, PN, NP, UseN, ComplN2, UsePN, Num, NumSg, NumPl, Det, DetCN, MassNP + , V, VV, V2, VS, VP, UseV + , A, A2, AP, AdjCN, PositA, ComplA2 , Comp, Adv, VP, UseComp, CompAP, CompNP, CompAdv -- is a public agency , Prep, PrepNP, AdvVP - , AdA, AdAdv -- only (within the organisation) + , AdA, AdAdv, Card, CAdv, AdN, AdNum, AdnCAdv + , Dig, Digits, NumDigits, IDig, IIDig, D_0, D_1, D_2, D_3, D_4, D_5, D_6, D_7, D_8, D_9 -- only (within the organisation) , ListAdv, BaseAdv, ConsAdv, ConjAdv , ListAP, BaseAP, ConsAP, ConjAP , ListNP, BaseNP, ConsNP, ConjNP , ListS, BaseS, ConsS, ConjS - , S, QS, Conj + , S, QS, Conj, Subj, SubjS + , RS, RP, IdRP, RelCN ] , StructuralEng [ Prep, to_Prep, for_Prep, from_Prep, on_Prep, before_Prep, after_Prep, possess_Prep , VV, must_VV + , AdN, CAdv, less_CAdv, more_CAdv, at_least_AdN, at_most_AdN + , Subj, because_Subj ] , ExtendEng [ VPS, MkVPS, mkVPS, ListVPS, BaseVPS, ConsVPS, ConjVPS, baseVPS , VPI, MkVPI, mkVPI --, [VPI], BaseVPI, ConsVPI, ConjVPI , VP, Tense, Ant, Temp, Pol, Conj -- for VPS - , ByVP - , S, PredVPS - , NP, GerundNP -- by performing NDB qualification + , ByVP, N, CompoundN + , S, PredVPS, RelVPS + , NP, GerundNP, Num, GenModNP -- by performing NDB qualification ] ** open SyntaxEng @@ -94,6 +98,8 @@ concrete CustomSyntaxEng of CustomSyntax = in vps ** {s = \\_,_ => may_have_occurred} ; -- : NP -> S ; -- it is NP — reference to a previous NP ReferenceNP np = mkS (mkCl it_NP ) ; + WhileDoing vp = cc2 (ss "while") (GerundAdv vp) ; + CNwhereS cn np vps = SentCN cn (cc2 (ss "where") (PredVPS np vps)) ; presSimul = mkTemp presentTense simultaneousAnt ; presAnt = mkTemp presentTense anteriorAnt ; @@ -104,6 +110,7 @@ concrete CustomSyntaxEng of CustomSyntax = theSg = theSg_Det ; thePl = thePl_Det ; aSg = aSg_Det ; + aPl = aPl_Det ; your = mkDet youSg_Pron ; about_Prep = ParadigmsEng.mkPrep "about" ; diff --git a/lib/haskell/natural4/grammars/CustomSyntaxMay.gf b/lib/haskell/natural4/grammars/CustomSyntaxMay.gf index 2b4b6f25b..6798b3e58 100644 --- a/lib/haskell/natural4/grammars/CustomSyntaxMay.gf +++ b/lib/haskell/natural4/grammars/CustomSyntaxMay.gf @@ -1,30 +1,34 @@ concrete CustomSyntaxMay of CustomSyntax = NumeralMay , GrammarMay [ - N, N2, CN, UseN, NP, Det, DetCN, MassNP - , V, VV, V2, VS, VP - , A, A2, AP, AdjCN, PositA + N, N2, CN, PN, NP, UseN, ComplN2, UsePN, Num, NumSg, NumPl, Det, DetCN, MassNP + , V, VV, V2, VS, VP, UseV + , A, A2, AP, AdjCN, PositA, ComplA2 -- , ProgrVP -- becoming aware , Comp, Adv, VP, UseComp, CompAP, CompNP, CompAdv -- is a public agency , Prep, PrepNP, AdvVP - , AdA, AdAdv -- only (within the organisation) + , AdA, AdAdv, Card, CAdv, AdN, AdNum, AdnCAdv + , Dig, Digits, NumDigits, IDig, IIDig, D_0, D_1, D_2, D_3, D_4, D_5, D_6, D_7, D_8, D_9 -- only (within the organisation) , ListAdv, BaseAdv, ConsAdv, ConjAdv , ListAP, BaseAP, ConsAP, ConjAP , ListNP, BaseNP, ConsNP, ConjNP , ListS, BaseS, ConsS, ConjS - , S, QS, Conj + , S, QS, Conj, Subj, SubjS + , RS, RP, IdRP, RelCN ] , StructuralMay [ Prep, for_Prep, from_Prep, on_Prep, after_Prep, possess_Prep , VV, must_VV + , AdN, CAdv, less_CAdv, more_CAdv, at_least_AdN, at_most_AdN + , Subj, because_Subj ] , ExtendMay [ VPS, MkVPS, mkVPS, ListVPS, BaseVPS, ConsVPS, ConjVPS, baseVPS , VPI, MkVPI, mkVPI --, [VPI], BaseVPI, ConsVPI, ConjVPI , VP, Tense, Ant, Temp, Pol, Conj -- for VPS - , ByVP - , S, PredVPS - , NP, GerundNP -- by performing NDB qualification + , ByVP, N, CompoundN + , S, PredVPS, RelVPS + , NP, GerundNP, Num, GenModNP -- by performing NDB qualification ] ** open SyntaxMay diff --git a/lib/haskell/natural4/grammars/InsLex.gf b/lib/haskell/natural4/grammars/InsLex.gf new file mode 100644 index 000000000..8ea4a2908 --- /dev/null +++ b/lib/haskell/natural4/grammars/InsLex.gf @@ -0,0 +1,750 @@ +abstract InsLex = NL4Base ** { + fun + _ignore_consider_V2 : V2 ; + _Number_PN : PN ; + _note_V2 : V2 ; + _thing_N : N ; + _convert_to_V2 : V2 ; + _A_PN : PN ; + _detail_N : N ; + _earn_V2 : V2 ; + _appearance_N : N ; + _concrete_A : A ; + _Pru_PN : PN ; + _administrative_A : A ; + _natural4_N : N ; + _claim_from_V2 : V2 ; + _damage_N : N ; + _base_on_V2 : V2 ; + _overall_A : A ; + _encoding_N : N ; + _OverallPolicySum_PN : PN ; + _database_N : N ; + _Amount_N : N ; + _reinstatement_N : N ; + _A_N : N ; + _life_assured_N : N ; + _like_Prep : Prep ; + _PruAssure_PN : PN ; + _convert_V2 : V2 ; + _long_Adv : Adv ; + _remark_N : N ; + _involve_VS : VS ; + _represent_V2 : V2 ; + _Damage_N : N ; + _relate_to_V2 : V2 ; + _Pru_N : N ; + _cause_V : V ; + _subsection_N : N ; + _text_N : N ; + _cell_N : N ; + _Damage_PN : PN ; + _PruAssure_N : N ; + _end_V : V ; + _end_accord_V2 : V2 ; + _argument_N : N ; + _use_VV : VV ; + _describe_in_V2 : V2 ; + _about_Prep : Prep ; + _arise_V2 : V2 ; + _qualify_for_V2 : V2 ; + _directly_Adv : Adv ; + _OverallPolicySum_N : N ; + _Number_N : N ; + _update_N : N ; + _indirectly_Adv : Adv ; + _ph_PN : PN ; + _natural_A : A ; + _separate_A : A ; + _subsequent_A : A ; + _structure_N : N ; + _accord_to_V2 : V2 ; + _atomicity_N : N ; + _Amount_PN : PN ; + _income_N : N ; + _reward_N : N ; + _more_Adv : Adv ; + _datatype_N : N ; + _Hsi_N : N ; + _consider_V2 : V2 ; + _reach_V2 : V2 ; + _insurer_N : N ; + _whether_Subj : Subj ; + _handle_V2 : V2 ; + _renew_V2 : V2 ; + _ph_N : N ; + _no_Adv : Adv ; + _live_A : A ; + _capacity_N : N ; + _cover_N : N ; + _start_V2 : V2 ; + _so_Adv : Adv ; + _define_based_on_V2 : V2 ; + _exclude_from_V2 : V2 ; + _similar_A : A ; + _here_Adv : Adv ; + _demarcate_V2 : V2 ; + _underlie_V : V ; + _complex_A : A ; + _clause_N : N ; + _leg_N : N ; + _line_N : N ; + _SA_PN : PN ; + _contract_N : N ; + _b_N : N ; + _then_Adv : Adv ; + _Life_PN : PN ; + _subject_A : A ; + _state_N : N ; + _result_from_V2 : V2 ; + _up_Prep : Prep ; + _authority_N : N ; + _first_Adv : Adv ; + _plan1_N : N ; + _play_V2 : V2 ; + _organise_V : V ; + _hockey_N : N ; + _than_Prep : Prep ; + _date_N : N ; + _Republic_PN : PN ; + _between_Prep : Prep ; + _tsapp_N : N ; + _work_N : N ; + _planF_PN : PN ; + _while_Subj : Subj ; + _after_Prep : Prep ; + _mean_as_V2 : V2 ; + _Schedule_PN : PN ; + _mental_A : A ; + _total_A : A ; + _register_V : V ; + _1014_PN : PN ; + _surgical_A : A ; + _set_in_V2 : V2 ; + _canoe_V : V ; + _govern_V : V ; + _benefit_V : V ; + _tcm_N : N ; + _occur_before_V2 : V2 ; + _convenience_N : N ; + _exception_V : V ; + _benTCM_PN : PN ; + _address_N : N ; + _hearing_N : N ; + _sport_N : N ; + _verifier_N : N ; + _expense_N : N ; + _UPON_PN : PN ; + _first_A : A ; + _pedestrian_N : N ; + _license_V : V ; + _supervise_V : V ; + _airline_N : N ; + _assure_for_V2 : V2 ; + _from_Prep : Prep ; + _planB_PN : PN ; + _transport_N : N ; + _Influenza_PN : PN ; + _can_claim_add_N : N ; + _benfcpa_N : N ; + _military_N : N ; + _majority_N : N ; + _sssure_for_V2 : V2 ; + _lead_to_V2 : V2 ; + _minimum_N : N ; + _benefpaidout_N : N ; + _reasoner_N : N ; + _suffer_V : V ; + _planf_N : N ; + _time_N : N ; + _employee_N : N ; + _other_A : A ; + _benADD_PN : PN ; + _Leg_PN : PN ; + _try_VV : VV ; + _federation_N : N ; + _suffer_V2 : V2 ; + _policysubscription_N : N ; + _vehicle_N : N ; + _add_A : A ; + _revolution_N : N ; + _step_V2 : V2 ; + _firstclaimyear_N : N ; + _schedule_N : N ; + _limb_N : N ; + _treatment_N : N ; + _name_N : N ; + _within_Prep : Prep ; + _fractured_A : A ; + _assure_in_V2 : V2 ; + _pothole_V : V ; + _physical_A : A ; + _passenger_N : N ; + _met_common_requirement_for_add_V2 : V2 ; + _H7N_PN : PN ; + _step_N : N ; + _incurable_A : A ; + _transform_into_V2 : V2 ; + _Nipah_PN : PN ; + _maximum_A : A ; + _number_N : N ; + _birthdate_N : N ; + _happen_after_V2 : V2 ; + _H7N9_PN : PN ; + _y_PN : PN ; + _hrr_N : N ; + _plan_N : N ; + _Type_PN : PN ; + _successful_A : A ; + _skydive_V : V ; + _auditorium_N : N ; + _sail_V : V ; + _tcmpb_N : N ; + _into_Prep : Prep ; + _as_Adv : Adv ; + _mean_VS : VS ; + _define_V2 : V2 ; + _death_N : N ; + _life_assured_die_N : N ; + _occur_during_V2 : V2 ; + _commercial_A : A ; + _dc_N : N ; + _injury_N : N ; + _self_injury_N : N ; + _active_A : A ; + _money_N : N ; + _bicycle_N : N ; + _Accident_PN : PN ; + _eligibility_N : N ; + _patella_N : N ; + _Reductions_PN : PN ; + _Accidental_PN : PN ; + _year_N : N ; + _only_Adv : Adv ; + _mountaineer_V : V ; + _relevant_A : A ; + _least_Adv : Adv ; + _assure_V : V ; + _due_A : A ; + _behaviour_N : N ; + _holder_PN : PN ; + _to_Prep : Prep ; + _planaf_N : N ; + _equal_A : A ; + _plan3_PN : PN ; + _disease_N : N ; + _Expense_PN : PN ; + _hotel_N : N ; + _occur_at_V2 : V2 ; + _have_V2 : V2 ; + _kind_N : N ; + _CN_of_any_kind_CN : CN -> CN ; + _benefit_N : N ; + _task_N : N ; + _Disease_PN : PN ; + _part_N : N ; + _bus_N : N ; + _rule_N : N ; + _pregnancy_N : N ; + _cost_N : N ; + _sumassure_V : V ; + _alcohol_N : N ; + _n_N : N ; + _assure_per_V2 : V2 ; + _parachute_V : V ; + _confinement_N : N ; + _mall_N : N ; + _fully_Adv : Adv ; + _act_N : N ; + _geographical_A : A ; + _less_A : A ; + _attempt_N : N ; + _benADDs_PN : PN ; + _take_in_V2 : V2 ; + _weapon_N : N ; + _dangerous_weapon_N : N ; + _payable_A : A ; + _exception_N : N ; + _N_PN : PN ; + _past_A : A ; + _p_PN : PN ; + _diving_PN : PN ; + _TABLE_PN : PN ; + _registered_A : A ; + _H7N7_V : V ; + _lens_N : N ; + _establish_V : V ; + _box_in_V2 : V2 ; + _1012_PN : PN ; + _hernia_N : N ; + _for_Prep : Prep ; + _adjust_for_V2 : V2 ; + _risk_N : N ; + _save_V2 : V2 ; + _burn_N : N ; + _possible_A : A ; + _basic_A : A ; + _pland_Adv : Adv ; + _register_with_V2 : V2 ; + _suicide_N : N ; + _stepupsumassure_V : V ; + _declare_VS : VS ; + _diagnosis_N : N ; + _month_N : N ; + _Details_PN : PN ; + _radiation_N : N ; + _motocross_PN : PN ; + _Ministry_PN : PN ; + _cover_in_V2 : V2 ; + _degree_N : N ; + _third_A : A ; + _nuclear_A : A ; + _sustain_V2 : V2 ; + _phalanx_N : N ; + _use_N : N ; + _sum_N : N ; + _make_within_V2 : V2 ; + _circumstance_N : N ; + _customer_N : N ; + _met_common_requirement_for_add_V : V ; + _Accidents_PN : PN ; + _life_assured_suffers_injury_does_not_die_within_30_day_N : N ; + _infectious_A : A ; + _pay_for_V2 : V2 ; + _per_Prep : Prep ; + _fire_N : N ; + _form_N : N ; + _claim_for_V2 : V2 ; + _get_from_V2 : V2 ; + _suffer_in_V2 : V2 ; + _toe_N : N ; + _fare_N : N ; + _exercise_N : N ; + _totally_Adv : Adv ; + _fever_N : N ; + _up_Adv : Adv ; + _ear_N : N ; + _insanity_N : N ; + _tail_N : N ; + _normal_A : A ; + _Plan14_PN : PN ; + _Claim_PN : PN ; + _across_Prep : Prep ; + _defect_N : N ; + _cover_V2 : V2 ; + _Yellow_PN : PN ; + _predicate_N : N ; + _private_A : A ; + _question_N : N ; + _Health_PN : PN ; + _shortening_N : N ; + _lose_V2 : V2 ; + _riot_N : N ; + _nature_N : N ; + _outcome_N : N ; + _way_N : N ; + _on_its_way_Adv : Adv ; + _Injury_PN : PN ; + _hand_N : N ; + _CoV_PN : PN ; + _previous_A : A ; + _low_A : A ; + _damagetype_N : N ; + _activity_N : N ; + _planC_PN : PN ; + _foot_N : N ; + _radioactivity_N : N ; + _Triple_PN : PN ; + _benmr_N : N ; + _333A_PN : PN ; + _eye_N : N ; + _home_N : N ; + _asssure_V : V ; + _virus_N : N ; + _drug_N : N ; + _polilcy_N : N ; + _car_N : N ; + _M_PN : PN ; + _mind_N : N ; + _m_N : N ; + _stepuppercentage_N : N ; + _include_V2 : V2 ; + _Event_PN : PN ; + _start_N : N ; + _policy_N : N ; + _1013_PN : PN ; + _Medicine_PN : PN ; + _accident_N : N ; + _possibility_N : N ; + _human_A : A ; + _payout_N : N ; + _school_N : N ; + _during_Prep : Prep ; + _addpercentageforinjury_N : N ; + _Cap_PN : PN ; + _sum_list_PN : PN ; + _viral_A : A ; + _place_N : N ; + _mean_V2 : V2 ; + _vcjd_N : N ; + _hence_Adv : Adv ; + _with_Prep : Prep ; + _that_Subj : Subj ; + _cave_V : V ; + _policyholder_N : N ; + _middle_A : A ; + _Subscribed_PN : PN ; + _string_N : N ; + _pland_N : N ; + _high_A : A ; + _pay_V2 : V2 ; + _Insurer_PN : PN ; + _adjustment_N : N ; + _give_V2 : V2 ; + _logical_A : A ; + _triple_A : A ; + _timeyear_N : N ; + _Adjustment_PN : PN ; + _dTime_PN : PN ; + _e_N : N ; + _lose_through_V2 : V2 ; + _cm_N : N ; + _biological_A : A ; + _recognise_V : V ; + _HAS_PN : PN ; + _scuba_diving_N : N ; + _before_Subj : Subj ; + _adjusted_A : A ; + _MIN_PN : PN ; + _Types_PN : PN ; + _day_N : N ; + _MR_PN : PN ; + _apply_V : V ; + _Date_PN : PN ; + _benRA_PN : PN ; + _life_N : N ; + _dangerous_A : A ; + _x_PN : PN ; + _japanese_A : A ; + _union_N : N ; + _policyHolder_PN : PN ; + _claim_N : N ; + _association_N : N ; + _case_N : N ; + _head_N : N ; + _upscaled_A : A ; + _martial_A : A ; + _if_Subj : Subj ; + _valid_A : A ; + _soon_Adv : Adv ; + _strain_N : N ; + _PolicyHolder_PN : PN ; + _speech_N : N ; + _y_N : N ; + _event_N : N ; + _at_Adv : Adv ; + _c_N : N ; + _Dismemberment_PN : PN ; + _1013_N : N ; + _both_Subj : Subj ; + _v_N : N ; + _include_V : V ; + _unsound_A : A ; + _thumb_N : N ; + _Removal_PN : PN ; + _amount_N : N ; + _addsa_N : N ; + _permanently_Adv : Adv ; + _chemical_A : A ; + _Melioidosis_PN : PN ; + _circ_PN : PN ; + _Benefit_PN : PN ; + _particular_A : A ; + _participate_in_V2 : V2 ; + _planAF_PN : PN ; + _at_Prep : Prep ; + _accepted_A : A ; + _war_N : N ; + _adjust_V : V ; + _or_Subj : Subj ; + _duty_N : N ; + _finger_N : N ; + _deduce_VS : VS ; +-- _occur_V : V ; + _accidental_A : A ; + _medical_A : A ; + _cover_V : V ; + _ponder_V2 : V2 ; + _mean_V : V ; + _climbing_N : N ; + _theatre_N : N ; + _Wife_PN : PN ; + _Service_PN : PN ; + _illness_N : N ; + _hospital_N : N ; + _more_A : A ; + _claimant_N : N ; + _unnecessary_A : A ; + _H5N1_PN : PN ; + _premise_N : N ; + _premise_where_N2 : N2 ; + _operation_N : N ; + _give_V : V ; + _ps_N : N ; + _LE_PN : PN ; + _RETURN_PN : PN ; + _under_Prep : Prep ; + _BSA_PN : PN ; + _unsuccessful_A : A ; + _Head_PN : PN ; + _die_from_V2 : V2 ; + _hand_V : V ; + _Legionnaires_PN : PN ; + _contamination_N : N ; + _when_Subj : Subj ; + _section_N : N ; + _Section_PN : PN ; + _removal_N : N ; + _traditional_A : A ; + _claim_V : V ; + _disabled_A : A ; + _non_N : N ; + _condition_N : N ; + _disability_N : N ; + _SG_PN : PN ; + _polo_N : N ; + _military_A : A ; + _Ontology_PN : PN ; + _hang_VV : VV ; + _through_Prep : Prep ; + _PlanAF_PN : PN ; + _refund_V2 : V2 ; + _hfmd_A : A ; + _PS_PN : PN ; + _terrorism_N : N ; + _have_give_V2 : V2 ; + _unlawful_A : A ; + _H9N2_PN : PN ; + _AIDS_PN : PN ; + _involve_V2 : V2 ; + _involving_Prep : Prep ; + _person_N : N ; + _double_A : A ; + _physician_N : N ; + _add_N : N ; + _police_N : N ; + _LA_PN : PN ; + _competitive_A : A ; + _jaw_N : N ; + _H7N7_N : N ; + _Death_PN : PN ; + _policyholder_V : V ; + _Teeth_PN : PN ; + _bool_N : N ; + _benefit_V2 : V2 ; + _race_V : V ; + _regulation_N : N ; + _of_Prep : Prep ; + _husband_N : N ; + _competition_N : N ; + _planE_PN : PN ; + _by_Prep : Prep ; + _declaration_N : N ; + _incident_N : N ; + _dead_A : A ; + _type_N : N ; + _aircraft_N : N ; + _Limit_PN : PN ; + _little_A : A ; + _waterborne_A : A ; + _p_N : N ; + _damageevent_N : N ; + _and_Subj : Subj ; + _Policy_PN : PN ; + _national_A : A ; + _cover_as_V2 : V2 ; + _assure_of_V2 : V2 ; + _acc_injury_or_death_happens_within_12_mos_of_accident_N : N ; + _infection_N : N ; + _claim_V2 : V2 ; + _Flu_PN : PN ; + _pay_as_V2 : V2 ; + _travel_as_V2 : V2 ; + _h7n9_N : N ; + _age_N : N ; + _hear_in_V2 : V2 ; + _MAP_PN : PN ; + _professional_A : A ; + _assure_across_V2 : V2 ; + _diagnose_with_V2 : V2 ; + _assure_V2 : V2 ; + _multiple_A : A ; + _glide_V : V ; + _current_A : A ; + _plan4_PN : PN ; + _vessel_N : N ; + _racing_N : N ; + _fit_N : N ; + _located_in_A2 : A2 ; + _percentage_N : N ; + _service_N : N ; + _Singapore_PN : PN ; + _in_Prep : Prep ; + _Step_PN : PN ; + _body_N : N ; + _out_Prep : Prep ; + _plana_N : N ; + _subscribe_V : V ; + _Mumps_PN : PN ; + _over_Prep : Prep ; + _sight_N : N ; + _description_N : N ; + _travel_in_V2 : V2 ; + _great_A : A ; + _practitioner_N : N ; + _loss_N : N ; + _training_N : N ; + _as_Prep : Prep ; + _take_V2 : V2 ; + _public_A : A ; + _train_V : V ; + _result_N : N ; + _limit_N : N ; + _windsurf_V : V ; + _area_N : N ; + _reckless_A : A ; + _list_N : N ; + _on_Prep : Prep ; + _as_Subj : Subj ; + _holder_N : N ; + _alive_A : A ; + _juvenile_A : A ; + _intentional_A : A ; + _permanent_A : A ; + _d_N : N ; + _riding_N : N ; + _Conditions_PN : PN ; + _reduction_N : N ; + _claimable_A : A ; + _addSA_PN : PN ; + _pay_V : V ; + _wrestle_in_V2 : V2 ; + _start_VS : VS ; + _tooth_N : N ; + _declare_V2 : V2 ; + _initial_A : A ; + _hunt_V : V ; + _but_Subj : Subj ; + _Assured_PN : PN ; + _ADD_PN : PN ; + _f_N : N ; + _travel_by_N2 : N2 ; + _qualifies_for_add_PN : PN ; + _member_N : N ; + _happen_within_V2 : V2 ; + _Address_PN : PN ; + _circumstancedescription_N : N ; + _dType_PN : PN ; + _schema_PN : PN ; +-- some PNs as Ns + _1012_N : N ; + _1014_N : N ; + _333A_N : N ; + _ADD_N : N ; + _AIDS_N : N ; + _Accident_N : N ; + _Accidental_N : N ; + _Accidents_N : N ; + _Address_N : N ; + _Adjustment_N : N ; + _Assured_N : N ; + _BSA_N : N ; + _Benefit_N : N ; + _Cap_N : N ; + _Claim_N : N ; + _CoV_N : N ; + _Conditions_N : N ; + _Date_N : N ; + _Death_N : N ; + _Details_N : N ; + _Disease_N : N ; + _Dismemberment_N : N ; + _Event_N : N ; + _Expense_N : N ; + _Flu_N : N ; + _H5N1_N : N ; + _H7N9_N : N ; + _H7N_N : N ; + _H9N2_N : N ; + _HAS_N : N ; + _Head_N : N ; + _Health_N : N ; + _Influenza_N : N ; + _Injury_N : N ; + _Insurer_N : N ; + _LA_N : N ; + _LE_N : N ; + _Leg_N : N ; + _Legionnaires_N : N ; + _Life_N : N ; + _Limit_N : N ; + _MAP_N : N ; + _MIN_N : N ; + _MR_N : N ; + _M_N : N ; + _Medicine_N : N ; + _Melioidosis_N : N ; + _Ministry_N : N ; + _Mumps_N : N ; + _N_N : N ; + _Nipah_N : N ; + _Ontology_N : N ; + _PS_N : N ; + _Plan14_N : N ; + _PlanAF_N : N ; + _PolicyHolder_N : N ; + _Policy_N : N ; + _RETURN_N : N ; + _Reductions_N : N ; + _Removal_N : N ; + _Republic_N : N ; + _SA_N : N ; + _SG_N : N ; + _Schedule_N : N ; + _Section_N : N ; + _Service_N : N ; + _Singapore_N : N ; + _Step_N : N ; + _Subscribed_N : N ; + _TABLE_N : N ; + _Teeth_N : N ; + _Triple_N : N ; + _Type_N : N ; + _Types_N : N ; + _UPON_N : N ; + _Wife_N : N ; + _Yellow_N : N ; + _addSA_N : N ; + _benADD_N : N ; + _benADDs_N : N ; + _benRA_N : N ; + _benTCM_N : N ; + _circ_N : N ; + _dTime_N : N ; + _dType_N : N ; + _diving_N : N ; + _motocross_N : N ; + _plan3_N : N ; + _plan4_N : N ; + _planAF_N : N ; + _planB_N : N ; + _planC_N : N ; + _planE_N : N ; + _planF_N : N ; + _policyHolder_N : N ; + _qualifies_for_add_N : N ; + _schema_N : N ; + _sum_list_N : N ; + _x_N : N ; + +} \ No newline at end of file diff --git a/lib/haskell/natural4/grammars/InsLexEng.gf b/lib/haskell/natural4/grammars/InsLexEng.gf new file mode 100644 index 000000000..e7b28510e --- /dev/null +++ b/lib/haskell/natural4/grammars/InsLexEng.gf @@ -0,0 +1,749 @@ +concrete InsLexEng of InsLex = NL4BaseEng ** + open ParadigmsEng, Prelude, GrammarEng in { + oper mkSubj : Str -> Subj = \s -> lin Subj (ss s) ; + lin _ignore_consider_V2 = mkV2 (mkV "ignore") (mkPrep "consider") ; + lin _Number_PN = mkPN "Number" ; + lin _note_V2 = mkV2 (mkV "note") ; + lin _thing_N = mkN "thing" ; + lin _convert_to_V2 = mkV2 (mkV "convert") (mkPrep "to") ; + lin _A_PN = mkPN "A" ; + lin _detail_N = mkN "detail" ; + lin _earn_V2 = mkV2 (mkV "earn") ; + lin _appearance_N = mkN "appearance" ; + lin _concrete_A = mkA "concrete" ; + lin _Pru_PN = mkPN "Pru" ; + lin _administrative_A = mkA "administrative" ; + lin _natural4_N = mkN "natural4" ; + lin _claim_from_V2 = mkV2 (mkV "claim") (mkPrep "from") ; + lin _damage_N = mkN "damage" ; + lin _base_on_V2 = mkV2 (mkV "base") (mkPrep "on") ; + lin _overall_A = mkA "overall" ; + lin _encoding_N = mkN "encoding" ; + lin _OverallPolicySum_PN = mkPN "OverallPolicySum" ; + lin _database_N = mkN "database" ; + lin _Amount_N = mkN "Amount" ; + lin _reinstatement_N = mkN "reinstatement" ; + lin _A_N = mkN "A" ; + lin _like_Prep = mkPrep "like" ; + lin _PruAssure_PN = mkPN "PruAssure" ; + lin _convert_V2 = mkV2 (mkV "convert") ; + lin _long_Adv = mkAdv "long" ; + lin _remark_N = mkN "remark" ; + lin _involve_VS = mkVS (mkV "involve") ; + lin _represent_V2 = mkV2 (mkV "represent") ; + lin _Damage_N = mkN "Damage" ; + lin _relate_to_V2 = mkV2 (mkV "relate") (mkPrep "to") ; + lin _Pru_N = mkN "Pru" ; + lin _cause_V = mkV "cause" ; + lin _subsection_N = mkN "subsection" ; + lin _text_N = mkN "text" ; + lin _cell_N = mkN "cell" ; + lin _Damage_PN = mkPN "Damage" ; + lin _PruAssure_N = mkN "PruAssure" ; + lin _end_V = mkV "end" ; + lin _end_accord_V2 = mkV2 (mkV "end") (mkPrep "accord") ; + lin _argument_N = mkN "argument" ; + lin _use_VV = mkVV (mkV "use") ; + lin _describe_in_V2 = mkV2 (mkV "describe") (mkPrep "in") ; + lin _about_Prep = mkPrep "about" ; + lin _arise_V2 = mkV2 (mkV "arise") ; + lin _qualify_for_V2 = mkV2 (mkV "qualify") (mkPrep "for") ; + lin _directly_Adv = mkAdv "directly" ; + lin _OverallPolicySum_N = mkN "OverallPolicySum" ; + lin _Number_N = mkN "Number" ; + lin _update_N = mkN "update" ; + lin _indirectly_Adv = mkAdv "indirectly" ; + lin _ph_PN = mkPN "ph" ; + lin _natural_A = mkA "natural" ; + lin _separate_A = mkA "separate" ; + lin _subsequent_A = mkA "subsequent" ; + lin _structure_N = mkN "structure" ; + lin _accord_to_V2 = mkV2 (mkV "accord") (mkPrep "to") ; + lin _atomicity_N = mkN "atomicity" ; + lin _Amount_PN = mkPN "Amount" ; + lin _income_N = mkN "income" ; + lin _reward_N = mkN "reward" ; + lin _more_Adv = mkAdv "more" ; + lin _datatype_N = mkN "datatype" ; + lin _consider_V2 = mkV2 (mkV "consider") ; + lin _reach_V2 = mkV2 (mkV "reach") ; + lin _insurer_N = mkN "insurer" ; + lin _whether_Subj = mkSubj "whether" ; + lin _handle_V2 = mkV2 (mkV "handle") ; + lin _renew_V2 = mkV2 (mkV "renew") ; + lin _ph_N = mkN "ph" ; + lin _no_Adv = mkAdv "no" ; + lin _live_A = mkA "//,,,live" ; + lin _capacity_N = mkN "capacity" ; + lin _cover_N = mkN "cover" ; + lin _start_V2 = mkV2 (mkV "start") ; + lin _so_Adv = mkAdv "so" ; + lin _define_based_on_V2 = mkV2 (mkV "define") (mkPrep "based on") ; + lin _exclude_from_V2 = mkV2 (mkV "exclude") (mkPrep "from") ; + lin _similar_A = mkA "similar" ; + lin _here_Adv = mkAdv "here" ; + lin _demarcate_V2 = mkV2 (mkV "demarcate") ; + lin _underlie_V = mkV "underlie" ; + lin _complex_A = mkA "complex" ; + lin _clause_N = mkN "clause" ; + lin _practitioner_N = mkN "practitioner" ; + lin _insanity_N = mkN "insanity" ; + lin _plan_N = mkN "plan" ; + lin _amount_N = mkN "amount" ; + lin _SA_PN = mkPN "SA" ; + lin _cover_as_V2 = mkV2 (us_britishV "cover") (mkPrep "as") ; + lin _govern_V = us_britishV "govern" ; + lin _auditorium_N = mkN "auditorium" ; + lin _Health_PN = mkPN "Health" ; + lin _nuclear_A = mkA "nuclear" ; + lin _question_N = mkN "question" ; + lin _permanently_Adv = mkAdv "permanently" ; + lin _Nipah_PN = mkPN "Nipah" ; + lin _hospital_N = mkN "hospital" ; + lin _take_in_V2 = mkV2 (us_britishV "take") (mkPrep "in") ; + lin _asssure_V = us_britishV "asssure" ; + lin _Schedule_PN = mkPN "Schedule" ; + lin _disability_N = mkN "disability" ; + lin _addSA_PN = mkPN "addSA" ; + lin _cover_in_V2 = mkV2 (us_britishV "cover") (mkPrep "in") ; + lin _juvenile_A = mkA "juvenile" ; + lin _state_N = mkN "state" ; + lin _tail_N = mkN "tail" ; + lin _home_N = mkN "home" ; + lin _speech_N = mkN "speech" ; + lin _Disease_PN = mkPN "Disease" ; + lin _event_N = mkN "event" ; + lin _box_in_V2 = mkV2 (us_britishV "box") (mkPrep "in") ; + lin _or_Subj = mkSubj "or" ; + lin _martial_A = mkA "martial" ; + lin _b_N = mkN "b" ; + lin _LE_PN = mkPN "LE" ; + lin _Type_PN = mkPN "Type" ; + lin _medical_A = mkA "medical" ; + lin _suffer_V = us_britishV "suffer" ; + lin _benefit_V = us_britishV "benefit" ; + lin _thumb_N = mkN "thumb" ; + lin _that_Subj = mkSubj "that" ; + lin _pay_as_V2 = mkV2 (us_britishV "pay") (mkPrep "as") ; + lin _active_A = mkA "active" ; + lin _into_Prep = mkPrep "into" ; + lin _Injury_PN = mkPN "Injury" ; + lin _behaviour_N = mkN "behaviour" ; + lin _planAF_PN = mkPN "planAF" ; + lin _illness_N = mkN "illness" ; + lin _at_Prep = mkPrep "at" ; + lin _unsound_A = mkA "unsound" ; + lin _can_claim_add_N = mkN "can_claim_add" ; + lin _stepupsumassure_V = us_britishV "stepupsumassure" ; + lin _possible_A = mkA "possible" ; + lin _training_N = mkN "training" ; + lin _step_N = mkN "step" ; + lin _benRA_PN = mkPN "benRA" ; + lin _body_N = mkN "body" ; + lin _tooth_N = mkN "tooth" ; + lin _up_Adv = mkAdv "up" ; + lin _strain_N = mkN "strain" ; + lin _war_N = mkN "war" ; + lin _public_A = mkA "public" ; + lin _totally_Adv = mkAdv "totally" ; + lin _reckless_A = mkA "reckless" ; + lin _reduction_N = mkN "reduction" ; + lin _removal_N = mkN "removal" ; + lin _sport_N = mkN "sport" ; + lin _weapon_N = mkN "weapon" ; + lin _dangerous_weapon_N = mkN "nuclear, biological or chemical weapon" ; + lin _middle_A = mkA "middle" ; + lin _MAP_PN = mkPN "MAP" ; + lin _UPON_PN = mkPN "UPON" ; + lin _act_N = mkN "act" ; + lin _outcome_N = mkN "outcome" ; + lin _pregnancy_N = mkN "pregnancy" ; + lin _hand_V = us_britishV "hand" ; + lin _across_Prep = mkPrep "across" ; + lin _subscribe_V = us_britishV "subscribe" ; + lin _acc_injury_or_death_happens_within_12_mos_of_accident_N = mkN "acc_injury_or_death_happens_within_12_mos_of_accident" ; + lin _great_A = mkA "great" ; + lin _date_N = mkN "date" ; + lin _climbing_N = mkN "climbing" ; + lin _jaw_N = mkN "jaw" ; + lin _bus_N = mkN "bus" ; + lin _add_A = mkA "add" ; + lin _PolicyHolder_PN = mkPN "PolicyHolder" ; + lin _Teeth_PN = mkPN "Teeth" ; + lin _permanent_A = mkA "permanent" ; + lin _degree_N = mkN "degree" ; + lin _benmr_N = mkN "benmr" ; + lin _finger_N = mkN "finger" ; + lin _HAS_PN = mkPN "HAS" ; + lin _more_A = mkA "more" ; + lin _n_N = mkN "n" ; + lin _biological_A = mkA "biological" ; + lin _travel_as_V2 = mkV2 (us_britishV "travel") (mkPrep "as") ; + lin _happen_within_V2 = mkV2 (us_britishV "happen") (mkPrep "within") ; + lin _sumassure_V = us_britishV "sumassure" ; + lin _race_V = us_britishV "race" ; + lin _if_Subj = mkSubj "if" ; + lin _radioactivity_N = mkN "radioactivity" ; + lin _at_Adv = mkAdv "at" ; + lin _first_Adv = mkAdv "first" ; + lin _assure_V = us_britishV "assure" ; + lin _unnecessary_A = mkA "unnecessary" ; + lin _plan1_N = mkN "plan1" ; + lin _minimum_N = mkN "minimum" ; + lin _planC_PN = mkPN "planC" ; + lin _bicycle_N = mkN "bicycle" ; + lin _day_N = mkN "day" ; + lin _drug_N = mkN "drug" ; + lin _Removal_PN = mkPN "Removal" ; + lin _majority_N = mkN "majority" ; + lin _geographical_A = mkA "geographical" ; + lin _confinement_N = mkN "confinement" ; + lin _take_V2 = mkV2 (us_britishV "take") ; + lin _PS_PN = mkPN "PS" ; + lin _Accidents_PN = mkPN "Accidents" ; + lin _and_Subj = mkSubj "and" ; + lin _suffer_V2 = mkV2 (us_britishV "suffer") ; + lin _sum_N = mkN "sum" ; + lin _claim_V = us_britishV "claim" ; + lin _have_give_V2 = mkV2 (us_britishV "have") (mkPrep "give") ; + lin _customer_N = mkN "customer" ; + lin _1013_N = mkN "10.1.3" ; + lin _v_N = mkN "v" ; + lin _valid_A = mkA "valid" ; + lin _maximum_A = mkA "maximum" ; + lin _unlawful_A = mkA "unlawful" ; + lin _sail_V = us_britishV "sail" ; + lin _pay_V = us_britishV "pay" ; + lin _assure_across_V2 = mkV2 (us_britishV "assure") (mkPrep "across") ; + lin _sustain_V2 = mkV2 (us_britishV "sustain") ; + lin _while_Subj = mkSubj "while" ; + lin _register_with_V2 = mkV2 (us_britishV "register") (mkPrep "with") ; + lin _cave_V = us_britishV "cave" ; + lin _rule_N = mkN "rule" ; + lin _regulation_N = mkN "regulation" ; + lin _damagetype_N = mkN "damagetype" ; + lin _part_N = mkN "part" ; + lin _Legionnaires_PN = mkPN "Legionnaires" ; + lin _claim_N = mkN "claim" ; + lin _money_N = mkN "money" ; + lin _dTime_PN = mkPN "dTime" ; + lin _birthdate_N = mkN "birthdate" ; + lin _1013_PN = mkPN "10.1.3" ; + lin _benfcpa_N = mkN "benfcpa" ; + lin _than_Prep = mkPrep "than" ; + lin _add_N = mkN "add" ; + lin _little_A = mkA "little" ; + lin _as_Subj = mkSubj "as" ; + lin _mind_N = mkN "mind" ; + lin _claim_for_V2 = mkV2 (us_britishV "claim") (mkPrep "for") ; + lin _planaf_N = mkN "planaf" ; + lin _initial_A = mkA "initial" ; + lin _triple_A = mkA "triple" ; + lin _mean_V2 = mkV2 (us_britishV "mean") ; + lin _convenience_N = mkN "convenience" ; + lin _circumstancedescription_N = mkN "circumstancedescription" ; + lin _diving_PN = mkPN "diving" ; + lin _Benefit_PN = mkPN "Benefit" ; + lin _lose_through_V2 = mkV2 (us_britishV "lose") (mkPrep "through") ; + lin _up_Prep = mkPrep "up" ; + lin _japanese_A = mkA "japanese" ; + lin _car_N = mkN "car" ; + lin _upscaled_A = mkA "upscaled" ; + lin _RETURN_PN = mkPN "RETURN" ; + lin _H7N9_PN = mkPN "H7N9" ; + lin _claim_V2 = mkV2 (us_britishV "claim") ; + lin _hand_N = mkN "hand" ; + lin _adjust_for_V2 = mkV2 (us_britishV "adjust") (mkPrep "for") ; + lin _involve_V2 = mkV2 (us_britishV "involve") ; + lin _involving_Prep = mkPrep "involving" ; + lin _place_N = mkN "place" ; + lin _injury_N = mkN "injury" ; + lin _self_injury_N = mkN "self-injury" ; + lin _treatment_N = mkN "treatment" ; + lin _BSA_PN = mkPN "BSA" ; + lin _hrr_N = mkN "hrr" ; + lin _motocross_PN = mkPN "motocross" ; + lin _schema_PN = mkPN "schema" ; + lin _but_Subj = mkSubj "but" ; + lin _case_N = mkN "case" ; + lin _planf_N = mkN "planf" ; + lin _h7n9_N = mkN "h7n9" ; + lin _on_its_way_Adv = ParadigmsEng.mkAdv "on its way" ; + lin _way_N = mkN "way" ; + lin _Medicine_PN = mkPN "Medicine" ; + lin _result_N = mkN "result" ; + lin _less_A = mkA "less" ; + lin _percentage_N = mkN "percentage" ; + lin _scuba_diving_N = mkN "scuba diving" ; + lin _Types_PN = mkPN "Types" ; + lin _revolution_N = mkN "revolution" ; + lin _physician_N = mkN "physician" ; + lin _use_N = mkN "use" ; + lin _third_A = mkA "third" ; + lin _first_A = mkA "first" ; + lin _circ_PN = mkPN "circ" ; + lin _travel_by_N2 = mkN2 (mkN "travel") (mkPrep "by") ; + lin _burn_N = mkN "burn" ; + lin _shortening_N = mkN "shortening" ; + lin _wrestle_in_V2 = mkV2 (us_britishV "wrestle") (mkPrep "in") ; + lin _set_in_V2 = mkV2 (us_britishV "set") (mkPrep "in") ; + lin _Date_PN = mkPN "Date" ; + lin _windsurf_V = us_britishV "windsurf" ; + lin _travel_in_V2 = mkV2 (us_britishV "travel") (mkPrep "in") ; + lin _Adjustment_PN = mkPN "Adjustment" ; + lin _benADDs_PN = mkPN "benADDs" ; + lin _aircraft_N = mkN "aircraft" ; + lin _current_A = mkA "current" ; + lin _husband_N = mkN "husband" ; + lin _Dismemberment_PN = mkPN "Dismemberment" ; + lin _successful_A = mkA "successful" ; + lin _viral_A = mkA "viral" ; + lin _equal_A = mkA "equal" ; + lin _qualifies_for_add_PN = mkPN "qualifies_for_add" ; + lin _contamination_N = mkN "contamination" ; + lin _bool_N = mkN "bool" ; + lin _as_Prep = mkPrep "as" ; + lin _virus_N = mkN "virus" ; + lin _parachute_V = us_britishV "parachute" ; + lin _low_A = mkA "low" ; + lin _competitive_A = mkA "competitive" ; + lin _hotel_N = mkN "hotel" ; + lin _Limit_PN = mkPN "Limit" ; + lin _register_V = us_britishV "register" ; + lin _alive_A = mkA "alive" ; + lin _fever_N = mkN "fever" ; + lin _theatre_N = mkN "theatre" ; + lin _claimable_A = mkA "claimable" ; + lin _after_Prep = mkPrep "after" ; + lin _normal_A = mkA "normal" ; + lin _declare_VS = mkVS (us_britishV "declare") ; + lin _with_Prep = mkPrep "with" ; + lin _Assured_PN = mkPN "Assured" ; + lin _deduce_VS = mkVS (us_britishV "deduce") ; + lin _relevant_A = mkA "relevant" ; + lin _lead_to_V2 = mkV2 (us_britishV "lead") (mkPrep "to") ; + lin _exercise_N = mkN "exercise" ; + lin _head_N = mkN "head" ; + lin _mental_A = mkA "mental" ; + lin _police_N = mkN "police" ; + lin _Leg_PN = mkPN "Leg" ; + lin _section_N = mkN "section" ; + lin _license_V = us_britishV "license" ; + lin _dead_A = mkA "dead" ; + lin _CoV_PN = mkPN "CoV" ; + lin _physical_A = mkA "physical" ; + lin _assure_for_V2 = mkV2 (us_britishV "assure") (mkPrep "for") ; + lin _apply_V = us_britishV "apply" ; + lin _basic_A = mkA "basic" ; + lin _policyholder_V = us_britishV "policyholder" ; + lin _traditional_A = mkA "traditional" ; + lin _Step_PN = mkPN "Step" ; + lin _holder_PN = mkPN "holder" ; + lin _lens_N = mkN "lens" ; + lin _die_from_V2 = mkV2 (us_britishV "die") (mkPrep "from") ; + lin _H5N1_PN = mkPN "H5N1" ; + lin _surgical_A = mkA "surgical" ; + lin _nature_N = mkN "nature" ; + lin _transform_into_V2 = mkV2 (us_britishV "transform") (mkPrep "into") ; + lin _only_Adv = mkAdv "only" ; + lin _benefit_V2 = mkV2 (us_britishV "benefit") ; + lin _fully_Adv = mkAdv "fully" ; + lin _MIN_PN = mkPN "MIN" ; + lin _step_V2 = mkV2 (us_britishV "step") ; + lin _terrorism_N = mkN "terrorism" ; + lin _commercial_A = mkA "commercial" ; + lin _include_V = us_britishV "include" ; + lin _name_N = mkN "name" ; + lin _hunt_V = us_britishV "hunt" ; + lin _PlanAF_PN = mkPN "PlanAF" ; + lin _operation_N = mkN "operation" ; + lin _333A_PN = mkPN "333A" ; + lin _previous_A = mkA "previous" ; + lin _give_V = us_britishV "give" ; + lin _other_A = mkA "other" ; + lin _addpercentageforinjury_N = mkN "addpercentageforinjury" ; + lin _line_N = mkN "line" ; + lin _activity_N = mkN "activity" ; + lin _adjust_V = us_britishV "adjust" ; + lin _eye_N = mkN "eye" ; + lin _Subscribed_PN = mkPN "Subscribed" ; + lin _x_PN = mkPN "x" ; + lin _hence_Adv = mkAdv "hence" ; + lin _occur_V = us_britishV "occur" ; + lin _Ontology_PN = mkPN "Ontology" ; + lin _start_N = mkN "start" ; + lin _Mumps_PN = mkPN "Mumps" ; + lin _string_N = mkN "string" ; + lin _plan4_PN = mkPN "plan4" ; + lin _alcohol_N = mkN "alcohol" ; + lin _H9N2_PN = mkPN "H9N2" ; + lin _organise_V = us_britishV "organise" ; + lin _benefit_N = mkN "benefit" ; + lin _type_N = mkN "type" ; + lin _waterborne_A = mkA "waterborne" ; + lin _when_Subj = mkSubj "when" ; + lin _non_N = mkN "non" ; + lin _high_A = mkA "high" ; + lin _Event_PN = mkPN "Event" ; + lin _occur_at_V2 = mkV2 (us_britishV "occur") (mkPrep "at") ; + lin _fit_N = mkN "fit" ; + lin _least_Adv = mkAdv "least" ; + lin _policysubscription_N = mkN "policysubscription" ; + lin _union_N = mkN "union" ; + lin _diagnose_with_V2 = mkV2 (us_britishV "diagnose") (mkPrep "with") ; + lin _risk_N = mkN "risk" ; + lin _define_V2 = mkV2 (us_britishV "define") ; + lin _met_common_requirement_for_add_V2 = mkV2 (us_britishV "met_common_requirement_for_add") ; + lin _defect_N = mkN "defect" ; + lin _polo_N = mkN "polo" ; + lin _policyHolder_PN = mkPN "policyHolder" ; + lin _Cap_PN = mkPN "Cap" ; + lin _tcmpb_N = mkN "tcmpb" ; + lin _pedestrian_N = mkN "pedestrian" ; + lin _fire_N = mkN "fire" ; + lin _Accidental_PN = mkPN "Accidental" ; + lin _Life_PN = mkPN "Life" ; + lin _assure_in_V2 = mkV2 (us_britishV "assure") (mkPrep "in") ; + lin _kind_N = mkN "kind" ; + lin _CN_of_any_kind_CN illness = AdvCN illness (ParadigmsEng.mkAdv "of any kind") ; + lin _double_A = mkA "double" ; + lin _claimant_N = mkN "claimant" ; + lin _suicide_N = mkN "suicide" ; + lin _Reductions_PN = mkPN "Reductions" ; + lin _occur_before_V2 = mkV2 (us_britishV "occur") (mkPrep "before") ; + lin _on_Prep = mkPrep "on" ; + lin _area_N = mkN "area" ; + lin _Head_PN = mkPN "Head" ; + lin _y_PN = mkPN "y" ; + lin _MR_PN = mkPN "MR" ; + lin _by_Prep = mkPrep "by" ; + lin _fractured_A = mkA "fractured" ; + lin _benefpaidout_N = mkN "benefpaidout" ; + lin _Conditions_PN = mkPN "Conditions" ; + lin _attempt_N = mkN "attempt" ; + lin _ADD_PN = mkPN "ADD" ; + lin _hearing_N = mkN "hearing" ; + lin _polilcy_N = mkN "polilcy" ; + lin _Claim_PN = mkPN "Claim" ; + lin _for_Prep = mkPrep "for" ; + lin _assure_per_V2 = mkV2 (us_britishV "assure") (mkPrep "per") ; + lin _radiation_N = mkN "radiation" ; + lin _declaration_N = mkN "declaration" ; + lin _occur_during_V2 = mkV2 (us_britishV "occur") _during_Prep ; + lin _work_N = mkN "work" ; + lin _accidental_A = mkA "accidental" ; + lin _as_Adv = mkAdv "as" ; + lin _accident_N = mkN "accident" ; + lin _give_V2 = mkV2 (us_britishV "give") ; + lin _Republic_PN = mkPN "Republic" ; + lin _hear_in_V2 = mkV2 (us_britishV "hear") (mkPrep "in") ; + lin _get_from_V2 = mkV2 (us_britishV "get") (mkPrep "from") ; + lin _Plan14_PN = mkPN "Plan14" ; + lin _reasoner_N = mkN "reasoner" ; + lin _limit_N = mkN "limit" ; + lin _H7N7_V = us_britishV "H7N7" ; + lin _timeyear_N = mkN "timeyear" ; + lin _life_N = mkN "life" ; + lin _establish_V = us_britishV "establish" ; + lin _pland_Adv = mkAdv "pland" ; + lin _supervise_V = us_britishV "supervise" ; + lin _out_Prep = mkPrep "out" ; + lin _start_VS = mkVS (us_britishV "start") ; + lin _riot_N = mkN "riot" ; + lin _transport_N = mkN "transport" ; + lin _H7N7_N = mkN "H7N7" ; + lin _both_Subj = mkSubj "both" ; + lin _leg_N = mkN "leg" ; + lin _firstclaimyear_N = mkN "firstclaimyear" ; + lin _Section_PN = mkPN "Section" ; + lin _list_N = mkN "list" ; + lin _recognise_V = us_britishV "recognise" ; + lin _planF_PN = mkPN "planF" ; + lin _benADD_PN = mkPN "benADD" ; + lin _SG_PN = mkPN "SG" ; + lin _AIDS_PN = mkPN "AIDS" ; + lin _human_A = mkA "human" ; + lin _cover_V = us_britishV "cover" ; + lin _address_N = mkN "address" ; + lin _Address_PN = mkPN "Address" ; + lin _duty_N = mkN "duty" ; + lin _patella_N = mkN "patella" ; + lin _schedule_N = mkN "schedule" ; + lin _particular_A = mkA "particular" ; + lin _participate_in_V2 = mkV2 (mkV "participate") in_Prep ; + lin _passenger_N = mkN "passenger" ; + lin _where_Subj = mkSubj "where" ; + lin _total_A = mkA "total" ; + lin _addsa_N = mkN "addsa" ; + lin _of_Prep = mkPrep "of" ; + lin _phalanx_N = mkN "phalanx" ; + lin _eligibility_N = mkN "eligibility" ; + lin _past_A = mkA "past" ; + lin _assure_V2 = mkV2 (us_britishV "assure") ; + lin _racing_N = mkN "racing" ; + lin _f_N = mkN "f" ; + lin _ponder_V2 = mkV2 (us_britishV "ponder") ; + lin _incident_N = mkN "incident" ; + lin _life_assured_die_N = mkN "life_assured_die" ; + lin _ps_N = mkN "ps" ; + lin _in_Prep = mkPrep "in" ; + lin _Expense_PN = mkPN "Expense" ; + lin _before_Subj = mkSubj "before" ; + lin _p_N = mkN "p" ; + lin _1014_PN = mkPN "10.1.4" ; + lin _canoe_V = us_britishV "canoe" ; + lin _pothole_V = us_britishV "pothole" ; + lin _exception_N = mkN "exception" ; + lin _limb_N = mkN "limb" ; + lin _between_Prep = mkPrep "between" ; + lin _school_N = mkN "school" ; + lin _logical_A = mkA "logical" ; + lin _sight_N = mkN "sight" ; + lin _policyholder_N = mkN ("policyHolder"|"policyholder") ; + lin _refund_V2 = mkV2 (us_britishV "refund") ; + lin _cost_N = mkN "cost" ; + lin _located_in_A2 = mkA2 (mkA "located") (mkPrep "in") ; + lin _unsuccessful_A = mkA "unsuccessful" ; + lin _during_Prep = mkPrep ("during"|"DURING") ; + lin _happen_after_V2 = mkV2 (us_britishV "happen") (mkPrep "after") ; + lin _hfmd_A = mkA "hfmd" ; + lin _tsapp_N = mkN "tsapp" ; + lin _possibility_N = mkN "possibility" ; + lin _ear_N = mkN "ear" ; + lin _TABLE_PN = mkPN "TABLE" ; + lin _authority_N = mkN "authority" ; + lin _federation_N = mkN "federation" ; + lin _Insurer_PN = mkPN "Insurer" ; + lin _Policy_PN = mkPN "Policy" ; + lin _Flu_PN = mkPN "Flu" ; + lin _condition_N = mkN "condition" ; + lin _LA_PN = mkPN "LA" ; + lin _hang_VV = mkVV (us_britishV "hang") ; + lin _over_Prep = mkPrep "over" ; + lin _benTCM_PN = mkPN "benTCM" ; + lin _pay_for_V2 = mkV2 (us_britishV "pay") (mkPrep "for") ; + lin _payable_A = mkA "payable" ; + lin _military_N = mkN "military" ; + lin _plana_N = mkN "plana" ; + lin _p_PN = mkPN "p" ; + lin _H7N_PN = mkPN "H7N" ; + lin _vessel_N = mkN "vessel" ; + lin _foot_N = mkN "foot" ; + lin _incurable_A = mkA "incurable" ; + lin _employee_N = mkN "employee" ; + lin _fare_N = mkN "fare" ; + lin _military_A = mkA "military" ; + lin _exception_V = us_britishV "exception" ; + lin _policy_N = mkN "policy" ; + lin _person_N = mkN "person" ; + lin _mean_VS = mkVS (us_britishV "mean") ; + lin _1012_PN = mkPN "10.1.2" ; + lin _include_V2 = mkV2 (us_britishV "include") ; + lin _within_Prep = mkPrep "within" ; + lin _pay_V2 = mkV2 (us_britishV "pay") ; + lin _Melioidosis_PN = mkPN "Melioidosis" ; + lin _chemical_A = mkA "chemical" ; + lin _N_PN = mkPN "N" ; + lin _pland_N = mkN "pland" ; + lin _cm_N = mkN "cm" ; + lin _intentional_A = mkA "intentional" ; + lin _predicate_N = mkN "predicate" ; + lin _dType_PN = mkPN "dType" ; + lin _try_VV = mkVV (us_britishV "try") ; + lin _result_from_V2 = mkV2 (us_britishV "result") (mkPrep "from") ; + lin _through_Prep = mkPrep "through" ; + lin _registered_A = mkA "registered" ; + lin _expense_N = mkN "expense" ; + lin _premise_N = mkN "premise" ; + lin _premise_where_N2 = mkN2 _premise_N (mkPrep "where") ; + lin _year_N = mkN "year" ; + lin _circumstance_N = mkN "circumstance" ; + lin _life_assured_suffers_injury_does_not_die_within_30_day_N = mkN "life_assured_suffers_injury_does_not_die_within_30_day" ; + lin _make_within_V2 = mkV2 (us_britishV "make") (mkPrep "within") ; + lin _description_N = mkN "description" ; + lin _diagnosis_N = mkN "diagnosis" ; + lin _train_V = us_britishV "train" ; + lin _Singapore_PN = mkPN "Singapore" ; + lin _glide_V = us_britishV "glide" ; + lin _sssure_for_V2 = mkV2 (us_britishV "sssure") (mkPrep "for") ; + lin _damageevent_N = mkN "damageevent" ; + lin _infection_N = mkN "infection" ; + lin _mean_V = us_britishV "mean" ; + lin _lose_V2 = mkV2 (us_britishV "lose") ; + lin _payout_N = mkN "payout" ; + lin _y_N = mkN "y" ; + lin _riding_N = mkN "riding" ; + lin _service_N = mkN "service" ; + lin _mean_as_V2 = mkV2 (us_britishV "mean") (mkPrep "as") ; + lin _association_N = mkN "association" ; + lin _hernia_N = mkN "hernia" ; + lin _month_N = mkN "month" ; + lin _competition_N = mkN "competition" ; + lin _Influenza_PN = mkPN "Influenza" ; + lin _c_N = mkN "c" ; + lin _skydive_V = us_britishV "skydive" ; + lin _m_N = mkN "m" ; + lin _private_A = mkA "private" ; + lin _accepted_A = mkA "accepted" ; + lin _age_N = mkN "age" ; + lin _Details_PN = mkPN "Details" ; + lin _contract_N = mkN "contract" ; + lin _member_N = mkN "member" ; + lin _e_N = mkN "e" ; + lin _number_N = mkN "number" ; + lin _Ministry_PN = mkPN "Ministry" ; + lin _mall_N = mkN "mall" ; + lin _Yellow_PN = mkPN "Yellow" ; + lin _verifier_N = mkN "verifier" ; + lin _under_Prep = mkPrep "under" ; + lin _due_A = mkA "due" ; + lin _multiple_A = mkA "multiple" ; + lin _vehicle_N = mkN "vehicle" ; + lin _d_N = mkN "d" ; + lin _cover_V2 = mkV2 (us_britishV "cover") ; + lin _hockey_N = mkN "hockey" ; + lin _declare_V2 = mkV2 (us_britishV "declare") ; + lin _play_V2 = mkV2 (us_britishV "play") ; + lin _planE_PN = mkPN "planE" ; + lin _national_A = mkA "national" ; + lin _per_Prep = mkPrep "per" ; + lin _planB_PN = mkPN "planB" ; + lin _stepuppercentage_N = mkN "stepuppercentage" ; + lin _adjusted_A = mkA "adjusted" ; + lin _disease_N = mkN "disease" ; + lin _Triple_PN = mkPN "Triple" ; + lin _disabled_A = mkA "disabled" ; + lin _subject_A = mkA "subject" ; + lin _holder_N = mkN "holder" ; + lin _then_Adv = mkAdv "then" ; + lin _task_N = mkN "task" ; + lin _save_V2 = mkV2 (us_britishV "save") ; + lin _adjustment_N = mkN "adjustment" ; + lin _airline_N = mkN "airline" ; + lin _to_Prep = mkPrep "to" ; + lin _infectious_A = mkA "infectious" ; + lin _death_N = mkN "death" ; + lin _time_N = mkN "time" ; + lin _professional_A = mkA "professional" ; + lin _life_assured_N = mkN "life assured" ; + lin _form_N = mkN "form" ; + lin _dc_N = mkN "dc" ; + lin _sum_list_PN = mkPN "sum_list" ; + lin _have_V2 = mkV2 (us_britishV "have") ; + lin _toe_N = mkN "toe" ; + lin _soon_Adv = mkAdv "soon" ; + lin _plan3_PN = mkPN "plan3" ; + lin _Wife_PN = mkPN "Wife" ; + lin _tcm_N = mkN "tcm" ; + lin _Service_PN = mkPN "Service" ; + lin _loss_N = mkN "loss" ; + lin _Accident_PN = mkPN "Accident" ; + lin _Death_PN = mkPN "Death" ; + lin _suffer_in_V2 = mkV2 (us_britishV "suffer") (mkPrep "in") ; + lin _from_Prep = mkPrep "from" ; + lin _dangerous_A = mkA "dangerous" ; + lin _M_PN = mkPN "M" ; + lin _mountaineer_V = us_britishV "mountaineer" ; + lin _assure_of_V2 = mkV2 (us_britishV "assure") (mkPrep "of") ; + lin _met_common_requirement_for_add_V = us_britishV "met_common_requirement_for_add" ; + lin _vcjd_N = mkN "vcjd" ; +-- some PNs as Ns + lin _1012_N = mkN "10.1.2" ; + lin _1014_N = mkN "10.1.4" ; + lin _333A_N = mkN "333A" ; + lin _ADD_N = mkN "ADD" ; + lin _AIDS_N = mkN "AIDS" ; + lin _Accident_N = mkN "Accident" ; + lin _Accidental_N = mkN "Accidental" ; + lin _Accidents_N = mkN "Accidents" ; + lin _Address_N = mkN "Address" ; + lin _Adjustment_N = mkN "Adjustment" ; + lin _Assured_N = mkN "Assured" ; + lin _BSA_N = mkN "BSA" ; + lin _Benefit_N = mkN "Benefit" ; + lin _Cap_N = mkN "Cap" ; + lin _Claim_N = mkN "Claim" ; + lin _CoV_N = mkN "CoV" ; + lin _Conditions_N = mkN "Conditions" ; + lin _Date_N = mkN "Date" ; + lin _Death_N = mkN "Death" ; + lin _Details_N = mkN "Details" ; + lin _Disease_N = mkN "Disease" ; + lin _Dismemberment_N = mkN "Dismemberment" ; + lin _Event_N = mkN "Event" ; + lin _Expense_N = mkN "Expense" ; + lin _Flu_N = mkN "Flu" ; + lin _H7N9_N = mkN "H7N9" ; + lin _H7N_N = mkN "H7N" ; + lin _H9N2_N = mkN "H9N2" ; + lin _HAS_N = mkN "HAS" ; + lin _Head_N = mkN "Head" ; + lin _Health_N = mkN "Health" ; + lin _Influenza_N = mkN "Influenza" ; + lin _Injury_N = mkN "Injury" ; + lin _Insurer_N = mkN "Insurer" ; + lin _LA_N = mkN "LA" ; + lin _LE_N = mkN "LE" ; + lin _Leg_N = mkN "Leg" ; + lin _Legionnaires_N = mkN "Legionnaires" ; + lin _Life_N = mkN "Life" ; + lin _Limit_N = mkN "Limit" ; + lin _MAP_N = mkN "MAP" ; + lin _MIN_N = mkN "MIN" ; + lin _MR_N = mkN "MR" ; + lin _M_N = mkN "M" ; + lin _Medicine_N = mkN "Medicine" ; + lin _Melioidosis_N = mkN "Melioidosis" ; + lin _Ministry_N = mkN "Ministry" ; + lin _Mumps_N = mkN "Mumps" ; + lin _N_N = mkN "N" ; + lin _Nipah_N = mkN "Nipah" ; + lin _Ontology_N = mkN "Ontology" ; + lin _PS_N = mkN "PS" ; + lin _Plan14_N = mkN "Plan14" ; + lin _PlanAF_N = mkN "PlanAF" ; + lin _PolicyHolder_N = mkN "PolicyHolder" ; + lin _Policy_N = mkN "Policy" ; + lin _RETURN_N = mkN "RETURN" ; + lin _Reductions_N = mkN "Reductions" ; + lin _Removal_N = mkN "Removal" ; + lin _Republic_N = mkN "Republic" ; + lin _SA_N = mkN "SA" ; + lin _SG_N = mkN "SG" ; + lin _Schedule_N = mkN "Schedule" ; + lin _Section_N = mkN "Section" ; + lin _Service_N = mkN "Service" ; + lin _Singapore_N = mkN "Singapore" ; + lin _Step_N = mkN "Step" ; + lin _Subscribed_N = mkN "Subscribed" ; + lin _TABLE_N = mkN "TABLE" ; + lin _Teeth_N = mkN "Teeth" ; + lin _Triple_N = mkN "Triple" ; + lin _Type_N = mkN "Type" ; + lin _Types_N = mkN "Types" ; + lin _UPON_N = mkN "UPON" ; + lin _Wife_N = mkN "Wife" ; + lin _Yellow_N = mkN "Yellow" ; + lin _addSA_N = mkN "addSA" ; + lin _benADD_N = mkN "benADD" ; + lin _benADDs_N = mkN "benADDs" ; + lin _benRA_N = mkN "benRA" ; + lin _benTCM_N = mkN "benTCM" ; + lin _circ_N = mkN "circ" ; + lin _dTime_N = mkN "dTime" ; + lin _dType_N = mkN "dType" ; + lin _diving_N = mkN "diving" ; + lin _motocross_N = mkN "motocross" ; + lin _plan3_N = mkN "plan3" ; + lin _plan4_N = mkN "plan4" ; + lin _planAF_N = mkN "planAF" ; + lin _planB_N = mkN "planB" ; + lin _planC_N = mkN "planC" ; + lin _planE_N = mkN "planE" ; + lin _planF_N = mkN "planF" ; + lin _policyHolder_N = mkN "policyHolder" ; + lin _qualifies_for_add_N = mkN "qualifies_for_add" ; + lin _schema_N = mkN "schema" ; + lin _sum_list_N = mkN "sum_list" ; + lin _x_N = mkN "x" ; +} \ No newline at end of file diff --git a/lib/haskell/natural4/grammars/NL4.gf b/lib/haskell/natural4/grammars/NL4.gf index 6f0921a7b..80188bffe 100644 --- a/lib/haskell/natural4/grammars/NL4.gf +++ b/lib/haskell/natural4/grammars/NL4.gf @@ -1,4 +1,5 @@ abstract NL4 = StandardLexicon -- Manually curated set of common legal domain words (TODO: split into smaller domains? when does size of lexicon become an issue?) , DomainLexicon -- Automatically generated on the fly from whatever document we are processing + , InsLex ; \ No newline at end of file diff --git a/lib/haskell/natural4/grammars/NL4.pgf b/lib/haskell/natural4/grammars/NL4.pgf index 6d2877de0..208e8e108 100644 Binary files a/lib/haskell/natural4/grammars/NL4.pgf and b/lib/haskell/natural4/grammars/NL4.pgf differ diff --git a/lib/haskell/natural4/grammars/NL4Base.gf b/lib/haskell/natural4/grammars/NL4Base.gf index 9ec8e0c8c..0f78a49c5 100644 --- a/lib/haskell/natural4/grammars/NL4Base.gf +++ b/lib/haskell/natural4/grammars/NL4Base.gf @@ -12,41 +12,41 @@ abstract NL4Base = CustomSyntax ** { Action ; Who ; [Who]{2} ; - Subj ; Deontic ; Upon ; fun -- for fancy NLG - Regulative : Subj -> Deontic -> Action -> Text ; + Regulative : NP -> Deontic -> Action -> Text ; advUPON : Upon -> Text ; -- actually include the word Upon -- for web forms qWHO, - sWHO : Subj -> Who -> Text ; + sWHO : NP -> Who -> Text ; qUPON, -- TODO rethink types when adding more langs -- TODO2 do we allow upon to take full sentence or just VP*? - sUPON : Subj -> Upon -> Text ; + sUPON : NP -> Upon -> Text ; qCOND, sCOND : Cond -> Text ; -- general Regulative stuff - EVERY, - PARTY, - AN, THE : CN -> Subj ; -- EVERY Person + EVERY : CN -> NP ; -- EVERY Person + -- PARTY, + -- AN, THE WHO : Temp -> Pol -> VP -> Who ; -- WHO walks ACTION : VP -> Action ; MUST, MAY, SHANT : Deontic ; AND, OR : Conj ; - SubjWho : Subj -> Who -> Subj ; + SubjWho : NP -> Who -> NP ; ConjWho : Conj -> [Who] -> Who ; ConjPreWho : PrePost -> Conj -> [Who] -> Who ; -- TODO need to find examples in the wild ConjPrePostWho : (_,_ : PrePost) -> Conj -> [Who] -> Who ; - You : Subj ; + You : NP ; UPON : VP -> Upon ; -- upon becoming + UPONnp : NP -> VP -> Upon ; -- upon Accident happening -- not used for parsing WHEN : NP -> Temp -> Pol -> VP -> Cond ; ConjCond : Conj -> [Cond] -> Cond ; @@ -63,9 +63,11 @@ abstract NL4Base = CustomSyntax ** { fun RPleafS : NP -> VPS -> Constraint ; - RPleafNP : NP -> Constraint ; -- to pair with PrePost to get a full sentence ??? RPleafVP : VPS -> Constraint ; + -- to pair with PrePost, which we assume to contain the actual predicate + RPleafNP : NP -> Constraint ; RPleafAP : AP -> Constraint ; + RPleafAdv : Adv -> Constraint ; ConjConstraint : Conj -> [Constraint] -> Constraint ; ConjPreConstraint : PrePost -> Conj -> [Constraint] -> Constraint ; ConjPrePostConstraint : PrePost -> PrePost -> Conj -> [Constraint] -> Constraint ; @@ -120,12 +122,21 @@ abstract NL4Base = CustomSyntax ** { MkYear : (x1,_,_,x4: YearComponent) -> Year ; Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7, Y8, Y9 : YearComponent ; + -- Ages and comparisons + Comparison_Card_Years : Card -> VPS ; + + -- Generic comparisons + LessThan, + GreaterThan : NP -> VPS ; + ----------------------------------------------------------------------------- -- Very specific things, yet uncategorised - V2_PrePost : V2 -> PrePost ; -- consumes + V2_PrePost : Temp -> Pol -> V2 -> PrePost ; -- consumes NP_PrePost : NP -> PrePost ; -- beverage AP_PrePost : AP -> PrePost ; -- any unauthorised Adv_PrePost : Adv -> PrePost ; -- of personal data + SSlash_PrePost : NP -> Temp -> Pol -> V2 -> PrePost ; -- accident resulted from + S_PrePost : NP -> VPS -> PrePost ; -- the vehicle is on its way APWho : AP -> Who ; -- alcoholic AdvWho : Adv -> Who ; -- in whole @@ -138,11 +149,12 @@ abstract NL4Base = CustomSyntax ** { recoverUnparsedWho : String -> Who ; recoverUnparsedCond : String -> Cond ; recoverUnparsedUpon : String -> Upon ; - recoverUnparsedSubj : String -> Subj ; + recoverUnparsedNP : String -> NP ; recoverUnparsedAction : String -> Action ; recoverUnparsedTimeUnit : String -> TimeUnit ; recoverRPis : String -> String -> Constraint ; + recoverRPmath : String -> String -> String -> Constraint ; recoverUnparsedAdv : String -> Adv ; diff --git a/lib/haskell/natural4/grammars/NL4BaseChi.gf b/lib/haskell/natural4/grammars/NL4BaseChi.gf index 5731a37c2..fb83da77f 100644 --- a/lib/haskell/natural4/grammars/NL4BaseChi.gf +++ b/lib/haskell/natural4/grammars/NL4BaseChi.gf @@ -13,6 +13,7 @@ concrete NL4BaseChi of NL4Base = , (Extend=ExtendChi) , (Symbolic=SymbolicChi) , (Lexicon=LexiconChi) + , (Construction=ConstructionChi) , (CustomSyntax=CustomSyntaxChi) ** open Coordination, Prelude, ParadigmsChi, (R=ResChi) in { @@ -126,7 +127,7 @@ lin recoverUnparsedUpon string = mkVP (invarV string.s) ; - recoverUnparsedSubj string = symb string ; + recoverUnparsedNP string = symb string ; recoverUnparsedAction string = MkVPI (mkVP (invarV string.s)) ; diff --git a/lib/haskell/natural4/grammars/NL4BaseEng.gf b/lib/haskell/natural4/grammars/NL4BaseEng.gf index 584391ec4..c893fcb90 100644 --- a/lib/haskell/natural4/grammars/NL4BaseEng.gf +++ b/lib/haskell/natural4/grammars/NL4BaseEng.gf @@ -6,6 +6,7 @@ concrete NL4BaseEng of NL4Base = , (Extend=ExtendEng) , (Symbolic=SymbolicEng) , (Lexicon=LexiconEng) + , (Construction=ConstructionEng) , (CustomSyntax=CustomSyntaxEng) ** open Coordination, Prelude, ParadigmsEng, (R=ResEng) in { @@ -52,22 +53,29 @@ concrete NL4BaseEng of NL4Base = s = "·" ++ damage.s ++ "is" ++ toContents.s ; -- if constraint isn't parsed, use the original string qs = "Is" ++ damage.s ++ toContents.s ++ bindQM } ; - lin recoverUnparsedConstraint string = recoverUnparsedPrePost string ; + lin recoverRPmath gt age fifty = { + s = "·" ++ age.s ++ gt.s ++ fifty.s ; -- if constraint isn't parsed, use the original string + qs = "Is" ++ age.s ++ gt.s ++ fifty.s ++ bindQM + } ; + lin recoverUnparsedConstraint string = { + s = "·" ++ string.s ; + qs = string.s ++ bindQM + } ; - lin recoverUnparsedWho string = MkVPS presSimul POS (mkVP (invarV string.s)) ; + lin recoverUnparsedWho string = MkVPS presSimul POS (mkVP (invarUnparsedV string)) ; lin recoverUnparsedCond string = { s = lin S string ; qs = lin QS {s = \\_ => string.s} } ; - lin recoverUnparsedUpon string = mkVP (invarV string.s) ; + lin recoverUnparsedUpon string = mkVP (invarUnparsedV string) ; - lin recoverUnparsedSubj string = symb string ; - - lin recoverUnparsedAction string = MkVPI (mkVP (invarV string.s)) ; + lin recoverUnparsedAction string = MkVPI (mkVP (invarUnparsedV string)) ; lin recoverUnparsedTimeUnit string = mkCN "·" ++ string.s} : N> ; + oper invarUnparsedV : SS -> V = \ss -> invarV ("·" ++ ss.s) ; + } diff --git a/lib/haskell/natural4/grammars/NL4BaseFunctor.gf b/lib/haskell/natural4/grammars/NL4BaseFunctor.gf index 574667f11..1a0bac0e5 100644 --- a/lib/haskell/natural4/grammars/NL4BaseFunctor.gf +++ b/lib/haskell/natural4/grammars/NL4BaseFunctor.gf @@ -5,6 +5,7 @@ incomplete concrete NL4BaseFunctor of NL4Base = CustomSyntax ** open , Lexicon , CustomSyntax , Coordination + , Construction , Prelude in { @@ -17,7 +18,6 @@ incomplete concrete NL4BaseFunctor of NL4Base = CustomSyntax ** open Action = Extend.VPI ; Who = Extend.VPS ; [Who] = Extend.ListVPS ; - Subj = Syntax.NP ; Deontic = Syntax.VV ; Upon = Syntax.VP ; @@ -75,7 +75,7 @@ incomplete concrete NL4BaseFunctor of NL4Base = CustomSyntax ** open -- : (_,_ : PrePost) -> Conj -> [Who] -> Who ; ConjPrePostWho = CustomSyntax.ConjPrePostVPS ; -- fun/lin in CustomSyntax - -- : Subj -> Who -> Subj ; + -- : NP -> Who -> NP ; SubjWho subj who = mkNP subj (Extend.RelVPS CustomSyntax.whoRP who) ; -- who_RP is oper in CustomSyntax You = you_NP ; @@ -139,6 +139,11 @@ incomplete concrete NL4BaseFunctor of NL4Base = CustomSyntax ** open -- qs = qsStr (Extend.SQuestVPS it_NP (MkVPS presSimul POS (mkVP ap))) ++ bindQM qs = (mkUtt ap).s ++ bindQM } ; + RPleafAdv adv = { + s = (mkUtt adv).s ; + qs = (mkUtt adv).s ++ bindQM + } ; + BaseConstraint c d = { s = Coordination.twoStr c.s d.s ; qs = Coordination.twoStr c.qs d.qs @@ -196,9 +201,9 @@ incomplete concrete NL4BaseFunctor of NL4Base = CustomSyntax ** open ConsTComparison = CustomSyntax.ConsPrep ; ConjTComparison = CustomSyntax.ConjPrep ; -- Chi has changed lincat and defs of Prep, so all must be from CustomSyntax - BEFORE = CustomSyntax.withinPrep -- internal oper defined in CustomSyntax{Eng,Chi,May} - | CustomSyntax.before_Prep ; -- comes from RGL, re-exported by CustomSyntax{Eng,Chi,May}. + BEFORE = CustomSyntax.before_Prep -- comes from RGL, re-exported by CustomSyntax{Eng,Chi,May}. -- In addition, its lincat and lin has been changed in CustomSyntaxChi. + | CustomSyntax.withinPrep ; -- internal oper defined in CustomSyntax{Eng,Chi,May} AFTER = CustomSyntax.after_Prep ; BY = CustomSyntax.by8timePrep ; ON = CustomSyntax.on_Prep ; @@ -226,16 +231,24 @@ incomplete concrete NL4BaseFunctor of NL4Base = CustomSyntax ** open MkYear = cc4 ; + -- Ages + -- : Card -> VPS ; + Comparison_Card_Years card = MkVPS presSimul POS (Construction.has_age_VP card) ; + + -- Generic comparisons + -- LessThan, + -- GreaterThan : NP -> VPS ; + ----------------------------------------------------------------------------- -- Very specific things, yet uncategorised -- : AP -> Who ; -- hack APWho alcoholic = Extend.MkVPS presSimul POS (mkVP alcoholic) ; AdvWho in_part = Extend.MkVPS presSimul POS (mkVP in_part) ; - -- : V2 -> PrePost ; -- consumes - V2_PrePost consume = - let consumes : SS = mkUtt (mkS (mkCl emptyNP (mkVP consume emptyNP))) ; - consume : SS = mkUtt (mkS (mkCl emptyPlNP (mkVP consume emptyNP))) ; + -- : Temp -> Pol -> V2 -> PrePost ; -- consumes + V2_PrePost t p consume = + let consumes : SS = mkUtt (mkS t p (mkCl emptyNP (mkVP consume emptyNP))) ; + consume : SS = mkUtt (mkS t p (mkCl emptyPlNP (mkVP consume emptyNP))) ; in {s = consumes.s ; qs = consume.s} ; -- : NP -> PrePost ; -- beverage @@ -253,6 +266,20 @@ incomplete concrete NL4BaseFunctor of NL4Base = CustomSyntax ** open -- : Adv -> PrePost ; -- of personal data Adv_PrePost adv = {s,qs = (mkUtt adv).s} ; + -- : S -> PrePost ; -- the vehicle is on its way + S_PrePost np vps = { + s = (mkUtt (PredVPS np vps)).s ; + qs = (mkUtt (SQuestVPS np vps)).s + } ; + + -- : NP -> Temp -> Pol -> V2 -> PrePost ; -- accident resulted from + SSlash_PrePost accident t p result_from = + let result_from_S : SS = mkUtt (mkS t p (mkCl accident (mkVP result_from emptyNP))) ; + result_from_QS : SS = mkUtt (mkQS t p (mkQCl (mkCl accident (mkVP result_from emptyNP)))) ; + in {s = result_from_S.s ; qs = result_from_QS.s} ; + + recoverUnparsedNP string = symb (cc2 (ss "·") string) ; + recoverUnparsedAdv string = lin Adv (cc2 {s="·"} string) ; -- override for Chi } diff --git a/lib/haskell/natural4/grammars/NL4BaseMay.gf b/lib/haskell/natural4/grammars/NL4BaseMay.gf index 25afae682..e39f05701 100644 --- a/lib/haskell/natural4/grammars/NL4BaseMay.gf +++ b/lib/haskell/natural4/grammars/NL4BaseMay.gf @@ -6,6 +6,7 @@ concrete NL4BaseMay of NL4Base = , (Extend=ExtendMay) , (Symbolic=SymbolicMay) , (Lexicon=LexiconMay) + , (Construction=ConstructionMay) , (CustomSyntax=CustomSyntaxMay) ** open Coordination, Prelude, ParadigmsMay, (R=ResMay) in { @@ -49,7 +50,7 @@ lin recoverUnparsedUpon string = mkVP (invarV string.s) ; - recoverUnparsedSubj string = symb string ; + recoverUnparsedNP string = symb string ; recoverUnparsedAction string = MkVPI (mkVP (invarV string.s)) ; diff --git a/lib/haskell/natural4/grammars/NL4Eng.gf b/lib/haskell/natural4/grammars/NL4Eng.gf index ba7ff05d7..d08106155 100644 --- a/lib/haskell/natural4/grammars/NL4Eng.gf +++ b/lib/haskell/natural4/grammars/NL4Eng.gf @@ -1,4 +1,5 @@ concrete NL4Eng of NL4 = StandardLexiconEng , DomainLexiconEng + , InsLexEng ; \ No newline at end of file diff --git a/lib/haskell/natural4/grammars/StandardLexicon.gf b/lib/haskell/natural4/grammars/StandardLexicon.gf index 6c20063bf..03dd6f641 100644 --- a/lib/haskell/natural4/grammars/StandardLexicon.gf +++ b/lib/haskell/natural4/grammars/StandardLexicon.gf @@ -8,6 +8,7 @@ abstract StandardLexicon = NL4Base ** { fun within_Prep : Prep ; only_AdA : AdA ; -- within -> only within + due_to_A2 : A2 ; -- Open classes, like nouns, verbs etc. fun diff --git a/lib/haskell/natural4/grammars/StandardLexiconChi.gf b/lib/haskell/natural4/grammars/StandardLexiconChi.gf index 474984e8f..0b4543836 100644 --- a/lib/haskell/natural4/grammars/StandardLexiconChi.gf +++ b/lib/haskell/natural4/grammars/StandardLexiconChi.gf @@ -42,7 +42,7 @@ concrete StandardLexiconChi of StandardLexicon = NL4BaseChi ** NP_caused_NP_to_VP_Prep_PrePost np water escape from = let cl : Cl = mkCl (mkVP cause_V2V ) ; - cls : ClSlash = mkClSlash cl ; + cls : ClSlash = mkClSlash cl ; qcl : QCl = hackQCl cls ; ss : SSlash = mkSSlash (mkTemp pastTense simultaneousAnt) positivePol cls ; qs : QS = mkQS pastTense qcl ; diff --git a/lib/haskell/natural4/grammars/StandardLexiconEng.gf b/lib/haskell/natural4/grammars/StandardLexiconEng.gf index e11dc65ef..e1efcef04 100644 --- a/lib/haskell/natural4/grammars/StandardLexiconEng.gf +++ b/lib/haskell/natural4/grammars/StandardLexiconEng.gf @@ -14,6 +14,7 @@ concrete StandardLexiconEng of StandardLexicon = NL4BaseEng ** lin within_Prep = mkPrep "within" ; only_AdA = mkAdA "only" ; + due_to_A2 = mkA2 (mkA "due") to_Prep ; -- Open classes, like nouns, verbs etc. lin diff --git a/lib/haskell/natural4/grammars/updateHS.sh b/lib/haskell/natural4/grammars/updateHS.sh index 45b11bb19..3dee6b629 100755 --- a/lib/haskell/natural4/grammars/updateHS.sh +++ b/lib/haskell/natural4/grammars/updateHS.sh @@ -2,7 +2,7 @@ set -euo pipefail -gf -make -f haskell --haskell=gadt --haskell=lexical --lexical=N,CN,AP,VP,V2,VS,VV,Dig,Day,Month,YearComponent NL4Eng.gf NL4May.gf NL4Chi.gf +gf -make -f haskell --haskell=gadt --haskell=lexical --lexical=A,V,N,CN,PN,Prep,Conj,Subj,AP,VP,V2,VS,VV,V2V,Dig,Day,Month,YearComponent NL4Eng.gf NL4May.gf NL4Chi.gf cat NL4.hs | sed 's/module NL4 where/module LS.NLP.NL4 where/' | \ sed 's/instance Show .*//' | \ diff --git a/lib/haskell/natural4/src/LS/NLP/NL4.hs b/lib/haskell/natural4/src/LS/NLP/NL4.hs index 88cda3a6e..5ee9790d1 100644 --- a/lib/haskell/natural4/src/LS/NLP/NL4.hs +++ b/lib/haskell/natural4/src/LS/NLP/NL4.hs @@ -1,28 +1,9 @@ -{-# LANGUAGE GADTs #-} -{-# LANGUAGE UndecidableInstances #-} - +{-# LANGUAGE GADTs, UndecidableInstances #-} module LS.NLP.NL4 where -import Control.Monad.Identity - ( Identity (Identity, runIdentity), - MonadPlus (..), - ap, - ) +import Control.Monad.Identity (Identity ( Identity, runIdentity), MonadPlus (..), ap ) import Data.Monoid () -import PGF - ( Expr, - mkApp, - mkCId, - mkFloat, - mkInt, - mkStr, - showCId, - showExpr, - unApp, - unFloat, - unInt, - unStr, - ) +import PGF (Expr, mkApp, mkCId, mkFloat, mkInt, mkStr, showCId, showExpr, unApp, unFloat, unInt, unStr ) ---------------------------------------------------- -- automatic translation from GF to Haskell @@ -59,16 +40,26 @@ instance (Gf (Tree a)) => Show (Tree a) where show = showExpr [] . gf ---------------------------------------------------- +type GA = Tree GA_ +data GA_ +type GA2 = Tree GA2_ +data GA2_ type GAP = Tree GAP_ data GAP_ type GAction = Tree GAction_ data GAction_ type GAdA = Tree GAdA_ data GAdA_ +type GAdN = Tree GAdN_ +data GAdN_ type GAdv = Tree GAdv_ data GAdv_ +type GCAdv = Tree GCAdv_ +data GCAdv_ type GCN = Tree GCN_ data GCN_ +type GCard = Tree GCard_ +data GCard_ type GComp = Tree GComp_ data GComp_ type GCond = Tree GCond_ @@ -115,10 +106,18 @@ type GListWho = Tree GListWho_ data GListWho_ type GMonth = Tree GMonth_ data GMonth_ +type GN = Tree GN_ +data GN_ +type GN2 = Tree GN2_ +data GN2_ type GNP = Tree GNP_ data GNP_ +type GNum = Tree GNum_ +data GNum_ type GNumeral = Tree GNumeral_ data GNumeral_ +type GPN = Tree GPN_ +data GPN_ type GPol = Tree GPol_ data GPol_ type GPrePost = Tree GPrePost_ @@ -127,6 +126,10 @@ type GPrep = Tree GPrep_ data GPrep_ type GQS = Tree GQS_ data GQS_ +type GRP = Tree GRP_ +data GRP_ +type GRS = Tree GRS_ +data GRS_ type GS = Tree GS_ data GS_ type GSub10 = Tree GSub10_ @@ -155,6 +158,8 @@ type GTimeUnit = Tree GTimeUnit_ data GTimeUnit_ type GUpon = Tree GUpon_ data GUpon_ +type GV = Tree GV_ +data GV_ type GV2 = Tree GV2_ data GV2_ type GVP = Tree GVP_ @@ -173,20 +178,10 @@ type GYear = Tree GYear_ data GYear_ type GYearComponent = Tree GYearComponent_ data GYearComponent_ -type GA = Tree GA_ -data GA_ -type GA2 = Tree GA2_ -data GA2_ type GAnt = Tree GAnt_ data GAnt_ -type GN = Tree GN_ -data GN_ -type GN2 = Tree GN2_ -data GN2_ type GTense = Tree GTense_ data GTense_ -type GV = Tree GV_ -data GV_ type GString = Tree GString_ data GString_ type GInt = Tree GInt_ @@ -195,6 +190,10 @@ type GFloat = Tree GFloat_ data GFloat_ data Tree :: * -> * where + LexA :: String -> Tree GA_ + G_located_in_A2 :: Tree GA2_ + Gdue_to_A2 :: Tree GA2_ + GComplA2 :: GA2 -> GNP -> Tree GAP_ GConjAP :: GConj -> GListAP -> Tree GAP_ GInt_or_older :: GInt -> Tree GAP_ GPositA :: GA -> Tree GAP_ @@ -204,16 +203,50 @@ data Tree :: * -> * where GACTION :: GVP -> Tree GAction_ GrecoverUnparsedAction :: GString -> Tree GAction_ Gonly_AdA :: Tree GAdA_ + GAdnCAdv :: GCAdv -> Tree GAdN_ + Gat_least_AdN :: Tree GAdN_ + Gat_most_AdN :: Tree GAdN_ GAdAdv :: GAdA -> GAdv -> Tree GAdv_ GByVP :: GVP -> Tree GAdv_ GConjAdv :: GConj -> GListAdv -> Tree GAdv_ GPrepNP :: GPrep -> GNP -> Tree GAdv_ + GSubjS :: GSubj -> GS -> Tree GAdv_ + GWhileDoing :: GVP -> Tree GAdv_ + G_as_Adv :: Tree GAdv_ + G_at_Adv :: Tree GAdv_ + G_directly_Adv :: Tree GAdv_ + G_first_Adv :: Tree GAdv_ + G_fully_Adv :: Tree GAdv_ + G_hence_Adv :: Tree GAdv_ + G_here_Adv :: Tree GAdv_ + G_indirectly_Adv :: Tree GAdv_ + G_least_Adv :: Tree GAdv_ + G_long_Adv :: Tree GAdv_ + G_more_Adv :: Tree GAdv_ + G_no_Adv :: Tree GAdv_ + G_on_its_way_Adv :: Tree GAdv_ + G_only_Adv :: Tree GAdv_ + G_permanently_Adv :: Tree GAdv_ + G_pland_Adv :: Tree GAdv_ + G_so_Adv :: Tree GAdv_ + G_soon_Adv :: Tree GAdv_ + G_then_Adv :: Tree GAdv_ + G_totally_Adv :: Tree GAdv_ + G_up_Adv :: Tree GAdv_ Gin_part :: Tree GAdv_ Gin_whole :: Tree GAdv_ GrecoverUnparsedAdv :: GString -> Tree GAdv_ + Gless_CAdv :: Tree GCAdv_ + Gmore_CAdv :: Tree GCAdv_ GAdjCN :: GAP -> GCN -> Tree GCN_ + GCNwhereS :: GCN -> GNP -> GVPS -> Tree GCN_ + GComplN2 :: GN2 -> GNP -> Tree GCN_ + GRelCN :: GCN -> GRS -> Tree GCN_ GUseN :: GN -> Tree GCN_ + G_CN_of_any_kind_CN :: GCN -> Tree GCN_ LexCN :: String -> Tree GCN_ + GAdNum :: GAdN -> GCard -> Tree GCard_ + GNumDigits :: GDigits -> Tree GCard_ GCompAP :: GAP -> Tree GComp_ GCompAdv :: GAdv -> Tree GComp_ GCompNP :: GNP -> Tree GComp_ @@ -223,22 +256,24 @@ data Tree :: * -> * where GRPConstraint :: GCond -> GTComparison -> GDate -> Tree GCond_ GWHEN :: GNP -> GTemp -> GPol -> GVP -> Tree GCond_ GrecoverUnparsedCond :: GString -> Tree GCond_ - GAND :: Tree GConj_ - GOR :: Tree GConj_ + LexConj :: String -> Tree GConj_ GConjConstraint :: GConj -> GListConstraint -> Tree GConstraint_ GConjPreConstraint :: GPrePost -> GConj -> GListConstraint -> Tree GConstraint_ GConjPrePostConstraint :: GPrePost -> GPrePost -> GConj -> GListConstraint -> Tree GConstraint_ GRPleafAP :: GAP -> Tree GConstraint_ + GRPleafAdv :: GAdv -> Tree GConstraint_ GRPleafNP :: GNP -> Tree GConstraint_ GRPleafS :: GNP -> GVPS -> Tree GConstraint_ GRPleafVP :: GVPS -> Tree GConstraint_ GrecoverRPis :: GString -> GString -> Tree GConstraint_ + GrecoverRPmath :: GString -> GString -> GString -> Tree GConstraint_ GrecoverUnparsedConstraint :: GString -> Tree GConstraint_ GMkDate :: GDay -> GMonth -> GYear -> Tree GDate_ LexDay :: String -> Tree GDay_ GMAY :: Tree GDeontic_ GMUST :: Tree GDeontic_ GSHANT :: Tree GDeontic_ + GaPl :: Tree GDet_ GaSg :: Tree GDet_ GthePl :: Tree GDet_ GtheSg :: Tree GDet_ @@ -266,13 +301,22 @@ data Tree :: * -> * where GListVPS :: [GVPS] -> Tree GListVPS_ GListWho :: [GWho] -> Tree GListWho_ LexMonth :: String -> Tree GMonth_ + GCompoundN :: GN -> GN -> Tree GN_ + LexN :: String -> Tree GN_ + G_premise_where_N2 :: Tree GN2_ + G_travel_by_N2 :: Tree GN2_ GConjNP :: GConj -> GListNP -> Tree GNP_ GContents :: Tree GNP_ GDetCN :: GDet -> GCN -> Tree GNP_ + GEVERY :: GCN -> Tree GNP_ + GGenModNP :: GNum -> GNP -> GCN -> Tree GNP_ GGerundNP :: GVP -> Tree GNP_ GLoss_or_Damage :: Tree GNP_ GMassNP :: GCN -> Tree GNP_ GNDB_Qualification :: Tree GNP_ + GSubjWho :: GNP -> GWho -> Tree GNP_ + GUsePN :: GPN -> Tree GNP_ + GYou :: Tree GNP_ Ganimal :: Tree GNP_ Gany_other_exclusion :: Tree GNP_ Gbirds :: Tree GNP_ @@ -283,6 +327,7 @@ data Tree :: * -> * where Ginsects :: Tree GNP_ Gplumbing_heating_or_AC :: Tree GNP_ Gpremium :: Tree GNP_ + GrecoverUnparsedNP :: GString -> Tree GNP_ Gresult_from :: GNP -> Tree GNP_ Grodents :: Tree GNP_ Gsigned :: Tree GNP_ @@ -291,7 +336,10 @@ data Tree :: * -> * where Gswimming_pool :: Tree GNP_ Gvermin :: Tree GNP_ Gwater :: Tree GNP_ + GNumPl :: Tree GNum_ + GNumSg :: Tree GNum_ Gnum :: GSub1000000 -> Tree GNumeral_ + LexPN :: String -> Tree GPN_ GNEG :: Tree GPol_ GPOS :: Tree GPol_ GAP_PrePost :: GAP -> Tree GPrePost_ @@ -299,20 +347,16 @@ data Tree :: * -> * where GNP_PrePost :: GNP -> Tree GPrePost_ GNP_caused_NP_to_VP_Prep_PrePost :: GNP -> GNP -> GVP -> GPrep -> Tree GPrePost_ GNP_caused_by_PrePost :: GNP -> Tree GPrePost_ - GV2_PrePost :: GV2 -> Tree GPrePost_ + GSSlash_PrePost :: GNP -> GTemp -> GPol -> GV2 -> Tree GPrePost_ + GS_PrePost :: GNP -> GVPS -> Tree GPrePost_ + GV2_PrePost :: GTemp -> GPol -> GV2 -> Tree GPrePost_ GrecoverUnparsedPrePost :: GString -> Tree GPrePost_ GConjPrep :: GConj -> GListPrep -> Tree GPrep_ - Gabout_Prep :: Tree GPrep_ - Gafter_Prep :: Tree GPrep_ - Gbefore_Prep :: Tree GPrep_ - Gfor_Prep :: Tree GPrep_ - Gfrom_Prep :: Tree GPrep_ - Gon_Prep :: Tree GPrep_ - Gpossess_Prep :: Tree GPrep_ - Gto_Prep :: Tree GPrep_ - Gwithin_Prep :: Tree GPrep_ + LexPrep :: String -> Tree GPrep_ GConjPrePostQS :: GString -> GString -> GConj -> GListQS -> Tree GQS_ GConjQS :: GConj -> GListQS -> Tree GQS_ + GIdRP :: Tree GRP_ + GRelVPS :: GRP -> GVPS -> Tree GRS_ GConjPrePostS :: GString -> GString -> GConj -> GListS -> Tree GS_ GConjS :: GConj -> GListS -> Tree GS_ GPredVPS :: GNP -> GVPS -> Tree GS_ @@ -344,13 +388,7 @@ data Tree :: * -> * where Gpot51 :: Tree GSub1000000000000_ Gpot5float :: GFloat -> Tree GSub1000000000000_ Gpot5plus :: GSub1000 -> GSub1000000000 -> Tree GSub1000000000000_ - GAN :: GCN -> Tree GSubj_ - GEVERY :: GCN -> Tree GSubj_ - GPARTY :: GCN -> Tree GSubj_ - GSubjWho :: GSubj -> GWho -> Tree GSubj_ - GTHE :: GCN -> Tree GSubj_ - GYou :: Tree GSubj_ - GrecoverUnparsedSubj :: GString -> Tree GSubj_ + LexSubj :: String -> Tree GSubj_ GAFTER :: Tree GTComparison_ GBEFORE :: Tree GTComparison_ GBY :: Tree GTComparison_ @@ -362,22 +400,24 @@ data Tree :: * -> * where GpresSimul :: Tree GTemp_ GTemporalConstraint :: GTComparison -> GDigits -> GTimeUnit -> Tree GTemporal_ GTemporalConstraintNoDigits :: GTComparison -> GTimeUnit -> Tree GTemporal_ - GRegulative :: GSubj -> GDeontic -> GAction -> Tree GText_ + GRegulative :: GNP -> GDeontic -> GAction -> Tree GText_ GadvUPON :: GUpon -> Tree GText_ GqCOND :: GCond -> Tree GText_ GqCONSTR :: GConstraint -> Tree GText_ GqPREPOST :: GPrePost -> Tree GText_ - GqUPON :: GSubj -> GUpon -> Tree GText_ - GqWHO :: GSubj -> GWho -> Tree GText_ + GqUPON :: GNP -> GUpon -> Tree GText_ + GqWHO :: GNP -> GWho -> Tree GText_ GsCOND :: GCond -> Tree GText_ - GsUPON :: GSubj -> GUpon -> Tree GText_ - GsWHO :: GSubj -> GWho -> Tree GText_ + GsUPON :: GNP -> GUpon -> Tree GText_ + GsWHO :: GNP -> GWho -> Tree GText_ GDay_Unit :: Tree GTimeUnit_ GMonth_Unit :: Tree GTimeUnit_ GYear_Unit :: Tree GTimeUnit_ GrecoverUnparsedTimeUnit :: GString -> Tree GTimeUnit_ GUPON :: GVP -> Tree GUpon_ + GUPONnp :: GNP -> GVP -> Tree GUpon_ GrecoverUnparsedUpon :: GString -> Tree GUpon_ + LexV :: String -> Tree GV_ LexV2 :: String -> Tree GV2_ GAdvVP :: GVP -> GAdv -> Tree GVP_ GComplV2 :: GV2 -> GNP -> Tree GVP_ @@ -386,10 +426,14 @@ data Tree :: * -> * where GComplVSif :: GVS -> GS -> Tree GVP_ GComplVSthat :: GVS -> GS -> Tree GVP_ GUseComp :: GComp -> Tree GVP_ + GUseV :: GV -> Tree GVP_ LexVP :: String -> Tree GVP_ GMkVPI :: GVP -> Tree GVPI_ + GComparison_Card_Years :: GCard -> Tree GVPS_ GConjPrePostVPS :: GString -> GString -> GConj -> GListVPS -> Tree GVPS_ GConjVPS :: GConj -> GListVPS -> Tree GVPS_ + GGreaterThan :: GNP -> Tree GVPS_ + GLessThan :: GNP -> Tree GVPS_ GMayHave :: GVP -> Tree GVPS_ GMkVPS :: GTemp -> GPol -> GVP -> Tree GVPS_ LexVS :: String -> Tree GVS_ @@ -403,13 +447,16 @@ data Tree :: * -> * where GrecoverUnparsedWho :: GString -> Tree GWho_ GMkYear :: GYearComponent -> GYearComponent -> GYearComponent -> GYearComponent -> Tree GYear_ LexYearComponent :: String -> Tree GYearComponent_ - LexN :: String -> Tree GN_ GString :: String -> Tree GString_ GInt :: Int -> Tree GInt_ GFloat :: Double -> Tree GFloat_ instance Eq (Tree a) where i == j = case (i,j) of + (LexA x,LexA y) -> x == y + (G_located_in_A2,G_located_in_A2) -> and [ ] + (Gdue_to_A2,Gdue_to_A2) -> and [ ] + (GComplA2 x1 x2,GComplA2 y1 y2) -> and [ x1 == y1 , x2 == y2 ] (GConjAP x1 x2,GConjAP y1 y2) -> and [ x1 == y1 , x2 == y2 ] (GInt_or_older x1,GInt_or_older y1) -> and [ x1 == y1 ] (GPositA x1,GPositA y1) -> and [ x1 == y1 ] @@ -419,16 +466,50 @@ instance Eq (Tree a) where (GACTION x1,GACTION y1) -> and [ x1 == y1 ] (GrecoverUnparsedAction x1,GrecoverUnparsedAction y1) -> and [ x1 == y1 ] (Gonly_AdA,Gonly_AdA) -> and [ ] + (GAdnCAdv x1,GAdnCAdv y1) -> and [ x1 == y1 ] + (Gat_least_AdN,Gat_least_AdN) -> and [ ] + (Gat_most_AdN,Gat_most_AdN) -> and [ ] (GAdAdv x1 x2,GAdAdv y1 y2) -> and [ x1 == y1 , x2 == y2 ] (GByVP x1,GByVP y1) -> and [ x1 == y1 ] (GConjAdv x1 x2,GConjAdv y1 y2) -> and [ x1 == y1 , x2 == y2 ] (GPrepNP x1 x2,GPrepNP y1 y2) -> and [ x1 == y1 , x2 == y2 ] + (GSubjS x1 x2,GSubjS y1 y2) -> and [ x1 == y1 , x2 == y2 ] + (GWhileDoing x1,GWhileDoing y1) -> and [ x1 == y1 ] + (G_as_Adv,G_as_Adv) -> and [ ] + (G_at_Adv,G_at_Adv) -> and [ ] + (G_directly_Adv,G_directly_Adv) -> and [ ] + (G_first_Adv,G_first_Adv) -> and [ ] + (G_fully_Adv,G_fully_Adv) -> and [ ] + (G_hence_Adv,G_hence_Adv) -> and [ ] + (G_here_Adv,G_here_Adv) -> and [ ] + (G_indirectly_Adv,G_indirectly_Adv) -> and [ ] + (G_least_Adv,G_least_Adv) -> and [ ] + (G_long_Adv,G_long_Adv) -> and [ ] + (G_more_Adv,G_more_Adv) -> and [ ] + (G_no_Adv,G_no_Adv) -> and [ ] + (G_on_its_way_Adv,G_on_its_way_Adv) -> and [ ] + (G_only_Adv,G_only_Adv) -> and [ ] + (G_permanently_Adv,G_permanently_Adv) -> and [ ] + (G_pland_Adv,G_pland_Adv) -> and [ ] + (G_so_Adv,G_so_Adv) -> and [ ] + (G_soon_Adv,G_soon_Adv) -> and [ ] + (G_then_Adv,G_then_Adv) -> and [ ] + (G_totally_Adv,G_totally_Adv) -> and [ ] + (G_up_Adv,G_up_Adv) -> and [ ] (Gin_part,Gin_part) -> and [ ] (Gin_whole,Gin_whole) -> and [ ] (GrecoverUnparsedAdv x1,GrecoverUnparsedAdv y1) -> and [ x1 == y1 ] + (Gless_CAdv,Gless_CAdv) -> and [ ] + (Gmore_CAdv,Gmore_CAdv) -> and [ ] (GAdjCN x1 x2,GAdjCN y1 y2) -> and [ x1 == y1 , x2 == y2 ] + (GCNwhereS x1 x2 x3,GCNwhereS y1 y2 y3) -> and [ x1 == y1 , x2 == y2 , x3 == y3 ] + (GComplN2 x1 x2,GComplN2 y1 y2) -> and [ x1 == y1 , x2 == y2 ] + (GRelCN x1 x2,GRelCN y1 y2) -> and [ x1 == y1 , x2 == y2 ] (GUseN x1,GUseN y1) -> and [ x1 == y1 ] + (G_CN_of_any_kind_CN x1,G_CN_of_any_kind_CN y1) -> and [ x1 == y1 ] (LexCN x,LexCN y) -> x == y + (GAdNum x1 x2,GAdNum y1 y2) -> and [ x1 == y1 , x2 == y2 ] + (GNumDigits x1,GNumDigits y1) -> and [ x1 == y1 ] (GCompAP x1,GCompAP y1) -> and [ x1 == y1 ] (GCompAdv x1,GCompAdv y1) -> and [ x1 == y1 ] (GCompNP x1,GCompNP y1) -> and [ x1 == y1 ] @@ -438,22 +519,24 @@ instance Eq (Tree a) where (GRPConstraint x1 x2 x3,GRPConstraint y1 y2 y3) -> and [ x1 == y1 , x2 == y2 , x3 == y3 ] (GWHEN x1 x2 x3 x4,GWHEN y1 y2 y3 y4) -> and [ x1 == y1 , x2 == y2 , x3 == y3 , x4 == y4 ] (GrecoverUnparsedCond x1,GrecoverUnparsedCond y1) -> and [ x1 == y1 ] - (GAND,GAND) -> and [ ] - (GOR,GOR) -> and [ ] + (LexConj x,LexConj y) -> x == y (GConjConstraint x1 x2,GConjConstraint y1 y2) -> and [ x1 == y1 , x2 == y2 ] (GConjPreConstraint x1 x2 x3,GConjPreConstraint y1 y2 y3) -> and [ x1 == y1 , x2 == y2 , x3 == y3 ] (GConjPrePostConstraint x1 x2 x3 x4,GConjPrePostConstraint y1 y2 y3 y4) -> and [ x1 == y1 , x2 == y2 , x3 == y3 , x4 == y4 ] (GRPleafAP x1,GRPleafAP y1) -> and [ x1 == y1 ] + (GRPleafAdv x1,GRPleafAdv y1) -> and [ x1 == y1 ] (GRPleafNP x1,GRPleafNP y1) -> and [ x1 == y1 ] (GRPleafS x1 x2,GRPleafS y1 y2) -> and [ x1 == y1 , x2 == y2 ] (GRPleafVP x1,GRPleafVP y1) -> and [ x1 == y1 ] (GrecoverRPis x1 x2,GrecoverRPis y1 y2) -> and [ x1 == y1 , x2 == y2 ] + (GrecoverRPmath x1 x2 x3,GrecoverRPmath y1 y2 y3) -> and [ x1 == y1 , x2 == y2 , x3 == y3 ] (GrecoverUnparsedConstraint x1,GrecoverUnparsedConstraint y1) -> and [ x1 == y1 ] (GMkDate x1 x2 x3,GMkDate y1 y2 y3) -> and [ x1 == y1 , x2 == y2 , x3 == y3 ] (LexDay x,LexDay y) -> x == y (GMAY,GMAY) -> and [ ] (GMUST,GMUST) -> and [ ] (GSHANT,GSHANT) -> and [ ] + (GaPl,GaPl) -> and [ ] (GaSg,GaSg) -> and [ ] (GthePl,GthePl) -> and [ ] (GtheSg,GtheSg) -> and [ ] @@ -481,13 +564,22 @@ instance Eq (Tree a) where (GListVPS x1,GListVPS y1) -> and [x == y | (x,y) <- zip x1 y1] (GListWho x1,GListWho y1) -> and [x == y | (x,y) <- zip x1 y1] (LexMonth x,LexMonth y) -> x == y + (GCompoundN x1 x2,GCompoundN y1 y2) -> and [ x1 == y1 , x2 == y2 ] + (LexN x,LexN y) -> x == y + (G_premise_where_N2,G_premise_where_N2) -> and [ ] + (G_travel_by_N2,G_travel_by_N2) -> and [ ] (GConjNP x1 x2,GConjNP y1 y2) -> and [ x1 == y1 , x2 == y2 ] (GContents,GContents) -> and [ ] (GDetCN x1 x2,GDetCN y1 y2) -> and [ x1 == y1 , x2 == y2 ] + (GEVERY x1,GEVERY y1) -> and [ x1 == y1 ] + (GGenModNP x1 x2 x3,GGenModNP y1 y2 y3) -> and [ x1 == y1 , x2 == y2 , x3 == y3 ] (GGerundNP x1,GGerundNP y1) -> and [ x1 == y1 ] (GLoss_or_Damage,GLoss_or_Damage) -> and [ ] (GMassNP x1,GMassNP y1) -> and [ x1 == y1 ] (GNDB_Qualification,GNDB_Qualification) -> and [ ] + (GSubjWho x1 x2,GSubjWho y1 y2) -> and [ x1 == y1 , x2 == y2 ] + (GUsePN x1,GUsePN y1) -> and [ x1 == y1 ] + (GYou,GYou) -> and [ ] (Ganimal,Ganimal) -> and [ ] (Gany_other_exclusion,Gany_other_exclusion) -> and [ ] (Gbirds,Gbirds) -> and [ ] @@ -498,6 +590,7 @@ instance Eq (Tree a) where (Ginsects,Ginsects) -> and [ ] (Gplumbing_heating_or_AC,Gplumbing_heating_or_AC) -> and [ ] (Gpremium,Gpremium) -> and [ ] + (GrecoverUnparsedNP x1,GrecoverUnparsedNP y1) -> and [ x1 == y1 ] (Gresult_from x1,Gresult_from y1) -> and [ x1 == y1 ] (Grodents,Grodents) -> and [ ] (Gsigned,Gsigned) -> and [ ] @@ -506,7 +599,10 @@ instance Eq (Tree a) where (Gswimming_pool,Gswimming_pool) -> and [ ] (Gvermin,Gvermin) -> and [ ] (Gwater,Gwater) -> and [ ] + (GNumPl,GNumPl) -> and [ ] + (GNumSg,GNumSg) -> and [ ] (Gnum x1,Gnum y1) -> and [ x1 == y1 ] + (LexPN x,LexPN y) -> x == y (GNEG,GNEG) -> and [ ] (GPOS,GPOS) -> and [ ] (GAP_PrePost x1,GAP_PrePost y1) -> and [ x1 == y1 ] @@ -514,20 +610,16 @@ instance Eq (Tree a) where (GNP_PrePost x1,GNP_PrePost y1) -> and [ x1 == y1 ] (GNP_caused_NP_to_VP_Prep_PrePost x1 x2 x3 x4,GNP_caused_NP_to_VP_Prep_PrePost y1 y2 y3 y4) -> and [ x1 == y1 , x2 == y2 , x3 == y3 , x4 == y4 ] (GNP_caused_by_PrePost x1,GNP_caused_by_PrePost y1) -> and [ x1 == y1 ] - (GV2_PrePost x1,GV2_PrePost y1) -> and [ x1 == y1 ] + (GSSlash_PrePost x1 x2 x3 x4,GSSlash_PrePost y1 y2 y3 y4) -> and [ x1 == y1 , x2 == y2 , x3 == y3 , x4 == y4 ] + (GS_PrePost x1 x2,GS_PrePost y1 y2) -> and [ x1 == y1 , x2 == y2 ] + (GV2_PrePost x1 x2 x3,GV2_PrePost y1 y2 y3) -> and [ x1 == y1 , x2 == y2 , x3 == y3 ] (GrecoverUnparsedPrePost x1,GrecoverUnparsedPrePost y1) -> and [ x1 == y1 ] (GConjPrep x1 x2,GConjPrep y1 y2) -> and [ x1 == y1 , x2 == y2 ] - (Gabout_Prep,Gabout_Prep) -> and [ ] - (Gafter_Prep,Gafter_Prep) -> and [ ] - (Gbefore_Prep,Gbefore_Prep) -> and [ ] - (Gfor_Prep,Gfor_Prep) -> and [ ] - (Gfrom_Prep,Gfrom_Prep) -> and [ ] - (Gon_Prep,Gon_Prep) -> and [ ] - (Gpossess_Prep,Gpossess_Prep) -> and [ ] - (Gto_Prep,Gto_Prep) -> and [ ] - (Gwithin_Prep,Gwithin_Prep) -> and [ ] + (LexPrep x,LexPrep y) -> x == y (GConjPrePostQS x1 x2 x3 x4,GConjPrePostQS y1 y2 y3 y4) -> and [ x1 == y1 , x2 == y2 , x3 == y3 , x4 == y4 ] (GConjQS x1 x2,GConjQS y1 y2) -> and [ x1 == y1 , x2 == y2 ] + (GIdRP,GIdRP) -> and [ ] + (GRelVPS x1 x2,GRelVPS y1 y2) -> and [ x1 == y1 , x2 == y2 ] (GConjPrePostS x1 x2 x3 x4,GConjPrePostS y1 y2 y3 y4) -> and [ x1 == y1 , x2 == y2 , x3 == y3 , x4 == y4 ] (GConjS x1 x2,GConjS y1 y2) -> and [ x1 == y1 , x2 == y2 ] (GPredVPS x1 x2,GPredVPS y1 y2) -> and [ x1 == y1 , x2 == y2 ] @@ -559,13 +651,7 @@ instance Eq (Tree a) where (Gpot51,Gpot51) -> and [ ] (Gpot5float x1,Gpot5float y1) -> and [ x1 == y1 ] (Gpot5plus x1 x2,Gpot5plus y1 y2) -> and [ x1 == y1 , x2 == y2 ] - (GAN x1,GAN y1) -> and [ x1 == y1 ] - (GEVERY x1,GEVERY y1) -> and [ x1 == y1 ] - (GPARTY x1,GPARTY y1) -> and [ x1 == y1 ] - (GSubjWho x1 x2,GSubjWho y1 y2) -> and [ x1 == y1 , x2 == y2 ] - (GTHE x1,GTHE y1) -> and [ x1 == y1 ] - (GYou,GYou) -> and [ ] - (GrecoverUnparsedSubj x1,GrecoverUnparsedSubj y1) -> and [ x1 == y1 ] + (LexSubj x,LexSubj y) -> x == y (GAFTER,GAFTER) -> and [ ] (GBEFORE,GBEFORE) -> and [ ] (GBY,GBY) -> and [ ] @@ -592,7 +678,9 @@ instance Eq (Tree a) where (GYear_Unit,GYear_Unit) -> and [ ] (GrecoverUnparsedTimeUnit x1,GrecoverUnparsedTimeUnit y1) -> and [ x1 == y1 ] (GUPON x1,GUPON y1) -> and [ x1 == y1 ] + (GUPONnp x1 x2,GUPONnp y1 y2) -> and [ x1 == y1 , x2 == y2 ] (GrecoverUnparsedUpon x1,GrecoverUnparsedUpon y1) -> and [ x1 == y1 ] + (LexV x,LexV y) -> x == y (LexV2 x,LexV2 y) -> x == y (GAdvVP x1 x2,GAdvVP y1 y2) -> and [ x1 == y1 , x2 == y2 ] (GComplV2 x1 x2,GComplV2 y1 y2) -> and [ x1 == y1 , x2 == y2 ] @@ -601,10 +689,14 @@ instance Eq (Tree a) where (GComplVSif x1 x2,GComplVSif y1 y2) -> and [ x1 == y1 , x2 == y2 ] (GComplVSthat x1 x2,GComplVSthat y1 y2) -> and [ x1 == y1 , x2 == y2 ] (GUseComp x1,GUseComp y1) -> and [ x1 == y1 ] + (GUseV x1,GUseV y1) -> and [ x1 == y1 ] (LexVP x,LexVP y) -> x == y (GMkVPI x1,GMkVPI y1) -> and [ x1 == y1 ] + (GComparison_Card_Years x1,GComparison_Card_Years y1) -> and [ x1 == y1 ] (GConjPrePostVPS x1 x2 x3 x4,GConjPrePostVPS y1 y2 y3 y4) -> and [ x1 == y1 , x2 == y2 , x3 == y3 , x4 == y4 ] (GConjVPS x1 x2,GConjVPS y1 y2) -> and [ x1 == y1 , x2 == y2 ] + (GGreaterThan x1,GGreaterThan y1) -> and [ x1 == y1 ] + (GLessThan x1,GLessThan y1) -> and [ x1 == y1 ] (GMayHave x1,GMayHave y1) -> and [ x1 == y1 ] (GMkVPS x1 x2 x3,GMkVPS y1 y2 y3) -> and [ x1 == y1 , x2 == y2 , x3 == y3 ] (LexVS x,LexVS y) -> x == y @@ -618,13 +710,34 @@ instance Eq (Tree a) where (GrecoverUnparsedWho x1,GrecoverUnparsedWho y1) -> and [ x1 == y1 ] (GMkYear x1 x2 x3 x4,GMkYear y1 y2 y3 y4) -> and [ x1 == y1 , x2 == y2 , x3 == y3 , x4 == y4 ] (LexYearComponent x,LexYearComponent y) -> x == y - (LexN x,LexN y) -> x == y (GString x, GString y) -> x == y (GInt x, GInt y) -> x == y (GFloat x, GFloat y) -> x == y _ -> False +instance Gf GA where + gf (LexA x) = mkApp (mkCId x) [] + + fg t = + case unApp t of + + Just (i,[]) -> LexA (showCId i) + _ -> error ("no A " ++ show t) + +instance Gf GA2 where + gf G_located_in_A2 = mkApp (mkCId "_located_in_A2") [] + gf Gdue_to_A2 = mkApp (mkCId "due_to_A2") [] + + fg t = + case unApp t of + Just (i,[]) | i == mkCId "_located_in_A2" -> G_located_in_A2 + Just (i,[]) | i == mkCId "due_to_A2" -> Gdue_to_A2 + + + _ -> error ("no A2 " ++ show t) + instance Gf GAP where + gf (GComplA2 x1 x2) = mkApp (mkCId "ComplA2") [gf x1, gf x2] gf (GConjAP x1 x2) = mkApp (mkCId "ConjAP") [gf x1, gf x2] gf (GInt_or_older x1) = mkApp (mkCId "Int_or_older") [gf x1] gf (GPositA x1) = mkApp (mkCId "PositA") [gf x1] @@ -634,6 +747,7 @@ instance Gf GAP where fg t = case unApp t of + Just (i,[x1,x2]) | i == mkCId "ComplA2" -> GComplA2 (fg x1) (fg x2) Just (i,[x1,x2]) | i == mkCId "ConjAP" -> GConjAP (fg x1) (fg x2) Just (i,[x1]) | i == mkCId "Int_or_older" -> GInt_or_older (fg x1) Just (i,[x1]) | i == mkCId "PositA" -> GPositA (fg x1) @@ -660,16 +774,53 @@ instance Gf GAdA where fg t = case unApp t of - Just (i,[]) | i == mkCId "only_AdA" -> Gonly_AdA + Just (i,[]) | i == mkCId "only_AdA" -> Gonly_AdA _ -> error ("no AdA " ++ show t) +instance Gf GAdN where + gf (GAdnCAdv x1) = mkApp (mkCId "AdnCAdv") [gf x1] + gf Gat_least_AdN = mkApp (mkCId "at_least_AdN") [] + gf Gat_most_AdN = mkApp (mkCId "at_most_AdN") [] + + fg t = + case unApp t of + Just (i,[x1]) | i == mkCId "AdnCAdv" -> GAdnCAdv (fg x1) + Just (i,[]) | i == mkCId "at_least_AdN" -> Gat_least_AdN + Just (i,[]) | i == mkCId "at_most_AdN" -> Gat_most_AdN + + + _ -> error ("no AdN " ++ show t) + instance Gf GAdv where gf (GAdAdv x1 x2) = mkApp (mkCId "AdAdv") [gf x1, gf x2] gf (GByVP x1) = mkApp (mkCId "ByVP") [gf x1] gf (GConjAdv x1 x2) = mkApp (mkCId "ConjAdv") [gf x1, gf x2] gf (GPrepNP x1 x2) = mkApp (mkCId "PrepNP") [gf x1, gf x2] + gf (GSubjS x1 x2) = mkApp (mkCId "SubjS") [gf x1, gf x2] + gf (GWhileDoing x1) = mkApp (mkCId "WhileDoing") [gf x1] + gf G_as_Adv = mkApp (mkCId "_as_Adv") [] + gf G_at_Adv = mkApp (mkCId "_at_Adv") [] + gf G_directly_Adv = mkApp (mkCId "_directly_Adv") [] + gf G_first_Adv = mkApp (mkCId "_first_Adv") [] + gf G_fully_Adv = mkApp (mkCId "_fully_Adv") [] + gf G_hence_Adv = mkApp (mkCId "_hence_Adv") [] + gf G_here_Adv = mkApp (mkCId "_here_Adv") [] + gf G_indirectly_Adv = mkApp (mkCId "_indirectly_Adv") [] + gf G_least_Adv = mkApp (mkCId "_least_Adv") [] + gf G_long_Adv = mkApp (mkCId "_long_Adv") [] + gf G_more_Adv = mkApp (mkCId "_more_Adv") [] + gf G_no_Adv = mkApp (mkCId "_no_Adv") [] + gf G_on_its_way_Adv = mkApp (mkCId "_on_its_way_Adv") [] + gf G_only_Adv = mkApp (mkCId "_only_Adv") [] + gf G_permanently_Adv = mkApp (mkCId "_permanently_Adv") [] + gf G_pland_Adv = mkApp (mkCId "_pland_Adv") [] + gf G_so_Adv = mkApp (mkCId "_so_Adv") [] + gf G_soon_Adv = mkApp (mkCId "_soon_Adv") [] + gf G_then_Adv = mkApp (mkCId "_then_Adv") [] + gf G_totally_Adv = mkApp (mkCId "_totally_Adv") [] + gf G_up_Adv = mkApp (mkCId "_up_Adv") [] gf Gin_part = mkApp (mkCId "in_part") [] gf Gin_whole = mkApp (mkCId "in_whole") [] gf (GrecoverUnparsedAdv x1) = mkApp (mkCId "recoverUnparsedAdv") [gf x1] @@ -680,26 +831,81 @@ instance Gf GAdv where Just (i,[x1]) | i == mkCId "ByVP" -> GByVP (fg x1) Just (i,[x1,x2]) | i == mkCId "ConjAdv" -> GConjAdv (fg x1) (fg x2) Just (i,[x1,x2]) | i == mkCId "PrepNP" -> GPrepNP (fg x1) (fg x2) - Just (i,[]) | i == mkCId "in_part" -> Gin_part - Just (i,[]) | i == mkCId "in_whole" -> Gin_whole + Just (i,[x1,x2]) | i == mkCId "SubjS" -> GSubjS (fg x1) (fg x2) + Just (i,[x1]) | i == mkCId "WhileDoing" -> GWhileDoing (fg x1) + Just (i,[]) | i == mkCId "_as_Adv" -> G_as_Adv + Just (i,[]) | i == mkCId "_at_Adv" -> G_at_Adv + Just (i,[]) | i == mkCId "_directly_Adv" -> G_directly_Adv + Just (i,[]) | i == mkCId "_first_Adv" -> G_first_Adv + Just (i,[]) | i == mkCId "_fully_Adv" -> G_fully_Adv + Just (i,[]) | i == mkCId "_hence_Adv" -> G_hence_Adv + Just (i,[]) | i == mkCId "_here_Adv" -> G_here_Adv + Just (i,[]) | i == mkCId "_indirectly_Adv" -> G_indirectly_Adv + Just (i,[]) | i == mkCId "_least_Adv" -> G_least_Adv + Just (i,[]) | i == mkCId "_long_Adv" -> G_long_Adv + Just (i,[]) | i == mkCId "_more_Adv" -> G_more_Adv + Just (i,[]) | i == mkCId "_no_Adv" -> G_no_Adv + Just (i,[]) | i == mkCId "_on_its_way_Adv" -> G_on_its_way_Adv + Just (i,[]) | i == mkCId "_only_Adv" -> G_only_Adv + Just (i,[]) | i == mkCId "_permanently_Adv" -> G_permanently_Adv + Just (i,[]) | i == mkCId "_pland_Adv" -> G_pland_Adv + Just (i,[]) | i == mkCId "_so_Adv" -> G_so_Adv + Just (i,[]) | i == mkCId "_soon_Adv" -> G_soon_Adv + Just (i,[]) | i == mkCId "_then_Adv" -> G_then_Adv + Just (i,[]) | i == mkCId "_totally_Adv" -> G_totally_Adv + Just (i,[]) | i == mkCId "_up_Adv" -> G_up_Adv + Just (i,[]) | i == mkCId "in_part" -> Gin_part + Just (i,[]) | i == mkCId "in_whole" -> Gin_whole Just (i,[x1]) | i == mkCId "recoverUnparsedAdv" -> GrecoverUnparsedAdv (fg x1) _ -> error ("no Adv " ++ show t) +instance Gf GCAdv where + gf Gless_CAdv = mkApp (mkCId "less_CAdv") [] + gf Gmore_CAdv = mkApp (mkCId "more_CAdv") [] + + fg t = + case unApp t of + Just (i,[]) | i == mkCId "less_CAdv" -> Gless_CAdv + Just (i,[]) | i == mkCId "more_CAdv" -> Gmore_CAdv + + + _ -> error ("no CAdv " ++ show t) + instance Gf GCN where gf (GAdjCN x1 x2) = mkApp (mkCId "AdjCN") [gf x1, gf x2] + gf (GCNwhereS x1 x2 x3) = mkApp (mkCId "CNwhereS") [gf x1, gf x2, gf x3] + gf (GComplN2 x1 x2) = mkApp (mkCId "ComplN2") [gf x1, gf x2] + gf (GRelCN x1 x2) = mkApp (mkCId "RelCN") [gf x1, gf x2] gf (GUseN x1) = mkApp (mkCId "UseN") [gf x1] + gf (G_CN_of_any_kind_CN x1) = mkApp (mkCId "_CN_of_any_kind_CN") [gf x1] gf (LexCN x) = mkApp (mkCId x) [] fg t = case unApp t of Just (i,[x1,x2]) | i == mkCId "AdjCN" -> GAdjCN (fg x1) (fg x2) + Just (i,[x1,x2,x3]) | i == mkCId "CNwhereS" -> GCNwhereS (fg x1) (fg x2) (fg x3) + Just (i,[x1,x2]) | i == mkCId "ComplN2" -> GComplN2 (fg x1) (fg x2) + Just (i,[x1,x2]) | i == mkCId "RelCN" -> GRelCN (fg x1) (fg x2) Just (i,[x1]) | i == mkCId "UseN" -> GUseN (fg x1) + Just (i,[x1]) | i == mkCId "_CN_of_any_kind_CN" -> G_CN_of_any_kind_CN (fg x1) Just (i,[]) -> LexCN (showCId i) _ -> error ("no CN " ++ show t) +instance Gf GCard where + gf (GAdNum x1 x2) = mkApp (mkCId "AdNum") [gf x1, gf x2] + gf (GNumDigits x1) = mkApp (mkCId "NumDigits") [gf x1] + + fg t = + case unApp t of + Just (i,[x1,x2]) | i == mkCId "AdNum" -> GAdNum (fg x1) (fg x2) + Just (i,[x1]) | i == mkCId "NumDigits" -> GNumDigits (fg x1) + + + _ -> error ("no Card " ++ show t) + instance Gf GComp where gf (GCompAP x1) = mkApp (mkCId "CompAP") [gf x1] gf (GCompAdv x1) = mkApp (mkCId "CompAdv") [gf x1] @@ -735,15 +941,12 @@ instance Gf GCond where _ -> error ("no Cond " ++ show t) instance Gf GConj where - gf GAND = mkApp (mkCId "AND") [] - gf GOR = mkApp (mkCId "OR") [] + gf (LexConj x) = mkApp (mkCId x) [] fg t = case unApp t of - Just (i,[]) | i == mkCId "AND" -> GAND - Just (i,[]) | i == mkCId "OR" -> GOR - + Just (i,[]) -> LexConj (showCId i) _ -> error ("no Conj " ++ show t) instance Gf GConstraint where @@ -751,10 +954,12 @@ instance Gf GConstraint where gf (GConjPreConstraint x1 x2 x3) = mkApp (mkCId "ConjPreConstraint") [gf x1, gf x2, gf x3] gf (GConjPrePostConstraint x1 x2 x3 x4) = mkApp (mkCId "ConjPrePostConstraint") [gf x1, gf x2, gf x3, gf x4] gf (GRPleafAP x1) = mkApp (mkCId "RPleafAP") [gf x1] + gf (GRPleafAdv x1) = mkApp (mkCId "RPleafAdv") [gf x1] gf (GRPleafNP x1) = mkApp (mkCId "RPleafNP") [gf x1] gf (GRPleafS x1 x2) = mkApp (mkCId "RPleafS") [gf x1, gf x2] gf (GRPleafVP x1) = mkApp (mkCId "RPleafVP") [gf x1] gf (GrecoverRPis x1 x2) = mkApp (mkCId "recoverRPis") [gf x1, gf x2] + gf (GrecoverRPmath x1 x2 x3) = mkApp (mkCId "recoverRPmath") [gf x1, gf x2, gf x3] gf (GrecoverUnparsedConstraint x1) = mkApp (mkCId "recoverUnparsedConstraint") [gf x1] fg t = @@ -763,10 +968,12 @@ instance Gf GConstraint where Just (i,[x1,x2,x3]) | i == mkCId "ConjPreConstraint" -> GConjPreConstraint (fg x1) (fg x2) (fg x3) Just (i,[x1,x2,x3,x4]) | i == mkCId "ConjPrePostConstraint" -> GConjPrePostConstraint (fg x1) (fg x2) (fg x3) (fg x4) Just (i,[x1]) | i == mkCId "RPleafAP" -> GRPleafAP (fg x1) + Just (i,[x1]) | i == mkCId "RPleafAdv" -> GRPleafAdv (fg x1) Just (i,[x1]) | i == mkCId "RPleafNP" -> GRPleafNP (fg x1) Just (i,[x1,x2]) | i == mkCId "RPleafS" -> GRPleafS (fg x1) (fg x2) Just (i,[x1]) | i == mkCId "RPleafVP" -> GRPleafVP (fg x1) Just (i,[x1,x2]) | i == mkCId "recoverRPis" -> GrecoverRPis (fg x1) (fg x2) + Just (i,[x1,x2,x3]) | i == mkCId "recoverRPmath" -> GrecoverRPmath (fg x1) (fg x2) (fg x3) Just (i,[x1]) | i == mkCId "recoverUnparsedConstraint" -> GrecoverUnparsedConstraint (fg x1) @@ -798,14 +1005,15 @@ instance Gf GDeontic where fg t = case unApp t of - Just (i,[]) | i == mkCId "MAY" -> GMAY - Just (i,[]) | i == mkCId "MUST" -> GMUST - Just (i,[]) | i == mkCId "SHANT" -> GSHANT + Just (i,[]) | i == mkCId "MAY" -> GMAY + Just (i,[]) | i == mkCId "MUST" -> GMUST + Just (i,[]) | i == mkCId "SHANT" -> GSHANT _ -> error ("no Deontic " ++ show t) instance Gf GDet where + gf GaPl = mkApp (mkCId "aPl") [] gf GaSg = mkApp (mkCId "aSg") [] gf GthePl = mkApp (mkCId "thePl") [] gf GtheSg = mkApp (mkCId "theSg") [] @@ -813,10 +1021,11 @@ instance Gf GDet where fg t = case unApp t of - Just (i,[]) | i == mkCId "aSg" -> GaSg - Just (i,[]) | i == mkCId "thePl" -> GthePl - Just (i,[]) | i == mkCId "theSg" -> GtheSg - Just (i,[]) | i == mkCId "your" -> Gyour + Just (i,[]) | i == mkCId "aPl" -> GaPl + Just (i,[]) | i == mkCId "aSg" -> GaSg + Just (i,[]) | i == mkCId "thePl" -> GthePl + Just (i,[]) | i == mkCId "theSg" -> GtheSg + Just (i,[]) | i == mkCId "your" -> Gyour _ -> error ("no Det " ++ show t) @@ -842,14 +1051,14 @@ instance Gf GDigit where fg t = case unApp t of - Just (i,[]) | i == mkCId "n2" -> Gn2 - Just (i,[]) | i == mkCId "n3" -> Gn3 - Just (i,[]) | i == mkCId "n4" -> Gn4 - Just (i,[]) | i == mkCId "n5" -> Gn5 - Just (i,[]) | i == mkCId "n6" -> Gn6 - Just (i,[]) | i == mkCId "n7" -> Gn7 - Just (i,[]) | i == mkCId "n8" -> Gn8 - Just (i,[]) | i == mkCId "n9" -> Gn9 + Just (i,[]) | i == mkCId "n2" -> Gn2 + Just (i,[]) | i == mkCId "n3" -> Gn3 + Just (i,[]) | i == mkCId "n4" -> Gn4 + Just (i,[]) | i == mkCId "n5" -> Gn5 + Just (i,[]) | i == mkCId "n6" -> Gn6 + Just (i,[]) | i == mkCId "n7" -> Gn7 + Just (i,[]) | i == mkCId "n8" -> Gn8 + Just (i,[]) | i == mkCId "n9" -> Gn9 _ -> error ("no Digit " ++ show t) @@ -1007,14 +1216,42 @@ instance Gf GMonth where Just (i,[]) -> LexMonth (showCId i) _ -> error ("no Month " ++ show t) +instance Gf GN where + gf (GCompoundN x1 x2) = mkApp (mkCId "CompoundN") [gf x1, gf x2] + gf (LexN x) = mkApp (mkCId x) [] + + fg t = + case unApp t of + Just (i,[x1,x2]) | i == mkCId "CompoundN" -> GCompoundN (fg x1) (fg x2) + + Just (i,[]) -> LexN (showCId i) + _ -> error ("no N " ++ show t) + +instance Gf GN2 where + gf G_premise_where_N2 = mkApp (mkCId "_premise_where_N2") [] + gf G_travel_by_N2 = mkApp (mkCId "_travel_by_N2") [] + + fg t = + case unApp t of + Just (i,[]) | i == mkCId "_premise_where_N2" -> G_premise_where_N2 + Just (i,[]) | i == mkCId "_travel_by_N2" -> G_travel_by_N2 + + + _ -> error ("no N2 " ++ show t) + instance Gf GNP where gf (GConjNP x1 x2) = mkApp (mkCId "ConjNP") [gf x1, gf x2] gf GContents = mkApp (mkCId "Contents") [] gf (GDetCN x1 x2) = mkApp (mkCId "DetCN") [gf x1, gf x2] + gf (GEVERY x1) = mkApp (mkCId "EVERY") [gf x1] + gf (GGenModNP x1 x2 x3) = mkApp (mkCId "GenModNP") [gf x1, gf x2, gf x3] gf (GGerundNP x1) = mkApp (mkCId "GerundNP") [gf x1] gf GLoss_or_Damage = mkApp (mkCId "Loss_or_Damage") [] gf (GMassNP x1) = mkApp (mkCId "MassNP") [gf x1] gf GNDB_Qualification = mkApp (mkCId "NDB_Qualification") [] + gf (GSubjWho x1 x2) = mkApp (mkCId "SubjWho") [gf x1, gf x2] + gf (GUsePN x1) = mkApp (mkCId "UsePN") [gf x1] + gf GYou = mkApp (mkCId "You") [] gf Ganimal = mkApp (mkCId "animal") [] gf Gany_other_exclusion = mkApp (mkCId "any_other_exclusion") [] gf Gbirds = mkApp (mkCId "birds") [] @@ -1025,6 +1262,7 @@ instance Gf GNP where gf Ginsects = mkApp (mkCId "insects") [] gf Gplumbing_heating_or_AC = mkApp (mkCId "plumbing_heating_or_AC") [] gf Gpremium = mkApp (mkCId "premium") [] + gf (GrecoverUnparsedNP x1) = mkApp (mkCId "recoverUnparsedNP") [gf x1] gf (Gresult_from x1) = mkApp (mkCId "result_from") [gf x1] gf Grodents = mkApp (mkCId "rodents") [] gf Gsigned = mkApp (mkCId "signed") [] @@ -1037,34 +1275,52 @@ instance Gf GNP where fg t = case unApp t of Just (i,[x1,x2]) | i == mkCId "ConjNP" -> GConjNP (fg x1) (fg x2) - Just (i,[]) | i == mkCId "Contents" -> GContents + Just (i,[]) | i == mkCId "Contents" -> GContents Just (i,[x1,x2]) | i == mkCId "DetCN" -> GDetCN (fg x1) (fg x2) + Just (i,[x1]) | i == mkCId "EVERY" -> GEVERY (fg x1) + Just (i,[x1,x2,x3]) | i == mkCId "GenModNP" -> GGenModNP (fg x1) (fg x2) (fg x3) Just (i,[x1]) | i == mkCId "GerundNP" -> GGerundNP (fg x1) - Just (i,[]) | i == mkCId "Loss_or_Damage" -> GLoss_or_Damage + Just (i,[]) | i == mkCId "Loss_or_Damage" -> GLoss_or_Damage Just (i,[x1]) | i == mkCId "MassNP" -> GMassNP (fg x1) - Just (i,[]) | i == mkCId "NDB_Qualification" -> GNDB_Qualification - Just (i,[]) | i == mkCId "animal" -> Ganimal - Just (i,[]) | i == mkCId "any_other_exclusion" -> Gany_other_exclusion - Just (i,[]) | i == mkCId "birds" -> Gbirds - Just (i,[]) | i == mkCId "cancelled" -> Gcancelled - Just (i,[]) | i == mkCId "claim" -> Gclaim - Just (i,[]) | i == mkCId "condition" -> Gcondition - Just (i,[]) | i == mkCId "household_appliance" -> Ghousehold_appliance - Just (i,[]) | i == mkCId "insects" -> Ginsects - Just (i,[]) | i == mkCId "plumbing_heating_or_AC" -> Gplumbing_heating_or_AC - Just (i,[]) | i == mkCId "premium" -> Gpremium + Just (i,[]) | i == mkCId "NDB_Qualification" -> GNDB_Qualification + Just (i,[x1,x2]) | i == mkCId "SubjWho" -> GSubjWho (fg x1) (fg x2) + Just (i,[x1]) | i == mkCId "UsePN" -> GUsePN (fg x1) + Just (i,[]) | i == mkCId "You" -> GYou + Just (i,[]) | i == mkCId "animal" -> Ganimal + Just (i,[]) | i == mkCId "any_other_exclusion" -> Gany_other_exclusion + Just (i,[]) | i == mkCId "birds" -> Gbirds + Just (i,[]) | i == mkCId "cancelled" -> Gcancelled + Just (i,[]) | i == mkCId "claim" -> Gclaim + Just (i,[]) | i == mkCId "condition" -> Gcondition + Just (i,[]) | i == mkCId "household_appliance" -> Ghousehold_appliance + Just (i,[]) | i == mkCId "insects" -> Ginsects + Just (i,[]) | i == mkCId "plumbing_heating_or_AC" -> Gplumbing_heating_or_AC + Just (i,[]) | i == mkCId "premium" -> Gpremium + Just (i,[x1]) | i == mkCId "recoverUnparsedNP" -> GrecoverUnparsedNP (fg x1) Just (i,[x1]) | i == mkCId "result_from" -> Gresult_from (fg x1) - Just (i,[]) | i == mkCId "rodents" -> Grodents - Just (i,[]) | i == mkCId "signed" -> Gsigned - Just (i,[]) | i == mkCId "stay_during_policy_period" -> Gstay_during_policy_period - Just (i,[]) | i == mkCId "stay_overnight" -> Gstay_overnight - Just (i,[]) | i == mkCId "swimming_pool" -> Gswimming_pool - Just (i,[]) | i == mkCId "vermin" -> Gvermin - Just (i,[]) | i == mkCId "water" -> Gwater + Just (i,[]) | i == mkCId "rodents" -> Grodents + Just (i,[]) | i == mkCId "signed" -> Gsigned + Just (i,[]) | i == mkCId "stay_during_policy_period" -> Gstay_during_policy_period + Just (i,[]) | i == mkCId "stay_overnight" -> Gstay_overnight + Just (i,[]) | i == mkCId "swimming_pool" -> Gswimming_pool + Just (i,[]) | i == mkCId "vermin" -> Gvermin + Just (i,[]) | i == mkCId "water" -> Gwater _ -> error ("no NP " ++ show t) +instance Gf GNum where + gf GNumPl = mkApp (mkCId "NumPl") [] + gf GNumSg = mkApp (mkCId "NumSg") [] + + fg t = + case unApp t of + Just (i,[]) | i == mkCId "NumPl" -> GNumPl + Just (i,[]) | i == mkCId "NumSg" -> GNumSg + + + _ -> error ("no Num " ++ show t) + instance Gf GNumeral where gf (Gnum x1) = mkApp (mkCId "num") [gf x1] @@ -1075,14 +1331,23 @@ instance Gf GNumeral where _ -> error ("no Numeral " ++ show t) +instance Gf GPN where + gf (LexPN x) = mkApp (mkCId x) [] + + fg t = + case unApp t of + + Just (i,[]) -> LexPN (showCId i) + _ -> error ("no PN " ++ show t) + instance Gf GPol where gf GNEG = mkApp (mkCId "NEG") [] gf GPOS = mkApp (mkCId "POS") [] fg t = case unApp t of - Just (i,[]) | i == mkCId "NEG" -> GNEG - Just (i,[]) | i == mkCId "POS" -> GPOS + Just (i,[]) | i == mkCId "NEG" -> GNEG + Just (i,[]) | i == mkCId "POS" -> GPOS _ -> error ("no Pol " ++ show t) @@ -1093,7 +1358,9 @@ instance Gf GPrePost where gf (GNP_PrePost x1) = mkApp (mkCId "NP_PrePost") [gf x1] gf (GNP_caused_NP_to_VP_Prep_PrePost x1 x2 x3 x4) = mkApp (mkCId "NP_caused_NP_to_VP_Prep_PrePost") [gf x1, gf x2, gf x3, gf x4] gf (GNP_caused_by_PrePost x1) = mkApp (mkCId "NP_caused_by_PrePost") [gf x1] - gf (GV2_PrePost x1) = mkApp (mkCId "V2_PrePost") [gf x1] + gf (GSSlash_PrePost x1 x2 x3 x4) = mkApp (mkCId "SSlash_PrePost") [gf x1, gf x2, gf x3, gf x4] + gf (GS_PrePost x1 x2) = mkApp (mkCId "S_PrePost") [gf x1, gf x2] + gf (GV2_PrePost x1 x2 x3) = mkApp (mkCId "V2_PrePost") [gf x1, gf x2, gf x3] gf (GrecoverUnparsedPrePost x1) = mkApp (mkCId "recoverUnparsedPrePost") [gf x1] fg t = @@ -1103,7 +1370,9 @@ instance Gf GPrePost where Just (i,[x1]) | i == mkCId "NP_PrePost" -> GNP_PrePost (fg x1) Just (i,[x1,x2,x3,x4]) | i == mkCId "NP_caused_NP_to_VP_Prep_PrePost" -> GNP_caused_NP_to_VP_Prep_PrePost (fg x1) (fg x2) (fg x3) (fg x4) Just (i,[x1]) | i == mkCId "NP_caused_by_PrePost" -> GNP_caused_by_PrePost (fg x1) - Just (i,[x1]) | i == mkCId "V2_PrePost" -> GV2_PrePost (fg x1) + Just (i,[x1,x2,x3,x4]) | i == mkCId "SSlash_PrePost" -> GSSlash_PrePost (fg x1) (fg x2) (fg x3) (fg x4) + Just (i,[x1,x2]) | i == mkCId "S_PrePost" -> GS_PrePost (fg x1) (fg x2) + Just (i,[x1,x2,x3]) | i == mkCId "V2_PrePost" -> GV2_PrePost (fg x1) (fg x2) (fg x3) Just (i,[x1]) | i == mkCId "recoverUnparsedPrePost" -> GrecoverUnparsedPrePost (fg x1) @@ -1111,30 +1380,13 @@ instance Gf GPrePost where instance Gf GPrep where gf (GConjPrep x1 x2) = mkApp (mkCId "ConjPrep") [gf x1, gf x2] - gf Gabout_Prep = mkApp (mkCId "about_Prep") [] - gf Gafter_Prep = mkApp (mkCId "after_Prep") [] - gf Gbefore_Prep = mkApp (mkCId "before_Prep") [] - gf Gfor_Prep = mkApp (mkCId "for_Prep") [] - gf Gfrom_Prep = mkApp (mkCId "from_Prep") [] - gf Gon_Prep = mkApp (mkCId "on_Prep") [] - gf Gpossess_Prep = mkApp (mkCId "possess_Prep") [] - gf Gto_Prep = mkApp (mkCId "to_Prep") [] - gf Gwithin_Prep = mkApp (mkCId "within_Prep") [] + gf (LexPrep x) = mkApp (mkCId x) [] fg t = case unApp t of Just (i,[x1,x2]) | i == mkCId "ConjPrep" -> GConjPrep (fg x1) (fg x2) - Just (i,[]) | i == mkCId "about_Prep" -> Gabout_Prep - Just (i,[]) | i == mkCId "after_Prep" -> Gafter_Prep - Just (i,[]) | i == mkCId "before_Prep" -> Gbefore_Prep - Just (i,[]) | i == mkCId "for_Prep" -> Gfor_Prep - Just (i,[]) | i == mkCId "from_Prep" -> Gfrom_Prep - Just (i,[]) | i == mkCId "on_Prep" -> Gon_Prep - Just (i,[]) | i == mkCId "possess_Prep" -> Gpossess_Prep - Just (i,[]) | i == mkCId "to_Prep" -> Gto_Prep - Just (i,[]) | i == mkCId "within_Prep" -> Gwithin_Prep - + Just (i,[]) -> LexPrep (showCId i) _ -> error ("no Prep " ++ show t) instance Gf GQS where @@ -1149,6 +1401,26 @@ instance Gf GQS where _ -> error ("no QS " ++ show t) +instance Gf GRP where + gf GIdRP = mkApp (mkCId "IdRP") [] + + fg t = + case unApp t of + Just (i,[]) | i == mkCId "IdRP" -> GIdRP + + + _ -> error ("no RP " ++ show t) + +instance Gf GRS where + gf (GRelVPS x1 x2) = mkApp (mkCId "RelVPS") [gf x1, gf x2] + + fg t = + case unApp t of + Just (i,[x1,x2]) | i == mkCId "RelVPS" -> GRelVPS (fg x1) (fg x2) + + + _ -> error ("no RS " ++ show t) + instance Gf GS where gf (GConjPrePostS x1 x2 x3 x4) = mkApp (mkCId "ConjPrePostS") [gf x1, gf x2, gf x3, gf x4] gf (GConjS x1 x2) = mkApp (mkCId "ConjS") [gf x1, gf x2] @@ -1172,7 +1444,7 @@ instance Gf GSub10 where fg t = case unApp t of Just (i,[x1]) | i == mkCId "pot0" -> Gpot0 (fg x1) - Just (i,[]) | i == mkCId "pot01" -> Gpot01 + Just (i,[]) | i == mkCId "pot01" -> Gpot01 _ -> error ("no Sub10 " ++ show t) @@ -1189,8 +1461,8 @@ instance Gf GSub100 where case unApp t of Just (i,[x1]) | i == mkCId "pot0as1" -> Gpot0as1 (fg x1) Just (i,[x1]) | i == mkCId "pot1" -> Gpot1 (fg x1) - Just (i,[]) | i == mkCId "pot110" -> Gpot110 - Just (i,[]) | i == mkCId "pot111" -> Gpot111 + Just (i,[]) | i == mkCId "pot110" -> Gpot110 + Just (i,[]) | i == mkCId "pot111" -> Gpot111 Just (i,[x1,x2]) | i == mkCId "pot1plus" -> Gpot1plus (fg x1) (fg x2) Just (i,[x1]) | i == mkCId "pot1to19" -> Gpot1to19 (fg x1) @@ -1207,7 +1479,7 @@ instance Gf GSub1000 where case unApp t of Just (i,[x1]) | i == mkCId "pot1as2" -> Gpot1as2 (fg x1) Just (i,[x1]) | i == mkCId "pot2" -> Gpot2 (fg x1) - Just (i,[]) | i == mkCId "pot21" -> Gpot21 + Just (i,[]) | i == mkCId "pot21" -> Gpot21 Just (i,[x1,x2]) | i == mkCId "pot2plus" -> Gpot2plus (fg x1) (fg x2) @@ -1224,7 +1496,7 @@ instance Gf GSub1000000 where case unApp t of Just (i,[x1]) | i == mkCId "pot2as3" -> Gpot2as3 (fg x1) Just (i,[x1]) | i == mkCId "pot3" -> Gpot3 (fg x1) - Just (i,[]) | i == mkCId "pot31" -> Gpot31 + Just (i,[]) | i == mkCId "pot31" -> Gpot31 Just (i,[x1]) | i == mkCId "pot3float" -> Gpot3float (fg x1) Just (i,[x1,x2]) | i == mkCId "pot3plus" -> Gpot3plus (fg x1) (fg x2) @@ -1242,7 +1514,7 @@ instance Gf GSub1000000000 where case unApp t of Just (i,[x1]) | i == mkCId "pot3as4" -> Gpot3as4 (fg x1) Just (i,[x1]) | i == mkCId "pot4" -> Gpot4 (fg x1) - Just (i,[]) | i == mkCId "pot41" -> Gpot41 + Just (i,[]) | i == mkCId "pot41" -> Gpot41 Just (i,[x1]) | i == mkCId "pot4float" -> Gpot4float (fg x1) Just (i,[x1,x2]) | i == mkCId "pot4plus" -> Gpot4plus (fg x1) (fg x2) @@ -1260,7 +1532,7 @@ instance Gf GSub1000000000000 where case unApp t of Just (i,[x1]) | i == mkCId "pot4as5" -> Gpot4as5 (fg x1) Just (i,[x1]) | i == mkCId "pot5" -> Gpot5 (fg x1) - Just (i,[]) | i == mkCId "pot51" -> Gpot51 + Just (i,[]) | i == mkCId "pot51" -> Gpot51 Just (i,[x1]) | i == mkCId "pot5float" -> Gpot5float (fg x1) Just (i,[x1,x2]) | i == mkCId "pot5plus" -> Gpot5plus (fg x1) (fg x2) @@ -1268,25 +1540,12 @@ instance Gf GSub1000000000000 where _ -> error ("no Sub1000000000000 " ++ show t) instance Gf GSubj where - gf (GAN x1) = mkApp (mkCId "AN") [gf x1] - gf (GEVERY x1) = mkApp (mkCId "EVERY") [gf x1] - gf (GPARTY x1) = mkApp (mkCId "PARTY") [gf x1] - gf (GSubjWho x1 x2) = mkApp (mkCId "SubjWho") [gf x1, gf x2] - gf (GTHE x1) = mkApp (mkCId "THE") [gf x1] - gf GYou = mkApp (mkCId "You") [] - gf (GrecoverUnparsedSubj x1) = mkApp (mkCId "recoverUnparsedSubj") [gf x1] + gf (LexSubj x) = mkApp (mkCId x) [] fg t = case unApp t of - Just (i,[x1]) | i == mkCId "AN" -> GAN (fg x1) - Just (i,[x1]) | i == mkCId "EVERY" -> GEVERY (fg x1) - Just (i,[x1]) | i == mkCId "PARTY" -> GPARTY (fg x1) - Just (i,[x1,x2]) | i == mkCId "SubjWho" -> GSubjWho (fg x1) (fg x2) - Just (i,[x1]) | i == mkCId "THE" -> GTHE (fg x1) - Just (i,[]) | i == mkCId "You" -> GYou - Just (i,[x1]) | i == mkCId "recoverUnparsedSubj" -> GrecoverUnparsedSubj (fg x1) - + Just (i,[]) -> LexSubj (showCId i) _ -> error ("no Subj " ++ show t) instance Gf GTComparison where @@ -1299,12 +1558,12 @@ instance Gf GTComparison where fg t = case unApp t of - Just (i,[]) | i == mkCId "AFTER" -> GAFTER - Just (i,[]) | i == mkCId "BEFORE" -> GBEFORE - Just (i,[]) | i == mkCId "BY" -> GBY + Just (i,[]) | i == mkCId "AFTER" -> GAFTER + Just (i,[]) | i == mkCId "BEFORE" -> GBEFORE + Just (i,[]) | i == mkCId "BY" -> GBY Just (i,[x1,x2]) | i == mkCId "ConjTComparison" -> GConjTComparison (fg x1) (fg x2) - Just (i,[]) | i == mkCId "ON" -> GON - Just (i,[]) | i == mkCId "VAGUE" -> GVAGUE + Just (i,[]) | i == mkCId "ON" -> GON + Just (i,[]) | i == mkCId "VAGUE" -> GVAGUE _ -> error ("no TComparison " ++ show t) @@ -1316,9 +1575,9 @@ instance Gf GTemp where fg t = case unApp t of - Just (i,[]) | i == mkCId "pastSimul" -> GpastSimul - Just (i,[]) | i == mkCId "presAnt" -> GpresAnt - Just (i,[]) | i == mkCId "presSimul" -> GpresSimul + Just (i,[]) | i == mkCId "pastSimul" -> GpastSimul + Just (i,[]) | i == mkCId "presAnt" -> GpresAnt + Just (i,[]) | i == mkCId "presSimul" -> GpresSimul _ -> error ("no Temp " ++ show t) @@ -1371,9 +1630,9 @@ instance Gf GTimeUnit where fg t = case unApp t of - Just (i,[]) | i == mkCId "Day_Unit" -> GDay_Unit - Just (i,[]) | i == mkCId "Month_Unit" -> GMonth_Unit - Just (i,[]) | i == mkCId "Year_Unit" -> GYear_Unit + Just (i,[]) | i == mkCId "Day_Unit" -> GDay_Unit + Just (i,[]) | i == mkCId "Month_Unit" -> GMonth_Unit + Just (i,[]) | i == mkCId "Year_Unit" -> GYear_Unit Just (i,[x1]) | i == mkCId "recoverUnparsedTimeUnit" -> GrecoverUnparsedTimeUnit (fg x1) @@ -1381,16 +1640,27 @@ instance Gf GTimeUnit where instance Gf GUpon where gf (GUPON x1) = mkApp (mkCId "UPON") [gf x1] + gf (GUPONnp x1 x2) = mkApp (mkCId "UPONnp") [gf x1, gf x2] gf (GrecoverUnparsedUpon x1) = mkApp (mkCId "recoverUnparsedUpon") [gf x1] fg t = case unApp t of Just (i,[x1]) | i == mkCId "UPON" -> GUPON (fg x1) + Just (i,[x1,x2]) | i == mkCId "UPONnp" -> GUPONnp (fg x1) (fg x2) Just (i,[x1]) | i == mkCId "recoverUnparsedUpon" -> GrecoverUnparsedUpon (fg x1) _ -> error ("no Upon " ++ show t) +instance Gf GV where + gf (LexV x) = mkApp (mkCId x) [] + + fg t = + case unApp t of + + Just (i,[]) -> LexV (showCId i) + _ -> error ("no V " ++ show t) + instance Gf GV2 where gf (LexV2 x) = mkApp (mkCId x) [] @@ -1408,6 +1678,7 @@ instance Gf GVP where gf (GComplVSif x1 x2) = mkApp (mkCId "ComplVSif") [gf x1, gf x2] gf (GComplVSthat x1 x2) = mkApp (mkCId "ComplVSthat") [gf x1, gf x2] gf (GUseComp x1) = mkApp (mkCId "UseComp") [gf x1] + gf (GUseV x1) = mkApp (mkCId "UseV") [gf x1] gf (LexVP x) = mkApp (mkCId x) [] fg t = @@ -1419,6 +1690,7 @@ instance Gf GVP where Just (i,[x1,x2]) | i == mkCId "ComplVSif" -> GComplVSif (fg x1) (fg x2) Just (i,[x1,x2]) | i == mkCId "ComplVSthat" -> GComplVSthat (fg x1) (fg x2) Just (i,[x1]) | i == mkCId "UseComp" -> GUseComp (fg x1) + Just (i,[x1]) | i == mkCId "UseV" -> GUseV (fg x1) Just (i,[]) -> LexVP (showCId i) _ -> error ("no VP " ++ show t) @@ -1434,15 +1706,21 @@ instance Gf GVPI where _ -> error ("no VPI " ++ show t) instance Gf GVPS where + gf (GComparison_Card_Years x1) = mkApp (mkCId "Comparison_Card_Years") [gf x1] gf (GConjPrePostVPS x1 x2 x3 x4) = mkApp (mkCId "ConjPrePostVPS") [gf x1, gf x2, gf x3, gf x4] gf (GConjVPS x1 x2) = mkApp (mkCId "ConjVPS") [gf x1, gf x2] + gf (GGreaterThan x1) = mkApp (mkCId "GreaterThan") [gf x1] + gf (GLessThan x1) = mkApp (mkCId "LessThan") [gf x1] gf (GMayHave x1) = mkApp (mkCId "MayHave") [gf x1] gf (GMkVPS x1 x2 x3) = mkApp (mkCId "MkVPS") [gf x1, gf x2, gf x3] fg t = case unApp t of + Just (i,[x1]) | i == mkCId "Comparison_Card_Years" -> GComparison_Card_Years (fg x1) Just (i,[x1,x2,x3,x4]) | i == mkCId "ConjPrePostVPS" -> GConjPrePostVPS (fg x1) (fg x2) (fg x3) (fg x4) Just (i,[x1,x2]) | i == mkCId "ConjVPS" -> GConjVPS (fg x1) (fg x2) + Just (i,[x1]) | i == mkCId "GreaterThan" -> GGreaterThan (fg x1) + Just (i,[x1]) | i == mkCId "LessThan" -> GLessThan (fg x1) Just (i,[x1]) | i == mkCId "MayHave" -> GMayHave (fg x1) Just (i,[x1,x2,x3]) | i == mkCId "MkVPS" -> GMkVPS (fg x1) (fg x2) (fg x3) @@ -1510,22 +1788,6 @@ instance Gf GYearComponent where -instance Gf GA where - gf _ = undefined - fg _ = undefined - - - - - -instance Gf GA2 where - gf _ = undefined - fg _ = undefined - - - - - instance Gf GAnt where gf _ = undefined fg _ = undefined @@ -1534,22 +1796,6 @@ instance Gf GAnt where -instance Gf GN where - gf _ = undefined - fg _ = undefined - - - - - -instance Gf GN2 where - gf _ = undefined - fg _ = undefined - - - - - instance Gf GTense where gf _ = undefined fg _ = undefined @@ -1557,16 +1803,9 @@ instance Gf GTense where - -instance Gf GV where - gf _ = undefined - fg _ = undefined - - - - instance Compos Tree where compos r a f t = case t of + GComplA2 x1 x2 -> r GComplA2 `a` f x1 `a` f x2 GConjAP x1 x2 -> r GConjAP `a` f x1 `a` f x2 GInt_or_older x1 -> r GInt_or_older `a` f x1 GPositA x1 -> r GPositA `a` f x1 @@ -1574,13 +1813,22 @@ instance Compos Tree where Gensuing x1 -> r Gensuing `a` f x1 GACTION x1 -> r GACTION `a` f x1 GrecoverUnparsedAction x1 -> r GrecoverUnparsedAction `a` f x1 + GAdnCAdv x1 -> r GAdnCAdv `a` f x1 GAdAdv x1 x2 -> r GAdAdv `a` f x1 `a` f x2 GByVP x1 -> r GByVP `a` f x1 GConjAdv x1 x2 -> r GConjAdv `a` f x1 `a` f x2 GPrepNP x1 x2 -> r GPrepNP `a` f x1 `a` f x2 + GSubjS x1 x2 -> r GSubjS `a` f x1 `a` f x2 + GWhileDoing x1 -> r GWhileDoing `a` f x1 GrecoverUnparsedAdv x1 -> r GrecoverUnparsedAdv `a` f x1 GAdjCN x1 x2 -> r GAdjCN `a` f x1 `a` f x2 + GCNwhereS x1 x2 x3 -> r GCNwhereS `a` f x1 `a` f x2 `a` f x3 + GComplN2 x1 x2 -> r GComplN2 `a` f x1 `a` f x2 + GRelCN x1 x2 -> r GRelCN `a` f x1 `a` f x2 GUseN x1 -> r GUseN `a` f x1 + G_CN_of_any_kind_CN x1 -> r G_CN_of_any_kind_CN `a` f x1 + GAdNum x1 x2 -> r GAdNum `a` f x1 `a` f x2 + GNumDigits x1 -> r GNumDigits `a` f x1 GCompAP x1 -> r GCompAP `a` f x1 GCompAdv x1 -> r GCompAdv `a` f x1 GCompNP x1 -> r GCompNP `a` f x1 @@ -1594,18 +1842,26 @@ instance Compos Tree where GConjPreConstraint x1 x2 x3 -> r GConjPreConstraint `a` f x1 `a` f x2 `a` f x3 GConjPrePostConstraint x1 x2 x3 x4 -> r GConjPrePostConstraint `a` f x1 `a` f x2 `a` f x3 `a` f x4 GRPleafAP x1 -> r GRPleafAP `a` f x1 + GRPleafAdv x1 -> r GRPleafAdv `a` f x1 GRPleafNP x1 -> r GRPleafNP `a` f x1 GRPleafS x1 x2 -> r GRPleafS `a` f x1 `a` f x2 GRPleafVP x1 -> r GRPleafVP `a` f x1 GrecoverRPis x1 x2 -> r GrecoverRPis `a` f x1 `a` f x2 + GrecoverRPmath x1 x2 x3 -> r GrecoverRPmath `a` f x1 `a` f x2 `a` f x3 GrecoverUnparsedConstraint x1 -> r GrecoverUnparsedConstraint `a` f x1 GMkDate x1 x2 x3 -> r GMkDate `a` f x1 `a` f x2 `a` f x3 GIDig x1 -> r GIDig `a` f x1 GIIDig x1 x2 -> r GIIDig `a` f x1 `a` f x2 + GCompoundN x1 x2 -> r GCompoundN `a` f x1 `a` f x2 GConjNP x1 x2 -> r GConjNP `a` f x1 `a` f x2 GDetCN x1 x2 -> r GDetCN `a` f x1 `a` f x2 + GEVERY x1 -> r GEVERY `a` f x1 + GGenModNP x1 x2 x3 -> r GGenModNP `a` f x1 `a` f x2 `a` f x3 GGerundNP x1 -> r GGerundNP `a` f x1 GMassNP x1 -> r GMassNP `a` f x1 + GSubjWho x1 x2 -> r GSubjWho `a` f x1 `a` f x2 + GUsePN x1 -> r GUsePN `a` f x1 + GrecoverUnparsedNP x1 -> r GrecoverUnparsedNP `a` f x1 Gresult_from x1 -> r Gresult_from `a` f x1 Gnum x1 -> r Gnum `a` f x1 GAP_PrePost x1 -> r GAP_PrePost `a` f x1 @@ -1613,11 +1869,14 @@ instance Compos Tree where GNP_PrePost x1 -> r GNP_PrePost `a` f x1 GNP_caused_NP_to_VP_Prep_PrePost x1 x2 x3 x4 -> r GNP_caused_NP_to_VP_Prep_PrePost `a` f x1 `a` f x2 `a` f x3 `a` f x4 GNP_caused_by_PrePost x1 -> r GNP_caused_by_PrePost `a` f x1 - GV2_PrePost x1 -> r GV2_PrePost `a` f x1 + GSSlash_PrePost x1 x2 x3 x4 -> r GSSlash_PrePost `a` f x1 `a` f x2 `a` f x3 `a` f x4 + GS_PrePost x1 x2 -> r GS_PrePost `a` f x1 `a` f x2 + GV2_PrePost x1 x2 x3 -> r GV2_PrePost `a` f x1 `a` f x2 `a` f x3 GrecoverUnparsedPrePost x1 -> r GrecoverUnparsedPrePost `a` f x1 GConjPrep x1 x2 -> r GConjPrep `a` f x1 `a` f x2 GConjPrePostQS x1 x2 x3 x4 -> r GConjPrePostQS `a` f x1 `a` f x2 `a` f x3 `a` f x4 GConjQS x1 x2 -> r GConjQS `a` f x1 `a` f x2 + GRelVPS x1 x2 -> r GRelVPS `a` f x1 `a` f x2 GConjPrePostS x1 x2 x3 x4 -> r GConjPrePostS `a` f x1 `a` f x2 `a` f x3 `a` f x4 GConjS x1 x2 -> r GConjS `a` f x1 `a` f x2 GPredVPS x1 x2 -> r GPredVPS `a` f x1 `a` f x2 @@ -1642,12 +1901,6 @@ instance Compos Tree where Gpot5 x1 -> r Gpot5 `a` f x1 Gpot5float x1 -> r Gpot5float `a` f x1 Gpot5plus x1 x2 -> r Gpot5plus `a` f x1 `a` f x2 - GAN x1 -> r GAN `a` f x1 - GEVERY x1 -> r GEVERY `a` f x1 - GPARTY x1 -> r GPARTY `a` f x1 - GSubjWho x1 x2 -> r GSubjWho `a` f x1 `a` f x2 - GTHE x1 -> r GTHE `a` f x1 - GrecoverUnparsedSubj x1 -> r GrecoverUnparsedSubj `a` f x1 GConjTComparison x1 x2 -> r GConjTComparison `a` f x1 `a` f x2 GTemporalConstraint x1 x2 x3 -> r GTemporalConstraint `a` f x1 `a` f x2 `a` f x3 GTemporalConstraintNoDigits x1 x2 -> r GTemporalConstraintNoDigits `a` f x1 `a` f x2 @@ -1663,6 +1916,7 @@ instance Compos Tree where GsWHO x1 x2 -> r GsWHO `a` f x1 `a` f x2 GrecoverUnparsedTimeUnit x1 -> r GrecoverUnparsedTimeUnit `a` f x1 GUPON x1 -> r GUPON `a` f x1 + GUPONnp x1 x2 -> r GUPONnp `a` f x1 `a` f x2 GrecoverUnparsedUpon x1 -> r GrecoverUnparsedUpon `a` f x1 GAdvVP x1 x2 -> r GAdvVP `a` f x1 `a` f x2 GComplV2 x1 x2 -> r GComplV2 `a` f x1 `a` f x2 @@ -1671,9 +1925,13 @@ instance Compos Tree where GComplVSif x1 x2 -> r GComplVSif `a` f x1 `a` f x2 GComplVSthat x1 x2 -> r GComplVSthat `a` f x1 `a` f x2 GUseComp x1 -> r GUseComp `a` f x1 + GUseV x1 -> r GUseV `a` f x1 GMkVPI x1 -> r GMkVPI `a` f x1 + GComparison_Card_Years x1 -> r GComparison_Card_Years `a` f x1 GConjPrePostVPS x1 x2 x3 x4 -> r GConjPrePostVPS `a` f x1 `a` f x2 `a` f x3 `a` f x4 GConjVPS x1 x2 -> r GConjVPS `a` f x1 `a` f x2 + GGreaterThan x1 -> r GGreaterThan `a` f x1 + GLessThan x1 -> r GLessThan `a` f x1 GMayHave x1 -> r GMayHave `a` f x1 GMkVPS x1 x2 x3 -> r GMkVPS `a` f x1 `a` f x2 `a` f x3 GAPWho x1 -> r GAPWho `a` f x1 diff --git a/lib/haskell/natural4/src/LS/NLP/NL4Transformations.hs b/lib/haskell/natural4/src/LS/NLP/NL4Transformations.hs index 651559e34..5ccb20031 100644 --- a/lib/haskell/natural4/src/LS/NLP/NL4Transformations.hs +++ b/lib/haskell/natural4/src/LS/NLP/NL4Transformations.hs @@ -28,17 +28,17 @@ pushPrePostIntoMain bsgt = case bsgt of hackStrVP :: GString -> GVP -> GVP hackStrVP in_part vp = GAdvVP vp (GrecoverUnparsedAdv in_part) - transformWho :: GV2 -> GNP -> GText -> GText - transformWho consume beverage (GqWHO person (GAPWho alcoholic)) = - GqWHO (referSubj person) (GWHO GpresSimul GPOS (GComplV2 consume (introduceNP (insertAP alcoholic beverage)))) - transformWho consume beverage (GqWHO person (GAdvWho in_part)) = - GqWHO (referSubj person) (GWHO GpresSimul GPOS (GAdvVP (GComplV2 consume (referNP beverage)) in_part)) + transformWho :: GTemp -> GPol -> GV2 -> GNP -> GText -> GText + transformWho t p consume beverage (GqWHO person (GAPWho alcoholic)) = + GqWHO (referNP person) (GWHO t p (GComplV2 consume (introduceNP (insertAP alcoholic beverage)))) + transformWho t p consume beverage (GqWHO person (GAdvWho in_part)) = + GqWHO (referNP person) (GWHO t p (GAdvVP (GComplV2 consume (referNP beverage)) in_part)) tryTransformWhole :: BoolStructGText -> BoolStructGText tryTransformWhole bs = case bs of All pp ( Any - ( Just ( PrePost (GqPREPOST ( GV2_PrePost consume ) ) + ( Just ( PrePost (GqPREPOST ( GV2_PrePost t p consume ) ) (GqPREPOST ( GNP_PrePost beverage)))) alcoholic_nonalcoholic : Any @@ -48,15 +48,15 @@ pushPrePostIntoMain bsgt = case bsgt of All pp ( Any Nothing ( - (transformWho consume beverage `mapBS`) <$> alcoholic_nonalcoholic) + (transformWho t p consume beverage `mapBS`) <$> alcoholic_nonalcoholic) : Any Nothing ( - (transformWho consume beverage `mapBS`) <$> inpart_inwhole) + (transformWho t p consume beverage `mapBS`) <$> inpart_inwhole) : restOfInnerRules ) Any pp ( All - ( Just ( PrePost (GqPREPOST ( GV2_PrePost consume ) ) + ( Just ( PrePost (GqPREPOST ( GV2_PrePost t p consume ) ) (GqPREPOST ( GNP_PrePost beverage)))) alcoholic_nonalcoholic : All @@ -66,10 +66,10 @@ pushPrePostIntoMain bsgt = case bsgt of Any pp ( All Nothing ( - (transformWho consume beverage `mapBS`) <$> alcoholic_nonalcoholic) + (transformWho t p consume beverage `mapBS`) <$> alcoholic_nonalcoholic) : All Nothing ( - (transformWho consume beverage `mapBS`) <$> inpart_inwhole) + (transformWho t p consume beverage `mapBS`) <$> inpart_inwhole) : restOfInnerRules ) _ -> bs @@ -96,7 +96,7 @@ bsNeg2textNeg bs = case bs of -- textNeg2bsNeg :: BoolStructWho -> BoolStructWho ----------------------------------------------------------------------------- --- This is rather hard to read, but the alternative is to duplicate bs2gf for every single GF category +-- This is rather hard to read, but the alternative is to duplicate bs2gf for every single GF cate(LexConj "OR")y type ConjFun list single = GConj -> Tree list -> Tree single type ConjPreFun list single = GPrePost -> GConj -> Tree list -> Tree single @@ -106,12 +106,12 @@ type ListFun single list = [Tree single] -> Tree list bs2gf :: (Gf (Tree s)) => ConjFun l s -> ConjPreFun l s -> ConjPrePostFun l s -> ListFun s l -> BoolStructGF s -> Tree s bs2gf conj conjPre conjPrePost mkList bs = case bs' of AA.Leaf x -> x - AA.Any Nothing xs -> mergeConj $ conj GOR $ mkList $ f <$> xs - AA.All Nothing xs -> mergeConj $ conj GAND $ mkList $ f <$> xs - AA.Any (Just (AA.Pre pre)) xs -> conjPre pre GOR $ mkList $ f <$> xs - AA.All (Just (AA.Pre pre)) xs -> conjPre pre GAND $ mkList $ f <$> xs - AA.Any (Just (AA.PrePost pre post)) xs -> conjPrePost pre post GOR $ mkList $ f <$> xs - AA.All (Just (AA.PrePost pre post)) xs -> conjPrePost pre post GAND $ mkList $ f <$> xs + AA.Any Nothing xs -> mergeConj $ conj (LexConj "OR") $ mkList $ f <$> xs + AA.All Nothing xs -> mergeConj $ conj (LexConj "AND") $ mkList $ f <$> xs + AA.Any (Just (AA.Pre pre)) xs -> conjPre pre (LexConj "OR") $ mkList $ f <$> xs + AA.All (Just (AA.Pre pre)) xs -> conjPre pre (LexConj "AND") $ mkList $ f <$> xs + AA.Any (Just (AA.PrePost pre post)) xs -> conjPrePost pre post (LexConj "OR") $ mkList $ f <$> xs + AA.All (Just (AA.PrePost pre post)) xs -> conjPrePost pre post (LexConj "AND") $ mkList $ f <$> xs AA.Not unexpectedBS -> trace unexpectedNegationMsg $ bs2gf conj conjPre conjPrePost mkList unexpectedBS -- AA.Not _ -> error unexpectedNegationMsg where @@ -149,27 +149,16 @@ mapBS f bs = case bs of AA.Not x -> AA.Not $ mapBS f x ----------------------------------------------------------------------------- -- Generic useful transformations - --- for Subj -introduceSubj :: forall a . Tree a -> Tree a -introduceSubj (GEVERY x) = GAN x -introduceSubj (GPARTY x) = GAN x -introduceSubj x = composOp introduceSubj x - -referSubj :: forall a . Tree a -> Tree a -referSubj (GEVERY x) = GTHE x -referSubj (GPARTY x) = GTHE x -referSubj (GAN x) = GTHE x -referSubj x = composOp referSubj x - -- for NP introduceNP :: forall a . Tree a -> Tree a +introduceNP (GEVERY x) = GDetCN GaSg x introduceNP (GMassNP x) = GDetCN GaSg x introduceNP (GDetCN _ x) = GDetCN GaSg x introduceNP x = composOp introduceNP x referNP :: forall a . Tree a -> Tree a +referNP (GEVERY x) = GDetCN GtheSg x referNP (GMassNP x) = GDetCN GtheSg x referNP (GDetCN GaSg x) = GDetCN GtheSg x --referNP (GDetCN GaPl x) = GDetCN GthePl x @@ -238,6 +227,6 @@ aggregateBoolStruct l bs = then bs else (case bs of - AA.Any _ xs -> maybe bs AA.Leaf $ squeezeTrees GOR $ concatMap toList xs - AA.All _ xs -> maybe bs AA.Leaf $ squeezeTrees GAND $ concatMap toList xs + AA.Any _ xs -> maybe bs AA.Leaf $ squeezeTrees (LexConj "OR") $ concatMap toList xs + AA.All _ xs -> maybe bs AA.Leaf $ squeezeTrees (LexConj "AND") $ concatMap toList xs _ -> bs) diff --git a/lib/haskell/natural4/src/LS/NLP/NLG.hs b/lib/haskell/natural4/src/LS/NLP/NLG.hs index 2fc0b8105..e3f5f1524 100644 --- a/lib/haskell/natural4/src/LS/NLP/NLG.hs +++ b/lib/haskell/natural4/src/LS/NLP/NLG.hs @@ -1,11 +1,11 @@ -{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE OverloadedStrings, GADTs #-} {-# OPTIONS_GHC -Wno-name-shadowing #-} module LS.NLP.NLG where import AnyAll qualified as AA import Control.Monad (when) -import Data.Char qualified as Char (toLower) +import Data.Char qualified as Char (toLower, isDigit) import Data.Foldable qualified as F import Data.HashMap.Strict (elems, keys, lookup, toList) import Data.HashMap.Strict qualified as Map @@ -32,13 +32,13 @@ import LS.NLP.NL4Transformations bsConstraint2gfConstraint, bsWho2gfWho, flipPolarity, - introduceSubj, + introduceNP, isChinese, isMalay, mapBSLabel, pastTense, pushPrePostIntoMain, - referSubj, + referNP, ) import LS.Rule (Interpreted (..), Rule (..), ruleLabelName, ruleName, ruleConstructor) import LS.Types @@ -51,7 +51,7 @@ import LS.Types MTExpr (MTT), MultiTerm, ParamText, - RPRel (RPTC, RPis), + RPRel (..), RelationalPredicate ( RPBoolStructR, RPConstraint, @@ -104,6 +104,7 @@ import PGF ) import Paths_natural4 (getDataFileName) import System.Environment (lookupEnv) +import Prettyprinter.Interpolate (__di) data NLGEnv = NLGEnv { gfGrammar :: PGF @@ -159,7 +160,7 @@ myNLGEnv l4i lang = do Left engL -> return $ mutter "** myNLGEnv" >> mutters engErr >> xpError engL Right engR -> do let myParse typ txt = parse gr engR typ (Text.unpack txt) - myLin = rmBIND . Text.pack . linearize gr lang + myLin = uncapKeywords . rmBIND . Text.pack . linearize gr lang return $ do mutter "** myNLGEnv" xpReturn $ NLGEnv gr lang myParse myLin verbose l4i @@ -167,6 +168,15 @@ myNLGEnv l4i lang = do rmBIND :: Text.Text -> Text.Text rmBIND = Text.replace " &+ " "" +uncapKeywords :: Text.Text -> Text.Text +uncapKeywords = Text.unwords . map (lowerWhole ["BEFORE","AFTER","IS"]) . Text.words + where + lowerWhole keywords word = + if word `elem` keywords + then Text.toLower word + else word + + gfPath :: String -> String gfPath x = "grammars/" ++ x @@ -214,7 +224,7 @@ nlg = nlg' TopLevel nlg' :: RecursionLevel -> NLGEnv -> Rule -> IO Text.Text nlg' thl env rule = case rule of Regulative {subj,upon,temporal,cond,who,deontic,action,lest,hence} -> do - let subjExpr = introduceSubj $ parseSubj env subj + let subjExpr = introduceNP $ parseSubj env subj deonticExpr = parseDeontic deontic actionExpr = parseAction env action whoSubjExpr = case who of @@ -322,6 +332,7 @@ ruleQuestions env alias rule = do text DefNameAlias {} -> pure [] -- no questions needed to produce from DefNameAlias DefTypically {} -> pure [] -- no questions needed to produce from DefTypically + RuleGroup {} -> pure [] _ -> pure [AA.Leaf $ Text.pack ("ruleQuestions: doesn't work yet for " <> ruleConstructor rule)] -- [TODO] for our Logging exercise, see how to convert the _ case above to an xpError @@ -359,10 +370,10 @@ ruleQnTrees env alias rule = do case rule of Regulative {subj,who,cond,upon} -> do let subjExpr = parseSubj env subj - aliasExpr = if subjExpr==orgExpr then youExpr else referSubj subjExpr + aliasExpr = if subjExpr==orgExpr then youExpr else referNP subjExpr qWhoTrees = mkWhoText env GqPREPOST (GqWHO aliasExpr) <$> who qCondTrees = mkCondText env GqPREPOST GqCOND <$> cond - qUponTrees = mkUponText env (GqUPON aliasExpr) <$> upon + qUponTrees = mkUponText env aliasExpr GqUPON <$> upon mutterdhsf 4 "Regulative/subjExpr" show subjExpr mutterdhsf 4 "Regulative/aliasExpr" show aliasExpr mutterdhsf 4 "Regulative/qWhoTrees" show qWhoTrees @@ -387,10 +398,10 @@ ruleQnTrees env alias rule = do ---------------------------------------------------------------------- -textViaQaHorns :: NLGEnv -> Alias -> Maybe GSubj -> [([RuleName], BoolStructT)] -textViaQaHorns env alias subj = [ (rn, linBStext env $ mkGFtext env alias (referSubj <$> subj) bsr) | (rn, bsr) <- qaHornsR (interpreted env)] +textViaQaHorns :: NLGEnv -> Alias -> Maybe GNP -> [([RuleName], BoolStructT)] +textViaQaHorns env alias subj = [ (rn, linBStext env $ mkGFtext env alias (referNP <$> subj) bsr) | (rn, bsr) <- qaHornsR (interpreted env)] -mkGFtext :: NLGEnv -> Alias -> Maybe GSubj -> BoolStructR -> BoolStructGText +mkGFtext :: NLGEnv -> Alias -> Maybe GNP -> BoolStructR -> BoolStructGText mkGFtext env alias subj bsr = case (whoParses, condParses) of ([], []) -> mkConstraintText env GqPREPOST GqCONSTR bsr ([], _:_) -> mkCondText env GqPREPOST GqCOND bsr @@ -427,11 +438,13 @@ mkCondText env f g bsr = mapBSLabel f g $ aggregateBoolStruct (gfLang env) $ par mkConstraintText :: NLGEnv -> (GPrePost -> GText) -> (GConstraint -> GText) -> BoolStructR -> BoolStructGText mkConstraintText env f g bsr = mapBSLabel f g $ aggregateBoolStruct (gfLang env) $ parseConstraintBS env bsr -mkUponText :: NLGEnv -> (GUpon -> GText) -> ParamText -> BoolStructGText -mkUponText env f pt = AA.Leaf (f $ parseUpon env pt) - --- mkUponText :: NLGEnv -> (GUpon -> GText) -> ParamText -> BoolStructT --- mkUponText env f = AA.Leaf . gfLin env . gf . f . parseUpon env +mkUponText :: NLGEnv -> GNP -> (GNP -> GUpon -> GText) -> ParamText -> BoolStructGText +mkUponText env alias f pt = AA.Leaf (f subj upon) + where + upon0 = parseUpon env pt + (subj,upon) = case upon0 of + GUPONnp np vp -> (np, GUPON vp) + _ -> (alias, upon0) nlgQuestion :: NLGEnv -> Rule -> XPileLog [Text.Text] nlgQuestion env rl = do @@ -497,11 +510,11 @@ parseAction env bsp = fg tree txt = bsp2text bsp tree :| _ = parseAny "Action" env txt -parseSubj :: NLGEnv -> BoolStructP -> GSubj +parseSubj :: NLGEnv -> BoolStructP -> GNP parseSubj env bsp = fg tree where txt = bsp2text bsp - tree :| _ = parseAny "Subj" env txt + tree :| _ = parseAny "NP" env txt parseWho :: NLGEnv -> RelationalPredicate -> GWho parseWho env rp = fg tree @@ -515,15 +528,32 @@ parseCond env (RPConstraint c (RPTC t) d) = GRPConstraint cond tc date cond = parseCond env (RPMT c) tc = parseTComparison t date = parseDate d +parseCond env (RPConstraint a RPis b) = case (nps,vps) of + (np:_, (GMkVPS t p vp):_) -> GWHEN np t p vp + _ -> parseCond env (RPMT [MTT $ Text.unwords [aTxt, "is", bTxt]]) + where + aTxt = Text.strip $ mt2text a + bTxt = Text.strip $ mt2text b + nps :: [GNP] + nps = fg <$> parseAnyNoRecover "NP" env aTxt + vps :: [GVPS] + vps = fg <$> parseAnyNoRecover "VPS" env (Text.unwords ["is", bTxt]) + parseCond env rp = fg tree where txt = rp2text rp tree :| _ = parseAny "Cond" env txt parseUpon :: NLGEnv -> ParamText -> GUpon -parseUpon env pt = fg tree +parseUpon env pt = case upons of + upon:_ -> upon + [] -> case nps of + np:_ -> GUPONnp np (LexVP "occur") + [] -> fg tree where txt = pt2text pt + upons = fg <$> parseAnyNoRecover "Upon" env txt + nps = fg <$> parseAnyNoRecover "NP" env txt tree :| _ = parseAny "Upon" env txt parseTemporal :: NLGEnv -> TemporalConstraint Text.Text -> GTemporal @@ -556,7 +586,7 @@ parseConstraint env (RPBoolStructR a RPis (AA.Not b)) = case (nps,vps) of (np:_, vp:_) -> GRPleafS (fg np) (flipPolarity $ fg vp) _ -> GrecoverRPis (tString aTxt) (tString $ Text.unwords ["not", bTxt]) where - aTxt = mt2text a + aTxt = Text.strip $ mt2text a bTxt = bsr2text b nps = parseAnyNoRecover "NP" env aTxt vps = parseAnyNoRecover "VPS" env $ Text.unwords ["is", bTxt] @@ -565,13 +595,94 @@ parseConstraint env (RPConstraint a RPis b) = case (nps,vps) of (np:_, vp:_) -> GRPleafS (fg np) (fg vp) _ -> GrecoverRPis (tString aTxt) (tString bTxt) where - aTxt = mt2text a - bTxt = mt2text b + aTxt = Text.strip $ mt2text a + bTxt = Text.strip $ mt2text b nps = parseAnyNoRecover "NP" env aTxt vps = parseAnyNoRecover "VPS" env $ Text.unwords ["is", bTxt] - tString :: Text.Text -> GString - tString = GString . Text.unpack +parseConstraint env (RPConstraint a (RPTC t) b) = case (sents,advs) of + (s:_, adv:_) -> case s of + GPredVPS np (GMkVPS t p vp) -> GRPleafS np (GMkVPS t p (GAdvVP vp adv)) + _ -> trace ("parseConstraint: unable to parse " <> showExpr [] (gf s)) fallback + x -> trace ("parseConstraint: unable to parse " <> show x <> Text.unpack tTxt) fallback + where + aTxt = Text.strip $ mt2text a + tTxt = gfLin env $ gf $ parseTComparison t + bTxt = Text.strip $ mt2text b + sents :: [GS] + sents = fg <$> parseAnyNoRecover "S" env aTxt + advs :: [GAdv] + advs = fg <$> parseAnyNoRecover "Adv" env (Text.unwords [tTxt, bTxt]) + fallback = GrecoverUnparsedConstraint (tString $ Text.unwords [aTxt, tTxt, bTxt]) + + +parseConstraint env (RPConstraint a RPgt b) = case (nps,vps) of + (np:_, vp:_) -> GRPleafS (fg np) (fg vp) + _ -> GrecoverRPmath (tString ">") (tString aTxt) (tString bTxt) + where + aTxt0 = Text.strip $ mt2text a + aTxt = case dp 6 aTxt0 of + "'s age" -> tk 6 aTxt0 -- policy holder's age -> policy holder + _ -> aTxt0 + + bTxt0 = Text.strip $ mt2text b + bTxt = case (dp 6 aTxt0, dp 5 bTxt0) of + ("'s age", "years") -> Text.unwords ["is more than", splitDigits bTxt0, "old"] + _ -> Text.unwords ["is greater than", bTxt0] + + nps = parseAnyNoRecover "NP" env aTxt + vps = parseAnyNoRecover "VPS" env bTxt + +parseConstraint env (RPConstraint a RPlt b) = case (nps,vps) of + (np:_, vp:_) -> GRPleafS (fg np) (fg vp) + _ -> GrecoverRPmath (tString "<") (tString aTxt) (tString bTxt) + where + aTxt0 = Text.strip $ mt2text a + aTxt = case dp 6 aTxt0 of + "'s age" -> tk 6 aTxt0 -- policy holder's age -> policy holder + _ -> aTxt0 + + bTxt0 = Text.strip $ mt2text b + bTxt = case (dp 6 aTxt0, dp 5 bTxt0) of + ("'s age", "years") -> Text.unwords ["is less than", splitDigits bTxt0, "old"] + _ -> Text.unwords ["is less than", bTxt0] + + nps = parseAnyNoRecover "NP" env aTxt + vps = parseAnyNoRecover "VPS" env bTxt + +parseConstraint env (RPConstraint a RPlte b) = case (nps,vps) of + (np:_, vp:_) -> GRPleafS (fg np) (fg vp) + _ -> GrecoverRPmath (tString "<") (tString aTxt) (tString bTxt) + where + aTxt0 = Text.strip $ mt2text a + aTxt = case dp 6 aTxt0 of + "'s age" -> tk 6 aTxt0 -- policy holder's age -> policy holder + _ -> aTxt0 + + bTxt0 = Text.strip $ mt2text b + bTxt = case (dp 6 aTxt0, dp 5 bTxt0) of + ("'s age", "years") -> Text.unwords ["is at most", splitDigits bTxt0, "old"] + _ -> Text.unwords ["is at most", bTxt0] + + nps = parseAnyNoRecover "NP" env aTxt + vps = parseAnyNoRecover "VPS" env bTxt + +parseConstraint env (RPConstraint a RPgte b) = case (nps,vps) of + (np:_, vp:_) -> GRPleafS (fg np) (fg vp) + _ -> GrecoverRPmath (tString "<") (tString aTxt) (tString bTxt) + where + aTxt0 = Text.strip $ mt2text a + aTxt = case dp 6 aTxt0 of + "'s age" -> tk 6 aTxt0 -- policy holder's age -> policy holder + _ -> aTxt0 + + bTxt0 = Text.strip $ mt2text b + bTxt = case (dp 6 aTxt0, dp 5 bTxt0) of + ("'s age", "years") -> Text.unwords ["is at least", splitDigits bTxt0, "old"] + _ -> Text.unwords ["is at least", bTxt0] + + nps = parseAnyNoRecover "NP" env aTxt + vps = parseAnyNoRecover "VPS" env bTxt parseConstraint env rp = fg tree where @@ -614,6 +725,24 @@ typeError cat actualCats = error $ unwords ["category", cat, "not a valid GF cat tString :: Text.Text -> GString tString = GString . Text.unpack + +splitDigits :: Text.Text -> Text.Text +splitDigits txt = Text.unwords (splitDigit <$> Text.words txt) + where + splitDigit d = if Text.all Char.isDigit d + then Text.intercalate " &+ " (Text.groupBy (\x y -> False) d) + else d + +tk, dp :: Int -> Text.Text -> Text.Text +tk i = Text.pack . tk' i . Text.unpack +dp i = Text.pack . dp' i . Text.unpack + + +tk', dp' :: Int -> String -> String +tk' i = reverse . drop i . reverse -- tk 2 "hello" == "hel" +dp' i = reverse . take i . reverse -- dp 2 "hello" == "lo" + + ----------------------------------------------------------------------------- -- Expand a set of rules diff --git a/lib/haskell/natural4/src/LS/XPile/CoreL4.hs b/lib/haskell/natural4/src/LS/XPile/CoreL4.hs index 8173a85ea..7b38a5675 100644 --- a/lib/haskell/natural4/src/LS/XPile/CoreL4.hs +++ b/lib/haskell/natural4/src/LS/XPile/CoreL4.hs @@ -420,7 +420,7 @@ rpRelToBComparOp RPelem = refute "rpRelToBComparOp: erroring on RPelem" rpRelToBComparOp RPnotElem = refute "rpRelToBComparOp: erroring on RPnotElem" rpRelToBComparOp RPnot = refute "rpRelToBComparOp: erroring on RPnot" rpRelToBComparOp RPTC {} = refute "rpRelToBComparOp: erroring on RPTC" - +rpRelToBComparOp x = refute ("rpRelToBComparOp: erroring on " <> pretty (show x)) -- END helper functions boolStructRToExpr :: [String] -> BoolStructR -> ExprM ann () diff --git a/lib/haskell/natural4/test/LS/NLGSpec.hs b/lib/haskell/natural4/test/LS/NLGSpec.hs index 035d62072..3bf3d9aef 100644 --- a/lib/haskell/natural4/test/LS/NLGSpec.hs +++ b/lib/haskell/natural4/test/LS/NLGSpec.hs @@ -136,13 +136,19 @@ spec = do -- in MustSing5, the gold just happens to be the same as returned by ruleQuestions, so why not - let mustsing5ViaQaHorns = textViaQaHorns envMustSing5 Nothing (Just $ parseSubj env $ subj $ head mustsing5Rules) - let (mustsing5ViaRuleQuestions,_) = xpLog $ ruleQuestions envMustSing5 Nothing (head $ expandRulesForNLG envMustSing5 mustsing5Rules) - testViaQaHorns "mustsing5" (map snd mustsing5ViaQaHorns) (mustsing5ViaRuleQuestions <> [Leaf "Does the following hold: Person Qualifies"]) + let mustsing5ViaQaHorns = + textViaQaHorns envMustSing5 + Nothing + (Just $ parseSubj env $ subj $ head mustsing5Rules) + let (mustsing5ViaRuleQuestions,_) = xpLog $ + ruleQuestions envMustSing5 + Nothing + (head $ expandRulesForNLG envMustSing5 mustsing5Rules) + testViaQaHorns "mustsing5" (map snd mustsing5ViaQaHorns) (mustsing5ViaRuleQuestions <> [Leaf "Person Qualifies?"]) let mustsing6ViaQaHorns = textViaQaHorns envMustSing6 Nothing (Just $ parseSubj env $ subj $ head mustsing6Rules) let (mustsing6ViaRuleQuestions,_) = xpLog $ ruleQuestions envMustSing6 Nothing (head $ expandRulesForNLG envMustSing6 mustsing6Rules) - testViaQaHorns "mustsing6" (map snd mustsing6ViaQaHorns) ([Leaf "Does the following hold: Person Qualifies"] <> mustsing6ViaRuleQuestions) + testViaQaHorns "mustsing6" (map snd mustsing6ViaQaHorns) ([Leaf "Person Qualifies?"] <> mustsing6ViaRuleQuestions) -- for Rodents, apparently ruleQuestions is genuinely buggy so compare it against a manually copied gold let rodentsViaQaHorns = textViaQaHorns env Nothing (Just $ parseSubj env $ subj $ head rodentsRules)