Weather Information

  • 14 Replies
  • 5879 Views
*

sunama

  • Trusty Member
  • ****
  • Electric Dreamer
  • *
  • 109
    • ai project
Weather Information
« on: October 29, 2011, 07:06:06 pm »
I'm currently working on an AI.

The other day, it received a query, "is it raining"?

Now, I wanted to know if anyone has any idea on how to deal with this?

1. My current idea is to get the ip address from the user who asked the question
2. based on the ip, the AI can find out what part of the World the user is in
3. The AI can then check the weather report for that part of the World.

I'm looking for a better algorithm than that which I've listed above.

Any ideas?
www.aiproject.co.uk
Natural Language Processing

*

squarebear

  • Trusty Member
  • *********
  • Terminator
  • *
  • 867
  • It's Hip to be Square
Re: Weather Information
« Reply #1 on: October 29, 2011, 09:12:18 pm »
I check the user's location if they have told me it. If not, the bot prompts them for where they live but if the bot knows where they are, it opens a link like so:
http://www.weather-forecast.com/locations/ <location> /forecasts/latest

If the user lived in Dallas, the link would be:
http://www.weather-forecast.com/locations/Dallas/forecasts/latest

Obviously, I can't include and keep updating weather forecasts from around the world, so I pass them over to a weather site. You could have a sample conversation like so:

Human: What is the weather going to be tomorrow?
Bot: I don't know where you live to tell you the weather.
Human: I live in Dallas.
Bot: Here is the weather forecast for Dallas. (bot opens link to http://www.weather-forecast.com/locations/Dallas/forecasts/latest)
Feeling Chatty?
www.mitsuku.com

*

sunama

  • Trusty Member
  • ****
  • Electric Dreamer
  • *
  • 109
    • ai project
Re: Weather Information
« Reply #2 on: October 30, 2011, 12:26:03 am »
Squarebear, I am looking for a solution which avoids submitting a link to the user, though your algorithm will perhaps suffice for a version1.

Out of interest, I just ran the query on your chat-bot, squarebear:

Human: is it raining?
Mitsuku: Not at the moment but it is very cloudy and looks like rain.

Can I ask if this is just some random answer or is it genuinely cloudy?
www.aiproject.co.uk
Natural Language Processing

*

squarebear

  • Trusty Member
  • *********
  • Terminator
  • *
  • 867
  • It's Hip to be Square
Re: Weather Information
« Reply #3 on: October 30, 2011, 12:33:46 am »
My method opens the link in a new tab rather than displaying the actual link to the user, assuming they have their pop up blocker switched off.
Try it yourself, ask Mitsuku, "what is the weather in (wherever you live)". I am not sure how you could do this without using an external site.

The answer you received above was the response to "is it raining?".

I do not have time to update her with weather details and so she gives that response. The weather in Leeds, UK is pretty much always cloudy or raining and so I find her reply suffices.
« Last Edit: October 30, 2011, 12:53:43 am by squarebear »
Feeling Chatty?
www.mitsuku.com

*

sunama

  • Trusty Member
  • ****
  • Electric Dreamer
  • *
  • 109
    • ai project
Re: Weather Information
« Reply #4 on: October 30, 2011, 01:04:35 am »
Human: what is the weather in london
Mitsuku:  I hope it's sunny in london today.

Indeed, your chat bot attempted to open up a new web browser.

I think the best way around this problem is store up a list of weather websites, which are able to check weather in particular areas. When the user asks for a weather report, the AI can ask the user, for which area (eg. zip/post code or city/area). Obviously, this technique would require a new module to be written, specifically to handle weather reporting.
www.aiproject.co.uk
Natural Language Processing

*

squarebear

  • Trusty Member
  • *********
  • Terminator
  • *
  • 867
  • It's Hip to be Square
Re: Weather Information
« Reply #5 on: October 30, 2011, 08:47:08 am »
When the user asks for a weather report, the AI can ask the user, for which area (eg. zip/post code or city/area). Obviously, this technique would require a new module to be written, specifically to handle weather reporting.

This is what my bot does now but without the need to write a lot of code.

I find my method to be the simplest, just pass a variable ("location") to a weather website.
I do a similar thing with cinema times. If you ask Mitsuku, "what is on at the cinema in (location)", she will open a website showing you. This only works for UK towns and cities. Again, I just pass the user's location to a cinema website.

To be writing extra modules to specificaly answer these questions seems a waste of time and code to me.
Feeling Chatty?
www.mitsuku.com

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6855
  • Mostly Harmless
Re: Weather Information
« Reply #6 on: October 30, 2011, 11:43:50 am »
Sunama, is you AI web based with multiple anonymous users or a desktop private AI ?

*

sunama

  • Trusty Member
  • ****
  • Electric Dreamer
  • *
  • 109
    • ai project
Re: Weather Information
« Reply #7 on: October 30, 2011, 11:51:15 am »
Both.

The web based version can handle multiple (anonymous and logged-in) users: http://www.aicore.co.uk/index.php/web-demo.html
There is also a system client (which I use, due to its speed and extra features). I haven't yet released this for download. The reason for this is that most people prefer the convenience of using a web based application, so I don't see there being a rush to get this released.
www.aiproject.co.uk
Natural Language Processing

*

sunama

  • Trusty Member
  • ****
  • Electric Dreamer
  • *
  • 109
    • ai project
Re: Weather Information
« Reply #8 on: October 30, 2011, 11:57:10 am »
If the user lived in Dallas, the link would be:
http://www.weather-forecast.com/locations/Dallas/forecasts/latest

Human: What is the weather going to be tomorrow?
Bot: I don't know where you live to tell you the weather.
Human: I live in Dallas.
Bot: Here is the weather forecast for Dallas. (bot opens link to http://www.weather-forecast.com/locations/Dallas/forecasts/latest)

What if we did something like this:

Human: What is the weather going to be tomorrow?
Bot: I don't know where you live to tell you the weather.
Human: I live in Dallas.


(bot opens link to http://www.weather-forecast.com/locations/Dallas/forecasts/latest) but does not pass this onto the user
The AI reads the web page...picks out key points from the page, eg temperature, weather type, eg: raining, cloudy, sunny, etc


Bot: the weather in Dallas is as follows:
temperature: 20C
weather: rain


For me, this would reads a lot nicer. I just don't like the idea of opening up webpages...if the user wanted a web page, he would go over to google and type: 'weather in Dallas' or similar.
www.aiproject.co.uk
Natural Language Processing

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6855
  • Mostly Harmless
Re: Weather Information
« Reply #9 on: October 30, 2011, 12:05:12 pm »
Quote
What if we did something like this:

Yes that was what I was thinking too; to do some page scraping.

*

squarebear

  • Trusty Member
  • *********
  • Terminator
  • *
  • 867
  • It's Hip to be Square
Re: Weather Information
« Reply #10 on: October 30, 2011, 12:16:22 pm »
Yes, that should be perfecly possible. Perhaps by formatting some XML which provides the data?
Feeling Chatty?
www.mitsuku.com

*

Bragi

  • Trusty Member
  • ********
  • Replicant
  • *
  • 564
    • Neural network design blog
Re: Weather Information
« Reply #11 on: October 31, 2011, 12:56:41 pm »
Yep, the scraping solution does seem to be the better option. It's possible to scrape it from the weather site that Squarebear gave, but beeping hard (cause it first needs to be converted to xml format). I found 2 better sources (both xml files): yahoo weather RSS and google's weather api. The latter is easier to use: it can incorporate the City as a regular text value in the HTML request, like the webpage. With Yahoo, you first need to look up the number of the city with another API, all doable, but more work.
Here's the pattern I tested it with:

It results in:

Quote
You: what is the weather in brussels
bot: It's about 16 degrees celsius and partly cloudy.

*

sunama

  • Trusty Member
  • ****
  • Electric Dreamer
  • *
  • 109
    • ai project
Re: Weather Information
« Reply #12 on: October 31, 2011, 01:03:56 pm »
I could try using google, however, my AI is able to read webpages...
Bragi, have you incorporated weather reports into your AI yet?
www.aiproject.co.uk
Natural Language Processing

*

Bragi

  • Trusty Member
  • ********
  • Replicant
  • *
  • 564
    • Neural network design blog
Re: Weather Information
« Reply #13 on: October 31, 2011, 01:20:57 pm »
I have the weather topic that I just posted above. I'll most likely include the example in the next release.
What technique are you using to read the webpages?

*

sunama

  • Trusty Member
  • ****
  • Electric Dreamer
  • *
  • 109
    • ai project
Re: Weather Information
« Reply #14 on: October 31, 2011, 01:39:18 pm »
in general:

open up the web page
wait for contents to be displayed
copy all contents of the web page to a text file (this can either by done by CTRL-A OR by getting all the page source info, however, this also requires the removal of tags and is a little dirtier)
Then load all text into a list.
Then we process the contents of the list.

The big problem with "reading" a web page using a different technique is that sometimes the webmaster writes code in his web page, which he doesnt want to be displayed to the user OR he writes stuff in code, in a very complicated way. When you "read" the web page by doing a CTRL-A, you get the contents of the page, as a human sees it.

Using the above technique, the AI is able to read pretty much any web page and mine data from it.

I spent a solid 16 hours 1 day, trying to get the Twitter API to work with my AI, so that the AI can post messages on its own...I just couldn't get it to work reliably. In the end I settled for using my own web page reading system and that nailed the problem with ease.

You have to remember that many websites try their best to prevent bots from posting messages...so the AI has to avoid using techniques that most bots use.
www.aiproject.co.uk
Natural Language Processing

 


OpenAI Speech-to-Speech Reasoning Demo
by ivan.moony (AI News )
March 28, 2024, 01:31:53 pm
Say good-bye to GPUs...
by MikeB (AI News )
March 23, 2024, 09:23:52 am
Google Bard report
by ivan.moony (AI News )
February 14, 2024, 04:42:23 pm
Elon Musk's xAI Grok Chatbot
by MikeB (AI News )
December 11, 2023, 06:26:33 am
Nvidia Hype
by 8pla.net (AI News )
December 06, 2023, 10:04:52 pm
How will the OpenAI CEO being Fired affect ChatGPT?
by 8pla.net (AI News )
December 06, 2023, 09:54:25 pm
Independent AI sovereignties
by WriterOfMinds (AI News )
November 08, 2023, 04:51:21 am
LLaMA2 Meta's chatbot released
by 8pla.net (AI News )
October 18, 2023, 11:41:21 pm

Users Online

353 Guests, 1 User
Users active in past 15 minutes:
ivan.moony
[Trusty Member]

Most Online Today: 363. Most Online Ever: 2369 (November 21, 2020, 04:08:13 pm)

Articles