Skip to content

Commit

Permalink
19 working calibrations
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Garside committed Jan 30, 2014
1 parent 3785acd commit f9127d3
Show file tree
Hide file tree
Showing 8 changed files with 252 additions and 26 deletions.
173 changes: 170 additions & 3 deletions EXAMPLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ balloons owned by Jane + 6

***

x - 9 0 {'x': x, 'Mrs. Jones bananas': x - 9}
# Zoidberg Solution

## The problem
Expand Down Expand Up @@ -213,6 +212,55 @@ dolls owned by Ethelle + 4

***

# Zoidberg Solution

## The problem
Joey has 13 toy cars. Chandler has 6 toy cars. How many fewer toy cars does Chandler have than Joey?

## Digested problem
Joey has 13 toy cars .
NNP VBZ CD NN NNS .

Chandler has 6 toy cars .
NNP VBZ CD NN NNS .

How many fewer toy cars does Chandler have than Joey ?
WRB JJ JJR NN NNS VBZ NNP VB IN NNP .

## Problem inference
I think this problem is about Joey and Chandler grouping toy cars and asks a single question.

## Parsed problem
Joey has 13 toy cars .
context operator constant unit punctuation

Chandler has 6 toy cars .
context operator constant unit punctuation

How many fewer toy cars does Chandler have than Joey ?
asking rel_less unit q_start context q_stop conjunction comparator_context punctuation


## Question 1

### Question text
How many fewer toy cars does Chandler have than Joey?

### Answer interpretation
The answer is the difference in value of toy cars owned by Chandler with respect to Joey.

## Data extraction

### Sentence 1
toy cars owned by Joey = 13
toy cars owned by Joey + 13

### Sentence 2
toy cars owned by Chandler = 6
toy cars owned by Chandler + 6

## Correct response
14 toy cars

***

Expand Down Expand Up @@ -391,7 +439,6 @@ pieces of pizza owned by Michael - 2

***

x - 11 0 {'x': x, 'Pigpen rocks': x - 11}
# Zoidberg Solution

## The problem
Expand Down Expand Up @@ -447,6 +494,53 @@ rocks owned by Pigpen's friends + 8

***

# Zoidberg Solution

## The problem
Mr. Lupis needs 4 eggs to bake 13 muffins. He has only 2 eggs. How many more eggs does he need to bake the muffins?

## Digested problem
Mr. Lupis needs 4 eggs to bake 13 muffins .
NNP NNP VBZ CD NNS TO VB CD NNS .

He has only 2 eggs .
PRP VBZ RB CD NNS .

How many more eggs does he need to bake the muffins ?
WRB JJ RBR NNS VBZ PRP VBP TO VB DT NNS .

## Problem inference
I think this problem is about Mr. Lupis eggs and asks a single question.

## Parsed problem
Mr. Lupis needs 4 eggs to bake 13 muffins .
context operator constant unit conjunction operator constant subordinate punctuation

Mr. Lupis has only 2 eggs .
context operator noise constant unit punctuation

How many more eggs does Mr. Lupis need to bake the muffins ?
asking rel_more unit q_start context q_stop conjunction operator noise subordinate punctuation


## Question 1

### Question text
How many more eggs does he need to bake the muffins?

### Answer interpretation
The answer is the increase in value of eggs needed by Mr. Lupis to bake muffins.

## Data extraction

### Sentence 1
eggs needed by Mr. Lupis to bake muffins == 4

### Sentence 2
eggs owned by Mr. Lupis = 2

## Correct response
2 eggs

***

Expand Down Expand Up @@ -708,7 +802,6 @@ doughnuts owned by Bennett + 4

***

Charlie bottles - 4 8 {'Charlie bottles': Charlie bottles - 4, 'Mac bottles': Mac bottles + 4}
# Zoidberg Solution

## The problem
Expand Down Expand Up @@ -885,3 +978,77 @@ dolls owned by Troy + 3

### Response 2
7 dolls

***

# Zoidberg Solution

## The problem
Dad gives Richard 7 feathers.
Dad gives William 4 feathers.
How many feathers does Dad give to the two boys?
How many more feathers does Richard have than William?

## Digested problem
Dad gives Richard 7 feathers .
NNP VBZ NNP CD NNS .

Dad gives William 4 feathers .
NNP VBZ NNP CD NNS .

How many feathers does Dad give to the two boys ?
WRB JJ NNS VBZ NNP VB TO DT CD NNS .

How many more feathers does Richard have than William ?
WRB JJ RBR NNS VBZ NNP VB IN NNP .

## Problem inference
I think this problem is about Dad, Richard, and William feathers and asks multiple questions.

## Parsed problem
Dad gives Richard 7 feathers .
context operator context constant unit punctuation

Dad gives William 4 feathers .
context operator context constant unit punctuation

How many feathers does Dad give to the two boys ?
asking unit q_start context q_stop conjunction noise constant subordinate punctuation

How many more feathers does Richard have than William ?
asking rel_more unit q_start context q_stop conjunction comparator_context punctuation


## Question 1

### Question text
How many feathers does Dad give to the two boys?

### Answer interpretation
The answer is the unknown value of feathers given to William and Richard added together.

## Question 2

### Question text
How many more feathers does Richard have than William?

### Answer interpretation
The answer is the increase in value of feathers owned by Richard with respect to William.

## Data extraction

### Sentence 1
feathers owned by Dad - 7
feathers owned by Richard + 7

### Sentence 2
feathers owned by William + 4
feathers owned by Dad - 4

## Correct response

### Response 1
11 feathers

### Response 2
3 feathers
4 changes: 2 additions & 2 deletions calibrations/19.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Dad gives Richard 7 feathers.
Dad gives William 4 feathers.
How many pens does Dad give to the two boys?
How many more pens does Richard have than Dominic?
How many feathers does Dad give to the two boys?
How many more feathers does Richard have than William?
2 changes: 1 addition & 1 deletion example.brain.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"gender": {"bananas": "neutral", "family": "mixed", "Marc": "masculine", "fish": "mixed", "Jim": "masculine", "doughnuts": "neutral", "pieces": "neutral", "Mr.": "masculine", "himself": "masculine", "Lupis": "ambiguous", "muffins": "neutral", "Jane": "feminine", "pond": "neutral", "skulls": "neutral", "Chandler": "masculine", "Hellen": "feminine", "skeleton": "neutral", "pink": "neutral", "toy": "neutral", "bottles": "neutral", "Mitch": "masculine", "her": "feminine", "cobs": "neutral", "Ragdoll": "feminine", "Mac": "masculine", "Jack": "masculine", "Charlie": "masculine", "jars": "neutral", "he": "masculine", "balloons": "neutral", "eggs": "neutral", "friend": "ambiguous", "dolls": "neutral", "Jones": "ambiguous", "Archie": "masculine", "them": "mixed", "his": "masculine", "Alex": "masculine", "marbles": "neutral", "Sara": "feminine", "cars": "neutral", "corn": "neutral", "Meathead": "masculine", "Michael": "masculine", "Lucy": "feminine", "Mrs.": "feminine", "Tony": "masculine", "they": "mixed", "Skellington": "ambiguous", "Lisa": "feminine", "friends": "mixed", "him": "masculine", "Joey": "masculine", "Mickey": "masculine", "christmas": "neutral", "Pigpen": "masculine", "Spooky": "ambiguous", "newspapers": "neutral", "Bennett": "masculine", "tree": "neutral", "Julia": "feminine", "rocks": "neutral", "Troy": "masculine", "ornaments": "neutral", "she": "feminine", "mother": "feminine", "Ethelle": "feminine", "sister": "feminine", "pizza": "neutral", "Eric": "masculine", "apples": "neutral"}, "operator_verbs": {"has": "eq", "needs": "re", "ate": "su", "join": "ad", "takes": "su", "tree": null, "buys": "ad", "had": "eq", "collects": "ad", "gave": "ex", "left": null, "buy": "ad", "bake": "co", "have": "eq", "were": "False", "need": "re", "kept": "su", "gives": "ex", "throws": "su", "bought": "ad"}, "inclusive": {"her family": "inclusive", "family": "inclusive", "his friends": "exclusive", "Mrs. Jones' family": "inclusive", "Pigpen's friends": "exclusive", "friends": "exclusive", "her friends": "exclusive", "Mrs. Jones' friends": "exclusive"}, "numbers": {"4": "4", "dozen": "12"}, "subordinates": {"pond": "place_noun", "left": "time_ending", "away": "False", "there": null, "only": "False", "rocks": null, "christmas tree": "place_noun", "apples": null, "altogether": "context_grouping", "muffins": null, "now": "time_ending", "beginning": "time_starting", "friend": null, "pizza": null}, "variables": {"some": "dynamic_variable", "half": "0.5"}, "retagged": {"fish": "noun", "are": "pre_ind_plu", "collects": "operator_verbs", "muffins": "noun_p", "bake": "operator_verbs", "dozen": "numbers", "mitch": "prop_noun", "away": "noise", "there": "exestential", "only": "noise", "4": "numbers", "friend": "noun", "pizza": "noun", "beginning": "subordinates", "ate": "operator_verbs", "join": "operator_verbs", "tree": "noun", "rocks": "noun_p", "apples": "noun_p", "were": "noise", "more": "comparison_adj", "left": "subordinates"}, "relative": {"fewer": "rel_less", "more": "rel_more"}, "answer_syntax": {"How many": "expression", "how many": "expression"}, "plurality": {"bananas": "plural", "Mitch": "singular", "Marc": "singular", "fish": "regular", "Jim": "singular", "doughnuts": "plural", "pieces": "singular", "Mr.": "singular", "himself": "singular", "are": null, "Lupis": "singular", "muffins": "plural", "Jane": "singular", "pond": "singular", "skulls": "plural", "Chandler": "singular", "Hellen": "singular", "dozen": null, "pink": "singular", "toy": "singular", "bottles": "plural", "family": "plural", "her": "singular", "cobs": "plural", "beginning": null, "Ragdoll": "singular", "Mac": "singular", "Jack": "singular", "Charlie": "singular", "jars": "plural", "Joey": "singular", "balloons": "plural", "eggs": "plural", "friend": "singular", "dolls": "plural", "Jones": "singular", "Archie": "singular", "them": "plural", "his": "singular", "Alex": "singular", "marbles": "plural", "Sara": "singular", "cars": "plural", "corn": "singular", "Meathead": "singular", "Michael": "singular", "Lucy": "singular", "Mrs.": "singular", "Ethelle": "singular", "they": "plural", "Skellington": "singular", "collects": null, "Lisa": "singular", "friends": "plural", "him": "singular", "he": "singular", "Mickey": "singular", "christmas": "singular", "Pigpen": "singular", "ate": null, "join": null, "mitch": null, "Spooky": "singular", "newspapers": "plural", "Bennett": "singular", "tree": "singular", "Julia": "singular", "rocks": "plural", "skeleton": "singular", "Troy": "singular", "ornaments": "plural", "she": "singular", "mother": "singular", "Tony": "singular", "sister": "singular", "pizza": "singular", "Eric": "singular", "apples": "plural"}, "exestential": {"there": "noise"}, "unknown": {"('bake', 'VB', None)": null, "('4', 'LS', None)": null, "('fish', 'JJ', None)": null, "('more', 'RBR', None)": null}, "gerunds": {"remaining": "solution_zero", "swimming": "acting"}, "comparison_adj": {"more": "gt"}, "determiners": {"a": "constant", "away": "noise", "were": "noise", "some": "variable", "only": "noise", "another": "noise", "half": "variable", "the": "noise"}}
{"gender": {"Archie": "masculine", "bananas": "neutral", "family": "mixed", "Marc": "masculine", "fish": "mixed", "Jim": "masculine", "doughnuts": "neutral", "pieces": "neutral", "Mr.": "masculine", "himself": "masculine", "Lupis": "ambiguous", "pond": "neutral", "Jane": "feminine", "muffins": "neutral", "skulls": "neutral", "Chandler": "masculine", "Hellen": "feminine", "skeleton": "neutral", "pink": "neutral", "toy": "neutral", "bottles": "neutral", "Mitch": "masculine", "her": "feminine", "cobs": "neutral", "Troy": "masculine", "Ragdoll": "feminine", "him": "masculine", "William": "masculine", "Mac": "masculine", "Jack": "masculine", "Charlie": "masculine", "jars": "neutral", "he": "masculine", "balloons": "neutral", "eggs": "neutral", "friend": "ambiguous", "dolls": "neutral", "Jones": "ambiguous", "Dad": "masculine", "them": "mixed", "his": "masculine", "Alex": "masculine", "marbles": "neutral", "Sara": "feminine", "cars": "neutral", "corn": "neutral", "Meathead": "masculine", "Michael": "masculine", "Lucy": "feminine", "Mrs.": "feminine", "boys": "masculine", "they": "mixed", "Skellington": "ambiguous", "Lisa": "feminine", "Tony": "masculine", "friends": "mixed", "Richard": "masculine", "Joey": "masculine", "Mickey": "masculine", "christmas": "neutral", "Pigpen": "masculine", "Spooky": "ambiguous", "newspapers": "neutral", "Bennett": "masculine", "tree": "neutral", "Julia": "feminine", "rocks": "neutral", "feathers": "neutral", "ornaments": "neutral", "she": "feminine", "mother": "feminine", "Ethelle": "feminine", "sister": "feminine", "pizza": "neutral", "Eric": "masculine", "apples": "neutral"}, "operator_verbs": {"has": "eq", "needs": "re", "ate": "su", "join": "ad", "takes": "su", "give": "ex", "tree": null, "buys": "ad", "had": "eq", "collects": "ad", "gave": "ex", "buy": "ad", "bake": "co", "have": "eq", "were": "False", "need": "re", "kept": "su", "left": null, "bought": "ad", "throws": "su", "gives": "ex"}, "inclusive": {"her family": "inclusive", "family": "inclusive", "his friends": "exclusive", "Mrs. Jones' family": "inclusive", "Pigpen's friends": "exclusive", "friends": "exclusive", "her friends": "exclusive", "Mrs. Jones' friends": "exclusive"}, "numbers": {"4": "4", "dozen": "12"}, "subordinates": {"pond": "place_noun", "left": "time_ending", "away": "False", "there": null, "only": "False", "rocks": null, "boys": "context_grouping", "christmas tree": "place_noun", "apples": null, "altogether": "context_grouping", "muffins": null, "now": "time_ending", "beginning": "time_starting", "friend": null, "pizza": null}, "variables": {"some": "dynamic_variable", "half": "0.5"}, "retagged": {"fish": "noun", "are": "pre_ind_plu", "collects": "operator_verbs", "muffins": "noun_p", "bake": "operator_verbs", "dozen": "numbers", "mitch": "prop_noun", "away": "noise", "there": "exestential", "only": "noise", "4": "numbers", "friend": "noun", "pizza": "noun", "beginning": "subordinates", "ate": "operator_verbs", "join": "operator_verbs", "tree": "noun", "rocks": "noun_p", "apples": "noun_p", "were": "noise", "more": "comparison_adj", "left": "subordinates"}, "relative": {"fewer": "rel_less", "more": "rel_more"}, "answer_syntax": {"How many": "expression", "how many": "expression"}, "plurality": {"Archie": "singular", "bananas": "plural", "family": "plural", "Marc": "singular", "fish": "regular", "Jim": "singular", "doughnuts": "plural", "pieces": "singular", "Mr.": "singular", "himself": "singular", "are": null, "Lupis": "singular", "muffins": "plural", "Jane": "singular", "pond": "singular", "skulls": "plural", "Chandler": "singular", "Hellen": "singular", "dozen": null, "pink": "singular", "toy": "singular", "bottles": "plural", "Richard": "singular", "her": "singular", "cobs": "plural", "beginning": null, "Troy": "singular", "Ragdoll": "singular", "William": "singular", "Mac": "singular", "Jack": "singular", "Charlie": "singular", "jars": "plural", "Joey": "singular", "balloons": "plural", "eggs": "plural", "Mitch": "singular", "dolls": "plural", "Jones": "singular", "Dad": "singular", "them": "plural", "his": "singular", "Alex": "singular", "marbles": "plural", "Ethelle": "singular", "Sara": "singular", "cars": "plural", "corn": "singular", "Meathead": "singular", "Michael": "singular", "Lucy": "singular", "Mrs.": "singular", "boys": "plural", "they": "plural", "Skellington": "singular", "collects": null, "Lisa": "singular", "friends": "plural", "him": "singular", "he": "singular", "Mickey": "singular", "christmas": "singular", "Pigpen": "singular", "ate": null, "join": null, "mitch": null, "she": "singular", "Spooky": "singular", "newspapers": "plural", "Bennett": "singular", "tree": "singular", "Julia": "singular", "rocks": "plural", "skeleton": "singular", "feathers": "plural", "ornaments": "plural", "friend": "singular", "mother": "singular", "Tony": "singular", "sister": "singular", "pizza": "singular", "Eric": "singular", "apples": "plural"}, "exestential": {"there": "noise"}, "unknown": {"('bake', 'VB', None)": null, "('4', 'LS', None)": null, "('fish', 'JJ', None)": null, "('more', 'RBR', None)": null}, "gerunds": {"remaining": "solution_zero", "swimming": "acting"}, "comparison_adj": {"more": "gt"}, "determiners": {"a": "constant", "away": "noise", "were": "noise", "some": "variable", "only": "noise", "another": "noise", "half": "variable", "the": "noise"}}
2 changes: 1 addition & 1 deletion run_example.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
clear
echo "" > EXAMPLE.md
MAX_IDX=18
MAX_IDX=19

for i in $(seq 1 $MAX_IDX); do
cat calibrations/$i.txt | zoidberg | tee -a EXAMPLE.md
Expand Down
9 changes: 8 additions & 1 deletion zoidberg/answer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"eq": "owned by",
"ad": "gained by",
"mu": "gained by",
"ex": "given to",
"su": "lost by",
"di": "lost by"
}
Expand Down Expand Up @@ -130,9 +131,15 @@ def execute(self):

# Assume subordinate during specifying is answer condition
if part == "subordinate":
stype = self.query.subordinate_lookup[val[0]]
if stype == "context_grouping":
if len(self.query.problem.subordinate_adaptive_contexts) > 0:
sac = self.query.problem.subordinate_adaptive_contexts[0]
self.context = sac
self.context_subtype = subtype
elif not specifying and self.actor is not None and self.query.problem.exestential:
# If we have an actor but are not specifying in an exestential
# problem, then we can simply assume that specification is occurring
if not specifying and self.actor is not None and self.query.problem.exestential:
specifying = True

if specifying:
Expand Down
16 changes: 16 additions & 0 deletions zoidberg/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def __init__(self, text, brain_path=None, file_name=None):
},
"last": None
}
self.subordinate_adaptive_contexts = []
self.previous_contexts = {
"plurality": {
"singular": None,
Expand All @@ -59,6 +60,21 @@ def __init__(self, text, brain_path=None, file_name=None):
},
"last": None
}
self.all_targets = {
"plurality": {
"singular": {},
"plural": {},
"regular": {}
},
"gender": {
"masculine": {},
"feminine": {},
"neutral": {},
"mixed": {},
"ambiguous": None
},
"last": None
}
self.all_contexts = {
"plurality": {
"singular": {},
Expand Down
Loading

0 comments on commit f9127d3

Please sign in to comment.