Tag: Definite Clause Grammar

Definite Clause Grammars in Lisp – Part 4

Written by on June 12, 2022 in LISP, Natural Language Processing, Programming, Prolog with 0 Comments
Definite Clause Grammars in Lisp – Part 4

In a series of articles written earlier, I had shown how it is possible to model Definite Clause Grammars (DCG) in LispWorks Lisp (Enterprise Edition). We use defgrammar in Common Prolog (available as part of KnowledgeWorks package) to define our grammar rules. Here is a toy English grammar represented using defgrammar: This corresponds to the following Prolog […]

Continue Reading

Sentence Negation

Written by on July 18, 2021 in Natural Language Processing, Programming, Prolog with 0 Comments
Sentence Negation

In the last article, I talked about determining sentence types automatically. Another interesting task is to generate the “negation” of a given sentence. Example-1: Sentence => “My teacher lives nearby” Negation => “My teacher does not live nearby” Example-2: Sentence => “She did not like that speech” Negation => “She liked that speech” I have […]

Continue Reading

The Structure of WH-Questions

Written by on May 23, 2021 in Natural Language Processing, Programming, Prolog with 0 Comments
The Structure of WH-Questions

WH-Questions are questions that begin with the following words: – Who (“Who came here yesterday?”) – What (“What is the goal of this project?”) – When (“When can I visit my parents?”) – Where (“Where did he go?”) – Why (“Why is everyone running away?”) – Which (“Which is the book you recommend?”) – How […]

Continue Reading

Definite Clause Grammars in Lisp – Part 3

Written by on June 23, 2017 in LISP, Natural Language Processing, Programming with 0 Comments
Definite Clause Grammars in Lisp – Part 3

In today’s post, let us see how we can enhance the grammar representation discussed so far to include both Number constraint and Parse Tree. Fortunately, this turns out to be quite straightforward. Just as we do in Prolog, we need to include additional parameters, as needed, to each grammar rule. In the earlier two posts, […]

Continue Reading

Definite Clause Grammars in Lisp – Part 2

Written by on June 4, 2017 in LISP, Natural Language Processing, Programming with 0 Comments
Definite Clause Grammars in Lisp – Part 2

In the last post, I showed how we can implement DCGs in LispWorks using the KnowledgeWorks package. The grammar discussed in that post did not take into account subject/predicate number agreement. This is one of the basic constraints in English grammar. Today I will show how easy it is to encode this constraint. Here is […]

Continue Reading

Definite Clause Grammars (DCG) in Lisp

Written by on May 22, 2017 in LISP, Natural Language Processing, Programming with 0 Comments
Definite Clause Grammars (DCG) in Lisp

Definite Clause Grammars (DCG) are an elegant formalism for specifying context free grammars, and part of their popularity is due to their support in the Prolog language. Most books on Natural Language processing usually include a brief coverage of DCGs, even though Natural languages are not context-free. Because of the ability to attach arbitrary actions […]

Continue Reading

Top