0

I have a Python script that extracts certain consumer product aspects from customer reviews using LinearSVC, but I am trying to convert this script into some sort of API to use for new reviews. Is there an easy way to do this? I am very new to the whole concept of APIs.

1 Answer 1

1

An API is just a library you import once it's reachable by the interpreter in your case. So any import in python is you calling on an library/API.

So if you're script is called foobar.py for example, if it is in the same directory as other python files using

import foobar

at the top of your python file should allow you to reference any functions made in your original python script.

Sign up to request clarification or add additional context in comments.

2 Comments

But how do you reference functions once you import the script? Initially, the script opens a csv file with 6 columns, but only uses the data from 3. Then for each column selected, certain transformations are made on each column, then the data is run through a classification algorithm to make predictions. How would I perform all of these steps in an API?
You'd put all the algorithms you want to perform in the python file called foobar.py in my above example, and then you should be able to reference them just by importing and typing foobar.FunctionName()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.