Reader small image

You're reading from  Hands-On Artificial Intelligence for Search

Product typeBook
Published inAug 2018
Reading LevelIntermediate
PublisherPackt
ISBN-139781789611151
Edition1st Edition
Languages
Right arrow
Author (1)
Devangini Patel
Devangini Patel
author image
Devangini Patel

Devangini Patel is a PhD student at the National University of Singapore, Singapore. Her research interests include deep learning, computer vision, machine learning, and artificial intelligence. She has completed a master's in artificial intelligence at the University of Southampton, UK. She has over 5 years, experience in the field of AI and has worked on various industrial and research projects in AI, including facial expression analysis, robotics, virtual try-on, object recognition and detection, and advertisement ranking.
Read more about Devangini Patel

Right arrow

Do it yourself

In this section, we will look at an application that you can develop by yourself. We will take a look at a new application and discuss the changes that are required. In the Introduction to file search applications section, we discussed two applications of file searching; now, we will develop the second type of example. Our aim is to develop a search application that is able to find program files containing specific program text.

In the code for recursive DFS, we mainly used three classes, as follows:

  • State: This has the three main ingredients of the search process
  • Node: This is used to build search trees
  • Recursive DFS: This has the actual algorithm implementation

Suppose that we want to adapt this code or file search application to new application. We will need to change three methods: getInitialState, successorFunction, and checkGoalState. For the new application of program searching, you will need to change just one method: checkGoalState.

In your new checkGoalState function, you will need to open the file, read the contents of the file line by line, and perform a substring check or regular expression check. Lastly, based on the results of the check, you will return true or false.

So, go ahead and try it out for yourself!

Previous PageNext Page
You have been reading a chapter from
Hands-On Artificial Intelligence for Search
Published in: Aug 2018Publisher: PacktISBN-13: 9781789611151
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Devangini Patel

Devangini Patel is a PhD student at the National University of Singapore, Singapore. Her research interests include deep learning, computer vision, machine learning, and artificial intelligence. She has completed a master's in artificial intelligence at the University of Southampton, UK. She has over 5 years, experience in the field of AI and has worked on various industrial and research projects in AI, including facial expression analysis, robotics, virtual try-on, object recognition and detection, and advertisement ranking.
Read more about Devangini Patel