diff options
author | anujag <anujag@inspiration.(none)> | 2012-07-13 13:00:54 +0530 |
---|---|---|
committer | anujag <anujag@inspiration.(none)> | 2012-07-13 13:00:54 +0530 |
commit | 2d412122742571b17a4d9a3bc79f20a199c223e6 (patch) | |
tree | 24d4a963714dfbde84ebfe16ed8dd7edd1222da4 /gstudio/update_lexicon.py | |
parent | 97bd4e1f8007a6ab6b6d2f1b3a158567c61f7d72 (diff) | |
download | gnowsys-2d412122742571b17a4d9a3bc79f20a199c223e6.tar.gz |
CNL added
Diffstat (limited to 'gstudio/update_lexicon.py')
-rw-r--r-- | gstudio/update_lexicon.py | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/gstudio/update_lexicon.py b/gstudio/update_lexicon.py new file mode 100644 index 0000000..8a4a359 --- /dev/null +++ b/gstudio/update_lexicon.py @@ -0,0 +1,100 @@ +from gstudio.lex import * + +def lex(self): + destination = open( "/home/user/gnowsys-studio/demo/aFile.pl", "a+" ) + f = destination.read() + ##print "f---" ,f + b = [] + c = [] + r = [] + source_r = [] + """ + strpos=f.find("one") + ##print strpos + """ + + #Updates lexicon file with each Objecttype as noun singular and plural + for each in Objecttype.objects.all(): + source=get_lex_OT(each) + for e_i in source: + strpos=f.find(e_i) + #print strpos + if strpos == -1: + #print "Going to write --", e_i + destination.write(str(e_i) + '\n') + else: + pass + + #Updates lexicon file with Gbobject and author of each Nodetype and stores them as Proper noun + for each in Nodetype.objects.all(): + for a in get_lex_author(each): + b.append(a) + + + for each in Gbobject.objects.all(): + for a in get_lex_GB(each): + b.append(a) + + + #Compares each of the entries of author & Gbobject, to make a unique list + for each in b: + if each not in c: + c.append(each) + + for e_i in c: + strpos=f.find(e_i) + #print strpos + if strpos == -1: + #print "Going to write --", e_i + destination.write(str(e_i) + '\n') + else: + pass + + #Updates lexicon file with each Relationtype as an intransitive adjective or transitive verb + for each in Relationtype.objects.all(): + for e_i in get_lex_RT(each): + r.append(e_i) + ##print " r---(will contain all rts, may contain repetition of prepositions)" + + #Compares each of the entries to ensure preposition entries are unique + for each_r in r: + if each_r not in source_r: + source_r.append(each_r) + + ###print "source_r, should not contain any rep" + + for e_ir in source_r: + strpos=f.find(e_ir) + #print strpos + if strpos == -1: + ##print "Going to write the above statement",e_i + destination.write(str(e_ir) + '\n') + else: + pass + + #Updates lexicon file with each Metatype as noun singular and plural + for each in Metatype.objects.all(): + source_m=get_lex_MT(each) + for e_im in source_m: + strpos=f.find(e_im) + #print strpos + if strpos == -1: + ##print "Going to write the above statement",e_i + destination.write(str(e_im) + '\n') + else: + pass + + #Updates lexicon file with each Attributetype as noun singular and plural + for each in Attributetype.objects.all(): + source_a=get_lex_AT(each) + for e_ia in source_a: + strpos=f.find(e_ia) + #print strpos + if strpos == -1: + ##print "Going to write the above statement",e_i + destination.write(str(e_ia) + '\n') + else: + pass + + + destination.close() |