Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 03f21ef1ef | |||
| 2e747bc8aa | |||
| d0dd8950a6 | |||
| 4612ed2108 | |||
| 0e988b201c | |||
| 7b4ebb8d76 |
@@ -113,33 +113,82 @@ function parseWeatherType(weatherText) {
|
|||||||
|
|
||||||
const text = weatherText.toLowerCase();
|
const text = weatherText.toLowerCase();
|
||||||
|
|
||||||
// Check for specific weather conditions (order matters - check combined effects first)
|
const weather_en = new Map([
|
||||||
if (text.includes('blizzard')) {
|
["blizzard", "blizzard"],
|
||||||
return 'blizzard'; // Snow + Wind
|
["storm", "storm,thunder,lightning"],
|
||||||
}
|
["wind", "wind,breeze,gust,gale"],
|
||||||
if (text.includes('storm') || text.includes('thunder') || text.includes('lightning')) {
|
["snow", "snow,flurries"],
|
||||||
return 'storm'; // Rain + Lightning
|
["rain", "rain,drizzle,shower"],
|
||||||
}
|
["mist", "mist,fog,haze"],
|
||||||
if (text.includes('wind') || text.includes('breeze') || text.includes('gust') || text.includes('gale')) {
|
["sunny", "sunny,clear,bright"],
|
||||||
return 'wind';
|
["none", "cloud,overcast,indoor,inside"],
|
||||||
}
|
]);
|
||||||
if (text.includes('snow') || text.includes('flurries')) {
|
|
||||||
return 'snow';
|
|
||||||
}
|
|
||||||
if (text.includes('rain') || text.includes('drizzle') || text.includes('shower')) {
|
|
||||||
return 'rain';
|
|
||||||
}
|
|
||||||
if (text.includes('mist') || text.includes('fog') || text.includes('haze')) {
|
|
||||||
return 'mist';
|
|
||||||
}
|
|
||||||
if (text.includes('sunny') || text.includes('clear') || text.includes('bright')) {
|
|
||||||
return 'sunny';
|
|
||||||
}
|
|
||||||
if (text.includes('cloud') || text.includes('overcast') || text.includes('indoor') || text.includes('inside')) {
|
|
||||||
return 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
return 'none';
|
const weather_ru = new Map([
|
||||||
|
["blizzard", "метель"],
|
||||||
|
["storm", "гроза,буря,шторм"],
|
||||||
|
[
|
||||||
|
"wind",
|
||||||
|
"ветер,ветрено,ветерок,бриз,легкий бриз,слегка ветрено,легкий ветер,шквал,буря",
|
||||||
|
],
|
||||||
|
["snow", "снег,снегопад"],
|
||||||
|
["rain", "дождь,морось,ливень"],
|
||||||
|
["mist", "мгла,туман,туманно"],
|
||||||
|
["sunny", "солнечно,ясно,ярко,ясное утро,ясный день"],
|
||||||
|
["none", "облачно,пасмурно,в помещении,внутри"],
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Check for specific weather conditions (order matters - check combined effects first)
|
||||||
|
if (
|
||||||
|
weather_en.get("blizzard").includes(text) ||
|
||||||
|
weather_ru.get("blizzard").includes(text)
|
||||||
|
) {
|
||||||
|
return "blizzard"; // Snow + Wind
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
weather_en.get("storm").includes(text) ||
|
||||||
|
weather_ru.get("storm").includes(text)
|
||||||
|
) {
|
||||||
|
return "storm"; // Rain + Lightning
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
weather_en.get("wind").includes(text) ||
|
||||||
|
weather_ru.get("wind").includes(text)
|
||||||
|
) {
|
||||||
|
return "wind";
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
weather_en.get("snow").includes(text) ||
|
||||||
|
weather_ru.get("snow").includes(text)
|
||||||
|
) {
|
||||||
|
return "snow";
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
weather_en.get("rain").includes(text) ||
|
||||||
|
weather_ru.get("rain").includes(text)
|
||||||
|
) {
|
||||||
|
return "rain";
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
weather_en.get("mist").includes(text) ||
|
||||||
|
weather_ru.get("mist").includes(text)
|
||||||
|
) {
|
||||||
|
return "mist";
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
weather_en.get("sunny").includes(text) ||
|
||||||
|
weather_ru.get("sunny").includes(text)
|
||||||
|
) {
|
||||||
|
return "sunny";
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
weather_en.get("none").includes(text) ||
|
||||||
|
weather_ru.get("none").includes(text)
|
||||||
|
) {
|
||||||
|
return "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user