AndersGiovanni commited on
Commit
23573c1
1 Parent(s): 60dfd3b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +29 -0
README.md CHANGED
@@ -37,4 +37,33 @@ dataset_info:
37
  ---
38
  # Dataset Card for "10-dim"
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  [More Information needed](https://github.com/huggingface/datasets/blob/main/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
 
37
  ---
38
  # Dataset Card for "10-dim"
39
 
40
+ ### Map labels to strings
41
+
42
+ ```python
43
+ # Here's the list of labels and mappings between id and label.
44
+
45
+ labels = [
46
+ "social_support",
47
+ "conflict",
48
+ "trust",
49
+ "fun",
50
+ "similarity",
51
+ "identity",
52
+ "respect",
53
+ "romance",
54
+ "knowledge",
55
+ "power",
56
+ ]
57
+ id2label = {i: label for i, label in enumerate(labels)}
58
+ label2id = {label: i for i, label in enumerate(labels)}
59
+
60
+ # Given an examples, this is how you map
61
+ sample = {
62
+ "text": "This is just a made up text"
63
+ "labels": [0, 0, 0, 1, 0, 0, 0, 0, 0, 1]
64
+ }
65
+
66
+ labels_str = [id2label[i] for i, label in enumerate(sample['labels']) if label == 1]
67
+ ```
68
+
69
  [More Information needed](https://github.com/huggingface/datasets/blob/main/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)