lxyuan commited on
Commit
fc40971
1 Parent(s): 5e21c98

Add chinese inference example

Browse files
Files changed (1) hide show
  1. README.md +27 -1
README.md CHANGED
@@ -24,7 +24,7 @@ model-index:
24
  name: Precision
25
  - type: recall
26
  value: 0.9281
27
- name: Recal
28
  license: apache-2.0
29
  datasets:
30
  - Babelscape/multinerd
@@ -117,6 +117,32 @@ entities
117
  # :(
118
  ```
119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  ## Training procedure
121
 
122
  One can reproduce the result running this [script](https://huggingface.co/tomaarsen/span-marker-mbert-base-multinerd/blob/main/train.py)
 
24
  name: Precision
25
  - type: recall
26
  value: 0.9281
27
+ name: Recall
28
  license: apache-2.0
29
  datasets:
30
  - Babelscape/multinerd
 
117
  # :(
118
  ```
119
 
120
+ #### Quick test on Chinese
121
+ ```python
122
+ from span_marker import SpanMarkerModel
123
+
124
+ model = SpanMarkerModel.from_pretrained("lxyuan/span-marker-bert-base-multilingual-cased-multinerd")
125
+
126
+ # translate to chinese
127
+ description = "Singapore is renowned for its hawker centers offering dishes \
128
+ like Hainanese chicken rice and laksa, while Malaysia boasts dishes such as \
129
+ nasi lemak and rendang, reflecting its rich culinary heritage."
130
+
131
+ zh_description = "新加坡因其小贩中心提供海南鸡饭和叻沙等菜肴而闻名, 而马来西亚则拥有椰浆饭和仁当等菜肴,反映了其丰富的烹饪传统."
132
+
133
+ entities = model.predict(zh_description)
134
+
135
+ entities
136
+ >>>
137
+ [
138
+ {'span': '新加坡', 'label': 'LOC', 'score': 0.9282007813453674, 'char_start_index': 0, 'char_end_index': 3},
139
+ {'span': '马来西亚', 'label': 'LOC', 'score': 0.7439665794372559, 'char_start_index': 27, 'char_end_index': 31}]
140
+
141
+ # It only managed to capture two countries: Singapore and Malaysia.
142
+ # All other entities were missed out.
143
+ ```
144
+
145
+
146
  ## Training procedure
147
 
148
  One can reproduce the result running this [script](https://huggingface.co/tomaarsen/span-marker-mbert-base-multinerd/blob/main/train.py)