Programming

std::is_convertible<>

Written by on May 24, 2020 in C++, Programming with 0 Comments
std::is_convertible<>

The type trait is_convertible<From, To> checks if an object of type From can be “implicitly” converted to an object of type To. The expression is_convertible<From, To>::value returns true if implicit conversion is possible, else it returns false. For more details, please check out the reference. Let us look at three primary cases. Case-1: Pre-defined Types […]

Continue Reading

dynamic_cast<> vs. std::is_base_of<>

Written by on May 9, 2020 in C++, Programming with 0 Comments
dynamic_cast<> vs. std::is_base_of<>

In the last article, we looked at the std:is_base_of<T1, T2> type trait. One question that a reader asked since that article appeared is “How does is_base_of<> differ from the dynamic_cast<> operator?” Good question! In today’s post let me try to address the key differences between the two. I am not going to cover the dynamic_cast<> […]

Continue Reading

std::is_base_of<>

Written by on April 26, 2020 in C++, Programming with 0 Comments
std::is_base_of<>

In our on-going series on C++ Type Traits, today’s topic is about the trait std::is_base_of<>. For the official description, see this. std::is_base_of<A, B>::value takes two arguments, both classes (or structs), and returns true if A is a base class of B and false otherwise. Trivially, std::<A, A>::value is true. Let us look at an example […]

Continue Reading

std::common_type<> Type Trait

Written by on April 12, 2020 in C++, Programming with 0 Comments
std::common_type<> Type Trait

In today’s post, I would like to go over the type trait std::common_type<>. This trait was introduced in C++11. As per the specification, std::common_type<T1, T2, …Tn>::type refers to a type Tx in the given list, which the rest of the types in the list can be implicitly converted to. This works with built-in as well […]

Continue Reading

std::is_empty

Written by on March 28, 2020 in C++, Programming with 0 Comments
std::is_empty<T>

In the previous post, we looked at the std::is_destructible<T> type trait. Today, let us try to understand another type trait std::is_empty<T>. As per the specification, is_empty<T>::value will return true in the following cases: – The class/struct has no non-static data member – The class/struct does not define a virtual function – The class/struct does not […]

Continue Reading

std::is_destructible

Written by on March 15, 2020 in C++, Programming with 0 Comments
std::is_destructible

In the last article, I explained the deleted destructor in some detail. Today, I would like to talk about a related construct, a type trait called std::is_destructible. Type traits, defined in the header <type_traits>, are a big help when it comes to implementing template metaprogramming.  See this article for a nice introduction to type traits in […]

Continue Reading

Automatically Converting Active Voice to Passive Voice and Vice Versa

Written by on February 16, 2020 in Natural Language Processing, Programming, Prolog with 0 Comments
Automatically Converting Active Voice to Passive Voice and Vice Versa

The iLexicon system can handle active/passive voice conversion of fairly complex English sentences. I gave examples of the underlying verb conjugation mechanism in this article and this one. Today, I am going to give examples of the conversion of complete sentences. Here is an example of active to passive voice conversion: The above is a snapshot […]

Continue Reading

Distributed Computing with Linda

Written by on December 22, 2019 in Programming, Prolog with 0 Comments
Distributed Computing with Linda

Linda, originally proposed by Nicholas Carriero and David Gelernter, is a model of process communication using a small set of well-defined primitives, operating on a tuple space.  Interestingly, Sicstus Prolog comes with a library that implements Linda (both Server and Client).  I played with it a little bit and really enjoyed it. In this article, I would […]

Continue Reading

Using Definite Clause Grammars (DCG) for Information Extraction

Written by on December 8, 2019 in Natural Language Processing, Programming, Prolog with 0 Comments
Using Definite Clause Grammars (DCG) for Information Extraction

In the previous article, I showed how we can use ATNs for extracting key information from natural language text. I also pointed out in that article that Definite Clause Grammars (DCG) are a more compact formalism for doing this. That will be the focus of today’s article. For a nice introduction to DCG, read this. […]

Continue Reading

Using Augmented Transition Networks (ATN) for Information Extraction

Written by on November 23, 2019 in LISP, Natural Language Processing, Programming with 0 Comments
Using Augmented Transition Networks (ATN) for Information Extraction

After Wood’s paper [1], Augmented Transition Networks (ATN) became popular in the 1970s, for parsing text. An ATN is a generalized transition network with two major enhancements: Support for recursive transitions, including jumping to other ATNs Performing arbitrary actions when edges are traversed Remembering state through the use of registers See the “Further Reading” section at […]

Continue Reading

Top