ccobra.syllogistic_generalized¶
Generalized Syllogistic submodule.
Functions
-
ccobra.syllogistic_generalized.
decode_response
(enc_response, task)[source]¶ Decodes an encoded generalized syllogistic response by transforming it to the corresponding tuple representation and inserting the appropriate terms.
- Parameters
enc_response (str) – Encoded syllogistic response (e.g., ‘Aac’).
task (list(str)) – Syllogistic task in the tuple list representation (e.g., [[‘Some’, ‘models’, ‘managers’], [‘All’, ‘models’, ‘clerks’]]).
- Returns
List representation of the response to decode.
- Return type
list
-
ccobra.syllogistic_generalized.
encode_response
(response, task)[source]¶ Encodes a response to its generalized syllogistic encoding.
- Parameters
response (list(str)) – Syllogistc response in list representation (e.g., [‘Most’, ‘A’, ‘C’])
task (list(list(str))) – Syllogistic task in list representation (e.g., [[‘All’, ‘A’, ‘B’], [‘Most’, ‘B’, ‘C’]]).
- Returns
Syllogistic response encoding (e.g., ‘Tac’).
- Return type
str
-
ccobra.syllogistic_generalized.
encode_task
(task)[source]¶ Encodes a generalized syllogistic task.
- Parameters
task (list(list(str))) – List representation of the syllogism (e.g., [[‘All’, ‘A’, ‘B’], [‘Most’, ‘B’, ‘C’]]).
- Returns
Syllogistic task encoding (e.g., ‘AI1’).
- Return type
str
Classes
-
class
ccobra.syllogistic_generalized.
GeneralizedSyllogism
(item)[source]¶ Generalized syllogistic helper class.
Constructs the generalized Syllogism based on a given task item.
- Parameters
item (ccobra.Item) – CCOBRA task item container to base this Syllogism helper on.
-
decode_response
(encoded_response)[source]¶ Decodes a syllogistic response in string representation based on the information stored in the syllogism’s premises.
- Parameters
encoded_response (str) – Encoded syllogistic response (e.g., ‘Aac’).
- Returns
List representation of the encoded response (e.g., [‘All’, ‘clerks’, ‘managers’]).
- Return type
list(str)
-
encode_response
(response)[source]¶ Encodes a given syllogistic response based on the information contained in the premises.
- Parameters
response (list(str)) – Syllogistic response in list representation (e.g., [‘All’, ‘clerks’, ‘managers’]).
- Returns
String encoding of the response (e.g., ‘Aac’).
- Return type
str
-
encoded_task
¶ String representation of the task
-
figure
¶ Figure of the syllogism
-
item
¶ Instance of the item the Syllogism is constructed on. The instance is copied in order to prevent reference mismatches from happening.
-
p1
¶ List representation of the first premise
-
p2
¶ List representation of the second premise
-
quantifier_p1
¶ Quantifier of the first premise
-
quantifier_p2
¶ Quantifier of the second premise
-
task
¶ Reference to the task the Syllogism is constructed on.
-
class
ccobra.syllogistic_generalized.
GeneralizedSyllogisticTaskEncoder
[source]¶ Generalized Syllogistic encoder. Provides functions for abbreviating generalized syllogistic tasks.
-
static
encode_task
(task)[source]¶ Encodes a task to its generalized syllogistic encoding.
- Parameters
task (list(list(str))) – List representation of the syllogism (e.g., [[‘All’, ‘A’, ‘B’], [‘Some’, ‘B’, ‘C’]]).
- Returns
Syllogistic task encoding (e.g., ‘AI1’).
- Return type
str
- Raises
ValueError – If figure of syllogism cannot be determined.
-
static
-
class
ccobra.syllogistic_generalized.
GeneralizedSyllogisticResponseEncoder
[source]¶ Generalized Syllogistic encoder. Provides functions for abbreviating generalized syllogistic responses.
-
static
encode_response
(response, task)[source]¶ Encodes a response to its syllogistic encoding.
- Parameters
response (list(str)) – Syllogistc response in list representation (e.g., [‘All’, ‘A’, ‘C’])
task (list(list(str))) – Syllogistic task in list representation (e.g., [[‘All’, ‘A’, ‘B’], [‘Some’, ‘B’, ‘C’]]).
- Returns
Syllogistic response encoding (e.g., ‘Aac’).
- Return type
str
-
static