Chatbots are the computer programs that could mimic human conversation using text or auditory methods. Chatbots are used for various purposes such as customer service and information acquisition. I am creating a chatbot that would give replies for domain specific queries. For this chatbot I will be using the AIML language. AIML allows you to easily create a chatbot from scratch.
AIML is an XML compliant language that is easy to learn. AIML was developed by Dr.Richard Wallace for creating the ALICE bot. So lets learn some basics of AIML before starting to develop a chatbot. Some of the basic tags in an AIML program are :
<aiml></aiml> – the tag that is used to begin and end an AIML program
<category></category – basic unit of knowledge
<pattern></pattern> – contains a pattern that matches what user inputs
<template></template> – contains the response for a particular matched pattern
In this tutorial we will be trying to create a basic chatbot by following the documentation given at the AIML website. Also we will be creating our bot in python language using aiml package. Also we may apply some basic NLP techniques using the python NLTK package.
Today I came through a concept called aliases in linux. It was pretty interesting topic. An alias is a command that is user-defined built from other commands. For eg, you could build an alias by,
$ alias aliasName=’command1; command2;’
After that you could enter this alias name in the terminal to execute the commands in chain.
.bashrc is a hidden file which is located in your home directory. Some linux based operating systems have them by default, but sometime they are not created by default. If not already present, then you can create it yourself. But remember to create it in the home directory. ‘.bashrc’ is a shell script that is automatically executed by terminal session, whenever it is started. ‘.bashrc’ file allows you to create permanent aliases.
The problem with alias is that they are temporary by default, means aliases will only execute for one terminal session in which it was created. If you create an alias and close the terminal, and then you opened a new terminal session, the previous alias you created won’t work in the new terminal session.
So inorder to solve this problem we need to create permanent alias. For creating permanent alias, simply copy your alias command and paste it into the .bashrc file. So each time you open a new terminal session, the .bashrc file will create your alias for you.
While reading a book on linux ( The linux command line ), I came through the concept of links. There are two types of links in linux, hard link and symbolic link. The latter was created to overcome the limitations of the former.
The hardlinks was the method adopted by the earlier linux versions. It was the original way of creating a link in linux. Every file will have a filename, by default this filename is attached to the file using a hardlink, therefore every file has a hardlink by default. Now coming to the limitations of hardlink.
A hardlink can be created by using the following command.
$ ln file linkname
A hardlink can be removed by using the following command.
$ unlink linkname
Now the awesome part of the links is that whenever you make any changes to content of the link, it is automatically applied to the file.
The symbolic links allows you to create links to the directories as well. Also it allow you to create a link that can reference a file outside it’s own filesystem.
A symlink can be created by using the following command.
$ ln -s <directory/file> linkname
A symlink can be removed by using the following command.
$ unlink linkname
Git as you all know is a version control system created by Linus Torwalds. Linus Torwalds is the creator of the linux OS. He created git for easing the development of linux kernel. A version control system is a software that keeps tracks of all the version s of a file. Different versions of a file are generated when changes are made to the particular file.
I came to use git recently, when i started developing miniproject for my BTECH course. I am pretty noob to git. But with my limited knowledge of git I am able to perform basic operations of git. I have an account in github.com which is a website i use to store my repositories. Each time I do a git push to my origin master I need to perform authentication with the github.com server. This gradually got boring because each time I push, I need to enter my username and password.
But git has a feature that could avoid this boring process of authentication each time. This feature of git can be enabled by entering the following commands in the command line.
$ git config credential.helper store
$ git push https://github.com/<username>/<repoName.git>
$ Username : <type your username>
$ Password : <type your password>
After you perform the above commands, you can push to your repository without authenticating each time. The ‘credential.helper store’ allows you to store the username and password in .git-credentials file as plaint text. Most developer tell this method is inefficient, but I find it useful.
For more reference on the topic, visit https://git-scm.com/docs/git-credential-store
Being a linux user, you may be familiar with terminals. Terminals are used to enter commands that could perform some functions. In windows, there is something called batch programs that allow you to execute the windows cmd commands one by one. Shell programming allow you to create script files that are programs on their own. These scripts can execute a chain of commands. Shell programming also allow you to use normal programming constructs like for, while, if etc..
Shell is basically an interface between us and unix kernal. It converts the commands we enter into something the kernal could understand. Kernal is what that manages resources in our linux OS. Most of linux operating system provide it’s users with a shell program from the GNU project called the ‘bash’. The bash is the acronym for ‘bourne again shell’. For the graphical user interface, there is another program called the terminal emulator which is supplied for interaction with the shell.
PHP error reporting displays error messages if there are any errors present in the code while running it like parse errors, runtime error etc.. The error reporting can be configured in php.ini file which is the PHP initialization file. In the php.ini file if we navigate to the error reporting section we could see that there are different type of the error level constants present which can be used to display different kinds of errors. This error level constants can be controlled by the bitwise operators
| bitwise OR
^ bitwise XOR
& bitwise AND
~ bitwise NOT
! boolean NOT
By default, PHP is set to take action on all errors, notices and warnings EXCEPT those related to E_NOTICE and E_STRICT, which together cover best practices and recommended coding standards in PHP. For performance reasons, this is the recommend error reporting setting. Your production server shouldn’t be wasting resources complaining about best practices and coding standards. That’s what development servers and development settings are for.
Error Level Constants:
E_ALL – All errors and warnings (includes E_STRICT as of PHP 5.4.0)
E_ERROR – fatal run-time errors
E_RECOVERABLE_ERROR – almost fatal run-time errors
E_WARNING – run-time warnings (non-fatal errors)
E_PARSE – compile-time parse errors
E_NOTICE – run-time notices (these are warnings which often result a bug in your code, but it’s possible that it was intentional (e.g., using an uninitialized variable and relying on the fact it is automatically initialized to an empty string)
E_STRICT – run-time notices, enable to have PHP suggest changes to your code which will ensure the best interoperability and forward compatibility of your code
E_CORE_ERROR – fatal errors that occur during PHP’s initial startup
E_CORE_WARNING – warnings (non-fatal errors) that occur during PHP’s initial startup
E_COMPILE_ERROR – fatal compile-time errors
E_COMPILE_WARNING – compile-time warnings (non-fatal errors)
E_USER_ERROR – user-generated error message
E_USER_WARNING – user-generated warning message
E_USER_NOTICE – user-generated notice message
E_DEPRECATED – warn about code that will not work in future versions of PHP
E_USER_DEPRECATED – user-generated deprecation warnings
The usage of the error level constants can be found in the php.ini file. In the php.ini file go to the error handling and logging section to see the common usage techniques of these error level constants.
All these error constants are assigned to a variable called error_reporting.
If you come up with any doubts while reading through the php.ini file please feel free to comment. Also like always I welcome all the suggestions. Thank you.
In this series, we would be trying to learn some basics of PHP and also some advanced stuff. By the end of this series we would try to implement a to-do list application which will support single user. Being a newbie to PHP programming, I will also be learning along this series of blog posts. So what is PHP? PHP is a server side scripting language. PHP means PHP hypertext pre-processor which is a recursive acronym that means an acronym containing another acronym inside it. The PHP inside it stands for personal homepage as initially it was called. PHP was originally created by Rasmus lerdorf in 1994.
I won’t be covering any other installation methods because it may found easily on Google. But instead I will covering how I installed PHP in my computer for learning purpose. To run PHP locally we need a web server. For this I installed WAMP web server. Installation of WAMP webserver is pretty much standard as you can download the executable from their website and install it simply by pressing next at each dialogue box until the installation is finished. After the WAMP webserver is installed you need to start the server in order to access the WWW directory of the webserver. WWW directory is where the source files of the PHP application or HTML or css files are kept. So whenever you want to test a PHP file, copy the PHP file to the WWW directory and open it in the web browser. WAMP server is an application stack that contains several applications to run PHP files. WAMP server stands for windows, apache, mysql, PHP server.
So that’s it for the first post on this series. But I know lot of you may have doubts regarding the installation process feel free to ask me through the comment section. Also I appreciate your suggestions and feedback’s too.
Well this is my first blog post. My name is George J Padayatti. It’s been lot many years that I have started my independent journey of acquiring knowledge. It was that moment when I got my first computer, I realised I need to know more about how the programs in a computer work and how are they build. So I decided to choose computer science as my passion. But today I find, I had been wasting my time because I didn’t have a clear path defined to establish my goals to follow my passion. But I have decide to change the way I work.
George J Padayatti