task_categories:text-generation language:en language:zh license:mit size_categories:100K<n<1M format:parquet modality:text library:datasets library:dask library:mlcroissant library:polars region:us business case business case synthetic synthetic data enterprise chineese english multilingual
---
language:
- en
- zh
dataset_info:
  features:
  - name: case_study_info
    dtype: string
  - name: stakeholders
    sequence:
    - name: stakeholder
      dtype: string
    - name: motivation
      dtype: string
  - name: case_study_solutions
    dtype: string
  - name: endpoint
    dtype: string
  splits:
  - name: english
    num_bytes: 1653189979
    num_examples: 344580
  - name: chinese
    num_bytes: 1108091208
    num_examples: 344580
  download_size: 1214318456
  dataset_size: 2761281187
configs:
- config_name: default
  data_files:
  - split: english
    path: data/english-*
  - split: chinese
    path: data/chinese-*
license: mit
task_categories:
- text-generation
multilingual:
  languages:
    - code: en
      name: English
      script: Latin
    - code: zh
      name: Chinese
      script: Han
tags:
- business
- case
- business case
- synthetic
- synthetic data
- enterprise
- chineese
- english
- multilingual
pretty_name: Dark Thoughts Casestudy Stakeholder
size_categories:
- 100K<n<1M
source:
  original_dataset: DataTonic/DarkThoughts-CaseStudies
  original_url: https://huggingface.co/datasets/DataTonic/DarkThoughts-CaseStudies
---

# Dark Thoughts Case Studies Dataset (English-Chinese)

This dataset contains a bilingual collection of case studies with detailed stakeholder analyses in English and Chinese. Each case study includes structured information about stakeholders and their motivations, along with comprehensive case analysis and solutions.

## Dataset Description

### Overview

The dataset consists of 344,580 paired case studies in English and Chinese, with detailed stakeholder analyses and solutions. Each entry contains:
- Initial case study information
- Structured stakeholder analysis (with roles and motivations)
- Proposed solutions and outcomes

### Data Structure

Each example in the dataset contains:
- `case_study_info`: Initial description and background of the case study
- `stakeholders`: List of stakeholders with their roles and motivations
  - `stakeholder`: The role or title of the stakeholder
  - `motivation`: Description of the stakeholder's motivations and interests
- `case_study_solutions`: Proposed solutions and expected outcomes
- `endpoint`: Reference identifier for the case study

### Splits

The dataset is organized into two splits:
- `english`: 344,580 examples (1.65 GB)
- `chinese`: 344,580 examples (1.11 GB)

Total dataset size: 2.76 GB
Download size: 1.21 GB

## Usage

```python
from datasets import load_dataset

# Load the entire dataset
dataset = load_dataset("DataTonic/dark_thoughts_casestudies_en_cn")

# Access English split
english_data = dataset["english"]

# Access Chinese split
chinese_data = dataset["chinese"]

# Example: Print first case study info in both languages
print("English case study:", english_data[0]["case_study_info"])
print("Chinese case study:", chinese_data[0]["case_study_info"])

# Example: Access stakeholder information
print("English stakeholders:", english_data[0]["stakeholders"])
```

## Data Fields

- `case_study_info`: string
  - Contains the initial description and context of the case study
- `stakeholders`: sequence of dictionaries containing:
  - `stakeholder`: string (role/title of the stakeholder)
  - `motivation`: string (description of stakeholder's motivations)
- `case_study_solutions`: string
  - Contains proposed solutions and expected outcomes
- `endpoint`: string
  - Reference identifier for the case study

## Dataset Creation

### Source Data

[DataTonic/DarkThoughts-CaseStudies](https://huggingface.co/datasets/DataTonic/DarkThoughts-CaseStudies)

### Data Processing

```python
def extract_stakeholders_english(text: str) -> List[Dict[str, str]]:
    """Extract stakeholders and their motivations from English text"""
    stakeholders = []
    
    patterns = [
        # List pattern with role and description
        r'[-\*]\s*\*\*(.*?)\*\*\s*[-:]\s*(.*?)(?=\n|$)',
        # Table pattern
        r'\|\s*(.*?)\s*\|\s*(.*?)\s*\|\s*(.*?)\s*\|',
        # Role-based pattern
        r'\*\*(.*?)\*\*\s*[-:]\s*(.*?)(?=\n|$)',
        # Numbered list pattern
        r'\d+\.\s*\*\*(.*?)\*\*\s*[-:]\s*(.*?)(?=\n|$)'
    ]
    
    for pattern in patterns:
        matches = re.findall(pattern, text, re.MULTILINE)
        if matches:
            if len(matches[0]) == 3:  # Table format
                matches = [(m[0], m[2]) for m in matches if 'role' not in m[0].lower()]
            for match in matches:
                stakeholder = match[0].strip()
                motivation = match[1].strip()
                if stakeholder and motivation:
                    stakeholders.append({
                        "stakeholder": stakeholder,
                        "motivation": motivation
                    })
            break
            
    return stakeholders

def extract_stakeholders_chinese(text: str) -> List[Dict[str, str]]:
    """Extract stakeholders and their motivations from Chinese text"""
    stakeholders = []
    
    patterns = [
        # Chinese table pattern
        r'\|\s*(.*?)\s*\|\s*(.*?)\s*\|\s*(.*?)\s*\|',
        # Chinese colon pattern with dash
        r'[-•]\s*\*\*(.*?)\*\*［：:]\s*(.*?)(?=\n|$)',
        # Chinese numbered list pattern
        r'\d+\.\s*\*\*(.*?)\*\*[:：](.*?)(?=\n|$)',
        # Chinese dash pattern
        r'[-—]\s*\*\*(.*?)\*\*[:：](.*?)(?=\n|$)',
        # Simple Chinese colon pattern
        r'\*\*(.*?)\*\*[:：](.*?)(?=\n|$)'
    ]
    
    for pattern in patterns:
        matches = re.findall(pattern, text, re.MULTILINE)
        if matches:
            if len(matches[0]) == 3:  # Table format
                matches = [(m[0], m[2]) for m in matches if '职位' not in m[0] and '角色' not in m[0]]
            for match in matches:
                stakeholder = match[0].strip()
                motivation = match[1].strip()
                if stakeholder and motivation:
                    stakeholders.append({
                        "stakeholder": stakeholder,
                        "motivation": motivation
                    })
            break
            
    return stakeholders

def split_case_study_english(text: str) -> Tuple[str, str, str]:
    """Split English case study into sections"""
    stakeholder_headers = [
        r"## Stakeholders",
        r"## Key Stakeholders",
        r"### Stakeholders",
        r"## 3\.\s*Stakeholders"
    ]
    
    next_section_headers = [
        r"## Situation Analysis",
        r"## Analysis",
        r"## 4\.",
        r"## Potential Solutions",
        r"## Expected Outcomes"
    ]
    
    return split_text_by_sections(text, stakeholder_headers, next_section_headers)

def split_case_study_chinese(text: str) -> Tuple[str, str, str]:
    """Split Chinese case study into sections"""
    stakeholder_headers = [
        r"## 利益相关者",
        r"## 3\.\s*利益相关者",
        r"### 利益相关者",
        r"## 相关方分析",
        r"## 三、利益相关者"
    ]
    
    next_section_headers = [
        r"## 情况分析",
        r"## 4\.",
        r"## 潜在解决方案",
        r"## 四、",
        r"## 分析"
    ]
    
    return split_text_by_sections(text, stakeholder_headers, next_section_headers)

def split_text_by_sections(text: str, start_headers: List[str], end_headers: List[str]) -> Tuple[str, str, str]:
    """Generic function to split text by section headers"""
    start_idx = -1
    for header in start_headers:
        match = re.search(header, text)
        if match:
            start_idx = match.start()
            break
    
    if start_idx == -1:
        return text, "", ""
    
    end_idx = len(text)
    for header in end_headers:
        match = re.search(header, text[start_idx:])
        if match:
            end_idx = start_idx + match.start()
            break
    
    return text[:start_idx].strip(), text[start_idx:end_idx].strip(), text[end_idx:].strip()
```

## Additional Information

### Dataset Size
- Number of examples: 344,580 per language
- Total size: 2.76 GB
- Download size: 1.21 GB

### Licensing Information
[Add license information here]

### Citation Information
[Add citation information here]

### Contributions

Contributions to improve the dataset are welcome. Please submit a pull request or open an issue to discuss proposed changes.

## Limitations

[Add any known limitations or biases in the dataset]

## Ethical Considerations

[Add any ethical considerations or guidelines for usage]