""" interlinguish.py
 Copyright (C) 1999 Aloril
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

 Goal is to make prolog like language at higher level.

 Now: goal has function that checks whether goal is fulfilled.
 If it's not fullfilled, then do this and this and ... to fulfill it.
 'This' can be function or subgoal.

 Things to add in near future: 'real' prolog style variables and 'or' metarule.
"""

import string
import panlingua
p=panlingua

#semnode ids from WordNet (english word+type+sense no)
#or it's made up (temporary until replaces with interlinguish sentence(s)
#describing goal or word (sense no=0)
breakfast=('breakfast','#breakfast_verb1')
lunch=('lunch','#lunch_verb1')
sup=('sup','#sup_verb1')
sleep=('sleep','#sleep_verb1')
eat=('eat','#eat_verb2')
be=('be','#be_verb1')
important=('important','#important_adj1')
more=('more','#more_adv1')
than=('than','#than_prep0')

#CHEAT!: temporary thing
build_home=('build home','#build_home_verb0')
chop_trees=('chop trees','#chop_trees0')
create_axes=('create axes','#create_axes0')

def importance(sub,cmp,obj):
    a1=p.atom("is",1,(be[1],"present tense"),(None,"declarative verb"))
    a2=p.atom(sub[0],2,(sub[1],"durative"),(a1,"verb subject"),"up")
    a3=p.atom("important",3,(important[1],"default"),
              (a2,"predicate adjective"),"left")
    a4=p.atom("more",4,(more[1],"default"),
              (a3,"adjective-modifying adverb"),"up")
    a5=p.atom("than",5,(than[1],"default"),
              (a4,"comparing preposition"),"left")
    a6=p.atom(obj[0],6,(obj[1],"durative"),(a5,"verb object"),"up")
    return (string.capitalize(sub[0])+\
            "ing is more important than "+obj[0]+"ing.",
            (a1,a2,a3,a4,a5,a6))

def match_importance(say):
    #A is more important than B.
    a1=p.atom("",1)
    a2=p.atom("",2,("?sub","durative"),(a1,"verb subject"),"up")
    a3=p.atom("important",3,('#important_adj1',"default"),
              (a2,"predicate adjective"),"left")
    a4=p.atom("more",4,('#more_adv1',"default"),
              (a3,"adjective-modifying adverb"),"up")
    a5=p.atom("than",5,('#than_prep0',"default"),
              (a4,"comparing preposition"),"left")
    a6=p.atom("",6,("?obj","durative"),(a5,"verb object"),"up")
    return p.match_sentence(say,[a1,a2,a3,a4,a5,a6])

    Source: geocities.com/siliconvalley/station/4279/src

               ( geocities.com/siliconvalley/station/4279)                   ( geocities.com/siliconvalley/station)                   ( geocities.com/siliconvalley)