Sanskrit & Artificial Intelligence — NASA
Knowledge Representation in Sanskrit and Artificial Intelligence
Roacs, NASA Ames Research Center, Moffet Field, California
In the past twenty years, much time, effort, and money has been expended on designing an unambiguous representation of natural languages to make them accessible to computer processing. These efforts have centered around creating schemata designed to parallel logical relations with relations expressed by the syntax and semantics of natural languages, which are clearly cumbersome and ambiguous in their function as vehicles for the transmission of logical data. Understandably, there is a widespread belief that natural languages are unsuitable for the transmission of many ideas that artificial languages can render with great precision and mathematical rigor.
But this dichotomy, which has served as a premise underlying much work in the areas of linguistics and artificial intelligence, is a false one. There is at least one language, Sanskrit, which for the duration of almost 1,000 years was a living spoken language with a considerable literature of its own. Besides works of literary value, there was a long philosophical and grammatical tradition that has continued to exist with undiminished vigor until the present century. Among the accomplishments of the grammarians can be reckoned a method for paraphrasing Sanskrit in a manner that is identical not only in essence but in form with current work in Artificial Intelligence. This article demonstrates that a natural language can serve as an artificial language also, and that much work in AI has been reinventing a wheel millenia old.
First, a typical Knowledge Representation Scheme (using Semantic Nets) will be laid out, followed by an outline of the method used by the ancient Indian Grammarians to analyze sentences unambiguously. Finally, the clear parallelism between the two will be demonstrated, and the theoretical implications of this equivalence will be given.
For the sake of comparison, a brief overview of semantic nets will be given, and examples will be included that will be compared to the Indian approach. After early attempts at machine translation (which were based to a large extent on simple dictionary look-up) failed in their effort to teach a computer to understand natural language, work in AI turned to Knowledge Representation.
Since translation is not simply a map from lexical item to lexical item, and since ambiguity is inherent in a large number of utterances, some means is required to encode what the actual meaning of a sentence is. Clearly, there must be a representation of meaning independent of words used. Another problem is the interference of syntax. In some sentences (for example active/passive) syntax is, for all intents and purposes, independent of meaning. Here one would like to eliminate considerations of syntax. In other sentences the syntax contributes to the meaning and here one wishes to extract it.
I will consider a "prototypical" semantic net system similar to that of Lindsay, Norman, and Rumelhart in the hopes that it is fairly representative of basic semantic net theory. Taking a simple example first, one would represent "John gave the ball to Mary" as in Figure 1. Here five nodes connected by four labeled arcs capture the entire meaning of the sentence. This information can be stored as a series of "triples":
give, agent, John
give, object, ball
give, recipient, Mary
give, time, past.
Note that grammatical information has been transformed into an arc and a node (past tense). A more complicated example will illustrate embedded sentences and changes of state:
"John told Mary that the train moved out of the station at 3 o'clock."
As shown in Figure 2, there was a change in state in which the train moved to some unspecified location from the station. It went to the former at 3:00 and from the latter at 3:O0. Now one can routinely convert the net to triples as before.
The verb is given central significance in this scheme and is considered the focus and distinguishing aspect of the sentence. However, there are other sentence types which differ fundamentally from the above examples. Figure 3 illustrates a sentence that is one of "state" rather than of "event ." Other nets could represent statements of time, location or more complicated structures.
A verb, say, "give," has been taken as primitive, but what is the meaning of "give" itself? Is it only definable in terms of the structure it generates? Clearly two verbs can generate the same structure. One can take a set-theoretic approach and a particular give as an element of "giving events" itself a subset of ALL-EVENTS. An example of this approach is given in Figure 4 ("John, a programmer living at Maple St., gives a book to Mary, who is a lawyer"). If one were to "read" this semantic net, one would have a very long text of awkward English: "There is a John" who is an element of the "Persons" set and who is the person who lives at ADRI, where ADRI is a subset of ADDRESS-EVENTS, itself a subset of 'ALL EVENTS', and has location '37 Maple St.', an element of Addresses; and who is a "worker" of 'occupation 1'. . .etc."
The degree to which a semantic net (or any unambiguous, nonsyntactic representation) is cumbersome and odd-sounding in a natural language is the degree to which that language is "natural" and deviates from the precise or "artificial." As we shall see, there was a language spoken among an ancient scientific community that has a deviation of zero.
The hierarchical structure of the above net and the explicit descriptions of set-relations are essential to really capture the meaning of the sentence and to facilitate inference. It is believed by most in the AI and general linguistic community that natural languages do not make such seemingly trivial hierarchies explicit. Below is a description of a natural language, Shastric Sanskrit, where for the past millenia successful attempts have been made to encode such information.
(1) "Caitra goes to the village." (graamam gacchati caitra)
receives in the analysis given by an eighteenth-century Sanskrit Grammarian from Maharashtra, India, the following paraphrase:
(2) "There is an activity which leads to a connection-activity which has as Agent no one other than Caitra, specified by singularity, [which] is taking place in the present and which has as Object something not different from 'village'."
The author, Nagesha, is one of a group of three or four prominent theoreticians who stand at the end of a long tradition of investigation. Its beginnings date to the middle of the first millennium B.C. when the morphology and phonological structure of the language, as well as the framework for its syntactic description were codified by Panini. His successors elucidated the brief, algebraic formulations that he had used as grammatical rules and where possible tried to improve upon them. A great deal of fervent grammatical research took place between the fourth century B.C and the fourth century A.D. and culminated in the seminal work, the Vaiakyapadiya by Bhartrhari. Little was done subsequently to advance the study of syntax, until the so-called "New Grammarian" school appeared in the early part of the sixteenth century with the publication of Bhattoji Dikshita's Vaiyakarana-bhusanasara and its commentary by his relative Kaundabhatta, who worked from Benares. Nagesha (1730-1810) was responsible for a major work, the Vaiyakaranasiddhantamanjusa, or Treasury of dejinitive statements of grammarians, which was condensed later into the earlier described work. These books have not yet been translated.
The reasoning of these authors is couched in a style of language that had been developed especially to formulate logical relations with scientific precision. It is a terse, very condensed form of Sanskrit, which paradoxically at times becomes so abstruse that a commentary is necessary to clarify it.
One of the main differences between the Indian approach to language analysis and that of most of the current linguistic theories is that the analysis of the sentence was not based on a noun-phrase model with its attending binary parsing technique but instead on a conception that viewed the sentence as springing from the semantic message that the speaker wished to convey. In its origins, sentence description was phrased in terms of a generative model: From a number of primitive syntactic categories (verbal action, agents, object, etc.) the structure of the sentence was derived so that every word of a sentence could be referred back to the syntactic input categories. Secondarily and at a later period in history, the model was reversed to establish a method for analytical descriptions. In the analysis of the Indian grammarians, every sentence expresses an action that is conveyed both by the verb and by a set of "auxiliaries." The verbal action (Icriyu- "action" or sadhyu-"that which is to be accomplished,") is represented by the verbal root of the verb form; the "auxiliary activities" by the nominals (nouns, adjectives, indeclinables) and their case endings (one of six).
The meaning of the verb is said to be both vyapara (action, activity, cause), and phulu (fruit, result, effect). Syntactically, its meaning is invariably linked with the meaning of the verb "to do". Therefore, in order to discover the meaning of any verb it is sufficient to answer the question: "What does he do?" The answer would yield a phrase in which the meaning of the direct object corresponds to the verbal meaning. For example, "he goes" would yield the paraphrase: "He performs an act of going"; "he drinks": "he performs an act of drinking," etc. This procedure allows us to rephrase the sentence in terms of the verb "to do" or one of its synonyms, and an object formed from the verbal root which expresses the verbal action as an action noun. It still leaves us with a verb form ("he does," "he performs"), which contains unanalyzed semantic information This information in Sanskrit is indicated by the fact that there is an agent who is engaged in an act of going, or drinking, and that the action is taking place in the present time.
Rather that allow the agent to relate to the syntax in this complex, unsystematic fashion, the agent is viewed as a one-time representative, or instantiation of a larger category of "Agency," which is operative in Sanskrit sentences. In turn, "Agency" is a member of a larger class of "auxiliary activities," which will be discussed presently. Thus Caitra is some Caitral or instance of Caitras, and agency is hierarchically related to the auxiliary activities. The fact that in this specific instance the agent is a third person-singular is solved as follows: The number category (singular, dual, or plural) is regarded as a quality of the Agent and the person category (first, second, or third) as a grammatical category to be retrieved from a search list, where its place is determined by the singularity of the agent.
The next step in the process of isolating the verbal meaning is to rephrase the description in such a way that the agent and number categories appear as qualities of the verbal action. This procedure leaves us with an accurate, but quite abstract formulation of the scntcnce: (3) "Caitra is going" (gacchati caitra) - "An act of going is taking place in the present of which the agent is no one other than Caitra qualified by singularity." (atraikatvaavacchinnacaitraabinnakartrko vartamaanakaa- liko gamanaanukuulo vyaapaarah:) (Double vowels indicate length.)
If the sentence contains, besides an agent, a direct object, an indirect object and/or other nominals that are dependent on the principal action of the verb, then in the Indian system these nominals are in turn viewed as representations of actions that contribute to the complete meaning of the sentence. However, it is not sufficient to state, for instance, that a word with a dative case represents the "recipient" of the verbal action, for the relation between the recipient and the verbal action itself requires more exact specification if we are to center the sentence description around the notion of the verbal action. To that end, the action described by the sentence is not regarded as an indivisible unit, but one that allows further subdivisions. Hence a sentence such as: (4) "John gave the ball to Mary" involves the verb Yo give," which is viewed as a verbal action composed of a number of auxiliary activities. Among these would be John's holding the ball in his hand, the movement of the hand holding the ball from John as a starting point toward Mary's hand as the goal, the seizing of the ball by Mary's hand, etc. It is a fundamental notion that actions themselves cannot be perceived, but the result of the action is observable, viz. the movement of the hand. In this instance we can infer that at least two actions have taken place:
(a) An act of movement starting from the direction of John and taking place in the direction of Mary's hand. Its Agent is "the ball" and its result is a union with Mary's hand.
(b) An act of receiving, which consists of an act of grasping whose agent is Mary's hand.
It is obvious that the act of receiving can be interpreted as an action involving a union with Mary's hand, an enveloping of the ball by Mary's hand, etc., so that in theory it might be difficult to decide where to stop this process of splitting meanings, or what the semantic primitives are. That the Indians were aware of the problem is evident from the following passage: "The name 'action' cannot be applied to the solitary point reached by extreme subdivision."
The set of actions described in (a) and (b) can be viewed as actions that contribute to the meaning of the total sentence, vix. the fact that the ball is transferred from John to Mary. In this sense they are "auxiliary actions" (Sanskrit kuruku-literally "that which brings about") that may be isolated as complete actions in their own right for possible further subdivision, but in this particular context are subordinate to the total action of "giving." These "auxiliary activities" when they become thus subordinated to the main sentence meaning, are represented by case endings affixed to nominals corresponding to the agents of the original auxiliary activity. The Sanskrit language has seven case endings (excluding the vocative), and six of these are definable representations of specific "auxiliary activities." The seventh, the genitive, represents a set of auxiliary activities that are not defined by the other six. The auxiliary actions are listed as a group of six: Agent, Object, Instrument, Recipient, Point of Departure, Locality. They are the semantic correspondents of the syntactic case endings: nominative, accusative, instrumental, dative, ablative and locative, but these are not in exact equivalence since the same syntactic structure can represent different semantic messages, as will be discussed below. There is a good deal of overlap between the karakas and the case endings, and a few of them, such as Point of Departure, also are used for syntactic information, in this case "because of". In many instances the relation is best characterized as that of the allo-eme variety.
To illustrate the operation of this model of description, a sentence involving an act of cooking rice is often quoted: (5) "Out of friendship, Maitra cooks rice for Devadatta in a pot, over a fire."
Here the total process of cooking is rendered by the verb form "cooks" as well as a number of auxiliary actions:
1. An Agent represented by the person Maitra
2. An Object by the "rice"
3. An Instrument by the "fire"
4. A Recipient by the person Devadatta
5. A Point of Departure (which includes the causal relationship) by the "friendship" (which is between Maitra and Devadatta)
6. The Locality by the "pot"
So the total meaning of the sentence is not complete without the intercession of six auxiliary actions. The action itself can be inferred from a change of the condition of the grains of rice, which started out being hard and ended up being soft.
Again, it would be possible to atomize the meaning expressed by the phrase: "to cook rice": It is an operation that is not a unitary "process", but a combination of processes, such as "to place a pot on the fire, to add fuel to the fire, to fan", etc. These processes, moreover, are not taking place in the abstract, but they are tied to, or "resting on" agencies that are associated with the processes. The word used for "tied to" is a form of the verbal root a-sri, which means to lie on, have recourse to, be situated on." Hence it is possible and usually necessary to paraphrase a sentence such as "he gives" as: "an act of giving residing in him." Hence the paraphrase of sentence (5) will be: (6) "There is an activity conducive to a softening which is a change residing in something not different from rice, and which takes place in the present, and resides in an agent not different from Maitra, who is specified by singularity and has a Recipient not different from Devadatta, an Instrument not different from.. .," etc.
It should be pointed out that these Sanskrit Grammatical Scientists actually wrote and talked this way. The domain for this type of language was the equivalent of today's technical journals. In their ancient journals and in verbal communication with each other they used this specific, unambiguous form of Sanskrit in a remarkably concise way.
Besides the verbal root, all verbs have certain suffixes that express the tense and/or mode, the person (s) engaged in the "action" and the number of persons or items so engaged. For example, the use of passive voice would necessitate using an Agent with an instrumental suffix, whereas the nonpassive voice implies that the agent of the sentence, if represented by a noun or pronoun, will be marked by a nominative singular suffix.
Word order in Sanskrit has usually no more than stylistic significance, and the Sanskrit theoreticians paid no more than scant attention to it. The language is then very suited to an approach that eliminates syntax and produces basically a list of semantic messages associated with the karakas.
An example of the operation of this model on an intransitive sentence is the following:
(7) Because of the wind, a leaf falls from a tree to the ground."
Here the wind is instrumental in bringing about an operation that results in a leaf being disunited from a tree and being united with the ground. By virtue of functioning as instrument of the operation, the term "wind" qualifies as a representative of the auxiliary activity "Instrument"; by virtue of functioning as the place from which the operation commences, the "tree" qualifies to be called "The Point of Departure"; by virtue of the fact that it is the place where the leaf ends up, the "ground" receives the designation "Locality". In the example, the word "leaf" serves only to further specify the agent that is already specified by the nonpassive verb in the form of a personal suffix. In the language it is rendered as a nominative case suffix. In passive sentences other statements have to be made. One may argue that the above phrase does not differ in meaning from "The wind blows a leaf from the tree," in which the "wind" appears in the Agent slot, the "leaf" in the Object slot. The truth is that this phrase is transitive, whereas the earlier one is intransitive. "Transitivity" can be viewed as an additional feature added to the verb. In Sanskrit this process is often accomplished by a suffix, the causative suffix, which when added to the verbal root would change the meaning as follows: "The wind causes the leaf to fall from the tree," and since English has the word "blows" as the equivalent of "causes to fall" in the case of an Instrument "wind," the relation is not quite transparent. Therefore, the analysis of the sentence presented earlier, in spite of its manifest awkwardness, enabled the Indian theoreticians to introduce a clarity into their speculations on language that was theretofore un- available. Structures that appeared radically different at first sight become transparent transforms of a basic set of elementary semantic categories.
It is by no means the case that these analyses have been exhausted, or that their potential has been exploited to the full. On the contrary, it would seem that detailed analyses of sentences and discourse units had just received a great impetus from Nagesha, when history intervened: The British conquered India and brought with them new and apparently effective means for studying and analyzing languages. The subsequent introduction of Western methods of language analysis, including such areas of research as historical and structural linguistics, and lately generative linguistics, has for a long time acted as an impediment to further research along the traditional ways. Lately, however, serious and responsible research into Indian semantics has been resumed, especially at the University of Poona, India. The surprising equivalence of the Indian analysis to the techniques used in applications of Artificial Intelligence will be discussed in the next section.
A comparison of the theories discussed in the first section with the Indian theories of sentence analysis in the second section shows at once a few striking similarities. Both theories take extreme care to define minute details with which a language describes the relations between events in the natural world. In both instances, the analysis itself is a map of the relations between events in the universe described. In the case of the computer-oriented analysis, this mapping is a necessary prerequisite for making the speaker's natural language digestible for the artificial processor; in the case of Sanskrit, the motivation is more elusive and probably has to do with an age-old Indo-Aryan preoccupation to discover the nature of the reality behind the the impressions we human beings receive through the operation of our sense organs. Be it as it may, it is a matter of surprise to discover that the outcome of both trends of thinking-so removed in time, space, and culture-have arrived at a representation of linguistic events that is not only theoretically equivalent but close in form as well. The one superficial difference is that the Indian tradition was on the whole, unfamiliar with the facility of diagrammatic representation, and attempted instead to formulate all abstract notions in grammatical sentences. In the following paragraphs a number of the parallellisms of the two analyses will be pointed out to illustrate the equivalence of the two systems.
Consider the sentence: "John is going." The Sanskrit paraphrase would be
"An Act of going is taking place in which the Agent is 'John' specified by singularity and masculinity."
If we now turn to the analysis in semantic nets, the event portrayed by a set of triples is the following:
1. "going events, instance, go (this specific going event)"
2. "go, agent, John"
3. "go, time, present."
The first equivalence to be observed is that the basic framework for inference is the same. John must be a semantic primitive, or it must have a dictionary entry, or it must be further represented (i.e. "John, number, 1" etc.) if further processing requires more detail (e.g. "HOW many people are going?"). Similarly, in the Indian analysis, the detail required in one case is not necessarily required in another case, although it can be produced on demand (if needed). The point to be made is that in both systems, an extensive degree of specification is crucial in understanding the real meaning of the sentence to the extent that it will allow inferences to be made about the facts not explicitly stated in the sentence
The basic crux of the equivalence can be illustrated by a careful look at sentence (5) noted in Part II.
"Out of friendship, Maitra cooks rice for Devadatta in a pot over a fire "
The semantic net is supplied in Figure 5. The triples corresponding to the net are:
cause, event, friendship
friendship, objectl, Devadatta
friendship, object2, Maitra
cause, result cook
cook, agent, Maitra
cook, recipient, Devadatta
cook, instrument, fire
cook, object, rice
cook, on-lot, pot.
The sentence in the Indian analysis is rendered as follows:
The Agent is represented by Maitra, the Object by "rice," the Instrument by "fire," the Recipient by "Devadatta," the Point of Departure (or cause) by "friendship" (between Maitra and Devadatta), the Locality by "pot."
Since all of these syntactic structures represent actions auxiliary to the action "cook," let us write %ook" uext to each karakn and its sentence representat(ion:
cook, agent, Maitra
cook, object, rice
cook, instrument, fire
cook, recipient, Devadatta
cook, because-of, friendship
friendship, Maitra, Devadatta
cook, locality, pot.
The comparison of the analyses shows that the Sanskrit sentence when rendered into triples matches the analysis arrived at through the application of computer processing. That is surprising, because the form of the Sanskrit sentence is radically different from that of the English. For comparison, the Sanskrit sentence is given here: Maitrah: sauhardyat Devadattaya odanam ghate agnina pacati.
Here the stem forms of the nouns are: Muitra-sauhardya- "friendship," Devadatta -, odana- "gruel," ghatu- "pot," agni- "fire' and the verb stem is paca- "cook". The deviations of the stem forms occuring at the end of each word represent the change dictated by the word's semantic and syntactic position. It should also be noted that the Indian analysis calls for the specification of even a greater amount of grammatical and semantic detail: Maitra, Devadatta, the pot, and fire would all be said to be qualified by "singularity" and "masculinity" and the act of cooking can optionally be expanded into a number of successive perceivable activities. Also note that the phrase "over a fire" on the face of it sounds like a locative of the same form as "in a pot." However, the context indicates that the prepositional phrase describes the instrument through which the heating of the rice takes place and, therefore, is best regarded as an instrument semantically. cause
Of course, many versions of semantic nets have been proposed, some of which match the Indian system better than others do in terms of specific concepts and structure. The important point is that the same ideas are present in both traditions and that in the case of many proposed semantic net systems it is the Indian analysis which is more specific.
A third important similarity between the two treatments of the sentence is its focal point which in both cases is the verb. The Sanskrit here is more specific by rendering the activity as a "going-event", rather than "ongoing." This procedure introduces a new necessary level of abstraction, for in order to keep the analysis properly structured, the focal point ought to be phrased: "there is an event taking place which is one of cooking," rather than "there is cooking taking place", in order for the computer to distinguish between the levels of unspecified "doing" (vyapara) and the result of the doing (phala).
A further similarity between the two systems is the striving for unambiguity. Both Indian and AI schools en-code in a very clear, often apparently redundant way, in order to make the analysis accessible to inference. Thus, by using the distinction of phala and vyapara, individual processes are separated into components which in term are decomposable. For example, "to cook rice" was broken down as "placing a pot on the fire, adding fuel, fanning, etc." Cooking rice also implies a change of state, realized by the phala, which is the heated softened rice. Such specifications are necessary to make logical pathways, which otherwise would remain unclear. For example, take the following sentence:
"Maitra cooked rice for Devadatta who burned his mouth while eating it."
The semantic nets used earlier do not give any information about the logical connection between the two clauses. In order to fully understand the sentence, one has to be able to make the inference that the cooking process involves the process of "heating" and the process of "making palatable." The Sanskrit grammarians bridged the logical gap by the employment of the phalu/ vyapara distinction. Semantic nets could accomplish the same in a variety of ways:
1. by mapping "cooking" as a change of state, which would involve an excessive amount of detail with too much compulsory inference;
2. by representing the whole statement as a cause (event-result), or
3. by including dictionary information about cooking. A further comparison between the Indian system and the theory of semantic nets points to another similarity: The passive and the active transforms of the same sentence are given the same analysis in both systems. In the Indian system the notion of the "intention of the speaker" (tatparya, vivaksa) is adduced as a cause for distinguishing the two transforms semantically. The passive construction is said to emphasize the object, the nonpassive emphasizes the agent. But the explicit triples are not different. This observation indicates that both systems extract the meaning from the syntax.
Finally, a point worth noting is the Indian analysis of the intransitive phrase (7) describing the leaf falling from the tree. The semantic net analysis resembles the Sanskrit analysis remarkably, but the latter has an interesting flavor. Instead of a change from one location to another, as the semantic net analysis prescribes, the Indian system views the process as a uniting and disuniting of an agent. This process is equivalent to the concept of addition to and deletion from sets. A leaf falling to the ground can be viewed as a leaf disuniting from the set of leaves still attached to the tree followed by a uniting with (addition to) the set of leaves already on the ground. This theory is very useful and necessary to formulate changes or statements of state, such as "The hill is in the valley."
In the Indian system, inference is very complete indeed. There is the notion that in an event of "moving", there is, at each instant, a disunion with a preceding point (the source, the initial state), and a union with the following point, toward the destination, the final state. This calculus-like concept fascillitates inference. If it is stated that a process occurred, then a language processor could answer queries about the state of the world at any point during the execution of the process.
As has been shown, the main point in which the two lines of thought have converged is that the decomposition of each prose sentence into karalca-representations of action and focal verbal-action, yields the same set of triples as those which result from the decomposition of a semantic net into nodes, arcs, and labels. It is interesting to speculate as to why the Indians found it worthwhile to pursue studies into unambiguous coding of natural language into semantic elements. It is tempting to think of them as computer scientists without the hardware, but a possible explanation is that a search for clear, unambigous understanding is inherent in the human being.
Let us not forget that among the great accomplishments of the Indian thinkers were the invention of zero, and of the binary number system a thousand years before the West re-invented them.
Their analysis of language casts doubt on the humanistic distinction between natural and artificial intelligence, and may throw light on how research in AI may finally solve the natural language understanding and machine translation problems.
Bhatta, Nagesha (1963) Vaiyakarana-Siddhanta-Laghu-Manjusa, Benares (Chowkhamba Sanskrit Series Office).
Nilsson, Nils J. Principles of Artificial Intelligence. Palo Alto: Tioga Publishing Co
Bhatta, Nagesha (1974) Parama-Lalu-Manjusa Edited by Pandit Alakhadeva Sharma, Benares (Chowkhambha Sanskrit Series Office).
Rumelhart, D E. & D A. Norman (1973) Active Semantic Networks as a model of human memory. IJCAI.
Wang, William S-Y (1967) "Final Administrative Report to the National Science Foundation." Project for Machine Translation. University of California, Berkeley. (A biblzographical summary of work done in Berkeley on a program to translate Chinese.)
[THE AI MAGAZINE Spring, 1985 #39]