norhan12 commited on
Commit
28b5bc1
·
verified ·
1 Parent(s): 64e2526

Update process_interview.py

Browse files
Files changed (1) hide show
  1. process_interview.py +21 -0
process_interview.py CHANGED
@@ -231,6 +231,27 @@ def analyze_interviewee_voice(audio_path: str, utterances: List[Dict]) -> Dict:
231
  logger.error(f"Voice analysis failed: {str(e)}")
232
  return {'error': str(e)}
233
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  def calculate_acceptance_probability(analysis_data: Dict) -> float:
235
  # Your full, detailed function
236
  voice = analysis_data.get('voice_analysis', {})
 
231
  logger.error(f"Voice analysis failed: {str(e)}")
232
  return {'error': str(e)}
233
 
234
+
235
+ def analyze_text_content(utterances: List[Dict]) -> Dict:
236
+ interviewee_utterances = [u['text'] for u in utterances if u.get('role') == 'Interviewee']
237
+ if not interviewee_utterances:
238
+ return {"overall_sentiment": {"label": "NEUTRAL", "score": 1.0}, "mentioned_technologies": [], "mentioned_soft_skills": []}
239
+
240
+ full_text = " ".join(interviewee_utterances)
241
+ sentiment_results = sentiment_pipeline(full_text, truncation=True, max_length=512)
242
+
243
+ tech_keywords = ['python', 'react', 'aws', 'docker', 'api', 'fastapi', 'machine learning', 'pytorch', 'tensorflow']
244
+ soft_skills = ['leadership', 'teamwork', 'communication', 'problem solving', 'management', 'planning']
245
+
246
+ found_tech = [kw for kw in tech_keywords if kw in full_text.lower()]
247
+ found_skills = [skill for skill in soft_skills if skill in full_text.lower()]
248
+
249
+ return {
250
+ "overall_sentiment": sentiment_results[0],
251
+ "mentioned_technologies": list(set(found_tech)),
252
+ "mentioned_soft_skills": list(set(found_skills))
253
+ }
254
+
255
  def calculate_acceptance_probability(analysis_data: Dict) -> float:
256
  # Your full, detailed function
257
  voice = analysis_data.get('voice_analysis', {})