This is a basic grammar that tries to handle long noun phrases. The Persian possessive mark ( the English “of”) is not always written in texts, which makes long noun phrases with several adjective and nouns to be difficult to create. Some words like pronouns, proper nouns and nouns always come at the end of the phrase. Also, in some nouns, the possessive mark shows up, which will helps us in our decision about phrase boundary.

Here's the grammar which handles basic intransitive, transitive and dis-transitive verbs, subject-verb agreement, free word order, basic predicates and long phrases consisting of nouns an adjectives. Basic morphology is also implemented.

########## Features ##########

feature {

      personNumber<1> : 1sg 2sg 3sg 1pl 2pl 3pl;
      shenas<1>: det nondet;
      ezafe<1>: notFalse {true} notTrue{false};
      case<1>: nom acc mod;
      ontology: semanticObject;

}

########### Words ############

def int-verb(Stem, p) {

word Stem:intransitiveVerb (pred= p){
      Stem.am: 1sg;
      Stem.i: 2sg;
      Stem: 3sg;
      Stem.im:1pl;
      Stem.id:2pl;
      Stem.and:3pl;
}

}

def tr-verb(Stem, p) {

word Stem:transitiveVerb (pred= p){
      Stem.am: 1sg;
      Stem.i: 2sg;
      Stem: 3sg;
      Stem.im:1pl;
      Stem.id:2pl;
      Stem.and:3pl;
}

}

def bit-verb(Stem, p) {

word Stem:bitransitiveVerb (pred= p){
      Stem.am: 1sg;
      Stem.i: 2sg;
      Stem: 3sg;
      Stem.im:1pl;
      Stem.id:2pl;
      Stem.and:3pl;
}

}

def normal-noun(Stem, p) {

word Stem:nominativeNoun (pred= p) {
      Stem: 3sg det;
      Stem.i: 3sg false nondet;
}
word Stem:ezafeNoun (pred= p){
  Stem: 3sg notFalse det;
}

}

def clue-ezafe-noun(Stem, p){

Stem: ezafeNoun(pred= p): 3sg true det;

}

def clue-noun(Stem, p) {

word Stem:nominativeNoun(pred= p) {
      Stem: 3sg false det;
      Stem.yi: 3sg false nondet;
}
word Stem.ye:ezafeNoun(pred= p): 3sg true det;

}

def clue-adj-with-ezafe(Stem, p) {

word Stem:AdjWithoutEzafe(pred= p) : false det;
word Stem.ye:AdjWithEzafe(pred= p): notFalse det;

}

def normal-adj-with-ezafe(Stem, p) {

word Stem:AdjWithoutEzafe(pred= p) : notTrue det;
word Stem:AdjWithEzafe(pred= p) : notFalse det;

}

int-verb(raft, went); int-verb(khandid, laughed); int-verb(david, ran); int-verb(khabid, slept); int-verb(shena-kard, swam); int-verb(parvaz-kard, flew); int-verb(larzid, shook); int-verb(gerye-kard, cried); int-verb(dars-khand, studied); int-verb(ghaza-pokht, cooked-food);

tr-verb(did, saw); tr-verb(shenid, heard); tr-verb(khandand, caused-to-laugh); tr-verb(peida-kard, found); tr-verb(doost-dasht, loved); tr-verb(entekhab-kard, chose); tr-verb(kahesh-dad, reduced); tr-verb(kam-kard, reduced); tr-verb(rang-zad, colored); tr-verb(seda-kard, called); tr-verb(gozaresh-kard, reported); tr-verb(larzand, shook);

bit-verb(dad, gave); bit-verb(gereft, got); bit-verb(kharid, bought); bit-verb(gharz-gereft, borrowed); bit-verb(yad-dad, taught); bit-verb(taghdim-kard, gave); bit-verb(neshan-dad, showed); bit-verb(tarjih-dad, prefered);

word man:pronoun(I):1sg; word to:pronoun(you):2sg; word uo:pronoun(he-she-it):3sg; word ma:pronoun(we):1pl; word shoma:pronoun(you):2pl; word anha:pronoun(them):3pl;

word ra: AccCaseMark; word az: ModCaseMark; word be: ModCaseMark; word ba: ModCaseMark; word bi: ModCaseMark; word dar: ModCaseMark; word bedoon: ModCaseMark;

word ali: properNoun(ali): 3sg; word narges: properNoun(narges): 3sg; word reza: properNoun(reza): 3sg; word tehran: properNoun(tehran): 3sg; word america: properNoun(america): 3sg; word cmu: properNoun(cmu): 3sg; word pittsburgh: properNoun(pittsburgh): 3sg; word ibm: properNoun(ibm): 3sg; word google: properNoun(google): 3sg;

normal-noun(ketab, book); normal-noun(moalem, teacher); normal-noun(daneshamooz, student); normal-noun(medad, pen); normal-noun(maman, mom); normal-noun(baba, dad); normal-noun(daneshgah, university); normal-noun(shab, night); normal-noun(rooz, day); normal-noun(khiaban, street); normal-noun(bastani, ice-cream); normal-noun(sham, dinner); normal-noun(nahar, lunch); normal-noun(narenj, orange); normal-noun(dars, lesson); normal-noun(sherkat, company); normal-noun(lebas, cloth); normal-noun(sakhteman,building); normal-noun(bal, wing); normal-noun(aseman, sky); normal-noun(baran, rain); normal-noun(doost, friend); clue-noun(parande,bird); clue-noun(seda, sound); clue-noun(dama, temperature); clue-noun(madrese, school); clue-noun(hava, weather); clue-noun(khane, home); clue-noun(mou, hair); clue-noun(holoo, peach); clue-noun(albaloo, cherry);

clue-adj-with-ezafe(ziba, beautiful); clue-adj-with-ezafe(khoshbou, nice);

normal-adj-with-ezafe(garm, warm); normal-adj-with-ezafe(mehraban, kind); normal-adj-with-ezafe(ghashang, pretty); normal-adj-with-ezafe(khoob, nice); normal-adj-with-ezafe(jaleb, interesting); normal-adj-with-ezafe(shirin, sweet); normal-adj-with-ezafe(abi, blue); normal-adj-with-ezafe(sabz, green); normal-adj-with-ezafe(ghermez, red); normal-adj-with-ezafe(zard, yellow); normal-adj-with-ezafe(sefid, white); normal-adj-with-ezafe(siah, black); normal-adj-with-ezafe(sakht, difficult); normal-adj-with-ezafe(asan, easy); normal-adj-with-ezafe(zood, soon); normal-adj-with-ezafe(abri, cloudy); normal-adj-with-ezafe(samimi, close);

########### Rules ############

rule {

 no typeraise;

}

#### Lexicon/Categories ######

family intransitiveVerb (verb, pred=p) {

      entry: s<~1> [E] \* np<1> [X nom notTrue] : E ( * ^<Actor> X);
      entry: s<~1> [E] /* np<1> [X nom notTrue] : E ( * ^<Actor> X);

}

family transitiveVerb (verb, pred=p) {

      entry: s<~1> [E] \* np<1> [X nom notTrue] \* np<2> [Y acc]:
      E (* ^<Actor> X ^<Patient> Y);
      entry: s<~1> [E] \* np<2> [Y acc] \* np<1> [X nom notTrue]:
      E (* ^<Actor> X ^<Patient> Y);
      entry: s<~1> [E] /* np<1> [X nom notTrue] \* np<2> [Y acc]:
      E (* ^<Actor> X ^<Patient> Y);
      entry: s<~1> [E] \* np<2> [Y acc] /* np<1> [X nom notTrue]:
      E (* ^<Actor> X ^<Patient> Y);
      entry: s<~1> [E] /* np<1> [X nom notTrue] /* np<2> [Y acc]:
      E (* ^<Actor> X ^<Patient> Y);
      entry: s<~1> [E] /* np<2> [Y acc] /* np<1> [X nom notTrue]:
      E (* ^<Actor> X ^<Patient> Y);
      entry: s<~1> [E] \* np<1> [X nom notTrue] /* np<2> [Y acc]:
      E (* ^<Actor> X ^<Patient> Y);
      entry: s<~1> [E] /* np<2> [Y acc] \* np<1> [X nom notTrue]:
      E (* ^<Actor> X ^<Patient> Y);

}

family bitransitiveVerb (verb, pred=p) {

      entry: s<~1> [E] \* np<1> [X nom notTrue] \* np<2> [Y acc] \ *np<3> [Z mod]:
      E (* ^<Actor> X ^<Patient> Y ^<modifier> Z);

}

family AccCaseMark (ra) {

      entry: np<~1>[acc notTrue] \* np<1>[nom notTrue];

}

family ModCaseMark (prep) {

      entry: np<~1>[mod notTrue] /* np<1>[nom notTrue];

}

family pronoun(n, pred=p) {

      entry: np<~1> [nom det false X]: X:semanticObject(*);

}

family properNoun(n, pred=p) {

      entry: np<~1> [nom det false X] : X:semanticObject(*);

}

family nominativeNoun (n, pred=p) {

      entry: np<~1> [nom X]: X:semanticObject(*);

}

family ezafeNoun(n, pred=p) {

      entry: np<~1>[nom det 3sg ezafe=notTrue Y] /* np<5> [nom notTrue X]:
      Y:semanticObject (* ^ <belonging-to> X);
      entry: np<~1>[nom det 3sg ezafe=notTrue Y] /* ajp<4> [notTrue X] :
      Y:semanticObject (* ^ <adj> X);
      entry: (np<~1>[nom det 3sg ezafe=notTrue Y] /* np<5> [nom notTrue Z] /* ajp<4> [notFalse X]):
      Y:semanticObject (* ^ <adj> X  ^<belonging-to> Z);

}

#zibaye –> khaneye zibaye #zibaye –> zibaye ziba family AdjWithEzafe(adj, pred=p) {

      entry: ajp<2> [X notFalse] : X:semanticObject(*);
      entry: ajp<~2> [X] /* ajp<2> [Y]: X: semanticObject (* ^ <and-adj> Y);

}

#garm –> khaneye garm, ketab garm #garm –> garm zibaye mehraban family AdjWithoutEzafe (adj, pred=p) {

      entry: ajp<2> [X notTrue] : X:semanticObject(*);
      entry: ajp<~2> [X] /* ajp<2> [Y]: X: semanticObject (* ^ <and-adj> Y);

}

testbed {

ali raft: 1;
man raft : 0;
man raftam : 1;
man ali ra didam : 1;
to ali ra didi :1 ;
man ali ra did :0 ;
ma ali ra didid :0;
moalem ketab moalem ra did:2;
moalem ketab moalem ra didam :0;
man khane shoma ra didam:0;
man khaneye shoma ra didam:1;
man sedaye moalem khaneye shoma ra shenidam :1;
man sedaye moalem madrese shoma ra shenidam :0;
man seda khane shoma ra shenidam:0;
man khaneye zibaye garm ra didam:1;
moalem mehraban ketab ra did;
man mehraban ketab ra didam :0;
ali khaneye zibaye moalem mehraban man ra did:1;
ali khaneye ziba moalem mehraban man ra did:0;
ali khaneye ziba moalem mehraban garm man ra did:0;
moalem man khaneye ziba moalem mehraban garm man ra did:1;
moalem man khaneye ziba moalem mehraban garm man ra didam:0;
khaneye zibaye moalem mehraban garm man khandid:1;
moalem mehraban man ketab zibaye reza ra az khaneye ali kharid:1;
moalem mehraban man ketab zibaye reza ra az khaneye ali kharidam:0;
az ali moalem mehraban man ketab zibaye reza ra kharid:1;
az ali moalem mehraban man ketab zibaye reza ra kharidam:0;
man dars jaleb moalem khoob shoma ra doost-dashtam:1;
man dars jaleb moalem khoob madreseye shoma ra doost-dashtam:1;
man dars jaleb moalem khoob madreseye shoma ra be dars khoob jaleb sherkat google tarjih-dadam:1;
moalem mehraban daneshgah dars ra be daneshamooz yad-dad:2;

}

 
openccg/grammars/basicpersian.txt · Last modified: 2008/05/18 01:37 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki