This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from spacy.matcher import Matcher | |
nlp = spacy.load("en_core_web_sm") | |
doc = nlp("Hello my friend!") | |
pattern = [ | |
{"TEXT": "Hello"} | |
] | |
matcher = Matcher(nlp.vocab) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import spacy | |
# load a spacy model that detects DNA, RNA and PROTEINS from | |
# biomedical documents | |
model = spacy.load( | |
"en_ner_jnlpba_md", | |
disable=["tok2vec", "tagger", "parser", "attribute_ruler", "lemmatizer"], | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import spacy | |
nlp = spacy.blanc("en") | |
doc_before = nlp("John lives in Atlanta") | |
# No entities are detected | |
print(doc_before.ents) | |
# () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import spacy | |
from spacy import displacy | |
nlp = spacy.load("en_core_web_sm") | |
doc = nlp("John lives in France and works at Apple Inc.") | |
print(doc.ents) | |
# (John, France, Apple Inc.) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import spacy | |
nlp = spacy.load("en_core_news_sm") | |
texts = ... # a large list of documents | |
docs = [] | |
for doc in nlp.pipe(texts, n_process=os.cpu_count()-1): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
number_of_tabs = st.sidebar.number_input( | |
"Number of tabs", | |
min_value=1, | |
max_value=20, | |
value=1, | |
) | |
number_of_tabs = int(number_of_tabs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
import streamlit as st | |
tabs = st.tabs(["metrics", "plots", "reports"]) | |
tab_metrics = tabs[0] | |
with tab_metrics: | |
st.metric("Precision", 0.85, delta=0.2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
tabs = st.tabs(["metrics", "plots", "reports"]) | |
tab_plots = tabs[1] | |
with tab_plots: | |
cols = st.columns(2) | |
with cols[0]: | |
st.image("./roc.png") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
tabs = st.tabs(["metrics", "plots", "reports"]) | |
tab_plots = tabs[1] | |
with tab_plots: | |
st.image("./roc.png") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
tabs = st.tabs(["metrics", "plots", "reports"]) | |
tab_metrics = tabs[0] | |
tab_metrics.metric("Precision", 0.85, delta=0.2) | |
tab_metrics.metric("Recall", 0.60, delta=-0.1) |