0 votes
1 view
in AI and Deep Learning by (50.5k points)

I'm in the process of moving away from the Google Weather API to BOM (Australia) weather service. I've managed to get the weather data from BOM just fine using stream readers etc, but what I'm stuck on is the image icon that matches the daily forecast.

What I did with the old Google Weather API was quite brutal yet did the trick. The Google Weather API only gave off a couple of different types of forecasts that I could jam together into a string that I could in turn use in an image URL.

Example of what I did with the Google Weather API...

imageDay1.ImageUrl = "images/weather/" + lbWeatherDay1Cond.Text.Replace(" ", string.Empty) + ".png";

"Mostly sunny" = mostlysunny.png

"Sunny" = sunny.png

"Chance of Rain" = chanceofrain.png

"Showers" = showers.png

"Partly cloudy" = partlycloudy.png

There was on say 15 different possible options for the daily forecast.

The problems I have now and with BOM (Australia Weather Service) is this...

Possible morning shower

Shower or two, clearing later

So many thousands more.... there is no standard.

What I'm hoping is that it is possible is some of the great minds on here to create a string from a keyword within this string? Something like "Showers" for "Showers.png" or something a little more complex to recognize "Chance of Showers" as "Chanceshowers.jpg" while keeping "Shower or two" as "Showers.png".

I'm easy to any ideas or solutions (hopefully in c#). As long as it's very lightweight (the process has to be repeated for the 5-day forecast) and can capture almost any scenario...

At this point in time, I'm carrying on with String. Replace, after String. Replace, after String. Replace option... It will do for now, but I can't roll it into a production like this.

Cheers, all!

1 Answer

0 votes
by (108k points)

Try with a look-up table (you'll extract the first match) where the key is a regular expression. If there is no standard you can't rely on a well-defined algorithm. This is a problem that's related to machine learning and AI. It involves some Natural Language Processing, like how Google tries to interpret what users ask it, or how mail spam filters work.

For better understanding refer the following link:


Welcome to Intellipaat Community. Get your technical queries answered by top developers !