A Prolog Perspective Natural Language Processing English Language Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.


Natural Language Processing (NLP) based on vast characteristics tries to explore that even a language such as English despite being simple and straightforward can be extremely useful in computer science field. Gone are the days when humans wanted computers to behave in a similar fashion as human. Today NLP has emerged as a giant leap in Computer Science as well as other science for example computational linguistics, speech recognition, etc. It can be rightly said that at present computers behave almost like a human being by carrying out tasks such as processing large data, understanding human behavior and analyzing it. Some NLP based computer programs are still restricted to few domains. But the increase in availability of information on internet to large number of computer users has focused many people's attention towards NLP tasks such as speech and voice control, spelling and text checking, interactive voice response (IVR) , machine translation.

Prolog and NLP

Prolog is a programming language contains facts and rules relating object of the problem to one another. Prolog's engine computes meaning of program from the set of logical consequences. According to authors Pereira and Shieber Prolog's development was due to design and construction of a language used for human-computer interaction based systems where languages can be easily understood. That is why these authors chose Prolog over other existing languages for solving many discrete NLP problems.


With the use of Prolog a list of syntactic and semantic structure is built where Prolog helps in identifying meaning of words in a sentence. Thus a semantic structure is generated. This natural language understanding technique can be used in many places. We will be using this technique here as well. We will use this semantic structure to find out meaning of the sentence.

Syntactic Analysis: in this a parse tree is constructed based on syntactic rules. With a given set of rules a parse is generated which can be used in a system. This is done to achieve the meaning of a sentence by organizing sentence into sF tactic units and by checking it's validity.

Syntax Analysis: the syntax rules which are recursive are easily handled by Prolog. These rules generate clauses for the sentence. They can be either major, which can be expressed in detail, in a form of a question , and extremely necessary. It can be secondary which is part of another unit and it's cache is that begins with a word indicating quantity of sentence. The syntax rules are also helpful in developing rules for noun and verb clauses as well. [2]

We will consider few sentences to demonstrate the syntax analysis. For example : "mary ate these mango" , the syntax of sentence is wrong because the noun "mango" and adjective "these" are different. This needs the sentence to be restructured because of the non matching of the words in the sentence. Similarly another example: "he love good food" is also wrong in terms of syntax because the word "he" is singular and the word "love" is plural so words do not match syntactically so it also needs to be restructured. [3]

Design for a prolog system is shown in figure above. In figure the developer of the software creates rules and ontologies . This is then translated into prolog code . Finally a set of general rules are formed to create a prolog program and then a user can do the queries and get results out from the software. [6]

If a user queries online the response time for translating queries into prolog can be summarized in a table shown below:-


NLP in Prolog: a natural choice?

Despite the criticisms, Prolog has emerged as a strong general purpose logic programming language and proved itself as a suitable programming language with many NLP tasks. But there are still few questions that remain to be answered such as: "Why users of NLP should consider Prolog as first choice to process natural language?" Also "Is Prolog a suitable programming language or not?

These few questions remain to be answered and in this section we will provide some matter to assist in answering these questions.

Prolog has many advantages which is in-built, syntax and semantic rules provide great assistance to prove that Prolog is still the right choice. In comparison with programming languages like java and C/C++ , Prolog is simple and can be easily understood. The syntax and semantic rules are simple and straightforward which makes Prolog much more simpler to handle. Prolog has one built in datatype called term. It contains variable, compound term and atom. To form complex queries and relations all the three things in a term are combined. To determine Prolog's simplicity we take an example, a word "house" which is a noun Prolog represents it as noun(house). Another representation can be a binary relation word _class (house, noun). [4]

Some issues which still arise are:

Text represented by a prolog software seems to have no limit on length of atoms .

The results from a program often seem to be clear but with XML there are results being unclear.

There is loss of information when the conversion takes place in the software. [7]

Most Prolog programmers use query interface to increase the efficiency of the system therefore in a query using prolog the facts are directly related to the query. Prolog using SQL gives the solution to a query one tuple at a time rather than set of tuples. Though the solutions in a prolog software is quick but it requires a lot of effort in terms of generating rules. This becomes more difficult when there are complex queries. [8]

Steps involved in prolog query are:-

Defining a schema for a relation.

Modification of the base facts to a collection of facts.

Implementation of the base facts by a programmer. [8]

Advantages of prolog: In case of parallelism, the prolog programming reduces execution time by leaps and bounds without even with the involvement of programmer. Large complex applications get translated in short time which otherwise may take several days or hours.

There has been a debate in prolog in terms of rules . Most programmer say that there is a limit in terms of rules of prolog but in the past years it has been proved that rules defined in prolog are wide and broad enough that there is no limit on it. [9]

The use of prolog in web applications using HTTP is that it parse and produce documents such as HTML and XML.

Latest developments

The increase in the projects in Brazil there was a need for a prolog software for Portuguese speaking market so Meridian systems came with an offer for a new Portuguese language for prolog in Brazil. [5]


Recent researches have proved that Prolog can be suitable with respect to certain NLP tasks and although it is a language rooted in formal logic, Prolog has advanced significantly and can be considered a general purpose programming language.