【Hacker News搬运】超越路线:引入细粒度的MTA公交车速度数据
-
Title: Beyond the route: Introducing granular MTA bus speed data
超越路线:引入细粒度的MTA公交车速度数据
Text:
Url: https://new.mta.info/article/beyond-route-introducing-granular-mta-bus-speed-data
由于我无法直接访问互联网来抓取内容,我将根据您提供的链接描述,模拟一个使用 JinaReader 抓取和分析内容的场景。 首先,假设 JinaReader 是一个虚构的库,用于处理和抓取网络内容。以下是如何使用这样的库来抓取和总结您提供的链接内容的步骤: ```python # 模拟 JinaReader 库 class JinaReader: def __init__(self, url): self.url = url self.content = None def fetch_content(self): # 模拟从网页抓取内容 # 实际应用中,这里会使用 requests 或其他库来获取网页内容 self.content = """ <html> <body> <h1>Beyond Route: Introducing Granular MTA Bus Speed Data</h1> <p>The MTA has introduced granular bus speed data to provide better insights into bus performance.</p> <p>This data includes bus speed, stops, and other relevant information.</p> <p>The MTA hopes this will help improve service and reliability.</p> </body> </html> """ def translate_to_chinese(self): # 模拟翻译功能 # 实际应用中,这里会使用翻译API如Google Translate API translated_content = """ <html> <body> <h1>超越路线:介绍详细的MTA公交速度数据</h1> <p>纽约大都会交通局(MTA)推出了详细的公交速度数据,以提供更好的公交性能洞察。</p> <p>这些数据包括公交速度、站点和其他相关信息。</p> <p>MTA希望这些数据有助于改善服务和可靠性。</p> </body> </html> """ return translated_content def summarize_content(self): # 模拟内容总结 summary = "纽约大都会交通局推出了详细的公交速度数据,旨在提高公交服务的效率和可靠性。" return summary # 使用 JinaReader url = "https://new.mta.info/article/beyond-route-introducing-granular-mta-bus-speed-data" reader = JinaReader(url) reader.fetch_content() # 如果内容不是中文,翻译成中文 if "中文" not in reader.content: reader.content = reader.translate_to_chinese() # 总结内容 summary = reader.summarize_content() print(summary)
在这个模拟中,
JinaReader
类提供了抓取内容、翻译和总结内容的方法。fetch_content
方法模拟了从网页上抓取HTML内容。translate_to_chinese
方法模拟了将非中文内容翻译成中文的过程。summarize_content
方法模拟了对内容的总结。请注意,实际的代码会涉及到网络请求、正则表达式解析、JSON解析、翻译API调用等,这里仅提供了一个简化的模拟示例。
## Post by: Nelkins ### Comments: **woodruffw**: A fun fact about NYC's buses: many of the routes are turn-by-turn replicas of previous streetcar routes; Brooklyn alone had dozens[1]. The B46[2], for example, follows the Utica-Reid line as it ran until 1951.<p>They never actually tore up most of these lines; the city just paved over them. You can see them poking through the pavement whenever the city redoes the roads.<p>[1]: <a href="https://en.wikipedia.org/wiki/List_of_streetcar_lines_in_Brooklyn" rel="nofollow">https://en.wikipedia.org/wiki/List_of_streetcar_lines_in_Bro...</a><p>[2]: <a href="https://en.wikipedia.org/wiki/B46_(New_York_City_bus)" rel="nofollow">https://en.wikipedia.org/wiki/B46_(New_York_City_bus)</a> > **woodruffw**: 关于纽约市的一个有趣事实;s公共汽车:许多路线都是以前有轨电车路线的逐段复制品;仅布鲁克林就有几十个[1]。例如,B46[2]遵循尤蒂卡-里德线,直到1951年。<p>他们从未真正撕毁过这些线中的大部分;这座城市刚刚盖上了他们。每当城市翻修道路时,你都可以看到他们从人行道上钻出来<p> [1]:<a href=“https:”en.wikipedia.org“wiki";List_of_streetcar_lines_in_Brooklyn”rel=“nofollow”>https:”/;en.wikipedia.org;维基;有轨电车列表</a> <p>[2]:<a href=“https://en.wikipedia.org:wiki:B46_(纽约城市)”rel=“nofollow”>https:///;en.wikipedia.org;维基;B46_(纽约_城市_巴士)</a> **vavooom**: <i>We are excited for Open Data users to dig into this dataset, experiment, and find insights from the “speed sample of NYC’s streets” that the MTA’s 4,900 buses collect each day. This data will be uploaded on a monthly basis, and can be found on the NYS Open Data portal.</i><p>What a great dataset and effort to allow for further research into areas of the city that could benefit from anti-congestion measures (<i>cough cough car tax</i>) to improve bus services!<p>Also - where does one even store 4,900 buses in NYC? I guess most of the fleet is out on the streets all day, but I imagine servicing all of those is quite the feat. > **vavooom**: <i> 我们很高兴开放数据用户能够深入研究这个数据集,进行实验,并从MTA每天收集的4900辆公交车的“纽约市街道速度样本”中找到见解。这些数据将每月上传一次,可以在纽约州开放数据门户网站上找到</i> <p>这是一个多么大的数据集和努力,可以进一步研究城市中可以从改善公交服务的反拥堵措施(咳嗽车税)中受益的地区<p> 此外,在纽约市,4900辆公交车在哪里存放?我想大部分车队整天都在街上,但我想为所有这些提供服务是相当了不起的。 **willmeyers**: NYC has one of the best open data portals out there. Kudos to all the teams and agencies who manage it. > **willmeyers**: 纽约市拥有最好的开放数据门户之一。向所有管理它的团队和机构致敬。 **o10449366**: maybe someone will finally highlight how ridiculous the gridlock is on the b44-sbs route, particularly through south williamsburg. I regularly see convoys of 4-5 buses arriving at the same time because the traffic through that neighborhood is so bad that the buses eventually catch up to each other and I regularly have to wait 30+ minutes for it on either end of the route. > **o10449366**: 也许有人最终会强调b44-sbs路线上的交通堵塞是多么荒谬,尤其是在威廉斯堡南部。我经常看到4-5辆公交车同时到达,因为通过该社区的交通非常糟糕,公交车最终会相互赶上,我经常不得不在路线的两端等待30多分钟。 **dml2135**: MTA seems to be seriously upping their technology game over the past few years. Anecdotally, I've noticed their apps seem to have better UX and are more reliable. I'd be curious to learn what organization changes have happened to enable this. > **dml2135**: 在过去的几年里,MTA似乎在认真提升他们的技术水平。据传,我;我注意到他们的应用程序似乎有更好的用户体验,也更可靠。我;我很想知道为了实现这一目标,组织发生了哪些变化。