This section lists all blog posts, regardless of topic.
Parsing numbersSeptember 6, 2008
After some thought, here is a strategy for parsing numbers.
Step 1: Word mappings and entity typesThe following word mappings and entity types are required:
'one' -> 1: digit 'two' -> 2: digit 'three' -> 3: digit 'four' -> 4: digit 'five' -> 5: digit 'six' -> 6: digit 'seven' -> 7: digit 'eight' -> 8: digit 'nine' -> 9: digit
'eleven' -> 11: teen_number 'twelve' -> 12: teen_number 'thirteen' -> 13: teen_number 'fourteen' -> 14: teen_number 'fifteen' -> 15: teen_number 'sixteen' -> 16: teen_number 'seventeen' -> 17: teen_number 'eighteen' -> 18: teen_number 'nineteen' -> 19: teen_number
'twenty' -> 20: group_of_ten 'thirty' -> 30: group_of_ten 'forty' -> 40: group_of_ten 'fifty' -> 50: group_of_ten 'sixty' -> 60: group_of_ten 'seventy' -> 70: group_of_ten 'eighty' -> 80: group_of_ten 'ninety' -> 90: group_of_ten
'hundred' -> 100: multiplier 'thousand' -> 1000: multiplier 'million' -> 1000000: multiplier 'billion' -> 1000000000: multiplier 'trillion' -> 1000000000000: multiplier 'quadrillion' -> 1000000000000000: multiplier
number_part digit is_a number_part teen_number is_a number_part group_of_ten is_a number_part 100+_number_part is_a number_part 100+_number_part is_a number
|
|
Step 2: New transformation typeThe first step is to introduce a new transformation type which evaluates a numerical formula. For example:
| {group_of_ten} {digit} -> # $1 + $2 |
|
The
# prefix indicates that the transformation's output specification is a numeric formula.
In addition, it would be helpful to be able to specify as a part of any transformation, what the result's entity type should be considered. For example:
| {group_of_ten} {digit} -> # $1 + $2 (number_part) |
|
Step 3: Transformations{group_of_ten} {digit} -> # $1 + $2 (number_part) {number_part} {multiplier} -> # $1 * $2 (100+_number_part) {multiplier} {number_part} -> # $1 + $2 (100+_number_part) {100+_number_part} {100+_number_part} -> # $1 + $2 (100+_number_part) {100+_number_part} {number_part} -> # $1 + $2 {100+_number_part} and {number_part} -> # $1 + $2 {number} + {number} -> # $1 + $2 {number} * {number} -> # $1 * $2
|
|
Numbers and the human brainSeptember 6, 2008
Something that I realized while working on exercise 9, is that it is quite mysterious how the human brain represents and deals with numbers, or more generally, quantities. While concepts and entities are fairly discrete things, numbers are more slippery. While they
are discrete, to a certain extent, there are an infinite number of them. ie. You can't create an entity in the brain to represent each one. How do you create a kind of
generic entity in the brain to represent any given number?
I have cheated in a sense, since I have implemented numbers using the computer's internal representation. I think this is the most sensible thing to do: Why lament on why the computer makes some aspects of intelligence easier?!
On a related note, I am pondering how to create a scheme to transform numbers like "five hundred and twenty three" into the brain's internal representation.
Exercise 9 thoughtsSeptember 6, 2008
It feels good to have completed the next exercise after the long haul implementing exercise 8... the hope was that I wouldn't burn out and stall making more progress, so this is a good sign.
Adding parametric relationships as a transformation output was fairly challenging. It made me realize that I needed to generalize the transformation process so that, regardless of the output specification's structure, the same logic could be applied. Hopefully this will pay dividends as I continue to add new transformation types.
older >>