Spaces:
Sleeping
Sleeping
CRITICAL: Filter false words (Otherwise, However) from answer extraction
Browse files469 unmodified lines470471472473474475476477469 unmodified linescleaned_word.replace('.','').replace('-','').isdigit()):meaningful_words.append(cleaned_word)# Return LAST meaningful word (most likely the answer)if meaningful_words:logger.info(f"Extracted LAST meaningful word from long answer: {meaningful_words[-1]}")return meaningful_words[-1]469 unmodified lines470471472473474475476477478479480481482483484485486487469 unmodified linescleaned_word.replace('.','').replace('-','').isdigit()):meaningful_words.append(cleaned_word)# Return LAST meaningful word (most likely the answer) - but avoid common false wordsif meaningful_words:# Filter out common false positives at end of long answersfalse_words = {'Otherwise', 'However', 'Therefore', 'Additionally', 'Furthermore', 'Unfortunately', 'Importantly', 'Specifically', 'Generally', 'Obviously', 'Naturally'}# Try to find a good answer, starting from the endfor word in reversed(meaningful_words):if word not in false_words and len(word) > 1:logger.info(f"Extracted LAST meaningful word from long answer: {word}")return word# If all words are false positives, return the last one anywaylogger.info(f"Extracted LAST meaningful word from long answer: {meaningful_words[-1]}")return meaningful_words[-1]
answer_extractor.py+11-1