Skip to content

Commit

Permalink
Up to the 7th calibration now works
Browse files Browse the repository at this point in the history
- This tool is capable of some pretty cool stuff, now.
- Check out the EXAMPLE.md for relative quantity comparison, special
  case comparators with contexts, subordinate conjunctions as filtering
  context containers.
- You can also correct the parser if/when it gets confused, and now all
  words are given a change to be accounted for. To mimic older
  functionality, simply say "1" for all questions of "what role does
  this fill". 1 being the "this is noise" option.
  • Loading branch information
Eric Garside committed Jul 8, 2013
1 parent cc41c42 commit bc65ebb
Show file tree
Hide file tree
Showing 16 changed files with 833 additions and 316 deletions.
147 changes: 125 additions & 22 deletions EXAMPLE.md
@@ -1,3 +1,11 @@

how many asking
balloons unit
does q_start
Jane context
have q_stop
('now', None) subordinate
? punctuation
# Zoidberg Solution

## The problem
Expand Down Expand Up @@ -38,13 +46,22 @@ The answer is the unknown value of balloons owned by Jane at the end of the prob
## Data extraction

### Sentence 1
balloons owend by Jane = 14
balloons owned by Jane = 14

### Sentence 2
balloons owend by Jane + 6
balloons owned by Jane + 6

## Correct response
20 balloons
how many asking
bananas unit
did q_start
Mrs. Jones context
buy q_stop
in conjunction
the noise
('beginning', 'in') subordinate
? punctuation
# Zoidberg Solution

## The problem
Expand Down Expand Up @@ -74,7 +91,7 @@ I think this problem is about Mrs. Jones, her family, and her friends exchanging
context operator constant unit punctuation

Mrs. Jones gave the remaining 4 bananas to her friends .
context operator noise solution_zero constant unit unknown context punctuation
context operator noise solution_zero constant unit noise context punctuation

How many bananas did Mrs. Jones buy in the beginning ?
asking unit q_start context q_stop conjunction noise subordinate punctuation
Expand All @@ -91,18 +108,25 @@ The answer is the unknown value of bananas owned by Mrs. Jones at the beginning
## Data extraction

### Sentence 1
bananas owend by Mrs. Jones = 0
bananas owend by Mrs. Jones + x
bananas owned by Mrs. Jones = 0
bananas owned by Mrs. Jones + x

### Sentence 2
bananas owend by Mrs. Jones - 5
bananas owned by Mrs. Jones - 5

### Sentence 3
bananas owend by Mrs. Jones - 4
bananas owend by Mrs. Jones == 0
bananas owned by Mrs. Jones - 4
bananas owned by Mrs. Jones == 0

## Correct response
9 bananas
how many asking
jars unit
does q_start
Tony context
have q_stop
('now', None) subordinate
? punctuation
# Zoidberg Solution

## The problem
Expand All @@ -126,7 +150,7 @@ I think this problem is about Tony and his sister exchanging jars and asks a sin
context operator constant unit punctuation

Tony gives 16 jars to his sister .
context operator constant unit unknown context punctuation
context operator constant unit noise context punctuation

How many jars does Tony have now ?
asking unit q_start context q_stop subordinate punctuation
Expand All @@ -143,13 +167,19 @@ The answer is the unknown value of jars owned by Tony at the end of the problem.
## Data extraction

### Sentence 1
jars owend by Tony = 19
jars owned by Tony = 19

### Sentence 2
jars owend by Tony - 16
jars owned by Tony - 16

## Correct response
3 jars
how many asking
dolls unit
does q_start
Ethelle context
have q_stop
? punctuation
# Zoidberg Solution

## The problem
Expand Down Expand Up @@ -190,14 +220,23 @@ The answer is the unknown value of dolls owned by Ethelle.
## Data extraction

### Sentence 1
dolls owend by Lucy = 8
dolls owned by Lucy = 8

### Sentence 2
dolls owend by Ethelle = 8
dolls owend by Ethelle + 4
dolls owned by Ethelle = 8
dolls owned by Ethelle + 4

## Correct response
12 dolls
how many asking
fewer rel_less
toy cars unit
does q_start
Chandler context
have q_stop
than conjunction
('Joey', (u'singular', u'masculine')) comparator_context
? punctuation
# Zoidberg Solution

## The problem
Expand Down Expand Up @@ -238,13 +277,20 @@ The answer is the difference in value of toy cars owned by Chandler with respect
## Data extraction

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

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

## Correct response
7 fewer toy cars
how many asking
apples unit
does q_start
Marc context
have q_stop
('now', None) subordinate
? punctuation
# Zoidberg Solution

## The problem
Expand Down Expand Up @@ -281,10 +327,10 @@ I think this problem is about Marc, Jim, and Julia exchanging apples and asks a
context operator constant unit noise punctuation

Marc gives 2 apples to Jim .
context operator constant unit unknown context punctuation
context operator constant unit noise context punctuation

Marc gives 3 apples to Julia .
context operator constant unit unknown context punctuation
context operator constant unit noise context punctuation

How many apples does Marc have now ?
asking unit q_start context q_stop subordinate punctuation
Expand All @@ -301,16 +347,73 @@ The answer is the unknown value of apples owned by Marc at the end of the proble
## Data extraction

### Sentence 1
apples owend by Marc = 10
apples owned by Marc = 10

### Sentence 2
apples owend by Marc - 2
apples owned by Marc - 2

### Sentence 3
apples owend by Marc - 2
apples owned by Marc - 2

### Sentence 4
apples owend by Marc - 3
apples owned by Marc - 3

## Correct response
3 apples
how many asking
fish context
are pre_ind_plu
swimming acting
in conjunction
the noise
('pond', 'in') subordinate
('now', None) subordinate
? punctuation
# Zoidberg Solution

## The problem
8 fish are swimming in a pond. 4 more fish join them.
How many fish are swimming in the pond now?

## Digested problem
8 fish are swimming in a pond .
CD JJ NN VBG IN DT NN .

4 more fish join them .
LS JJR JJ NN PRP .

How many fish are swimming in the pond now ?
WRB JJ JJ VBP VBG IN DT NN RB .

## Problem inference
I think this problem is about an increasing number of swimming fish in a pond and asks a single question.

## Parsed problem
8 fish are swimming in a pond .
constant context pre_ind_plu acting conjunction constant subordinate punctuation

4 more fish join fish .
constant rel_more context operator context punctuation

How many fish are swimming in the pond now ?
asking context pre_ind_plu acting conjunction noise subordinate subordinate punctuation


## Question 1

### Question text
How many fish are swimming in the pond now?

### Answer interpretation
The answer is the unknown value of fish swimming fish in a pond at the end of the problem.

## Data extraction

### Sentence 1
swimming fish in a pond = 8

### Sentence 2
swimming fish in a pond + 4

## Correct response
12 fish
8 changes: 7 additions & 1 deletion TODO
@@ -1 +1,7 @@
* Calibration 5 needs work; other calibrations appear to work
* Calibrations greater than 7 are broken
* There's a bug right now where on the first run through a problem where you
specify a correct pre_ind_plu using the unknown setter, the brain farts
and it answers incorrectly, but if rerun answers just fine.
Repro steps:
* Remove brain
* Answer calibration 7
2 changes: 2 additions & 0 deletions calibrations/07.txt
@@ -0,0 +1,2 @@
8 fish are swimming in a pond. 4 more fish join them.
How many fish are swimming in the pond now?
1 change: 1 addition & 0 deletions calibrations/08.txt
@@ -0,0 +1 @@
Michael had 8 pieces of pizza. He ate 2 pieces of pizza. How many pieces were left?
2 changes: 2 additions & 0 deletions calibrations/09.txt
@@ -0,0 +1,2 @@
Pigpen had some rocks. He kept 3 rocks for himself and gave the remaining 8 rocks to his friends.
How many rocks did he have in the beginning?
1 change: 1 addition & 0 deletions calibrations/10.txt
@@ -0,0 +1 @@
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?
1 change: 1 addition & 0 deletions calibrations/11.txt
@@ -0,0 +1 @@
Mitch has 3 cobs. Lisa has 2 cobs. How many cobs do they have altogether?
3 changes: 3 additions & 0 deletions calibrations/12.txt
@@ -0,0 +1,3 @@
Mickey has a dozen apples.
Eric takes away half of the apples.
How many apples does Mickey have now?
2 changes: 1 addition & 1 deletion example.brain.json
@@ -1 +1 @@
{"operator_verbs": {"has": "eq", "bought": "ad", "ate": "su", "buys": "ad", "gave": "su", "gives": "su"}, "inclusive": {"her family": "inclusive", "friends": "exclusive", "her friends": "exclusive", "family": "inclusive"}, "subordinates": {"now": "time_ending", "beginning": "time_starting"}, "retagged": {"ate": "operator_verbs"}, "relative": {"more": "rel_more"}, "answer_syntax": {"how many": "expression"}, "plurality": {"Jones": "singular", "sister": "singular", "ate": null, "her": "singular", "family": "plural", "friends": "plural", "bananas": "plural", "Lucy": "singular", "Mrs.": "singular", "Jane": "singular", "his": "singular", "she": "singular", "Tony": "singular", "jars": "plural", "dolls": "plural", "balloons": "plural", "Ethelle": "singular", "he": "singular"}, "determiners": {"the": "noise", "some": "variable", "another": "noise"}, "gender": {"Jones": "ambiguous", "sister": "feminine", "his": "masculine", "her": "feminine", "family": "mixed", "friends": "mixed", "bananas": "neutral", "Lucy": "feminine", "Mrs.": "feminine", "Jane": "feminine", "she": "feminine", "Tony": "masculine", "jars": "neutral", "dolls": "neutral", "balloons": "neutral", "Ethelle": "feminine", "he": "masculine"}, "gerunds": {"remaining": "solution_zero"}, "comparison_adj": {}}
{"operator_verbs": {"gives": "su", "ate": "su", "join": "ad", "buys": "ad", "gave": "su", "has": "eq", "throws": "su", "bought": "ad"}, "subordinates": {"pond": "place_noun", "away": "False", "now": "time_ending", "beginning": "time_starting"}, "inclusive": {"her family": "inclusive", "friends": "exclusive", "her friends": "exclusive", "family": "inclusive"}, "unknown": {"('to', 'TO', None)": "False", "('fish', 'JJ', None)": null, "('4', 'LS', None)": null}, "retagged": {"ate": "operator_verbs", "join": "operator_verbs", "fish": "nounlike", "to": "noise", "are": "pre_ind_plu", "away": "noise", "4": "numbers"}, "relative": {"fewer": "rel_less", "more": "rel_more"}, "answer_syntax": {"How many": "expression", "how many": "expression"}, "plurality": {"bananas": "plural", "family": "plural", "Marc": "singular", "fish": "regular", "Jim": "singular", "are": null, "apples": "plural", "Jane": "singular", "pond": "singular", "Chandler": "singular", "toy": "singular", "her": "singular", "jars": "plural", "Joey": "singular", "balloons": "plural", "dolls": "plural", "Jones": "singular", "them": "plural", "his": "singular", "cars": "plural", "Lucy": "singular", "Mrs.": "singular", "Ethelle": "singular", "friends": "plural", "he": "singular", "sister": "singular", "ate": null, "join": null, "Julia": "singular", "she": "singular", "Tony": "singular"}, "determiners": {"a": "constant", "away": "noise", "some": "variable", "to": "noise", "another": "noise", "the": "noise"}, "gender": {"bananas": "neutral", "family": "mixed", "Marc": "masculine", "fish": "mixed", "Jim": "masculine", "apples": "neutral", "Jane": "feminine", "pond": "neutral", "Chandler": "masculine", "toy": "neutral", "her": "feminine", "jars": "neutral", "he": "masculine", "balloons": "neutral", "dolls": "neutral", "Jones": "ambiguous", "them": "mixed", "his": "masculine", "cars": "neutral", "Lucy": "feminine", "Mrs.": "feminine", "Tony": "masculine", "friends": "mixed", "Joey": "masculine", "sister": "feminine", "Julia": "feminine", "she": "feminine", "Ethelle": "feminine"}, "gerunds": {"remaining": "solution_zero", "swimming": "acting"}, "comparison_adj": {}, "numbers": {"4": "4"}}
15 changes: 8 additions & 7 deletions run_example.sh
@@ -1,8 +1,9 @@
sudo ./setup.py install
clear
cat calibrations/01.txt | zoidberg > EXAMPLE.md
cat calibrations/02.txt | zoidberg >> EXAMPLE.md
cat calibrations/03.txt | zoidberg >> EXAMPLE.md
cat calibrations/04.txt | zoidberg >> EXAMPLE.md
cat calibrations/05.txt | zoidberg >> EXAMPLE.md
cat calibrations/06.txt | zoidberg >> EXAMPLE.md
echo "" > EXAMPLE.md
cat calibrations/01.txt | zoidberg | tee -a EXAMPLE.md
cat calibrations/02.txt | zoidberg | tee -a EXAMPLE.md
cat calibrations/03.txt | zoidberg | tee -a EXAMPLE.md
cat calibrations/04.txt | zoidberg | tee -a EXAMPLE.md
cat calibrations/05.txt | zoidberg | tee -a EXAMPLE.md
cat calibrations/06.txt | zoidberg | tee -a EXAMPLE.md
cat calibrations/07.txt | zoidberg | tee -a EXAMPLE.md

0 comments on commit bc65ebb

Please sign in to comment.