Redian新闻
>
这道面试题如何入手?
avatar
这道面试题如何入手?# JobHunting - 待字闺中
e*n
1
Today: Mostly cloudy with a 20 percent chance of snow. Highs in the mid 30s.
Tonight: Cloudy with a 20 percent chance of snow. Lows in the lower to mid
20s.
Saturday: Warmer. Mostly cloudy with a 10 percent chance of snow. Highs in
the lower to mid 40s. Winds 10 to 15 mph.
Saturday Night: Mostly cloudy. Chance of rain in the morning, then chance of
snow overnight. Probability of rain and snow 40 percent. Lows 25 to 31.
Sunday: Partly cloudy. Highs 40 to 46.
Sunday Night: Partly cloudy. Lows 24 to 30.
These words are automatically generated from various gridded weather
information such as: Temperature, Wind, Probability of Precipitation, and
Precipitation Type (Rain, Snow, etc.). Note there are dependencies from one
time period to another (e.g. “Warmer”) plus dependencies between phrases
within a time period as appears in the Saturday Night forecast.
Design the algorithm allowing the auto-generation of these textual
descriptions from said gridded fields. How would you approach this software
design problem?
Since “one size does not fit all”, the software must be extensible and
easily customized. For example, “Warm” in Alaska may mean something
different than in Florida. Also, the algorithms to produce the digital data
may differ from location to location.
What software design concepts (or approach) would you use?
怎么入手?数据结构?怎么设计?
avatar
m*s
2
Consider the output as segments
Each segment needs a strategy
Each strategy has multiple factories
avatar
h*n
3
你的数据可能来源于XML, JSON或者databse等,你设置好switch case和和rule,根据
你取到的数据加不同英文句子。比如这句:
Saturday: Warmer. Mostly cloudy with a 10 percent chance of snow. Highs in
the lower to mid 40s. Winds 10 to 15 mph.
一开始是时间,然后是“warmer" ,warmer“ 这个可能要根据和前一天的温度比较得
出, “ most cloudy" 是它的数据里的信息,降雪概率10%它的数据里也会有。你就把
数据套到句子里去就行了。......
另外有些描述性句子,它原始给出的数据就可能这样的。
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。