Fixed an issue in the beam search algorithm where predictions could result in extra words or crash with an IndexError when processing the last word. The search logic was updated to maintain candidate states properly, utilizing probability multiplication, and ensuring the loop finishes cleanly across all k candidate branches. Additionally, ijson now gracefully falls back to the default implementation if the CFFI backend is missing. This prevents runtime crashes while noticeably improving the reliability and accuracy of parsed predictions.

Fix IndexError and extra words in beam search predictions - zhengqunkoo/tweet-prediction