I am trying to run Alchemy API on my computer for python 2.7. This is the file:
AlchemyAPI.py-2.5
I have kept it in the same file as the Code:
# Load the AlchemyAPI module code.
import AlchemyAPI
# Create an AlchemyAPI object.
alchemyObj = AlchemyAPI.AlchemyAPI()
# Load the API key from disk.
alchemyObj.loadAPIKey("api_key.txt")
# Extract a ranked list of named entities from a web URL.
result = alchemyObj.URLGetRankedNamedEntities("http://www.techcrunch.com/");
print (result)
# Extract a ranked list of named entities from a text string.
result = alchemyObj.TextGetRankedNamedEntities("Hello my name is Bob. I am speaking to you at this very moment. Are you listening to me, Bob?");
print (result)
# Load a HTML document to analyze.
htmlFileHandle = open("data/example.html", 'r')
htmlFile = htmlFileHandle.read()
htmlFileHandle.close()
# Extract a ranked list of named entities from a HTML document.
result = alchemyObj.HTMLGetRankedNamedEntities(htmlFile, "http://www.test.com/");
print (result)
This is the standard code and gives the error i have mentioned in the heading. As required by README i have copied the AlchemyAPI.py-2.5 into the same directory. Im not sure how py-2.5 file works.
you should remove the -2.5 from the file extension, just save it as "AlchemyAPI.py"
Also, if you are running python 2.7, is there a reason you are using the python 2.5 version file?
Do you vizit that page ? It contains all information about AlchemyAPI module.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.