Spaces:
Build error
Build error
Johannes
commited on
Commit
·
54e9b45
1
Parent(s):
a5bc7b6
update
Browse files
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
title: Borrowing Detection
|
| 3 |
emoji: 🔍
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: purple
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Borrowing Detection Español
|
| 3 |
emoji: 🔍
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: purple
|
app.py
CHANGED
|
@@ -18,6 +18,7 @@ diplacy_dict_template = {
|
|
| 18 |
def infer(input_text):
|
| 19 |
displacy_ents = []
|
| 20 |
borrowings = nlp(input_text)
|
|
|
|
| 21 |
for borrowing in borrowings:
|
| 22 |
displacy_ent_dict = {
|
| 23 |
"start": borrowing["start"],
|
|
@@ -28,9 +29,10 @@ def infer(input_text):
|
|
| 28 |
|
| 29 |
colors = {"B-ENG": "linear-gradient(90deg, #aa9cfc, #fc9ce7)",
|
| 30 |
"I-ENG": "linear-gradient(90deg, #99bfff, #a57cf0)",
|
| 31 |
-
"OTHER": "linear-gradient(90deg, #79d0a5, #f6e395)"
|
|
|
|
| 32 |
|
| 33 |
-
options = {"ents": ["B-ENG", "I-ENG", "OTHER"], "colors": colors}
|
| 34 |
displacy_dict_template = {"text": input_text, "ents": displacy_ents, "title": None}
|
| 35 |
|
| 36 |
html = displacy.render(displacy_dict_template, style="ent", page=True, manual=True, options=options)
|
|
@@ -44,12 +46,23 @@ def infer(input_text):
|
|
| 44 |
return html
|
| 45 |
|
| 46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
demo = gr.Interface(
|
| 48 |
title="Borrowing Detection Español",
|
|
|
|
| 49 |
fn=infer,
|
| 50 |
inputs=gr.Text(),
|
| 51 |
outputs=gr.HTML(),
|
| 52 |
-
examples=["Buscamos data scientist para proyecto de machine learning."
|
|
|
|
|
|
|
| 53 |
)
|
| 54 |
|
| 55 |
demo.launch()
|
|
|
|
| 18 |
def infer(input_text):
|
| 19 |
displacy_ents = []
|
| 20 |
borrowings = nlp(input_text)
|
| 21 |
+
|
| 22 |
for borrowing in borrowings:
|
| 23 |
displacy_ent_dict = {
|
| 24 |
"start": borrowing["start"],
|
|
|
|
| 29 |
|
| 30 |
colors = {"B-ENG": "linear-gradient(90deg, #aa9cfc, #fc9ce7)",
|
| 31 |
"I-ENG": "linear-gradient(90deg, #99bfff, #a57cf0)",
|
| 32 |
+
"B-OTHER": "linear-gradient(90deg, #79d0a5, #f6e395)",
|
| 33 |
+
"I-OTHER": "linear-gradient(90deg, #f79a76, #fb6d6d)"}
|
| 34 |
|
| 35 |
+
options = {"ents": ["B-ENG", "I-ENG", "B-OTHER", "I-OTHER"], "colors": colors}
|
| 36 |
displacy_dict_template = {"text": input_text, "ents": displacy_ents, "title": None}
|
| 37 |
|
| 38 |
html = displacy.render(displacy_dict_template, style="ent", page=True, manual=True, options=options)
|
|
|
|
| 46 |
return html
|
| 47 |
|
| 48 |
|
| 49 |
+
description="""This space is a demo for the paper Detecting Unassimilated Borrowings in Spanish:
|
| 50 |
+
[An Annotated Corpus and Approaches to Modeling](https://arxiv.org/pdf/2203.16169.pdf)
|
| 51 |
+
|
| 52 |
+
The goal of the underlying model is to detect foreign words, e.g. anglicisms, in spanish texts.
|
| 53 |
+
In general it has two types of tags for foreign words: *ENG* and *OTHER*. The authors used BIO-tagging,
|
| 54 |
+
which is why in practice you will see a *B-* or *I-* in front of the tags.
|
| 55 |
+
"""
|
| 56 |
+
|
| 57 |
demo = gr.Interface(
|
| 58 |
title="Borrowing Detection Español",
|
| 59 |
+
description=description,
|
| 60 |
fn=infer,
|
| 61 |
inputs=gr.Text(),
|
| 62 |
outputs=gr.HTML(),
|
| 63 |
+
examples=["Buscamos data scientist para proyecto de machine learning.",
|
| 64 |
+
"Las fake news sobre la celebrity se reprodujeron por los 'mass media' en prime time.",
|
| 65 |
+
"Me gusta el cine noir y el anime."],
|
| 66 |
)
|
| 67 |
|
| 68 |
demo.launch()
|