我正在尝试了解 IBM Watson Personality Insights API 在今年年底关闭之前的工作原理。我有一个要分析的基本文本文件,但我无法让代码正常运行。我一直在尝试按照官方的说明进行操作,但我被卡住了。我究竟做错了什么?(我已经在下面的代码中涂抹了我的钥匙)。
from ibm_watson import PersonalityInsightsV3
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
authenticator = IAMAuthenticator('BlottedOutKey')
personality_insights = PersonalityInsightsV3(
version='2017-10-13',
authenticator=authenticator
)
personality_insights.set_service_url('https://api.us-west.personality-insights.watson.cloud.ibm.com')
with open(join(C:\Users\AWaywardShepherd\Documents\Data Science Projects\TwitterScraper-master\TwitterScraper-master\snscrape\python-wrapper\Folder\File.txt), './profile.json')) as profile_json:
profile = personality_insights.profile(
profile_json.read(),
content_type='text/plain',
consumption_preferences=True,
raw_scores=True)
.get_result()
print(json.dumps(profile, indent=2))
我不断收到以下难以描述的语法错误:
File "<ipython-input-1-1c7761f3f3ea>", line 11
with open(join(C:\Users\AWaywardShepherd\Documents\Data Science Projects\TwitterScraper-master\TwitterScraper-master\snscrape\python-wrapper\Folder\File.txt), './profile.json')) as profile_json:
^ SyntaxError: invalid syntax