Update README to specify binary classification and simplify notes
Browse files
README.md
CHANGED
|
@@ -19,7 +19,7 @@ tags:
|
|
| 19 |
- advertisement
|
| 20 |
- social-media
|
| 21 |
- xiaohongshu
|
| 22 |
-
-
|
| 23 |
pretty_name: CHASM - Covert Advertisement on RedNote
|
| 24 |
---
|
| 25 |
|
|
@@ -31,7 +31,7 @@ A dataset containing posts from Xiaohongshu (RedNote) for text classification ta
|
|
| 31 |
|
| 32 |
## Dataset Description
|
| 33 |
|
| 34 |
-
- **Task Type**: Text Classification
|
| 35 |
- **Language**: Chinese
|
| 36 |
- **License**: MIT
|
| 37 |
- **Dataset Size**: Contains two classes (label_0 and label_1)
|
|
@@ -39,40 +39,40 @@ A dataset containing posts from Xiaohongshu (RedNote) for text classification ta
|
|
| 39 |
|
| 40 |
### Dataset Structure
|
| 41 |
|
| 42 |
-
|
| 43 |
|
| 44 |
-
#### 1.
|
| 45 |
|
| 46 |
-
|
| 47 |
|
| 48 |
-
- `label_0/`:
|
| 49 |
-
- `label_1/`:
|
| 50 |
|
| 51 |
-
|
| 52 |
|
| 53 |
-
- `data.json`:
|
| 54 |
-
-
|
| 55 |
|
| 56 |
-
#### 2. Hugging Face
|
| 57 |
|
| 58 |
-
|
| 59 |
|
| 60 |
-
- `hf_format/train.csv`
|
| 61 |
-
- `hf_format/validation.csv`
|
| 62 |
-
- `hf_format/test.csv`
|
| 63 |
-
- `hf_format/dataset_info.json`:
|
| 64 |
|
| 65 |
-
###
|
| 66 |
|
| 67 |
Each data sample contains the following fields:
|
| 68 |
|
| 69 |
-
- `id`:
|
| 70 |
-
- `title`:
|
| 71 |
-
- `description`:
|
| 72 |
-
- `date`:
|
| 73 |
-
- `comments`:
|
| 74 |
-
- `images`:
|
| 75 |
-
- `label`:
|
| 76 |
|
| 77 |
### Data Example
|
| 78 |
|
|
@@ -90,56 +90,56 @@ Each data sample contains the following fields:
|
|
| 90 |
|
| 91 |
## Usage
|
| 92 |
|
| 93 |
-
|
| 94 |
|
| 95 |
```python
|
| 96 |
import os
|
| 97 |
import json
|
| 98 |
from glob import glob
|
| 99 |
|
| 100 |
-
#
|
| 101 |
for label_dir in ['label_0', 'label_1']:
|
| 102 |
for sample_dir in glob(f"{label_dir}/*"):
|
| 103 |
if os.path.isdir(sample_dir):
|
| 104 |
-
#
|
| 105 |
with open(os.path.join(sample_dir, 'data.json'), 'r', encoding='utf-8') as f:
|
| 106 |
data = json.load(f)
|
| 107 |
|
| 108 |
-
#
|
| 109 |
images = glob(os.path.join(sample_dir, '*.jpg'))
|
| 110 |
|
| 111 |
-
#
|
| 112 |
```
|
| 113 |
|
| 114 |
-
|
| 115 |
|
| 116 |
```python
|
| 117 |
import pandas as pd
|
| 118 |
|
| 119 |
-
#
|
| 120 |
train_df = pd.read_csv('hf_format/train.csv')
|
| 121 |
val_df = pd.read_csv('hf_format/validation.csv')
|
| 122 |
test_df = pd.read_csv('hf_format/test.csv')
|
| 123 |
|
| 124 |
-
#
|
| 125 |
import json
|
| 126 |
with open('hf_format/train.json', 'r', encoding='utf-8') as f:
|
| 127 |
train_data = json.load(f)
|
| 128 |
```
|
| 129 |
|
| 130 |
-
|
| 131 |
|
| 132 |
```python
|
| 133 |
from datasets import load_dataset
|
| 134 |
|
| 135 |
-
#
|
| 136 |
dataset = load_dataset("Jingyi77/CHASM-Covert_Advertisement_on_RedNote")
|
| 137 |
|
| 138 |
-
#
|
| 139 |
print(dataset)
|
| 140 |
|
| 141 |
-
#
|
| 142 |
-
print(dataset['train'][0]) #
|
| 143 |
```
|
| 144 |
|
| 145 |
## Data Preprocessing
|
|
@@ -150,10 +150,7 @@ print(dataset['train'][0]) # 查看训练集的第一个数据点
|
|
| 150 |
|
| 151 |
## Notes
|
| 152 |
|
| 153 |
-
|
| 154 |
-
2. Comments may contain sensitive content, please use with caution
|
| 155 |
-
3. All temporal information has been anonymized
|
| 156 |
-
4. This dataset is specifically designed for research on covert advertisement detection
|
| 157 |
|
| 158 |
## Dataset Creation
|
| 159 |
|
|
|
|
| 19 |
- advertisement
|
| 20 |
- social-media
|
| 21 |
- xiaohongshu
|
| 22 |
+
- RedNote
|
| 23 |
pretty_name: CHASM - Covert Advertisement on RedNote
|
| 24 |
---
|
| 25 |
|
|
|
|
| 31 |
|
| 32 |
## Dataset Description
|
| 33 |
|
| 34 |
+
- **Task Type**: Text Classification (Binary Classification)
|
| 35 |
- **Language**: Chinese
|
| 36 |
- **License**: MIT
|
| 37 |
- **Dataset Size**: Contains two classes (label_0 and label_1)
|
|
|
|
| 39 |
|
| 40 |
### Dataset Structure
|
| 41 |
|
| 42 |
+
This dataset is available in two formats:
|
| 43 |
|
| 44 |
+
#### 1. Original Directory Structure
|
| 45 |
|
| 46 |
+
Data is organized in the following directory structure:
|
| 47 |
|
| 48 |
+
- `label_0/`: Non-advertisement content
|
| 49 |
+
- `label_1/`: Advertisement content
|
| 50 |
|
| 51 |
+
Each sample has its own folder (e.g., `train_889/`), containing:
|
| 52 |
|
| 53 |
+
- `data.json`: Text data
|
| 54 |
+
- Multiple image files (JPG/WEBP format)
|
| 55 |
|
| 56 |
+
#### 2. Hugging Face Format
|
| 57 |
|
| 58 |
+
For better compatibility with the Hugging Face platform, we also provide processed formats:
|
| 59 |
|
| 60 |
+
- `hf_format/train.csv` and `hf_format/train.json`: Training set
|
| 61 |
+
- `hf_format/validation.csv` and `hf_format/validation.json`: Validation set
|
| 62 |
+
- `hf_format/test.csv` and `hf_format/test.json`: Test set
|
| 63 |
+
- `hf_format/dataset_info.json`: Dataset metadata
|
| 64 |
|
| 65 |
+
### Data Fields
|
| 66 |
|
| 67 |
Each data sample contains the following fields:
|
| 68 |
|
| 69 |
+
- `id`: Sample unique identifier
|
| 70 |
+
- `title`: Post title
|
| 71 |
+
- `description`: Post description
|
| 72 |
+
- `date`: Publication date and location
|
| 73 |
+
- `comments`: List of comments
|
| 74 |
+
- `images`: List of image filenames
|
| 75 |
+
- `label`: Classification label (0: non-advertisement, 1: advertisement)
|
| 76 |
|
| 77 |
### Data Example
|
| 78 |
|
|
|
|
| 90 |
|
| 91 |
## Usage
|
| 92 |
|
| 93 |
+
Using the original directory structure:
|
| 94 |
|
| 95 |
```python
|
| 96 |
import os
|
| 97 |
import json
|
| 98 |
from glob import glob
|
| 99 |
|
| 100 |
+
# Iterate through all samples
|
| 101 |
for label_dir in ['label_0', 'label_1']:
|
| 102 |
for sample_dir in glob(f"{label_dir}/*"):
|
| 103 |
if os.path.isdir(sample_dir):
|
| 104 |
+
# Read data file
|
| 105 |
with open(os.path.join(sample_dir, 'data.json'), 'r', encoding='utf-8') as f:
|
| 106 |
data = json.load(f)
|
| 107 |
|
| 108 |
+
# Get image files
|
| 109 |
images = glob(os.path.join(sample_dir, '*.jpg'))
|
| 110 |
|
| 111 |
+
# Process data...
|
| 112 |
```
|
| 113 |
|
| 114 |
+
Using Hugging Face format:
|
| 115 |
|
| 116 |
```python
|
| 117 |
import pandas as pd
|
| 118 |
|
| 119 |
+
# Load data
|
| 120 |
train_df = pd.read_csv('hf_format/train.csv')
|
| 121 |
val_df = pd.read_csv('hf_format/validation.csv')
|
| 122 |
test_df = pd.read_csv('hf_format/test.csv')
|
| 123 |
|
| 124 |
+
# Or use JSON format
|
| 125 |
import json
|
| 126 |
with open('hf_format/train.json', 'r', encoding='utf-8') as f:
|
| 127 |
train_data = json.load(f)
|
| 128 |
```
|
| 129 |
|
| 130 |
+
Using Hugging Face datasets library:
|
| 131 |
|
| 132 |
```python
|
| 133 |
from datasets import load_dataset
|
| 134 |
|
| 135 |
+
# Load dataset
|
| 136 |
dataset = load_dataset("Jingyi77/CHASM-Covert_Advertisement_on_RedNote")
|
| 137 |
|
| 138 |
+
# View dataset information
|
| 139 |
print(dataset)
|
| 140 |
|
| 141 |
+
# Access data
|
| 142 |
+
print(dataset['train'][0]) # View first data point in training set
|
| 143 |
```
|
| 144 |
|
| 145 |
## Data Preprocessing
|
|
|
|
| 150 |
|
| 151 |
## Notes
|
| 152 |
|
| 153 |
+
This dataset is specifically designed for research on covert advertisement detection as a binary classification task.
|
|
|
|
|
|
|
|
|
|
| 154 |
|
| 155 |
## Dataset Creation
|
| 156 |
|