  Post-stroke patient rehabilitation requires precise, personalized treatment
plans. Natural Language Processing (NLP) offers potential to extract valuable
exercise information from clinical notes, aiding in the development of more
effective rehabilitation strategies. Objective: This study aims to develop and
evaluate a variety of NLP algorithms to extract and categorize physical
rehabilitation exercise information from the clinical notes of post-stroke
patients treated at the University of Pittsburgh Medical Center. A cohort of
13,605 patients diagnosed with stroke was identified, and their clinical notes
containing rehabilitation therapy notes were retrieved. A comprehensive
clinical ontology was created to represent various aspects of physical
rehabilitation exercises. State-of-the-art NLP algorithms were then developed
and compared, including rule-based, machine learning-based algorithms, and
large language model (LLM)-based algorithms (ChatGPT). Analysis was conducted
on a dataset comprising 23,724 notes with detailed demographic and clinical
characteristics. The rule-based NLP algorithm demonstrated superior performance
in most areas, particularly in detecting the 'Right Side' location with an F1
score of 0.975, outperforming Gradient Boosting by 0.063. Gradient Boosting
excelled in 'Lower Extremity' location detection (F1 score: 0.978), surpassing
rule-based NLP by 0.023. It also showed notable performance in 'Passive Range
of Motion' with an F1 score of 0.970, a 0.032 improvement over rule-based NLP.
The rule-based algorithm efficiently handled 'Duration', 'Sets', and 'Reps'
with F1 scores up to 0.65. LLM-based NLP, particularly ChatGPT with few-shot
prompts, achieved high recall but generally lower precision and F1 scores.
However, it notably excelled in 'Backward Plane' motion detection, achieving an
F1 score of 0.846, surpassing the rule-based algorithm's 0.720.
