leafleafleafDocy banner shape 01Docy banner shape 02Man illustrationFlower illustration

Introduction to Python AI (Artificial Intelligence)

Estimated reading: 7 minutes 39 views

AI is short for artificial intelligence, and it is a new technological science. This tutorial is a brief introduction to artificial intelligence.

Introduction to Artificial Intelligence Technology

Simply put, Artificial Intelligence (AI) is the technology that enables machines to perform intelligent tasks like humans.

In 1956, several famous scientists in the United States held an academic conference at Dartmouth College in the United States, and put forward the term and concept of “artificial intelligence” for the first time. This conference marked that artificial intelligence officially became a discipline. In fact, before the advent of computers, people imagined that a machine could realize human thinking, help people solve problems, and even have higher intelligence than humans.

With the invention and popularization of computers, computing technology has developed into many sub-disciplines according to its different application fields, such as multimedia, computer-aided design, database, computer network communication technology, etc. At this time, artificial intelligence has become a part of computing science. At the same time, it has gradually become an intersecting field of many disciplines such as computational science, biology, psychology, and neuroscience.

The research and development of artificial intelligence has experienced several twists and turns, including the golden period from the 1950s to the 1970s, and the trough and winter of the next 20 years. Until the 1990s, when humans first failed in chess with machines, artificial intelligence came into people’s attention again and received more attention, which gradually ushered in its spring.

Since then, artificial intelligence science has started to make breakthroughs one after another in “fighting wits” with humans:

  • In 2011, IBM’s Watson Robot AI program beat humans on a TV quiz show.
  • In 2016, AlphaGo defeated Go world champion Lee Sedol.
  • In 2017, AlphaGo defeated Chinese chess player Ke Jie.

Once again, artificial intelligence has aroused great concern and even human anxiety. People seem to see the possibility of artificial intelligence surpassing human intelligence. The scientific research of artificial intelligence has also set off an upsurge again, and more people have begun to study the application of computer software and hardware to simulate some intelligent behaviors of human beings, and construct a system with certain intelligence, so as to replace human beings to engage in corresponding physical and mental work.

Today, in our life, artificial intelligence has been applied in various forms, in a wide range of fields, and in different degrees, such as speech synthesis, speech recognition, natural language processing, autonomous driving, image recognition, face recognition, data analysis, and so on.

If you are still a little unfamiliar with these fields, then we will give you some examples in life, you will understand, voice and picture search and shopping on Taobao, WeChat voice-to-text conversion, iFLYTEK’s translation pen, Siri application in iPhone , artificial intelligence customer service on e-commerce websites, and various robots with different degrees of intelligent functions… All these applications are inseparable from the support of artificial intelligence technology. Artificial intelligence has become a technology that our daily lives increasingly rely on.

Python – the language of artificial intelligence

Python is known as the “glue language”, which shows its wide range of applications and scenarios. Fans of Python even call it “the most beautiful” programming language. Although people have a lot of praise for Python, it is undeniable that Python applications are everywhere from the cloud, the client, to the IoT terminal, and Python is also recognized as the preferred programming language for artificial intelligence applications.

In the field of artificial intelligence, the Python programming language has the following inherent advantages:

  • Python is open source, has strong community support, and has high-quality and informative documentation.
  • Python is platform independent and can be used on Windows, Linux and UNIX platforms. This good platform compatibility makes Python very popular.
  • Compared to other object-oriented programming languages, Python has a simple syntax and is easier to learn. Therefore, Python has also become the language of choice for children to learn programming.
  • Python has a very rich set of third-party libraries. When writing programs in Python, its third-party libraries greatly expand Python’s capabilities and application areas.

Third-party libraries for Python target a wide variety of specialized application areas, such as various Python Imaging Library libraries for image processing, VTK and Maya 3D, etc., Numpy, Scientific Python, etc. for numerical and scientific computing, supporting machine scikit-learn, PyBrain, PyML, etc. for learning, NLTK, jieba, etc. for natural language processing.

Therefore, it can be said that as long as you learn and master the Python language, you will have a unique advantage in developing related applications of artificial intelligence.

We expect artificial intelligence to have the ability to analyze, process and understand language and words, so as to realize the interaction between humans and machines, and the research fields and technologies that realize this ability are collectively referred to as Natural Language Processing (NLP), As shown in Figure 1.
Python - the language of artificial intelligence
figure 1
Natural language processing is one of the most important technologies in the information age. Some of our common products, such as machine translation, question answering systems, chat robots, sentiment analysis, etc., are applications of natural language processing in different fields. More generally, natural language processing refers to the ability of machines to understand and interpret the way humans use words and language, and the goal of natural language processing is to make computers as intelligent as humans in understanding language and words.

As mentioned earlier, Python has been used in various branches of artificial intelligence, and it is impossible for us to introduce them one by one. In the next section, we select the application direction of NLP, and introduce how to use Python to implement Chinese word segmentation for NLP through a simple example.

In the process of NLP, in order to better deal with sentences, it is often necessary to split sentences into words one by one, so that the characteristics of sentences can be better analyzed. This process is called word segmentation. Word segmentation is the basis of NLP, and the accuracy of word segmentation directly determines the quality of subsequent part-of-speech tagging, syntactic analysis, word vector and text analysis (these are other steps of NLP).

Because Chinese sentences are not naturally self-separated like English, and there are various phrases, Chinese word segmentation is difficult to a certain extent. However, there are already many tools that can help us achieve basic Chinese word segmentation. Jieba is a Chinese word segmentation module implemented in Python. It is well-known in the field of Chinese word segmentation and supports simplified and traditional Chinese. Advanced users can also add custom dictionaries to improve the accuracy of word segmentation.

But before using jieba for word segmentation, we need to install it. Let’s install the jieba library.

Installation of the Python jieba library

Installing the jieba library also requires the pip tool. We used this tool to install Pygame when we introduced Pygame earlier.

After confirming the connection to the Internet, enter “pip install jieba” on the command line and press the Enter key to execute the installation, as shown in Figure 1.

pip install jieba
figure 1
Then wait until the installation progress reaches 100%, and it prompts that the jieba library is installed successfully, and the version is 0.39, as shown in Figure 2.

jieba library installed successfully

Leave a Comment