Skip to content

Commit

Permalink
More tweaks to the text summaries.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason LaPorte committed Jul 5, 2013
1 parent e9e2aa6 commit dd2337a
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 142 deletions.
230 changes: 116 additions & 114 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@ <h1>Dark Sky Multilingual Text Summaries</h1>
rather than full sentences; as such, they are capitalized like titles,
and don't generally contain punctuation. -->

<tr>
<td class="input"><pre>(title
clear)</pre></td>
<td class="en">Clear</td>
</tr>

<tr>
<td class="input"><pre>(title
very-light-precipitation)</pre></td>
Expand All @@ -79,96 +73,30 @@ <h1>Dark Sky Multilingual Text Summaries</h1>
<td class="en">Light Precipitation</td>
</tr>

<tr>
<td class="input"><pre>(title
medium-precipitation)</pre></td>
<td class="en">Precipitation</td>
</tr>

<tr>
<td class="input"><pre>(title
heavy-precipitation)</pre></td>
<td class="en">Heavy Precipitation</td>
</tr>

<tr>
<td class="input"><pre>(title
very-light-rain)</pre></td>
<td class="en">Drizzle</td>
</tr>

<tr>
<td class="input"><pre>(title
light-rain)</pre></td>
<td class="en">Light Rain</td>
</tr>

<tr>
<td class="input"><pre>(title
medium-rain)</pre></td>
<td class="en">Rain</td>
</tr>

<tr>
<td class="input"><pre>(title
heavy-rain)</pre></td>
<td class="en">Heavy Rain</td>
</tr>

<tr>
<td class="input"><pre>(title
very-light-sleet)</pre></td>
<td class="en">Light Sleet</td>
</tr>

<tr>
<td class="input"><pre>(title
light-sleet)</pre></td>
<td class="en">Light Sleet</td>
</tr>

<tr>
<td class="input"><pre>(title
medium-sleet)</pre></td>
<td class="en">Sleet</td>
</tr>

<tr>
<td class="input"><pre>(title
heavy-sleet)</pre></td>
<td class="en">Heavy Sleet</td>
</tr>

<tr>
<td class="input"><pre>(title
very-light-snow)</pre></td>
<td class="en">Flurries</td>
</tr>

<tr>
<td class="input"><pre>(title
light-snow)</pre></td>
<td class="en">Light Snow</td>
</tr>

<tr>
<td class="input"><pre>(title
medium-snow)</pre></td>
<td class="en">Snow</td>
</tr>

<tr>
<td class="input"><pre>(title
heavy-snow)</pre></td>
<td class="en">Heavy Snow</td>
</tr>

<tr>
<td class="input"><pre>(title
light-wind)</pre></td>
<td class="en">Breezy</td>
</tr>

<tr>
<td class="input"><pre>(title
medium-wind)</pre></td>
Expand All @@ -193,36 +121,12 @@ <h1>Dark Sky Multilingual Text Summaries</h1>
<td class="en">Dry</td>
</tr>

<tr>
<td class="input"><pre>(title
high-humidity)</pre></td>
<td class="en">Humid</td>
</tr>

<tr>
<td class="input"><pre>(title
fog)</pre></td>
<td class="en">Foggy</td>
</tr>

<tr>
<td class="input"><pre>(title
light-clouds)</pre></td>
<td class="en">Partly Cloudy</td>
</tr>

<tr>
<td class="input"><pre>(title
medium-clouds)</pre></td>
<td class="en">Mostly Cloudy</td>
</tr>

<tr>
<td class="input"><pre>(title
heavy-clouds)</pre></td>
<td class="en">Overcast</td>
</tr>

<tr>
<td class="input"><pre>(title
(and
Expand All @@ -231,9 +135,6 @@ <h1>Dark Sky Multilingual Text Summaries</h1>
<td class="en">Humid and Partly Cloudy</td>
</tr>

<!-- FIXME: Do a few other combined cases? Maybe remove the original
plaintext cases for those? -->

<!-- SINGLE-HOUR SUMMARIES. These summaries are used on the "minutely"
data block, and represent the weather conditions over a period of sixty
minutes. -->
Expand Down Expand Up @@ -296,11 +197,112 @@ <h1>Dark Sky Multilingual Text Summaries</h1>
<tr>
<td class="input"><pre>(sentence
(for-day
clear))</pre></td>
<td class="en">Clear throughout the day.</td>
medium-clouds))</pre></td>
<td class="en">Mostly cloudy throughout the day.</td>
</tr>

<tr>
<td class="input"><pre>(sentence
(starting
very-light-sleet
morning))</pre></td>
<td class="en">Light sleet starting in the morning.</td>
</tr>

<!-- FIXME -->
<tr>
<td class="input"><pre>(sentence
(until
medium-wind
today-night))</pre></td>
<td class="en">Windy until tonight.</td>
</tr>

<tr>
<td class="input"><pre>(sentence
(during
light-wind
afternoon))</pre></td>
<td class="en">Breezy in the afternoon.</td>
</tr>

<tr>
<td class="input"><pre>(sentence
(during
medium-snow
(and
later-today-evening
tomorrow-morning)))</pre></td>
<td class="en">Snow later this evening and tomorrow morning.</td>
</tr>

<tr>
<td class="input"><pre>(sentence
(clauses
(until
medium-snow
later-today-morning)
(starting-again
today-evening)))</pre></td>
<td class="en">Snow until later this morning, starting again this evening.</td>
</tr>

<tr>
<td class="input"><pre>(sentence
(clauses
(starting
heavy-clouds
evening)
(continuing-until
night)))</pre></td>
<td class="en">Overcast starting in the evening, continuing overnight.</td>
</tr>

<tr>
<td class="input"><pre>(sentence
(then
(during
light-sleet
later-today-afternoon)
(during
medium-snow
tomorrow-morning)))</pre></td>
<td class="en">Light sleet later this afternoon, then snow tomorrow morning.</td>
</tr>

<tr>
<td class="input"><pre>(sentence
(then
(during
light-sleet
later-today-afternoon)
(during
medium-snow
tomorrow-morning)))</pre></td>
<td class="en">Light sleet later this afternoon, then snow tomorrow morning.</td>
</tr>

<!-- FIXME: we need to test a few more "X, then Y" cases, where X and Y are any
of the below:
template:
(starting X Y)
(until X Y)
(during X Y)
(during X (and Y Z))
(clauses (until X Y) (starting-again (in Z)))
(clauses (starting X Y) (continuing-until Z))
The following periods still need to get tested:
today-morning
today-afternoon
today-night
later-today-night
tomorrow-afternoon
tomorrow-evening
tomorrow-night
-->

<!-- 7-DAY SUMMARIES. These summaries are used on the "daily" data
block, and represent the general weather conditions over a period of
Expand All @@ -313,7 +315,7 @@ <h1>Dark Sky Multilingual Text Summaries</h1>
(clauses
(for-week
no-precipitation)
(on
(during
(peaking
temperatures
(fahrenheit
Expand All @@ -327,7 +329,7 @@ <h1>Dark Sky Multilingual Text Summaries</h1>
(clauses
(over-weekend
mixed-precipitation)
(on
(during
(rising
temperatures
(celsius
Expand All @@ -339,44 +341,44 @@ <h1>Dark Sky Multilingual Text Summaries</h1>
<tr>
<td class="input"><pre>(sentence
(clauses
(on
medium-rain
(during
very-light-rain
today)
(on
(during
(valleying
temperatures
(fahrenheit
15))
friday)))</pre></td>
<td class="en">Rain today, temperatures bottoming out at 15°F on Friday.</td>
<td class="en">Drizzle today, temperatures bottoming out at 15°F on Friday.</td>
</tr>

<tr>
<td class="input"><pre>(sentence
(clauses
(on
very-light-snow
(during
light-snow
(and
monday
tuesday))
(on
(during
(falling
temperatures
(celsius
0))
sunday)))</pre></td>
<td class="en">Flurries on Monday and Tuesday, temperatures falling to 0°C on Sunday.</td>
<td class="en">Light snow on Monday and Tuesday, temperatures falling to 0°C on Sunday.</td>
</tr>

<tr>
<td class="input"><pre>(sentence
(clauses
(on
(during
medium-precipitation
(range
wednesday
saturday))
(on
(during
(peaking
temperatures
(fahrenheit
Expand Down
31 changes: 3 additions & 28 deletions src/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,40 +57,15 @@ var DarkSkyEnglish = {
"minutes": "$1 min.",
"fahrenheit": "$1\u00B0F",
"celsius": "$1\u00B0C",
"and": function(/* ... */) {
switch(arguments.length) {
case 1:
return arguments[0];

case 2:
return arguments[0] + " and " + arguments[1];

default:
return Array.prototype.slice.call(arguments, 0, -1).join(", ") +
", and " + arguments[arguments.length - 1];
}
},
"and": "$1 and $2",
"then": "$1, then $2",
"range": "$1 through $2",
"clauses": function(one, two) {
return one +
(one.indexOf(",") === -1 && two.indexOf(",") === -1 ? ", " : "; ") +
two;
},
"during": function(period) {
switch(period) {
case "morning":
case "afternoon":
case "evening":
return "in the " + period;

case "night":
return "overnight";

default:
return period;
}
},
"on": function(condition, day) {
"during": function(condition, day) {
return condition +
(day === "today" || day === "tomorrow" ? " " : " on ") +
day;
Expand Down

0 comments on commit dd2337a

Please sign in to comment.