[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BVN533Q9RNRSWS5SBQ04E8":3,"skill-same:01M7BVN533Q9RNRSWS5SBQ04E8":79},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":51,"commitSha":52,"skillDirectory":53,"forksCount":54,"repositoryHtmlUrl":55,"repositoryHomepageUrl":6,"ownerHtmlUrl":56,"ownerBlogUrl":6,"ownerDescription":57,"updatedAt":58,"install":59,"resources":72},"01M7BVN533Q9RNRSWS5SBQ04E8","data-extractor",null,">","om-scogo\u002Fskillsh-scraper","om-scogo","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F160466840?v=4","01M79AWB6DFVCQ7RK70CS34B96","Om Achrekar","01M79AWB6ZM9SKR8KDH1WSSM22",0,"MIT","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fclaude-office-skills-skills\u002Fdata-extractor\u002FSkill.md",[],[],"2026-11-15 14:19:17",false,"---\n# ═══════════════════════════════════════════════════════════════════════════════\n# CLAUDE OFFICE SKILL - Enhanced Metadata v2.0\n# ═══════════════════════════════════════════════════════════════════════════════\n\n# Basic Information\nname: data-extractor\ndescription: \">\"\nversion: \"1.0\"\nauthor: claude-office-skills\nlicense: MIT\n\n# Categorization\ncategory: parsing\ntags:\n  - extraction\n  - data\n  - unstructured\ndepartment: All\n\n# AI Model Compatibility\nmodels:\n  recommended:\n    - claude-sonnet-4\n    - claude-opus-4\n  compatible:\n    - claude-3-5-sonnet\n    - gpt-4\n    - gpt-4o\n\n# MCP Tools Integration\nmcp:\n  server: office-mcp\n  tools:\n    - extract_text_from_pdf\n    - extract_tables_from_pdf\n\n# Skill Capabilities\ncapabilities:\n  - data_extraction\n  - format_handling\n\n# Language Support\nlanguages:\n  - en\n  - zh\n---\n\n# Data Extractor Skill\n\n## Overview\n\nThis skill enables extraction of structured data from any document format using **unstructured** - a unified library for processing PDFs, Word docs, emails, HTML, and more. Get consistent, structured output regardless of input format.\n\n## How to Use\n\n1. Provide the document to process\n2. Optionally specify extraction options\n3. I'll extract structured elements with metadata\n\n**Example prompts:**\n- \"Extract all text and tables from this PDF\"\n- \"Parse this email and get the body, attachments, and metadata\"\n- \"Convert this HTML page to structured elements\"\n- \"Extract data from these mixed-format documents\"\n\n## Domain Knowledge\n\n### unstructured Fundamentals\n\n```python\nfrom unstructured.partition.auto import partition\n\n# Automatically detect and process any document\nelements = partition(\"document.pdf\")\n\n# Access extracted elements\nfor element in elements:\n    print(f\"Type: {type(element).__name__}\")\n    print(f\"Text: {element.text}\")\n    print(f\"Metadata: {element.metadata}\")\n```\n\n### Supported Formats\n\n| Format | Function | Notes |\n|--------|----------|-------|\n| PDF | `partition_pdf` | Native + scanned |\n| Word | `partition_docx` | Full structure |\n| PowerPoint | `partition_pptx` | Slides & notes |\n| Excel | `partition_xlsx` | Sheets & tables |\n| Email | `partition_email` | Body & attachments |\n| HTML | `partition_html` | Tags preserved |\n| Markdown | `partition_md` | Structure preserved |\n| Plain Text | `partition_text` | Basic parsing |\n| Images | `partition_image` | OCR extraction |\n\n### Element Types\n\n```python\nfrom unstructured.documents.elements import (\n    Title,\n    NarrativeText,\n    Text,\n    ListItem,\n    Table,\n    Image,\n    Header,\n    Footer,\n    PageBreak,\n    Address,\n    EmailAddress,\n)\n\n# Elements have consistent structure\nelement.text           # Raw text content\nelement.metadata       # Rich metadata\nelement.category       # Element type\nelement.id            # Unique identifier\n```\n\n### Auto Partition\n\n```python\nfrom unstructured.partition.auto import partition\n\n# Process any file type\nelements = partition(\n    filename=\"document.pdf\",\n    strategy=\"auto\",          # or \"fast\", \"hi_res\", \"ocr_only\"\n    include_metadata=True,\n    include_page_breaks=True,\n)\n\n# Filter by type\ntitles = [e for e in elements if isinstance(e, Title)]\ntables = [e for e in elements if isinstance(e, Table)]\n```\n\n### Format-Specific Partitioning\n\n```python\n# PDF with options\nfrom unstructured.partition.pdf import partition_pdf\n\nelements = partition_pdf(\n    filename=\"document.pdf\",\n    strategy=\"hi_res\",              # High quality extraction\n    infer_table_structure=True,     # Detect tables\n    include_page_breaks=True,\n    languages=[\"en\"],               # OCR language\n)\n\n# Word documents\nfrom unstructured.partition.docx import partition_docx\n\nelements = partition_docx(\n    filename=\"document.docx\",\n    include_metadata=True,\n)\n\n# HTML\nfrom unstructured.partition.html import partition_html\n\nelements = partition_html(\n    filename=\"page.html\",\n    include_metadata=True,\n)\n```\n\n### Working with Tables\n\n```python\nfrom unstructured.partition.auto import partition\n\nelements = partition(\"report.pdf\", infer_table_structure=True)\n\n# Extract tables\nfor element in elements:\n    if element.category == \"Table\":\n        print(\"Table found:\")\n        print(element.text)\n        \n        # Access structured table data\n        if hasattr(element, 'metadata') and element.metadata.text_as_html:\n            print(\"HTML:\", element.metadata.text_as_html)\n```\n\n### Metadata Access\n\n```python\nfrom unstructured.partition.auto import partition\n\nelements = partition(\"document.pdf\")\n\nfor element in elements:\n    meta = element.metadata\n    \n    # Common metadata fields\n    print(f\"Page: {meta.page_number}\")\n    print(f\"Filename: {meta.filename}\")\n    print(f\"Filetype: {meta.filetype}\")\n    print(f\"Coordinates: {meta.coordinates}\")\n    print(f\"Languages: {meta.languages}\")\n```\n\n### Chunking for AI\u002FRAG\n\n```python\nfrom unstructured.partition.auto import partition\nfrom unstructured.chunking.title import chunk_by_title\nfrom unstructured.chunking.basic import chunk_elements\n\n# Partition document\nelements = partition(\"document.pdf\")\n\n# Chunk by title (semantic chunks)\nchunks = chunk_by_title(\n    elements,\n    max_characters=1000,\n    combine_text_under_n_chars=200,\n)\n\n# Or basic chunking\nchunks = chunk_elements(\n    elements,\n    max_characters=500,\n    overlap=50,\n)\n\nfor chunk in chunks:\n    print(f\"Chunk ({len(chunk.text)} chars):\")\n    print(chunk.text[:100] + \"...\")\n```\n\n### Batch Processing\n\n```python\nfrom unstructured.partition.auto import partition\nfrom pathlib import Path\nfrom concurrent.futures import ThreadPoolExecutor\n\ndef process_document(file_path):\n    \"\"\"Process single document.\"\"\"\n    try:\n        elements = partition(str(file_path))\n        return {\n            'file': str(file_path),\n            'status': 'success',\n            'elements': len(elements),\n            'text': '\\n\\n'.join([e.text for e in elements])\n        }\n    except Exception as e:\n        return {\n            'file': str(file_path),\n            'status': 'error',\n            'error': str(e)\n        }\n\ndef batch_process(input_dir, max_workers=4):\n    \"\"\"Process all documents in directory.\"\"\"\n    input_path = Path(input_dir)\n    files = list(input_path.glob('*'))\n    \n    with ThreadPoolExecutor(max_workers=max_workers) as executor:\n        results = list(executor.map(process_document, files))\n    \n    return results\n```\n\n### Export Formats\n\n```python\nfrom unstructured.partition.auto import partition\nfrom unstructured.staging.base import elements_to_json, elements_to_dicts\n\nelements = partition(\"document.pdf\")\n\n# To JSON string\njson_str = elements_to_json(elements)\n\n# To list of dicts\ndicts = elements_to_dicts(elements)\n\n# To DataFrame\nimport pandas as pd\ndf = pd.DataFrame(dicts)\n```\n\n## Best Practices\n\n1. **Choose Strategy Wisely**: \"fast\" for speed, \"hi_res\" for accuracy\n2. **Enable Table Detection**: For documents with tables\n3. **Specify Language**: For better OCR on non-English docs\n4. **Chunk for RAG**: Use semantic chunking for AI applications\n5. **Handle Errors**: Some formats may fail gracefully\n\n## Common Patterns\n\n### Document to JSON\n```python\ndef document_to_json(file_path, output_path=None):\n    \"\"\"Convert document to structured JSON.\"\"\"\n    from unstructured.partition.auto import partition\n    from unstructured.staging.base import elements_to_json\n    import json\n    \n    elements = partition(file_path)\n    \n    # Create structured output\n    output = {\n        'source': file_path,\n        'elements': []\n    }\n    \n    for element in elements:\n        output['elements'].append({\n            'type': type(element).__name__,\n            'text': element.text,\n            'metadata': {\n                'page': element.metadata.page_number,\n                'coordinates': element.metadata.coordinates.to_dict() if element.metadata.coordinates else None\n            }\n        })\n    \n    if output_path:\n        with open(output_path, 'w') as f:\n            json.dump(output, f, indent=2)\n    \n    return output\n```\n\n### Email Parser\n```python\nfrom unstructured.partition.email import partition_email\n\ndef parse_email(email_path):\n    \"\"\"Extract structured data from email.\"\"\"\n    \n    elements = partition_email(email_path)\n    \n    email_data = {\n        'subject': None,\n        'from': None,\n        'to': [],\n        'date': None,\n        'body': [],\n        'attachments': []\n    }\n    \n    for element in elements:\n        meta = element.metadata\n        \n        # Extract headers from metadata\n        if meta.subject:\n            email_data['subject'] = meta.subject\n        if meta.sent_from:\n            email_data['from'] = meta.sent_from\n        if meta.sent_to:\n            email_data['to'] = meta.sent_to\n        \n        # Body content\n        email_data['body'].append({\n            'type': type(element).__name__,\n            'text': element.text\n        })\n    \n    return email_data\n```\n\n## Examples\n\n### Example 1: Research Paper Extraction\n```python\nfrom unstructured.partition.pdf import partition_pdf\nfrom unstructured.chunking.title import chunk_by_title\n\ndef extract_paper(pdf_path):\n    \"\"\"Extract structured data from research paper.\"\"\"\n    \n    elements = partition_pdf(\n        filename=pdf_path,\n        strategy=\"hi_res\",\n        infer_table_structure=True,\n        include_page_breaks=True\n    )\n    \n    paper = {\n        'title': None,\n        'abstract': None,\n        'sections': [],\n        'tables': [],\n        'references': []\n    }\n    \n    # Find title (usually first Title element)\n    for element in elements:\n        if element.category == \"Title\" and not paper['title']:\n            paper['title'] = element.text\n            break\n    \n    # Extract tables\n    for element in elements:\n        if element.category == \"Table\":\n            paper['tables'].append({\n                'page': element.metadata.page_number,\n                'content': element.text,\n                'html': element.metadata.text_as_html if hasattr(element.metadata, 'text_as_html') else None\n            })\n    \n    # Chunk into sections\n    chunks = chunk_by_title(elements, max_characters=2000)\n    \n    current_section = None\n    for chunk in chunks:\n        if chunk.category == \"Title\":\n            paper['sections'].append({\n                'title': chunk.text,\n                'content': ''\n            })\n        elif paper['sections']:\n            paper['sections'][-1]['content'] += chunk.text + '\\n'\n    \n    return paper\n\npaper = extract_paper('research_paper.pdf')\nprint(f\"Title: {paper['title']}\")\nprint(f\"Tables: {len(paper['tables'])}\")\nprint(f\"Sections: {len(paper['sections'])}\")\n```\n\n### Example 2: Invoice Data Extraction\n```python\nfrom unstructured.partition.auto import partition\nimport re\n\ndef extract_invoice_data(file_path):\n    \"\"\"Extract key data from invoice.\"\"\"\n    \n    elements = partition(file_path, strategy=\"hi_res\")\n    \n    # Combine all text\n    full_text = '\\n'.join([e.text for e in elements])\n    \n    invoice = {\n        'invoice_number': None,\n        'date': None,\n        'total': None,\n        'vendor': None,\n        'line_items': [],\n        'tables': []\n    }\n    \n    # Extract patterns\n    inv_match = re.search(r'Invoice\\s*#?\\s*:?\\s*(\\w+[-\\w]*)', full_text, re.I)\n    if inv_match:\n        invoice['invoice_number'] = inv_match.group(1)\n    \n    date_match = re.search(r'Date\\s*:?\\s*(\\d{1,2}[-\u002F]\\d{1,2}[-\u002F]\\d{2,4})', full_text, re.I)\n    if date_match:\n        invoice['date'] = date_match.group(1)\n    \n    total_match = re.search(r'Total\\s*:?\\s*\\$?([\\d,]+\\.?\\d*)', full_text, re.I)\n    if total_match:\n        invoice['total'] = float(total_match.group(1).replace(',', ''))\n    \n    # Extract tables\n    for element in elements:\n        if element.category == \"Table\":\n            invoice['tables'].append(element.text)\n    \n    return invoice\n\ninvoice = extract_invoice_data('invoice.pdf')\nprint(f\"Invoice #: {invoice['invoice_number']}\")\nprint(f\"Total: ${invoice['total']}\")\n```\n\n### Example 3: Document Corpus Builder\n```python\nfrom unstructured.partition.auto import partition\nfrom unstructured.chunking.title import chunk_by_title\nfrom pathlib import Path\nimport json\n\ndef build_corpus(input_dir, output_path):\n    \"\"\"Build searchable corpus from document collection.\"\"\"\n    \n    input_path = Path(input_dir)\n    corpus = []\n    \n    # Support multiple formats\n    patterns = ['*.pdf', '*.docx', '*.html', '*.txt', '*.md']\n    files = []\n    for pattern in patterns:\n        files.extend(input_path.glob(pattern))\n    \n    for file in files:\n        print(f\"Processing: {file.name}\")\n        \n        try:\n            elements = partition(str(file))\n            chunks = chunk_by_title(elements, max_characters=1000)\n            \n            for i, chunk in enumerate(chunks):\n                corpus.append({\n                    'id': f\"{file.stem}_{i}\",\n                    'source': str(file),\n                    'type': type(chunk).__name__,\n                    'text': chunk.text,\n                    'page': chunk.metadata.page_number if chunk.metadata.page_number else None\n                })\n        \n        except Exception as e:\n            print(f\"  Error: {e}\")\n    \n    # Save corpus\n    with open(output_path, 'w') as f:\n        json.dump(corpus, f, indent=2)\n    \n    print(f\"Corpus built: {len(corpus)} chunks from {len(files)} files\")\n    return corpus\n\ncorpus = build_corpus('.\u002Fdocuments', 'corpus.json')\n```\n\n## Limitations\n\n- Complex layouts may need manual review\n- OCR quality depends on image quality\n- Large files may need chunking\n- Some proprietary formats not supported\n- API rate limits for cloud processing\n\n## Installation\n\n```bash\n# Basic installation\npip install unstructured\n\n# With all dependencies\npip install \"unstructured[all-docs]\"\n\n# For PDF processing\npip install \"unstructured[pdf]\"\n\n# For specific formats\npip install \"unstructured[docx,pptx,xlsx]\"\n```\n\n## Resources\n\n- [unstructured GitHub](https:\u002F\u002Fgithub.com\u002FUnstructured-IO\u002Funstructured)\n- [Documentation](https:\u002F\u002Funstructured-io.github.io\u002Funstructured\u002F)\n- [Unstructured API](https:\u002F\u002Funstructured.io\u002Fapi-key)\n","# Data Extractor Skill\n\n## Overview\n\nThis skill enables extraction of structured data from any document format using **unstructured** - a unified library for processing PDFs, Word docs, emails, HTML, and more. Get consistent, structured output regardless of input format.\n\n## How to Use\n\n1. Provide the document to process\n2. Optionally specify extraction options\n3. I'll extract structured elements with metadata\n\n**Example prompts:**\n- \"Extract all text and tables from this PDF\"\n- \"Parse this email and get the body, attachments, and metadata\"\n- \"Convert this HTML page to structured elements\"\n- \"Extract data from these mixed-format documents\"\n\n## Domain Knowledge\n\n### unstructured Fundamentals\n\n```python\nfrom unstructured.partition.auto import partition\n\n# Automatically detect and process any document\nelements = partition(\"document.pdf\")\n\n# Access extracted elements\nfor element in elements:\n    print(f\"Type: {type(element).__name__}\")\n    print(f\"Text: {element.text}\")\n    print(f\"Metadata: {element.metadata}\")\n```\n\n### Supported Formats\n\n| Format | Function | Notes |\n|--------|----------|-------|\n| PDF | `partition_pdf` | Native + scanned |\n| Word | `partition_docx` | Full structure |\n| PowerPoint | `partition_pptx` | Slides & notes |\n| Excel | `partition_xlsx` | Sheets & tables |\n| Email | `partition_email` | Body & attachments |\n| HTML | `partition_html` | Tags preserved |\n| Markdown | `partition_md` | Structure preserved |\n| Plain Text | `partition_text` | Basic parsing |\n| Images | `partition_image` | OCR extraction |\n\n### Element Types\n\n```python\nfrom unstructured.documents.elements import (\n    Title,\n    NarrativeText,\n    Text,\n    ListItem,\n    Table,\n    Image,\n    Header,\n    Footer,\n    PageBreak,\n    Address,\n    EmailAddress,\n)\n\n# Elements have consistent structure\nelement.text           # Raw text content\nelement.metadata       # Rich metadata\nelement.category       # Element type\nelement.id            # Unique identifier\n```\n\n### Auto Partition\n\n```python\nfrom unstructured.partition.auto import partition\n\n# Process any file type\nelements = partition(\n    filename=\"document.pdf\",\n    strategy=\"auto\",          # or \"fast\", \"hi_res\", \"ocr_only\"\n    include_metadata=True,\n    include_page_breaks=True,\n)\n\n# Filter by type\ntitles = [e for e in elements if isinstance(e, Title)]\ntables = [e for e in elements if isinstance(e, Table)]\n```\n\n### Format-Specific Partitioning\n\n```python\n# PDF with options\nfrom unstructured.partition.pdf import partition_pdf\n\nelements = partition_pdf(\n    filename=\"document.pdf\",\n    strategy=\"hi_res\",              # High quality extraction\n    infer_table_structure=True,     # Detect tables\n    include_page_breaks=True,\n    languages=[\"en\"],               # OCR language\n)\n\n# Word documents\nfrom unstructured.partition.docx import partition_docx\n\nelements = partition_docx(\n    filename=\"document.docx\",\n    include_metadata=True,\n)\n\n# HTML\nfrom unstructured.partition.html import partition_html\n\nelements = partition_html(\n    filename=\"page.html\",\n    include_metadata=True,\n)\n```\n\n### Working with Tables\n\n```python\nfrom unstructured.partition.auto import partition\n\nelements = partition(\"report.pdf\", infer_table_structure=True)\n\n# Extract tables\nfor element in elements:\n    if element.category == \"Table\":\n        print(\"Table found:\")\n        print(element.text)\n        \n        # Access structured table data\n        if hasattr(element, 'metadata') and element.metadata.text_as_html:\n            print(\"HTML:\", element.metadata.text_as_html)\n```\n\n### Metadata Access\n\n```python\nfrom unstructured.partition.auto import partition\n\nelements = partition(\"document.pdf\")\n\nfor element in elements:\n    meta = element.metadata\n    \n    # Common metadata fields\n    print(f\"Page: {meta.page_number}\")\n    print(f\"Filename: {meta.filename}\")\n    print(f\"Filetype: {meta.filetype}\")\n    print(f\"Coordinates: {meta.coordinates}\")\n    print(f\"Languages: {meta.languages}\")\n```\n\n### Chunking for AI\u002FRAG\n\n```python\nfrom unstructured.partition.auto import partition\nfrom unstructured.chunking.title import chunk_by_title\nfrom unstructured.chunking.basic import chunk_elements\n\n# Partition document\nelements = partition(\"document.pdf\")\n\n# Chunk by title (semantic chunks)\nchunks = chunk_by_title(\n    elements,\n    max_characters=1000,\n    combine_text_under_n_chars=200,\n)\n\n# Or basic chunking\nchunks = chunk_elements(\n    elements,\n    max_characters=500,\n    overlap=50,\n)\n\nfor chunk in chunks:\n    print(f\"Chunk ({len(chunk.text)} chars):\")\n    print(chunk.text[:100] + \"...\")\n```\n\n### Batch Processing\n\n```python\nfrom unstructured.partition.auto import partition\nfrom pathlib import Path\nfrom concurrent.futures import ThreadPoolExecutor\n\ndef process_document(file_path):\n    \"\"\"Process single document.\"\"\"\n    try:\n        elements = partition(str(file_path))\n        return {\n            'file': str(file_path),\n            'status': 'success',\n            'elements': len(elements),\n            'text': '\\n\\n'.join([e.text for e in elements])\n        }\n    except Exception as e:\n        return {\n            'file': str(file_path),\n            'status': 'error',\n            'error': str(e)\n        }\n\ndef batch_process(input_dir, max_workers=4):\n    \"\"\"Process all documents in directory.\"\"\"\n    input_path = Path(input_dir)\n    files = list(input_path.glob('*'))\n    \n    with ThreadPoolExecutor(max_workers=max_workers) as executor:\n        results = list(executor.map(process_document, files))\n    \n    return results\n```\n\n### Export Formats\n\n```python\nfrom unstructured.partition.auto import partition\nfrom unstructured.staging.base import elements_to_json, elements_to_dicts\n\nelements = partition(\"document.pdf\")\n\n# To JSON string\njson_str = elements_to_json(elements)\n\n# To list of dicts\ndicts = elements_to_dicts(elements)\n\n# To DataFrame\nimport pandas as pd\ndf = pd.DataFrame(dicts)\n```\n\n## Best Practices\n\n1. **Choose Strategy Wisely**: \"fast\" for speed, \"hi_res\" for accuracy\n2. **Enable Table Detection**: For documents with tables\n3. **Specify Language**: For better OCR on non-English docs\n4. **Chunk for RAG**: Use semantic chunking for AI applications\n5. **Handle Errors**: Some formats may fail gracefully\n\n## Common Patterns\n\n### Document to JSON\n```python\ndef document_to_json(file_path, output_path=None):\n    \"\"\"Convert document to structured JSON.\"\"\"\n    from unstructured.partition.auto import partition\n    from unstructured.staging.base import elements_to_json\n    import json\n    \n    elements = partition(file_path)\n    \n    # Create structured output\n    output = {\n        'source': file_path,\n        'elements': []\n    }\n    \n    for element in elements:\n        output['elements'].append({\n            'type': type(element).__name__,\n            'text': element.text,\n            'metadata': {\n                'page': element.metadata.page_number,\n                'coordinates': element.metadata.coordinates.to_dict() if element.metadata.coordinates else None\n            }\n        })\n    \n    if output_path:\n        with open(output_path, 'w') as f:\n            json.dump(output, f, indent=2)\n    \n    return output\n```\n\n### Email Parser\n```python\nfrom unstructured.partition.email import partition_email\n\ndef parse_email(email_path):\n    \"\"\"Extract structured data from email.\"\"\"\n    \n    elements = partition_email(email_path)\n    \n    email_data = {\n        'subject': None,\n        'from': None,\n        'to': [],\n        'date': None,\n        'body': [],\n        'attachments': []\n    }\n    \n    for element in elements:\n        meta = element.metadata\n        \n        # Extract headers from metadata\n        if meta.subject:\n            email_data['subject'] = meta.subject\n        if meta.sent_from:\n            email_data['from'] = meta.sent_from\n        if meta.sent_to:\n            email_data['to'] = meta.sent_to\n        \n        # Body content\n        email_data['body'].append({\n            'type': type(element).__name__,\n            'text': element.text\n        })\n    \n    return email_data\n```\n\n## Examples\n\n### Example 1: Research Paper Extraction\n```python\nfrom unstructured.partition.pdf import partition_pdf\nfrom unstructured.chunking.title import chunk_by_title\n\ndef extract_paper(pdf_path):\n    \"\"\"Extract structured data from research paper.\"\"\"\n    \n    elements = partition_pdf(\n        filename=pdf_path,\n        strategy=\"hi_res\",\n        infer_table_structure=True,\n        include_page_breaks=True\n    )\n    \n    paper = {\n        'title': None,\n        'abstract': None,\n        'sections': [],\n        'tables': [],\n        'references': []\n    }\n    \n    # Find title (usually first Title element)\n    for element in elements:\n        if element.category == \"Title\" and not paper['title']:\n            paper['title'] = element.text\n            break\n    \n    # Extract tables\n    for element in elements:\n        if element.category == \"Table\":\n            paper['tables'].append({\n                'page': element.metadata.page_number,\n                'content': element.text,\n                'html': element.metadata.text_as_html if hasattr(element.metadata, 'text_as_html') else None\n            })\n    \n    # Chunk into sections\n    chunks = chunk_by_title(elements, max_characters=2000)\n    \n    current_section = None\n    for chunk in chunks:\n        if chunk.category == \"Title\":\n            paper['sections'].append({\n                'title': chunk.text,\n                'content': ''\n            })\n        elif paper['sections']:\n            paper['sections'][-1]['content'] += chunk.text + '\\n'\n    \n    return paper\n\npaper = extract_paper('research_paper.pdf')\nprint(f\"Title: {paper['title']}\")\nprint(f\"Tables: {len(paper['tables'])}\")\nprint(f\"Sections: {len(paper['sections'])}\")\n```\n\n### Example 2: Invoice Data Extraction\n```python\nfrom unstructured.partition.auto import partition\nimport re\n\ndef extract_invoice_data(file_path):\n    \"\"\"Extract key data from invoice.\"\"\"\n    \n    elements = partition(file_path, strategy=\"hi_res\")\n    \n    # Combine all text\n    full_text = '\\n'.join([e.text for e in elements])\n    \n    invoice = {\n        'invoice_number': None,\n        'date': None,\n        'total': None,\n        'vendor': None,\n        'line_items': [],\n        'tables': []\n    }\n    \n    # Extract patterns\n    inv_match = re.search(r'Invoice\\s*#?\\s*:?\\s*(\\w+[-\\w]*)', full_text, re.I)\n    if inv_match:\n        invoice['invoice_number'] = inv_match.group(1)\n    \n    date_match = re.search(r'Date\\s*:?\\s*(\\d{1,2}[-\u002F]\\d{1,2}[-\u002F]\\d{2,4})', full_text, re.I)\n    if date_match:\n        invoice['date'] = date_match.group(1)\n    \n    total_match = re.search(r'Total\\s*:?\\s*\\$?([\\d,]+\\.?\\d*)', full_text, re.I)\n    if total_match:\n        invoice['total'] = float(total_match.group(1).replace(',', ''))\n    \n    # Extract tables\n    for element in elements:\n        if element.category == \"Table\":\n            invoice['tables'].append(element.text)\n    \n    return invoice\n\ninvoice = extract_invoice_data('invoice.pdf')\nprint(f\"Invoice #: {invoice['invoice_number']}\")\nprint(f\"Total: ${invoice['total']}\")\n```\n\n### Example 3: Document Corpus Builder\n```python\nfrom unstructured.partition.auto import partition\nfrom unstructured.chunking.title import chunk_by_title\nfrom pathlib import Path\nimport json\n\ndef build_corpus(input_dir, output_path):\n    \"\"\"Build searchable corpus from document collection.\"\"\"\n    \n    input_path = Path(input_dir)\n    corpus = []\n    \n    # Support multiple formats\n    patterns = ['*.pdf', '*.docx', '*.html', '*.txt', '*.md']\n    files = []\n    for pattern in patterns:\n        files.extend(input_path.glob(pattern))\n    \n    for file in files:\n        print(f\"Processing: {file.name}\")\n        \n        try:\n            elements = partition(str(file))\n            chunks = chunk_by_title(elements, max_characters=1000)\n            \n            for i, chunk in enumerate(chunks):\n                corpus.append({\n                    'id': f\"{file.stem}_{i}\",\n                    'source': str(file),\n                    'type': type(chunk).__name__,\n                    'text': chunk.text,\n                    'page': chunk.metadata.page_number if chunk.metadata.page_number else None\n                })\n        \n        except Exception as e:\n            print(f\"  Error: {e}\")\n    \n    # Save corpus\n    with open(output_path, 'w') as f:\n        json.dump(corpus, f, indent=2)\n    \n    print(f\"Corpus built: {len(corpus)} chunks from {len(files)} files\")\n    return corpus\n\ncorpus = build_corpus('.\u002Fdocuments', 'corpus.json')\n```\n\n## Limitations\n\n- Complex layouts may need manual review\n- OCR quality depends on image quality\n- Large files may need chunking\n- Some proprietary formats not supported\n- API rate limits for cloud processing\n\n## Installation\n\n```bash\n# Basic installation\npip install unstructured\n\n# With all dependencies\npip install \"unstructured[all-docs]\"\n\n# For PDF processing\npip install \"unstructured[pdf]\"\n\n# For specific formats\npip install \"unstructured[docx,pptx,xlsx]\"\n```\n\n## Resources\n\n- [unstructured GitHub](https:\u002F\u002Fgithub.com\u002FUnstructured-IO\u002Funstructured)\n- [Documentation](https:\u002F\u002Funstructured-io.github.io\u002Funstructured\u002F)\n- [Unstructured API](https:\u002F\u002Funstructured.io\u002Fapi-key)\n",{"mcp":24,"name":5,"tags":29,"author":33,"models":34,"license":15,"version":42,"category":43,"languages":44,"department":47,"description":7,"capabilities":48},{"tools":25,"server":28},[26,27],"extract_text_from_pdf","extract_tables_from_pdf","office-mcp",[30,31,32],"extraction","data","unstructured","claude-office-skills",{"compatible":35,"recommended":39},[36,37,38],"claude-3-5-sonnet","gpt-4","gpt-4o",[40,41],"claude-sonnet-4","claude-opus-4","1.0","parsing",[45,46],"en","zh","All",[49,50],"data_extraction","format_handling","main","8859218955d9504cd18b59e7892100718039d3b4","data\u002Fskills\u002Fclaude-office-skills-skills\u002Fdata-extractor",1,"https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper","https:\u002F\u002Fgithub.com\u002Fom-scogo","SDE-1 @ Scogo ","2026-07-18 12:22:46",{"source":8,"skillName":5,"commands":60,"prompt":70,"zipAvailable":71},[61,64,67],{"tool":62,"command":63},"npx","npx skills add om-scogo\u002Fskillsh-scraper --skill data-extractor",{"tool":65,"command":66},"bunx","bunx skills add om-scogo\u002Fskillsh-scraper --skill data-extractor",{"tool":68,"command":69},"pnpm","pnpm dlx skills add om-scogo\u002Fskillsh-scraper --skill data-extractor","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fclaude-office-skills-skills\u002Fdata-extractor\u002FSkill.md",true,[73],{"path":74,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":77,"sourceHtmlUrl":78},"metadata.json","REFERENCE","参考文档",476,"https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fclaude-office-skills-skills\u002Fdata-extractor\u002Fmetadata.json",[80,87,92,99,104,111],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7D6MC9FAAEV4CMNYX8W7JTG","arxiv-search","Search arXiv physics, math, and computer science preprints using natural language queries. Powered by Valyu semantic search.","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fyorkeccak-scientific-skills\u002Farxiv-search\u002Fskills\u002Farxiv-search\u002FSKILL.md",[],[],{"skillNo":88,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7D6M85CKKN87TA98VCQV4H7","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fyorkeccak-scientific-skills\u002Farxiv-search\u002FSkill.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M7D4ZTCS4DR3CE4JY06X84T2","working-with-legacy-code","Safely change and test untested codebases using Feathers' \"Working Effectively with Legacy Code\". Use when the user mentions \"legacy code\", \"no tests\", \"untested codebase\", \"how do I test this\", \"seams\", \"characterization tests\", \"golden master\", \"sprout method\", \"afraid to change this code\", \"monster method\", \"dependency breaking\", or \"inherited a messy codebase\". Also trigger when changing code without tests safely, getting a class under test when constructors, statics, or singletons block it, adding features to tangled modules, or planning incremental test coverage for an old codebase. Covers the legacy-code change algorithm, seams, characterization tests, sprout\u002Fwrap, and dependency-breaking techniques. For refactoring code that already has tests, see refactoring-patterns. For day-to-day code quality, see clean-code.","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fworking-with-legacy-code\u002Fworking-with-legacy-code\u002FSKILL.md",[],[],{"skillNo":100,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":19},"01M7D4ZHZKJD2RSNGAF63V14P4","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fworking-with-legacy-code\u002FSkill.md",[],[],{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":19},"01M7D4ZB4CJBFW5JE67CPH2QRV","web-typography","Select, pair, and implement typefaces for web projects. Use when the user mentions \"font pairing\", \"which typeface\", \"line height\", \"responsive typography\", \"web font loading\", \"type hierarchy\", \"variable fonts\", \"FOUT\u002FFOIT\", \"typographic scale\", or \"the text is hard to read\". Also trigger when choosing between system fonts and web fonts, optimizing font-loading performance, or designing readable long-form content. Covers readability evaluation, CSS implementation, and performance optimization. For overall UI design systems, see refactoring-ui. For dramatic typographic experiences, see top-design.","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fweb-typography\u002Fweb-typography\u002FSKILL.md",[],[],{"skillNo":112,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":19},"01M7D4Z4MVYVY3NMJ18BNV6WNA","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fweb-typography\u002FSkill.md",[],[]]