A Report On In The Field Computer Science 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.

In the field of computer science and artificial intelligence, logic programming has proved very important and appropriate for solving problems in natural-language processing.

Natural language is a language used by human for communication and for exchange of ideas. A Natural-language-processing programs allow a user or aprogrammer to communicate with a computer in the user's natural language with the help of artificial intelligence.

The computer can both understand and respond to commands given in a natural language.

Computer languages are artificial languages are developed so that user can give instructions to the computer and enabling them to communicate with each other.

By programming computers via computer languages like C,C++,PRLOG,LISP etc can respond to our natural languages

But there are many problems in trying to make a computer understand people or user's instruction and commands.

Four problems that can cause misunderstanding are:

  1. AMBIGUITY-confusion over what is meant due to multiple meanings of words and phrases.
  2. IMPRECISION-thoughts are sometimes expressed in vague and inexact terms.
  3. INCOMPLETENESS-the entire idea is not presented, and the listener is expected to "read between the lines."
  4. INACCURACY-spelling, punctuation, and grammar problems can obscure meaning.

To solve these problems, natural language processing programs seek to analyze:

  1. syntax-the way words are put together in a sentence or phrase
  2. semantics-the derived meaning of the phrase or sentence
  3. context-the meaning of distinct words within a sentence.

WORKING OF NLP PROGRAM:

  1. a sentence is typed in on the keyboard
  2. if the program can derive meaning-that is, if it has a reference in its knowledge base for every word and phrase-it will respond, more or less appropriately.

EXAMPLE:

Computerized card catalogue available in many public libraries.

The four choices for looking up information in main menu are:

  • search by author
  • search by title
  • search by subject
  • search by keyword.

If we want a list of books on a specific topic or subject then we will type the appropriate phrase. We ask the computer to tell available material on the topic.

The computer also responds in a English in a fraction of seconds. it will display a list of books along with call numbers so that we can find what we need.

CONVERTING ENGLISH TO PROLOG FACTS AND RULES:

It is very simple to convert English sentences and facts to PROLOG equivalents.

Different facts that can be represented in PROLOG are:

ENGLISH:

  • The cakes are delicious.
  • The pickles are spicy.
  • Biryani is delicious.
  • PROLOG:

  • delicious (cakes).
  • spicy (pickles).
  • delicious ( biryani ).
  • Different rules that can be represented in PROLOG are:
  • ENGLISH:

  • Mary likes food if they are delicious.
  • John likes food if they are spicy.
  • PROLOG:

  • likes (mary, Food) if delicious (Food).
  • likes (john, Food) if spicy (Food).
  • Note: Variables begin with an upper case letter. here the variable is 'food'.The constant like mary and pickle begin with lower case letters.

    While writing in PROLOG we can replace if by :- and ands by commas(,).Every rule must be terminated by a .(period).

comments could be in any of the form:

  1. % this comments only this line
  2. /*this comments everything in between the astericks and the slashes*/

GOALS:

After the compilation of the program it is ready to accept goals which are more likely queries.

For example:

Which food items are delicious?

In PROLOG terminology,it is called as goal and is represented on the ? as ?-delicious(Food).

Goals also end with . (period)

PROLOG TERMINOLOGY

  • ANCESTOR

A goal's parent or its parent's parent is called as ancestor of a goal

For example if we have the following database:

a :- b.

b :- c.

c :- d.

then a, b, and c are ancestors of d.

  • ANONYMOUS VARIABLE

a variable that is written in a special way in order to show that it is different from every other variable in the clause is called as an anonymous variable. It is written as '_'.

If we consider the following clause

a( _ , _ ).

So there are two variables whose values we are not interested in.

Here, a(X, _).

There is only one variable.

  • ARGUMENT

The terms which are written in brackets after clause is called as an argument of a goal or query.

The arguments of a (1, two, Three).

Are 1, two, and Three.

  • ARITY

The number of arguments a goal or query has is called as arity of a goal or query. The arity of: a(1, two, Three). is 3.

  • ATOM

Anything in a clause that begins with a lower case letter and consists only letters, numbers, and the underscore character is called as an atom.

For example:

  • two is an atom
  • 1 is not an atom
  • Three is not an atom
  • BACKTRACK

When PROLOG tries to find another solution to a goal and answer is no to that goal then it returns to the previous goal. This phenomenon is called as backtracking.

For example:

a(1).

a(2).

b(2).

and ask goal as:

?- a(X), b(X).

then a(X) succeeds with X equal to 1and b(1) fails.

Thus, PROLOG backtracks to find another solution for a, finding X = 2.

  • BUILT IN PREDICATE

If PROLOG can answer queries and goals without any use of information given by the user then those predicate are called as a built in predicate.

  • CLAUSE

a piece of information in PROLOG which is used to establish whether a goal/query is true or not is called as clause. It will either say that a certain query is true, or that it is true under certain conditions:

a(1).

a(X) :- b(X).

are both clauses.

  • CONSULT

If we record all the clauses in PROLOG's database so that they can be used for answering the questions in future is called as consulting..

  • FACT

A clause that is unconditionally true, that is once the clause has been matched the goal is proven is called as fact.

For example:

a(1) is a fact, but

a(X) :- b(X)

is not a fact.

  • FUNCTOR

A part of a goal or query that comes before the '( ' is called as functor. Functors should obey same naming rules as atoms.

  • PARENT

When PROLOG tries to establish a goal, it sometimes uses a rule that causes it to try other goals in the tail. The former goal is called the parent of the latter.

  • PREDICATE
  • A collection of a clauses who have the same functor and arity is called as predicate.

    for example: length/2 findall/3

  • PROMPT
  • The symbol, usually ?- used to indicate that PROLOG is waiting for the user to type in a query or goal is called as prompt.

  • QUERY
  • A query and a goal is same but the term query is more used for a goal entered by the user.

  • RELATION
  • A predicate with arity greater than 1 is called as relation.

    For example:

    christian(carlton).

    christian is a property

    But in likes(masoud, books).

    likes is a relation.

  • RULE
  • a clause with one or more conditions is called as rule. Thus

    a(X) :- b(X). is a rule but

    a(1). is not rule.

  • STRUCTURE
  • Something that can be decomposed into simple elements is called as structure. Atoms, integers, real numbers and strings are simple elements whereas lists and trees, for example, are structures.

  • TAIL
  • The part after the ':-' is called as tail of the rule.

    For example: a :- b, c, d.

    is b, c, d. b, c and d are called tail goals.

  • TOP-LEVEL INTERPRETER
  • The part of the PROLOG system that accepts queries from the user and prints the answers is called as top-level interpreter.

  • VARIABLE
  • Something in PROLOG that has not been assigned a value or whose value has been removed by backtracking is called as variable.Variables begin by an upper case character or underscore character ('_') as the first character, and may be followed by letters and digits.

For example:

X is a variable

Var is a variable

_123 is a variable

_var is a variable

1 is not a variable

3_Four is not a variable

aTOM is not a variable

here _ is a special type of variable known as anonymous variable.

GOAL OF SYMBOLIC LANGUAGE:

One of the main goals of the development of symbolic logic has been to capture the notion of logical consequence with formal, mechanical, means. If the conditions for a certain class of problems can be formalized within a suitable logic as a set of premises, and if a problem to be solved can be stated as a sentence in the logic, then a solution might be found by constructing a formal proof of the problem statement from the premises.

REFERENCES:

  1. www2.dcs.hull.ac.uk/NEAT/dnd/AI/prolog_glossary.html
  2. www.dai.ed.ac.uk/groups/ssp/.../quickprolog/node5.html
  3. en.wikipedia.org/wiki/Natural_language_processing
  4. www.aaai.org/AITopics/html/natlang.html