Catherine Breslin commited on
Commit
a53dcb2
1 Parent(s): 1ebcb96

Spacy NER Demo

Browse files
Files changed (2) hide show
  1. app.py +18 -0
  2. requirements.txt +5 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import spacy
3
+ from spacytextblob.spacytextblob import SpacyTextBlob
4
+ from spacy_streamlit import visualize_ner
5
+
6
+ st.header("NER Demo")
7
+ st.markdown("This demo uses Spacy to identify entities in text.")
8
+
9
+ # Streamlit text boxes
10
+ # Text source: https://www.fool.com/earnings/call-transcripts/2022/02/08/danaos-dac-q4-2021-earnings-call-transcript/
11
+ text = st.text_area('Enter text:', value="Good day, and welcome to the Danaos Corporation conference call to discuss the financial results for the three months ended December 31, 2021. As a reminder, today's call is being recorded. Hosting the call today is Dr. John Coustas, chief executive officer of Danaos Corporation; and Mr. Evangelos Chatzis, chief financial officer of Danaos Corporation. Dr. Coustas and Mr. Chatzis will be making some introductory comments and then we will open the call to a question-and-answer session. Please go ahead. Thank you, operator, and good morning to everyone. And thank you for joining us today. Before we begin, I quickly want to remind everyone that management's remarks this morning may contain certain forward-looking statements and that actual results could differ materially from those projected today. These forward-looking statements are made as of today, and we undertake no obligation to update them. Factors that might affect future results are discussed in our filings with the SEC, and we encourage you to review these detailed Safe Harbor and risk factor disclosures. Please also note that where we feel appropriate, we will continue to refer to non-GAAP financial measures such as EBITDA, adjusted EBITDA and adjusted net income to evaluate our business. Reconciliations of non-GAAP financial measures to GAAP financial measures are included in our earnings release and accompanying materials. With that, now let me turn the call over to Dr. Coustas, who will provide a broad overview of the quarter.")
12
+
13
+
14
+ nlp = spacy.load("en_core_web_sm")
15
+ if text:
16
+ doc = nlp(text)
17
+ visualize_ner(doc, labels=nlp.get_pipe("ner").labels)
18
+
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ spacy
2
+ spacytextblob
3
+ https://huggingface.co/spacy/en_core_web_sm/resolve/main/en_core_web_sm-any-py3-none-any.whl
4
+ st-annotated_text
5
+ spacy-streamlit