forked from EshwarSR/kaarakas
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinitial_algorithm.txt
More file actions
93 lines (61 loc) · 2.13 KB
/
initial_algorithm.txt
File metadata and controls
93 lines (61 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
main()
{
naamapada = {set of all naamapada in the sentence}
identify kriyapada
aakanksha , optional , voice = process_kriyapada(kriyapada)
dict = new dictionary()
for each pada in naamapada:
dict[pada] = process_naamapada(pada) // returns a set of kaarakas it can take and its corresponding scores
sort the dict in increasing order based on cardinality of the set
// Better to start fixing the kaarakas in this order adhikaraNa , karana , apaadana , sampradana , kartha , karma
do for each naamapada:
if cardinality == 1
tag that naamapada as that kaaraka
else choose the best among the set based on the scores and propagate that constraint to all other naamapadas
until (all the naamapadas are tagged) or (all aakanksha are found and all naamapadas are processed)
}
process_kriyapada(kriyapada)
{
kaarakas = {kartha , karma , karana , sampradhana , apaadana , adhikaraNa}
aakanksha = {}
if IN:
add neenu or neevu or etc according to the gender count of the kriyapada, to the naamapada set
aakanksha.insert(kartha)
if TR:
aakanksha.insert(kartha , karma)
if BI:
aakanksha.insert(kartha,karma,sampradhana)
optional = kaarakas - aakanksha;
return aakanksha , optional , voice_of_sentence;
}
process_naamapada(pada)
{
set = new Set();
if NOM i.e. 1 :
if(voice is active) and (kriyapada gender and number matches to this pada):
set.insert(kartha = 1 , karma = 0.5 ) //karma because vibhakthi might be dropped, hence lower score
if(voice is passive) :
set.insert(karma = 1)
if ACC i.e. 2:
set.insert(karma);
if ABL i.e. 3:
if (voice is passive) and (kriyapada gender and number matches to this pada):
set.insert(kartha = 1)
if (aadu dathu)
set.insert(karma = 1)
if (place or fixed thing)
set.insert(apaadana = 1 )
if(thing or person)
set.insert(karana = 0.5 , apaadana = 0.5);
if DAT i.e. 4 :
set.insert(sampradhana = 1)
if GEN:
if (ach bhava krudantha)
set.insert(all)
if LOC:
if(place)
set.insert(adhikaraNa = 1)
if(thing or person)
set.insert(karana = 1)
return set;
}