How can i ask for user input and use that input for this text summarizer i created? [duplicate]

2024/7/8 6:37:40

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."""

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

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?

Answer

In python 2.x, you can do:

usertext = raw_input("message here")

for python 3.x:

usertext = input("message here")
https://en.xdnf.cn/q/120406.html

Related Q&A

Return to main menu function for python calculator program

I was asked to write a calculator in Python, and I completed it, but there is only one issue that needs to be fixed. What is the prerequisite? "Once the user inputs/selects an arithmetic operatio…

what the code to use in # Complete this function with recursion in lines 4

# TODO: 2. Create a function that counts the sum of all the numbers in a list belownumber = [1,2,3,4,5] # Use this list as inputdef hitung_total(listKu):# Complete this function with recursionreturn li…

Pip cannot install some Python packages due to missing platform tag in M1 Mac

Lately I have been facing issues installing packages through pip. For e.g. when I try to install the torch package, it fails with the below error > arch arm64 > python --version 3.10.12 ❯ pip --…

find (i,j) location of closest (long,lat) values in a 2D array [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.Want to improve this question? Update the question so it focuses on one problem only by editing this post.Closed 9…

an error occured to add picture in python

I am new in python and I am using python 3.5 version. I want to add photo to python, and heres the code I wrote:from tkinter import * win=Tk() win.title("Python Image")canvas=Canvas(win,width…

Implementing stack in python by using lists as stacks [closed]

Its difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying thi…

Addition function in Python is not working as expected

I tried to create a function using which I want to do mathematical operations like (Addition and Multiplication), I could able to prompt the values and when I insert the values result is not returning …

Probability Distribution Function Python

I have a set of raw data and I have to identify the distribution of that data. What is the easiest way to plot a probability distribution function? I have tried fitting it in normal distribution. But …

how to convert a np array of lists to a np array

latest updated: >>> a = np.array(["0,1", "2,3", "4,5"]) >>> a array([0,1, 2,3, 4,5], dtype=|S3) >>> b = np.core.defchararray.split(a, sep=,) >…

Regex stemmer code explanation

Can someone please explain what does this code do?def stemmer(word):[(stem,end)] = re.findall(^(.*ss|.*?)(s)?$,word)return stem