This may be the wrong place to be asking this, but I'm not entirely sure what kind of advantage using a language like Prolog gives you over an Object-Oriented language like Python. Also, is there a reason why Prolog is popular in both linguistics AND ai? I assume the two fields are connected.

  • 1
    I know a few linguists who have used Prolog (I'm one), but none who currently do. Most use Unix utilities, Perl, Python, or special purpose languages like Praat or R. The canonic language for AI is Lisp, but Prolog is an orthodox alternative; however, there are easier languages to program in, and O-O languages are widely-used there as well. Be careful with "popular" when applied to programming languages -- it refers to popular regard, not necessarily to popular usage. – jlawler Jul 22 '14 at 17:09
  • 1
    The big advantage with Prolog AFAIK is transparent backtracking -- if one solution doesn't work, try another. This makes some algorithms easy to implement. I have friends who use Java, Haskell, Python, Scala, Clojure, Go, etc. I'm not sure if any one language can be considered "popular" in NLP. – prash Jul 22 '14 at 20:46
  • I would say these languages are popular for natural language processing in a more important way than for computational linguistics. – hippietrail Jul 25 '14 at 2:44

Imperative programming languages perform the instructions in the order you specify. Procedural languages (e.g. C) are imperative languages that allow you to group instructions into named blocks called functions or procedures. Object orientated languages like C++, Java and Python extend procedural languages with additional features.

Prolog works in a completely different way to imperative languages. With prolog, you define facts, e.g. noun(Tom).. You can also define rules that infer things from other things (i.e. define relationships). These then allow you to perform queries on an input given the facts and rules in the system.

A use case for Prolog in computational linguistics would be in constructing syntax trees from a given sentence. The facts would be the part of speech classification for each word, and the rules would be how the parts of speech group together in syntax tree constructs (e.g. noun phrases).

Prolog (and related languages) are popular for a type of AI approach called an expert system (of which the syntax tree construction above is an example). Expert systems have been applied to different domains, e.g. medical diagnostics, to varying degrees of success.

The reason why languages like Prolog are popular for writing expert systems is that they are specifically constructed for writing expert systems, so you don't have to write a lot of boilerplate or repeated code as you would in another programming language. In computer science, this is an example of a domain-specific language -- kind of like how different fields define their own words and their own terminology for things.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.