|
|
|
"""Extractive_UWC_Case_History_Summarization.ipynb |
|
|
|
Automatically generated by Colaboratory. |
|
|
|
Original file is located at |
|
https://colab.research.google.com/drive/1D2eqhloS0uZR5jXlRGvm10uibWdz2L4g |
|
|
|
# **Texts** |
|
""" |
|
|
|
text1 = """The adolescent was previously diagnosed with major depressive disorder and treated intermittently with supportive psychotherapy and antidepressants. Her more recent episodes related to her parents’ marital problems and her academic/social difficulties at school. She was treated using cognitive-behavioral therapy (CBT).""" |
|
|
|
text2 = """Sam was team captain of his soccer team, but an unexpected fight with another teammate prompted his parents to meet with a clinical psychologist. Sam was diagnosed with major depressive disorder after showing an increase in symptoms over the previous three months. Several recent challenges in his family and romantic life led the therapist to recommend interpersonal psychotherapy for adolescents (IPT-A).""" |
|
|
|
text3 = """Mark had a history of depression and sought treatment after his second marriage ended. His depression was characterized as being “controlled by a pattern of interpersonal avoidance.” The behavior/activation therapist asked Mark to complete an activity record to help steer the treatment sessions.""" |
|
|
|
text4 = """Denise is described as having “nonchronic depression” which appeared most recently at the onset of her husband’s diagnosis with brain cancer. Her symptoms were loneliness, difficulty coping with daily life, and sadness. Treatment included filling out a weekly activity log and identifying/reconstructing automatic thoughts.""" |
|
|
|
text5 ="""Luke is described as having treatment-resistant depression and while not suicidal, hoped that a fatal illness would take his life or that he would just disappear. His treatment involved mindfulness-based cognitive therapy, which helps participants become aware of and recharacterize their overwhelming negative thoughts. It involves regular practice of mindfulness techniques and exercises as one component of therapy.""" |
|
|
|
text6 ="""Peggy had a history of chronic depression, which flared during her husband’s illness and ultimate death. Guilt was a driving factor of her depressive symptoms, which lasted six months after his death. The clinician treated Peggy with psychodynamic therapy over a period of two years.""" |
|
|
|
"""# **Extractive Summarization** |
|
|
|
|
|
|
|
|
|
""" |
|
|
|
|
|
from summarizer import Summarizer |
|
|
|
bert_model = Summarizer() |
|
|
|
|
|
|
|
|
|
|
|
def abstractive_text(text): |
|
summary_text = bert_model(text, ratio=0.1) |
|
return summary_text |
|
|
|
|
|
|
|
iface = gr.Interface(fn=abstractive_text, inputs= ["text"],outputs=["text"],title="Case summary generation") |
|
iface.launch(share=True) |
|
|
|
|