A constraint based dependancy parser for Sanskrit Amba Kulkarni apksh@uohyd.ernet.in Department of Sanskrit Studies University of Hyderabad Hyderabad 19 Feb 2010 Calicut University Page 1
Æ Ó - Ý Ý Ñ ÚÝ Ó Ñ ÚÔ ÓÔ Ò ÚØ Ø º ÚÝ Ò Ñ Ñ? ¹Ý Ô ¹Ý ÔÖ - Ô Ò Å Ø ÚÝ º 19 Feb 2010 Calicut University Page 2
Ù Ö Ì Ñ, Ö Ñ Ð Ñ É Øº ¹ÑÒ Ú Ö Ñ Ø ÑÒ - Ý Ý Ø, Ð ÑÑ Ø ÑÒ - Ý Ý Ñ, Ø Å ÚÝ º Å Ò Ì ÝØ? 19 Feb 2010 Calicut University Page 3
WHERE is the information about the relations coded? Ô ¹Ý Ô Ò Å» Öß ÝØ º Ø Ú Ò, Ú ( ÙÔÔ Ò, ÒÔ Ø Ò ), Ú Ñ Ò Ö Ý Ò 19 Feb 2010 Calicut University Page 4
Ú - ê Õ - ÑÝ Ú - Ò Ö ÖÐ Ú Øº Analysis Process is non-deterministic ÔÖ Ø Ú - Úê Õ - ÑÝ Òß - Úê Õ Ò Å ²ÝÑ Ò Òº Ø¹Ý Ö Ñ? Ö âýñ º Ø» Ú Ì - Ò ÚÑ -, Ý ¹Ý Ô ¹Ý Òß - Úê Õ Ò 19 Feb 2010 Calicut University Page 5
- ÑÝ, Ñ ÝÓ, Ø Ø Ý Ú Ñ Úê Õ Ý Ø Ô Ø Ô Ñ Ø Ú Ò Ø º Ö a) Ú - Ì - Ò ÚÑ Ø Ö ÝÓ¹Ø Ø Ý ( Ò Ø ) ( Ô.. 2.3.18) Ò Ò» Ñ ÝÓ Ø Ö Ú Ö âýó Ô Ø Ø Ý Ú Ö ÝØ º Ø¹Ñ Ø Ñ ÝÓ Ø Ø Ý Ø Ô Ø Ú Ö Ú ÚØÑ Øº 19 Feb 2010 Calicut University Page 6
Ù Ö Ì Ñ, Ö Ñ Ò Ú Ð ÝØ º ¹ÑÒ Ú ÚÐ Ú Ö Ñ Ø Ú Ö Ø Ú Ò Ø º Ø» Ø - Ò Ó Ò Ý ÝÓ ÝØ ÒÑ Ô Ú Ý Ñ º 19 Feb 2010 Calicut University Page 7
b) Ô ¹Ý Òß - Úê Õ Ò Ú Ñ Ô Ý Ñ º Ö Ñ ÚÒ É Øº ¹ÑÒ Ú Ô - Úê Õ Ñ Ò Ò Ö ÚØÑ Øº Ö Ñ = Ö Ñ Ô 1.Ú. / Ö Ò ÐÎ Ù.Ô..Ú. ÔÖ¹ÑßÔ ÚÒ = ÚÒ ÒÔ 1.Ú. / ÚÒ ÒÔ 2.Ú. É Ø = É Ø ( Ñ Ø ) Ô 7.Ú. / É Ø ( Ñ Ø ) ÒÔ 7.Ú. / Ñ ÐÎ.Ô.Ú. ÔÖ¹ÑßÔ 19 Feb 2010 Calicut University Page 8
» âç ÚÝÇ ØÔ ÝØ Ø º Ö Ñ Ø ÑÒ - Ý Ý Ø, ÚÒ Ø ÑÒ - Ý Ý Ñ º ÚÝ Ø Ö - Ø - Ò - Ý Ý Ø ( Ý Ø ), ÚÒ Ø Ö - Ø - Ò - Ý Ý Ñ, Ú, É Ø Ý» Ø Ñ Ú¹ØØ âø Ý ÚÝ ÔÒ Ø» âø Ý - Ý Ý ÚØ Ø º Ì Ø ¹ÑÒ Ù Ö Ô Ý Ú Ø âø Ý ÚÝ Ý Ø Ø Ö ØÝ Ý Ò Ý Ò ÖÐ º 19 Feb 2010 Calicut University Page 9
Prioritizing Multiple Analysis Òß - ÚÝ Ò ÚØ Ø Ø Ø Õ ÚÝ Õ Ý ¹Ì ÔØ Ø Ú? ÔÇÚ ÔÝ Å ÚÝ Ó Ì - ÝÓ ÝØ - Ø ÔÝ - - ÒÑ Ú Ý Ñ º Õ ØÕ Ú Ò ù ÝÓ Ø º 19 Feb 2010 Calicut University Page 10
Ú Ý Ñ Ø ÔÝ Ò Ì ²Ý - ÒÑ ÒÑ - ¹ Ý Ø ßÚ Ý ÝÓ ÝØ Ò Ì Ô Ì ¹Ý ÒÑ Òß Ú - Ò¹Ý Ú Ý Ø Ú Øº Ø ÒÑ ¹ÑÒ ÑÝ Ø ù Ò ¹Øº Ý Ô ÝÓ ÝØ - Ø ÔÝ Ò Ú Ø ÒÒ Å ²Ý - Úê Õ Ò Ý Ò Ø Ô Ø - Ñ Ý Ø Õ Ñ ÔÇÚ ÔÝ Ø ÝØ Ø º 19 Feb 2010 Calicut University Page 11
Ñ Ù Ö Ô Ý Ñ º Î Ý Ò É Øº ¹ÑÒ Ú Ú Ú Ñ ¹Ø Ô - Úê Õ - = Î 1 ÒÔ.Ú. / Î 2 ÒÔ.Ú. ÎÑ = ÚÒ 1 ÒÔ.Ú. / ÚÒ 2 ÒÔ.Ú. ÚÒÑ = Ñ ÐÎ Ø Ö.Ô..Ú. / É Ø ( Ñ Ø ) É Ø 7.Ú. / É Ø ( Ñ Ø ) Ô 7.Ú. ÒÔ 19 Feb 2010 Calicut University Page 12
» Õ Ú - Úê Õ Ò Å Ú Ø 1. ÎÑ Ø ÑÒ - Ý Ý Ø, Ø ÑÒ - Ý Ý Ñ º ÚÒÑ ÎÑ Ø ÑÒ 2. Ý Ý - Ñ, Ø ÑÒ - Ý Ý Ø º ÚÒÑ ÚÒÑ Ø ÑÒ 3. Ý Ý - Ø, ÎÑ Ø ÚÒ¹Ý Ú Õ Ñ º 4. ÚÒÑ Ø ÑÒ - Ý Ý Ñ, ÎÑ Ø ÚÒ¹Ý Ú Õ Ñ º 19 Feb 2010 Calicut University Page 13
5. ÎÑ Ø ÑÒ - Ý Ý Ø, ÚÒÑ Ø Î¹Ý Ú Õ Ñ º 6. ÎÑ Ø ÑÒ - Ý Ý Ñ, ÚÒÑ Ø Î¹Ý Ú Õ Ñ º 19 Feb 2010 Calicut University Page 14
» Ç âç ÚÝÇ Ø Ú Ñ âýó Ô Ö - Å Ç ÝØ º Ø Ø Ý Ø Ö Ý Õ ÔÝ Ø ÚÐ Ú Ö - Å ¹Øº ÔÖ - Ö ¹Ý Ý Ö Ö ÝÑ º Ø» Ô ÔÒ Ô Ñ Ú ÕÎ - ÚÝ ÚÒ Ú Õ - Ô Ø º 19 Feb 2010 Calicut University Page 15
Ñ ÝØ ÌÑ Ø - Ö Ø Ò ØÖ Ñ Ö Ñ ØÌßÚ Ñ Ý Ô Ï Õ ÝØ º Ý Ô ¹ Ø - Õ Ý Ý Ô Æ ¹Ý Ñ¹Ý Ò Ó Ô Ø ÚØ Ø ØÌ Ô Ú Õ Ò ØÖ Ú ÝÑ Ø Ñ Ñ Ý Ô Ò ÝØ º ØÌ Ú Ñ Ý - ÑÑ Ò Ý ÚÝ¹Ý ÔÇÚ ÔÝ ¹Ý Ò Ý Ø Ø º 19 Feb 2010 Calicut University Page 16
HOW is the information coded (explicitly or implicitly)? Å ÚÝ Ò Ý º Ý Å ÝÝ Ò Ø ÙÉÝØ Ú Å ¹Ú Ö Ý º Ò Ø ÔÖÅÔÖÝ º 19 Feb 2010 Calicut University Page 17
ÒÑ Ô Ú Ð Ø» Ö Ú Ø, Ò Ò Ô Ñ Ò Ø ÝÓ Ù Ö Ì Ñ, Ô Ú Ð É Øº Ö Ñ Ú, ¹ÑÒ Ö Ñ Ø Ô - Ø - Ò - Ý Ý Ø Ø ÝÝ Òº Ø Ú ¹ÑÒ Ö Ñ Ø Ô ¹Ý Ô Ú Ò Ò Ô Ò Å ÌÑ ÓÔ Ò Ò ²Ý º 19 Feb 2010 Calicut University Page 18
Another criterion for prioritizing Multiple Analysis ¹ÑÒ Ù Ö Ý Ñ¹Ý ÚØ Ø º Ñ Ú Ð âç Ô âø Ý - Ú Ç ¹Ø º Ø âç Ô Ô - Ø - Ò - Ý Ý Ú ÑÒ - Ý Ý Ñ ÚØÑ Øº Ø¹Ñ Ø âç Å ÚØ - Ù Ö Å ÚØ Ô - Ø - Ò - Ý Ý Ñ Ð ÑÒ - Ý Ý Ñ ÑÒ - Ý Ý Ñ Ð Ô - Ø - Ò - Ý Ý Ñ 19 Feb 2010 Calicut University Page 19
» Ô ù ÝÓ ÝØ Ò¹Ý Ú Ø âø Ý - ÚÝ Ý Ò Ø º - éý ÚÝ ÔÇÚ ÔÝ Ø º 19 Feb 2010 Calicut University Page 20
Taking into account all the above consideration, now, we propose a mathematical model to get the ÚÝ of a sanskrit sentence mechanically. Let each word in a sentence be represented as a node in a graph. The relations between nodes are represented by the directional labelled edges. 19 Feb 2010 Calicut University Page 21
Given a graph G with n nodes representing n words of a sentence, the task is to find a subgraph of G which is a directed tree. a a A Tree is a graph in which any two vertices are connected by exactly one simple path. 19 Feb 2010 Calicut University Page 22
Each node consists of one or more cells, each cell representing one morphological analysis of the word represented by the node. We break the problem into three parts: For a given sentence, draw all possible labelled directed edges between cells of one node to that of the other. Identify a subgraph T of G such that T is a directed Tree. Prioritize the solutions, in case there are more than one possible directed Trees. 19 Feb 2010 Calicut University Page 23
Task 1: Let a 5-tuple (i,j,r,l,m) represent an edge labelled R from the m th cell of the l th node to the j th cell of the i th node. In other words this 5-tuple represents a relation R from the m th morphological analysis of the l th word to the j th morphological analysis of the i th word. Let C[i,j,R,l,m] = 1, if such a relation exists, else = 0. 19 Feb 2010 Calicut University Page 24
Based on the available information in a given sentence in the form of Ø Ú, Ú, and Ñ Ò Ö Ý, the cost matrix is populated with 0s and 1s. 19 Feb 2010 Calicut University Page 25
Task 2: Following constraints are imposed on the matrix C A word can t satisfy its own expectancy. i.e. a word can t be linked to itself. Or in other words there can not be self loops. j,r,k C[i,j,R,i,k] = 0 A word can fulfill only one expectancy. i.e. a node can have at the most one incoming arrow. This also ensures that a word can have only one valid analysis per solution. j,r,k,l C[i,j,R,k,l] = 1 19 Feb 2010 Calicut University Page 26
If a word has both an incoming arrow as well as an outgoing arrow, they should be through the same cell. i j R,l,n C[i,j,R,l,n] + a,b,r,k!=j C[a,b,R,i,k] 1 If there are more than one outgoing arrows through a node, then they should be through the same cell. i.e. there can be only one valid morph analysis per word, per analysis. 19 Feb 2010 Calicut University Page 27
There can not be more than one outgoing arrows with same label from the same cell, if the relation is a kaaraka relation. i.e. there can not be two words satisfying the same kaaraka role for the same verb. If all the nodes are plotted in a straight line, then they should not intersect each other. i.e., if C[i,j,R,k,l]=1, then v yc[u,v,w,x,y] = 0, if i < x < k and u < i or u > k 19 Feb 2010 Calicut University Page 28
Task 3: The solutions are prioritised using the conditions specified below. For each of the analysis, the distance is measured as d = i,r,j d irj, where d irj = j i wt R, if C[i,a,R,j,b] = 1 for some a and b. d irj = 0 otherwise. wt R = 100, if R marks a relation with an upapada, = 10, if R marks a relation with a verb, = 1, otherwise. 19 Feb 2010 Calicut University Page 29
This takes care of ( Ö relation is preferred over the Ñ Ò Ö ÝÑ ) 19 Feb 2010 Calicut University Page 30
DEMO 19 Feb 2010 Calicut University Page 31
Some real life problems: Ò Ð Ñ Ò ØÝ Ø Ö Ñ ÚÒ Ò ÚÒ Ú Ò Ø Ú Öâ ¹Ý Ò Ø» ÎÑ Ò Ý ÚÒ ÖÅÝÑ Ú Ì Ú Ú Ú Ø»Ý ÖÑÑ Ã ÝÚ Ò 19 Feb 2010 Calicut University Page 32
Some real life problems: Ò Ð Ñ Ò ØÝ Ø Ö Ñ ÚÒ Ò ÚÒ Ú Ò Ø Ú Öâ ¹Ý Ò Ø» ÎÑ Ò Ý ÚÒ ÖÅÝÑ Ú Ì Ú Ú Ú Ø»Ý ÖÑÑ Ã ÝÚ Ò Ø»Ý? 19 Feb 2010 Calicut University Page 33
Some real life problems: Ò Ð Ñ Ò ØÝ Ø Ö Ñ ÚÒ Ò ÚÒ Ú Ò Ø Ú Öâ ¹Ý Ò Ø» ÎÑ Ò Ý ÚÒ ÖÅÝÑ Ú Ì Ú Ú Ú Ø»Ý ÖÑÑ Ã ÝÚ Ò Ö Ñ ÚÒ Ò ÚÒ Ú... Ø»Ý ÝÚ Ò Is it not violation of Ñ Ò Ø ÝÓ Ô Ú Ð? 19 Feb 2010 Calicut University Page 34
Some real life problems: Ò Ð Ñ Ò ØÝ Ø Ö Ñ ÚÒ Ò ÚÒ Ú Ò Ø Ú Öâ ¹Ý Ò Ø» ÎÑ Ò Ý ÚÒ ÖÅÝÑ Ú Ì Ú Ú Ú Ø»Ý ÖÑÑ Ã ÝÚ Ò Should the anvaya of Ú be with Ø Ú or ÝÚ Ò? 19 Feb 2010 Calicut University Page 35
Some real life problems: Ò Ð Ñ Ò ØÝ Ø Ö Ñ ÚÒ Ò ÚÒ Ú Ò Ø Ú Öâ ¹Ý Ò Ø» ÎÑ Ò Ý ÚÒ ÖÅÝÑ Ú Ì Ú Ú Ú Ø»Ý ÖÑÑ Ã ÝÚ Ò ÚÒ Ò ÚÒ» Ö Å? 19 Feb 2010 Calicut University Page 36
ÝÚ 19 Feb 2010 Calicut University Page 37