#This script is completely generated by ChatGPT3.5 using several prompt, but the main prompt is "can you write a Python script that given a sentence give it a confidence score from 0 to 100 where 0 means it doesn't have any language error and 100 means that it is fully faulty. I need to give the score to the sentence."
importjson
importlanguage_tool_python
defget_error_confidence(sentence):
# Initialize LanguageTool
tool=language_tool_python.LanguageTool('en-US')
# Tokenize the sentence
sentences=sentence.split(".")
# Initialize dictionaries to store confidence scores for sentences and phrases