Migrate model card from transformers-repo
Browse filesRead announcement at https://discuss.huggingface.co/t/announcement-all-model-cards-will-be-migrated-to-hf-co-model-repos/2755
Original file history: https://github.com/huggingface/transformers/commits/master/model_cards/sagorsarker/codeswitch-spaeng-ner-lince/README.md
README.md
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- es
|
4 |
+
- en
|
5 |
+
datasets:
|
6 |
+
- lince
|
7 |
+
license: mit
|
8 |
+
tags:
|
9 |
+
- codeswitching
|
10 |
+
- spanish-english
|
11 |
+
- ner
|
12 |
+
---
|
13 |
+
|
14 |
+
# codeswitch-spaeng-ner-lince
|
15 |
+
This is a pretrained model for **Name Entity Recognition** of `spanish-english` code-mixed data used from [LinCE](https://ritual.uh.edu/lince/home)
|
16 |
+
|
17 |
+
This model is trained for this below repository.
|
18 |
+
|
19 |
+
[https://github.com/sagorbrur/codeswitch](https://github.com/sagorbrur/codeswitch)
|
20 |
+
|
21 |
+
To install codeswitch:
|
22 |
+
|
23 |
+
```
|
24 |
+
pip install codeswitch
|
25 |
+
```
|
26 |
+
|
27 |
+
## Name Entity Recognition of Spanish-English Mixed Data
|
28 |
+
|
29 |
+
* **Method-1**
|
30 |
+
|
31 |
+
```py
|
32 |
+
|
33 |
+
from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
|
34 |
+
|
35 |
+
tokenizer = AutoTokenizer.from_pretrained("sagorsarker/codeswitch-spaeng-ner-lince")
|
36 |
+
|
37 |
+
model = AutoModelForTokenClassification.from_pretrained("sagorsarker/codeswitch-spaeng-ner-lince")
|
38 |
+
|
39 |
+
ner_model = pipeline('ner', model=model, tokenizer=tokenizer)
|
40 |
+
|
41 |
+
ner_model("put any spanish english code-mixed sentence")
|
42 |
+
|
43 |
+
```
|
44 |
+
|
45 |
+
* **Method-2**
|
46 |
+
|
47 |
+
```py
|
48 |
+
from codeswitch.codeswitch import NER
|
49 |
+
ner = NER('spa-eng')
|
50 |
+
text = "" # your mixed sentence
|
51 |
+
result = ner.tag(text)
|
52 |
+
print(result)
|
53 |
+
```
|