julien-c HF staff commited on
Commit
0ef969b
1 Parent(s): f1206aa

Migrate model card from transformers-repo

Browse files

Read 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-sentiment-analysis-lince/README.md

Files changed (1) hide show
  1. README.md +53 -0
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
+ - sentiment-analysis
12
+ ---
13
+
14
+ # codeswitch-spaeng-sentiment-analysis-lince
15
+ This is a pretrained model for **Sentiment Analysis** 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
+ ## Sentiment Analysis of Spanish-English Code-Mixed Data
28
+
29
+ * **Method-1**
30
+
31
+ ```py
32
+
33
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
34
+
35
+ tokenizer = AutoTokenizer.from_pretrained("sagorsarker/codeswitch-spaeng-sentiment-analysis-lince")
36
+
37
+ model = AutoModelForSequenceClassification.from_pretrained("sagorsarker/codeswitch-spaeng-sentiment-analysis-lince")
38
+
39
+ nlp = pipeline('sentiment-analysis', model=model, tokenizer=tokenizer)
40
+ sentence = "El perro le ladraba a La Gatita .. .. lol #teamlagatita en las playas de Key Biscayne este Memorial day"
41
+ nlp(sentence)
42
+
43
+ ```
44
+
45
+ * **Method-2**
46
+
47
+ ```py
48
+ from codeswitch.codeswitch import SentimentAnalysis
49
+ sa = SentimentAnalysis('spa-eng')
50
+ sentence = "El perro le ladraba a La Gatita .. .. lol #teamlagatita en las playas de Key Biscayne este Memorial day"
51
+ result = sa.analyze(sentence)
52
+ print(result)
53
+ ```