Programming

C++17: std::optional<>

Written by on November 21, 2017 in C++, Programming with 0 Comments
C++17: std::optional<>

Suppose we want to write a function that returns a value, but with the possibility that  the computation might fail. This failure can be represented as an exception, or as a return value that unamibiguously denotes failure (for example, -1). Throwing an exception is a strong form of failure and might not be appropriate in […]

Continue Reading

C++17: std::variant<>

Written by on November 5, 2017 in C++, Programming with 0 Comments
C++17: std::variant<>

C++17 introduces a new type-safe union in the form of std::variant. At any time, it can store a single value from one of many types. We need to include <variant> to use this feature. Let us look at a simple example to get started: First, we define a variant object v1 to hold either an int […]

Continue Reading

C++17: Initialization in Selection Statements

Written by on October 21, 2017 in C++, Programming with 0 Comments
C++17: Initialization in Selection Statements

C++17 enhances if and switch statements with the ability to define  variables whose life-time is limited to the corresponding scope. This is in keeping with the general guideline that variables should have a tight scope, i.e.,  should be defined as close to the point of use as possible and should not live beyond where they […]

Continue Reading

Using Function Calls in the Grammar

Written by on October 14, 2017 in LISP, Natural Language Processing, Programming with 0 Comments
Using Function Calls in the Grammar

One of the advanced features of iLangGen is the ability to embed arbitrary function calls on the RHS of grammar rules. Such functions impart interesting dynamic behaviour to the generated data. For convenience and flexibility, iLangGen supports two types of function calls – Direct and Indirect. In the case of the Direct function call, the […]

Continue Reading

Reuse of Grammars Through Inheritance

Written by on September 13, 2017 in LISP, Natural Language Processing, Programming with 0 Comments
Reuse of Grammars Through Inheritance

We are familiar with the advantages of class inheritance in object-oriented languages such as C++, C#, Java, and Python. The ability to reuse functionality via inheritance allows us to express our software design optimally, without having to write redundant code. iLangGen encourages the reuse of grammars by supporting Grammar Inheritance, where a grammar can explicitly […]

Continue Reading

Repetition in Grammar Rules

Written by on August 18, 2017 in LISP, Natural Language Processing, Programming with 0 Comments
Repetition in Grammar Rules

Many times, we need to repeatedly generate an element, or in general, have a way to control the number times one or more elements get generated. iLangGen supports all the standard cases: – Zero or once – Zero or more times (unbounded) – Zero or more times (bounded) – One or more times (unbounded) – […]

Continue Reading

Text Generation Using iLangGen Framework

Written by on August 6, 2017 in LISP, Natural Language Processing, Programming with 0 Comments
Text Generation Using iLangGen Framework

The two primary areas in Natural Language processing are Natural Language Understanding and Natural Language Generation. The former is concerned with processing and making sense of natural language text, whereas the latter is concerned with synthesizing text, possibly from some deep representation. Both are fascinating and at the same time, challenging, areas of research. The […]

Continue Reading

CLPython: Python in Common Lisp – Part 2

Written by on July 22, 2017 in LISP, Programming, Python with 0 Comments

We looked at the basic features of CLPython in our last blog. In today’s post let us look at the support for Python classes. PYTEST 130 > (defun pyclass ()   (run  “class Employee:    def __init__(self, name, dept):      self.name = name      self.dept = dept    def dump(self):      print ‘Name […]

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

Top