% Protactile Sign Language Translation System using NSM
% Translates between Protactile, English, and SignWriting via NSM explication
% ============================================================================
% PROTACTILE-SPECIFIC SEMANTIC PRIMES
% Extensions to NSM for tactile-haptic modality
% ============================================================================
% Tactile perception primes
tactile_prime(touch_feel, perception, 'tactile sensation').
tactile_prime(press, action, 'apply pressure').
tactile_prime(tap, action, 'brief contact').
tactile_prime(slide, movement, 'continuous contact movement').
tactile_prime(hold, action, 'sustained contact').
tactile_prime(vibration, sensation, 'oscillating movement').
% Body location primes (for Protactile)
body_location(hand, upper_limb, 'palm, fingers, back of hand').
body_location(forearm, upper_limb, 'lower arm').
body_location(upper_arm, upper_limb, 'upper arm').
body_location(shoulder, upper_limb, 'shoulder area').
body_location(back, torso, 'upper back').
body_location(chest, torso, 'chest area').
body_location(leg, lower_limb, 'thigh, knee').
% Contact type descriptors
contact_type(light, pressure, 'minimal pressure').
contact_type(firm, pressure, 'moderate pressure').
contact_type(strong, pressure, 'significant pressure').
contact_type(continuous, duration, 'maintained contact').
contact_type(repeated, duration, 'multiple brief contacts').
contact_type(single, duration, 'one contact').
% ============================================================================
% PROTACTILE SIGN REPRESENTATION
% Structure: sign(Name, Components, Semantics)
% ============================================================================
% Basic Protactile signs with tactile components
protactile_sign(yes, [
contact(hand, tap, repeated, 3),
location(signer_hand),
movement(up_down)
], agreement).
protactile_sign(no, [
contact(hand, slide, continuous, 1),
location(signer_palm),
movement(side_to_side),
handshape(flat)
], negation).
protactile_sign(understand, [
contact(forearm, tap, single, 1),
location(upper_forearm),
pressure(light)
], comprehension).
protactile_sign(want, [
contact(hand, hold, continuous, 2),
location(signer_hand),
movement(pull_toward_body)
], desire).
protactile_sign(person, [
contact(shoulder, tap, single, 1),
location(shoulder_front)
], human_referent).
protactile_sign(give, [
contact(hand, slide, continuous, 1),
location(signer_palm),
movement(toward_receiver),
transfer(object_concept)
], transfer_action).
protactile_sign(name, [
contact(upper_arm, tap, repeated, 2),
location(upper_arm_outer)
], identification).
protactile_sign(deaf, [
contact(ear_area, tap, single, 1),
then_contact(mouth_area, tap, single, 1)
], deaf_identity).
protactile_sign(deafblind, [
contact(ear_area, tap, single, 1),
then_contact(eye_area, tap, single, 1)
], deafblind_identity).
protactile_sign(good, [
contact(chest, tap, single, 1),
pressure(light),
movement(outward)
], positive_evaluation).
protactile_sign(bad, [
contact(chest, press, firm, 1),
movement(downward)
], negative_evaluation).
protactile_sign(happy, [
contact(chest, circular_rub, repeated, 3),
pressure(light),
speed(moderate)
], positive_emotion).
protactile_sign(sad, [
contact(chest, slow_downward_slide, continuous, 1),
pressure(firm)
], negative_emotion).
protactile_sign(water, [
contact(hand, tap, repeated, 3),
location(under_chin),
movement(wave_like)
], substance).
protactile_sign(eat, [
contact(mouth_area, tap, repeated, 2),
then_contact(stomach, circular_rub, continuous, 1)
], action).
protactile_sign(see_tactile, [
contact(palm, touch_explore, continuous, 1),
movement(systematic_scanning)
], tactile_perception).
protactile_sign(help, [
contact(forearm, lift, continuous, 1),
pressure(firm),
movement(upward)
], assistance).
protactile_sign(friend, [
contact(both_hands, interlock, continuous, 2),
movement(shake_together)
], social_bond).
protactile_sign(communication, [
contact(hand, alternating_tap, repeated, 4),
location(between_both_hands)
], exchange).
% ============================================================================
% NSM EXPLICATIONS FOR PROTACTILE CONCEPTS
% ============================================================================
nsm_explication(yes_protactile, [
'someone wants another person to know something',
'this person does something',
'this person touches the other person\'s hand',
'this person does this many times in the same moment',
'because of this, the other person can know:',
' "this person thinks: it is like this"'
]).
nsm_explication(no_protactile, [
'someone wants another person to know something',
'this person does something',
'this person touches the other person\'s hand',
'this person\'s hand moves from one side to the other side',
'the hand touches all the time when it moves',
'because of this, the other person can know:',
' "this person thinks: it is not like this"'
]).
nsm_explication(understand_protactile, [
'someone wants another person to know something',
'this person does something',
'this person touches the other person\'s arm',
'this person does this one time',
'because of this, the other person can know:',
' "this person knows what you said"',
' "this person thinks: I know this now"'
]).
nsm_explication(want_protactile, [
'someone feels something',
'this person does something',
'this person touches the other person\'s hand',
'this person\'s hand moves toward this person\'s body',
'because of this, the other person can know:',
' "this person thinks: I want this thing"'
]).
nsm_explication(give_protactile, [
'someone does something',
'before this, this person has something',
'this person wants another person to have this thing',
'this person does something:',
' this person touches the other person',
' this person\'s hand moves toward the other person',
'because of this, after this, the other person has this thing'
]).
nsm_explication(happy_protactile, [
'someone feels something good',
'this person does something',
'this person touches the other person\'s chest',
'this person\'s hand moves in circles',
'this person does this many times',
'because of this, the other person can know:',
' "this person feels something good"'
]).
nsm_explication(friend_protactile, [
'someone wants another person to know something',
'this person does something with both hands',
'this person\'s hands touch the other person\'s hands',
'the hands move together like this:',
' both hands hold each other',
' both hands move at the same time',
'because of this, the other person can know:',
' "this person thinks good things about me"',
' "this person wants to be with me"'
]).
% ============================================================================
% SIGNWRITING NOTATION
% Simplified representation of SignWriting symbols
% ============================================================================
signwriting_symbol(hand_contact, 'S14c00').
signwriting_symbol(hand_flat, 'S20500').
signwriting_symbol(movement_up, 'S27101').
signwriting_symbol(movement_down, 'S27102').
signwriting_symbol(movement_side, 'S27103').
signwriting_symbol(movement_circle, 'S27104').
signwriting_symbol(touch_location_chest, 'S30a00').
signwriting_symbol(touch_location_arm, 'S30b00').
signwriting_symbol(repetition, 'S38a00').
% Map Protactile signs to SignWriting sequences
protactile_to_signwriting(yes, [
signwriting_symbol(hand_contact, 'S14c00'),
signwriting_symbol(repetition, 'S38a00'),
signwriting_symbol(movement_up, 'S27101')
]).
protactile_to_signwriting(no, [
signwriting_symbol(hand_flat, 'S20500'),
signwriting_symbol(movement_side, 'S27103')
]).
protactile_to_signwriting(happy, [
signwriting_symbol(touch_location_chest, 'S30a00'),
signwriting_symbol(movement_circle, 'S27104'),
signwriting_symbol(repetition, 'S38a00')
]).
protactile_to_signwriting(understand, [
signwriting_symbol(touch_location_arm, 'S30b00'),
signwriting_symbol(hand_contact, 'S14c00')
]).
% ============================================================================
% TRANSLATION ENGINE
% ============================================================================
% Main translation: Protactile -> English
translate_to_english(ProtactileSign, English) :-
protactile_sign(ProtactileSign, _, Semantic),
semantic_to_english(Semantic, English).
semantic_to_english(agreement, 'yes').
semantic_to_english(negation, 'no').
semantic_to_english(comprehension, 'I understand').
semantic_to_english(desire, 'want').
semantic_to_english(human_referent, 'person').
semantic_to_english(transfer_action, 'give').
semantic_to_english(positive_evaluation, 'good').
semantic_to_english(negative_evaluation, 'bad').
semantic_to_english(positive_emotion, 'happy').
semantic_to_english(negative_emotion, 'sad').
semantic_to_english(assistance, 'help').
semantic_to_english(social_bond, 'friend').
% Protactile -> NSM -> English (detailed)
translate_via_nsm(ProtactileSign, NsmExplication, EnglishGloss) :-
atom_concat(ProtactileSign, '_protactile', NsmKey),
nsm_explication(NsmKey, NsmExplication),
translate_to_english(ProtactileSign, EnglishGloss).
% Protactile -> SignWriting
translate_to_signwriting(ProtactileSign, SignWriting) :-
protactile_to_signwriting(ProtactileSign, SignWriting).
% Full translation with all modalities
full_translation(ProtactileSign) :-
format('~n=== PROTACTILE TRANSLATION: ~w ===~n', [ProtactileSign]),
% Show Protactile structure
format('~nPROTACTILE STRUCTURE:~n'),
protactile_sign(ProtactileSign, Components, Semantic),
format(' Components: ~w~n', [Components]),
format(' Semantic: ~w~n', [Semantic]),
% Show NSM explication
format('~nNSM EXPLICATION:~n'),
atom_concat(ProtactileSign, '_protactile', NsmKey),
(nsm_explication(NsmKey, Explication) ->
display_explication_lines(Explication)
;
format(' [No detailed explication available]~n')
),
% Show English translation
format('~nENGLISH TRANSLATION:~n'),
(translate_to_english(ProtactileSign, English) ->
format(' ~w~n', [English])
;
format(' [Translation not available]~n')
),
% Show SignWriting notation
format('~nSIGNWRITING NOTATION:~n'),
(translate_to_signwriting(ProtactileSign, Sw) ->
format(' ~w~n', [Sw])
;
format(' [SignWriting not available]~n')
).
display_explication_lines([]).
display_explication_lines([Line|Rest]) :-
format(' ~w~n', [Line]),
display_explication_lines(Rest).
% ============================================================================
% PROTACTILE SENTENCE COMPOSITION
% ============================================================================
% Represent a Protactile sentence/phrase
protactile_sentence(greeting_1, [person, good], 'Hello person').
protactile_sentence(request_1, [person, help, want], 'I want help').
protactile_sentence(affirmation_1, [understand, yes], 'Yes, I understand').
protactile_sentence(emotional_state_1, [person, happy], 'Person is happy').
protactile_sentence(social_1, [person, friend, good], 'Person is good friend').
% Translate sentence
translate_sentence(SentenceId) :-
protactile_sentence(SentenceId, Signs, EnglishMeaning),
format('~n=== SENTENCE TRANSLATION ===~n'),
format('Sentence ID: ~w~n', [SentenceId]),
format('Protactile signs: ~w~n', [Signs]),
format('English meaning: ~w~n', [EnglishMeaning]),
format('~nSign-by-sign breakdown:~n'),
translate_sign_sequence(Signs, 1).
translate_sign_sequence([], _).
translate_sign_sequence([Sign|Rest], N) :-
format(' ~w. ~w: ', [N, Sign]),
(translate_to_english(Sign, English) ->
format('~w~n', [English])
;
format('[no translation]~n')
),
N1 is N + 1,
translate_sign_sequence(Rest, N1).
% ============================================================================
% TACTILE FEATURE ANALYSIS
% ============================================================================
% Analyze tactile features of a sign
analyze_tactile_features(Sign) :-
format('~n=== TACTILE FEATURE ANALYSIS: ~w ===~n', [Sign]),
protactile_sign(Sign, Components, _),
extract_features(Components).
extract_features([]).
extract_features([Feature|Rest]) :-
format(' ~w~n', [Feature]),
extract_features(Rest).
% Find signs by contact location
signs_by_location(Location, Signs) :-
findall(Sign, (
protactile_sign(Sign, Components, _),
member(contact(Location, _, _, _), Components)
), Signs).
% Find signs by movement type
signs_by_movement(Movement, Signs) :-
findall(Sign, (
protactile_sign(Sign, Components, _),
member(movement(Movement), Components)
), Signs).
% ============================================================================
% BIDIRECTIONAL TRANSLATION
% ============================================================================
% English -> Protactile suggestions
english_to_protactile(English, PossibleSigns) :-
findall(Sign, translate_to_english(Sign, English), PossibleSigns).
% Batch translation
batch_translate(Signs) :-
format('~n=== BATCH TRANSLATION ===~n'),
batch_translate_helper(Signs, 1).
batch_translate_helper([], _).
batch_translate_helper([Sign|Rest], N) :-
format('~n--- Sign ~w: ~w ---~n', [N, Sign]),
(translate_to_english(Sign, English) ->
format('English: ~w~n', [English])
;
format('English: [not available]~n')
),
(translate_to_signwriting(Sign, Sw) ->
format('SignWriting: ~w~n', [Sw])
;
format('SignWriting: [not available]~n')
),
N1 is N + 1,
batch_translate_helper(Rest, N1).
% ============================================================================
% QUERY INTERFACE
% ============================================================================
% List all Protactile signs
list_protactile_signs :-
format('~n=== ALL PROTACTILE SIGNS ===~n'),
findall([Sign, Semantic], protactile_sign(Sign, _, Semantic), Pairs),
display_sign_list(Pairs).
display_sign_list([]).
display_sign_list([[Sign, Semantic]|Rest]) :-
format('~w (~w)~n', [Sign, Semantic]),
display_sign_list(Rest).
% Interactive translation demo
demo :-
format('~n╔════════════════════════════════════════════════════════╗~n'),
format('║ PROTACTILE-NSM TRANSLATION SYSTEM DEMO ║~n'),
format('╚════════════════════════════════════════════════════════╝~n'),
format('~nDemonstrating translations for key signs...~n'),
demo_signs([yes, no, understand, happy, friend, give]).
demo_signs([]).
demo_signs([Sign|Rest]) :-
full_translation(Sign),
format('~n---~n'),
demo_signs(Rest).
% ============================================================================
% EXAMPLE QUERIES
% ============================================================================
% Usage examples:
% ?- full_translation(yes).
% ?- translate_sentence(greeting_1).
% ?- analyze_tactile_features(happy).
% ?- signs_by_location(hand, Signs).
% ?- english_to_protactile('yes', Signs).
% ?- batch_translate([yes, no, happy, friend]).
% ?- list_protactile_signs.
% ?- demo.