I'm new to python. Could anyone suggest what goes wrong with this input command. I'm running this code in python 3.7.0 from anaconda
def annotation_tool(path):
final_results = []
nlp = spacy.load("en_core_web_sm")
if path != '':
file_text = open(path, "r").read()
nlp_file_doc = nlp(file_text)
sentences = list(nlp_file_doc.sents)
for i in sentences:
print("--------- Next sentence is %s ---------".format(i))
print("--------- Possible candidates are %s ---------".format(apply_extraction(row,nlp))
num_candidates = int(input("Enter number of candidates"))
pair = []
for x in range(0, num_candidates):
candidates = input("--------- Enter candidates e.g. computer, good ---------")
polarity = input("--------- Enter polarity of above candidates (pos/neg/neu) ---------")
dict = {candidates: polarity}
pair.append(dict)
result = {"sentence": i, "candidates": pair}
final_results.append(result)
is_continue = input("--------- Continue with annotation y/n? ---------")
if is_continue == 'n':
break
return final_results
Here is syntax error:
File "test.py", line 128
num_candidates = int(input("Enter number of
candidates"))
SyntaxError: invalid syntax
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…