我如何要求用户输入并将该输入用于我创建的文本摘要器? [英] How can i ask for user input and use that input for this text summarizer i created?

查看:25
本文介绍了我如何要求用户输入并将该输入用于我创建的文本摘要器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我根据在 Github 上找到的代码创建了一个文本摘要器.我正在尝试编写脚本,询问文本标题并询问实际文本.

I have created a text summarizer based on a code I found on Github. I'm trying to have to script ask for the title for the text and ask for the actual text.

title =    """ """

content = """
As metro Atlanta's weather and road conditions continue to thaw after this week's snowstorm, MARTA is planning modified bus and Mobility (paratransit) service starting tomorrow, initially on 30 "life-line" routes. MARTA's rail service will continue operating on a weekend schedule on all lines.

Bus and Mobility service will start at 7 a.m. Friday and run until 11:30 p.m. (See below for preliminary list of restored bus routes or visit MARTA's website: itsmarta.com.) The first round of bus routes being restored provide transit access to some of the region's major hospitals, job centers and commercial corridors. Customers may experience extended waits on some routes are asked to please allow extra time to complete their trips. Based on specific road and traffic conditions, more routes may be added throughout the day and real-time adjustments to the bus schedule are possible.

MARTA rail service will begin for customers at 4:35 a.m. Friday and run until about 2 a.m. on Saturday. Customers should mostly expect wait times for trains ranging from 10 to 20 minutes – conditions permitting. Since some rail stations are open to the elements, customers are advised to dress accordingly.

"""

^ 这就是我在代码中的内容:标题在哪里,您输入标题.content 是用户想要总结的文本.

^ that's what I have in the code: where Title is, you input the title. content is the text the user would want summarized.

如果你想要一个演示:你可以去http://runnable.com/Uv1foJAZ0BxuAABl/Summerizer-for-python 并点击运行.

If you want a demo: you can go to http://runnable.com/Uv1foJAZ0BxuAABl/summerizer-for-python and click run.

如何让程序询问标题和内容?

How can i have the program ask for the title and the content?

推荐答案

在 python 2.x 中,你可以:

In python 2.x, you can do:

usertext = raw_input("message here")

对于 python 3.x:

for python 3.x:

usertext = input("message here")

这篇关于我如何要求用户输入并将该输入用于我创建的文本摘要器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆