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

Composition of Grammars

Written by on September 27, 2017 in LISP, Natural Language Processing with 0 Comments
Composition of Grammars

In the last post, we saw how iLangGen text generation framework supports reuse of grammars through inheritance, akin to object-oriented languages. The good news is that we can achieve reuse through composition as well. The following is a simple grammar, nothing fancy to elaborate. Here is the output when you traverse the grammar without AST. […]

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

KP Astrology REST API

Written by on August 30, 2017 in Astrology, C++ with 0 Comments
KP Astrology REST API

In today’s post I want to share my experience in implementing a set of REST API calls for Astrology. The series on iLangGen will resume after this. As readers of this column probably know, I am the author of an Astrology software called KPAstro. You can read about it here. First released in the year […]

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

Top