-2

I am developing a chat application in java where a user chat with the software like a bot machine. My question is, if a user writes any query or any input message it must search in google then retrieve it parse it etc.. that all i can go with. but the problem is how can i fetch the data from google based on user input. and also user should not feel that it is a simple search its a chat.

user1453544
  • 35
  • 1
  • 3

2 Answers2

2

There might be easier and simpler ways out there - but this is what I would do :

I would suggest first work on querying Google through a simple application, and work out that part effectively. Here are a few link for that:

How to query google through desktop java app?

How can I Programmatically perform a search without using an API?

Is there a way to programmatically access Google's search engine results?

How can you search Google Programmatically Java API

Once you are done with this part, for implementing your chatting bot, I would suggest you to go for AIML. I personally have developed a chatting bot using AIML, and it is pretty good and accurate.

So to line up your task - first learn how to query Google through a Java program, then fetch results from it and try to dynamically create AIML files. Once done with it, use an AIML interpreter to interpret those AIML files and boom! - your bot is ready!

Community
  • 1
  • 1
Kazekage Gaara
  • 14,972
  • 14
  • 61
  • 108
0

Have you looked at the Google Custom Search API?

https://developers.google.com/custom-search/v1/overview

Worth noting the cost:

Free quota

Usage is free for all users, up to 100 queries per day.

Paid Usage

Any usage beyond the free usage quota will fail if you are not signed up for billing. Once you have enabled billing, you will continue to receive 100 free queries per day. However, you will be billed for all additional requests at the rate of $5 per 1000 queries, for up to 10,000 queries per day. If you need additional quota, please request additional quota from the console.

Correct as of June 2012

infojolt
  • 5,244
  • 3
  • 40
  • 82