Spaces:
Runtime error
Runtime error
File size: 987 Bytes
227f173 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import language_tool_python, json, re, logging
from flask import jsonify
tool = language_tool_python.LanguageTool('en-US')
# from pdfminer.high_level import extract_text
class ResumeReviewer:
def __init__(self):
pass
def review(self):
pass
def grammar_check(self, parsed_resume):
text = parsed_resume["text"]
matches = tool.check(text)
corrected_text = tool.correct(text)
grammar_issues = []
for match in matches:
issue = {
"error": match.message,
"suggested_correction": match.replacements,
"context": match.context,
"rule_id": match.ruleId
}
grammar_issues.append(issue)
grammar_result = {
"original_text": text,
"grammar_issues": grammar_issues,
"corrected_text": corrected_text
}
return jsonify(grammar_result) |