analytics

Saturday, June 23, 2012

Programming syntax for English sentences

I've been mulling this over for the past few days.. if English were written like the Python programming language with a few modifications...

You would have a different class for every noun there is, they would be arranged in a hierarchy, like the class for the noun boy might look like:

class Boy(Human):
  self.age = range(0, 18)
  self.gender = "male"

Then the human class in turn might look like:

class Human(Mammal):
  self.age = range(0, 120)
  self.gender=("male", "female", "other")
  def walk(..., mode="bipedal")
  ...
 The walk function is mostly the same as for a mammal which is in turn the same as a lot of animals, etc... but in humans it is bipedal type of walking.

A particular boy named Jimmy would derive from Boy:
jim = Boy()
jim.name="Jim Smalls"
jim.age = 13
jim.house=House()
jim.house.location="913 West Oak Blvd, San Diego, California, U.S.A"

Finally, the sentence "Jim walked jauntily to the store from his house yesterday."
jim.walk(from=jim.house, to = store, style="jauntily", time="yesterday")

 Of course the store would have to be a particular store or just the generic idea of store from the heirarchy of all the different types of buildings.

It would truly be an endless project but in the end you would have all the concepts and things in the world mapped into the computer and then it would be easier to make an artificial intelligence.


No comments:

Post a Comment