Spaces:
Running
Running
poltextlab
commited on
listing named entities from spacy glossary; case sensitiveness warning
Browse files
app.py
CHANGED
@@ -7,13 +7,24 @@ from interfaces.emotion import demo as emotion_demo
|
|
7 |
from interfaces.ner import demo as ner_demo
|
8 |
from interfaces.ner import download_models as download_spacy_models
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
with gr.Blocks() as demo:
|
11 |
gr.Markdown(
|
12 |
-
"""
|
13 |
<div style="display: block; text-align: left; padding:0; margin:0;">
|
14 |
<h1 style="text-align: center">Babel Machine Demo</h1>
|
15 |
<p>This is a demo for text classification using language models finetuned on data labeled by <a href="https://www.comparativeagendas.net/">CAP</a>, <a href="https://manifesto-project.wzb.eu/">Manifesto Project</a>, sentiment, and emotion coding systems.<br>
|
16 |
-
For the coding of complete datasets, please visit the official <a href="https://babel.poltextlab.com/">Babel Machine</a> site
|
|
|
|
|
|
|
|
|
|
|
17 |
</div>
|
18 |
""")
|
19 |
|
|
|
7 |
from interfaces.ner import demo as ner_demo
|
8 |
from interfaces.ner import download_models as download_spacy_models
|
9 |
|
10 |
+
from spacy import glossary
|
11 |
+
|
12 |
+
entities = ["CARDINAL", "DATE", "EVENT", "FAC", "GPE", "LANGUAGE", "LAW", "LOC", "MONEY", "NORP", "ORDINAL", "ORG", "PERCENT", "PERSON", "PRODUCT", "QUANTITY", "TIME", "WORK_OF_ART"]
|
13 |
+
ent_dict = glossary.GLOSSARY
|
14 |
+
ent_sum = [f'{ent} = <i>{ent_dict[ent]}</i>' for ent in entities ]
|
15 |
+
|
16 |
with gr.Blocks() as demo:
|
17 |
gr.Markdown(
|
18 |
+
f"""
|
19 |
<div style="display: block; text-align: left; padding:0; margin:0;">
|
20 |
<h1 style="text-align: center">Babel Machine Demo</h1>
|
21 |
<p>This is a demo for text classification using language models finetuned on data labeled by <a href="https://www.comparativeagendas.net/">CAP</a>, <a href="https://manifesto-project.wzb.eu/">Manifesto Project</a>, sentiment, and emotion coding systems.<br>
|
22 |
+
For the coding of complete datasets, please visit the official <a href="https://babel.poltextlab.com/">Babel Machine</a> site.<br>
|
23 |
+
Please note that named entity inputs are case sensitive.<br>
|
24 |
+
For named entity recognition the following labels are used:</p>
|
25 |
+
<ul>
|
26 |
+
<li> {'</li> <li>'.join(ent_sum)} </li>
|
27 |
+
</ul>
|
28 |
</div>
|
29 |
""")
|
30 |
|