File size: 2,035 Bytes
47b17cc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
:- module(subcategorization, [subcat_frame/2, check_theta_criterion/3, role_assignment/3]).

:- use_module(lexicon).

%% ==========================================================================
%% MLAF Grammar Engine — Theta Grids & Argument Structure
%%
%% Implements the Theta Criterion (Chomsky 1981):
%%   - Each argument receives exactly one theta-role
%%   - Each theta-role is assigned to exactly one argument
%% ==========================================================================

%% --- subcat_frame(+VerbID, -Frame) ---
%% Returns the subcategorization frame for a verb.
%% Frame = required(Roles) where Roles is the theta grid.

subcat_frame(VerbID, required(Roles)) :-
    theta_grid(VerbID, Roles).

subcat_frame(VerbID, none) :-
    \+ theta_grid(VerbID, _).

%% --- check_theta_criterion(+VerbID, +Arguments, -Result) ---
%% Arguments is a list of argument IDs (gesture IDs for subject and object).
%% Returns satisfied or violation(Type, Count).

check_theta_criterion(VerbID, Arguments, satisfied) :-
    theta_grid(VerbID, Roles),
    length(Roles, NRoles),
    length(Arguments, NArgs),
    NRoles =:= NArgs,
    !.

check_theta_criterion(VerbID, Arguments, violation(missing_args, Missing)) :-
    theta_grid(VerbID, Roles),
    length(Roles, NRoles),
    length(Arguments, NArgs),
    NArgs < NRoles,
    Missing is NRoles - NArgs,
    !.

check_theta_criterion(VerbID, Arguments, violation(extra_args, Extra)) :-
    theta_grid(VerbID, Roles),
    length(Roles, NRoles),
    length(Arguments, NArgs),
    NArgs > NRoles,
    Extra is NArgs - NRoles,
    !.

check_theta_criterion(VerbID, _, violation(no_frame, 0)) :-
    \+ theta_grid(VerbID, _).

%% --- role_assignment(+VerbID, +Position, -Role) ---
%% Maps verb + argument position to thematic role.
%% Position: 1 = external argument (subject), 2 = internal argument (object)

role_assignment(VerbID, Position, Role) :-
    theta_grid(VerbID, Roles),
    nth1(Position, Roles, Role).

role_assignment(_, Position, unassigned) :-
    Position > 2.