[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M72A0C2RFFHEDT9W5PV5QASN":3,"skill-same:01M72A0C2RFFHEDT9W5PV5QASN":70},{"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":50,"commitSha":51,"skillDirectory":5,"forksCount":52,"repositoryHtmlUrl":53,"repositoryHomepageUrl":6,"ownerHtmlUrl":54,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":55,"install":56,"resources":69},"01M72A0C2RFFHEDT9W5PV5QASN","data-extractor",null,">","claude-office-skills\u002Fskills","claude-office-skills","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F258027507?v=4","01M729XQC9FBRQ54AQZS0KY3ZK","AGI Lab","01M729XQCYW6WF9GY762P9RNQJ",575,"MIT","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fdata-extractor\u002FSKILL.md",[],[],"2026-11-10 18:39:20",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":9,"models":33,"license":15,"version":41,"category":42,"languages":43,"department":46,"description":7,"capabilities":47},{"tools":25,"server":28},[26,27],"extract_text_from_pdf","extract_tables_from_pdf","office-mcp",[30,31,32],"extraction","data","unstructured",{"compatible":34,"recommended":38},[35,36,37],"claude-3-5-sonnet","gpt-4","gpt-4o",[39,40],"claude-sonnet-4","claude-opus-4","1.0","parsing",[44,45],"en","zh","All",[48,49],"data_extraction","format_handling","main","9c4c7d5cd2813a8936bf2c9fdb174ea883b85a11",105,"https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills","2026-01-31 22:03:56",{"source":8,"skillName":5,"commands":57,"prompt":67,"zipAvailable":68},[58,61,64],{"tool":59,"command":60},"npx","npx skills add claude-office-skills\u002Fskills --skill data-extractor",{"tool":62,"command":63},"bunx","bunx skills add claude-office-skills\u002Fskills --skill data-extractor",{"tool":65,"command":66},"pnpm","pnpm dlx skills add claude-office-skills\u002Fskills --skill data-extractor","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fdata-extractor\u002FSKILL.md",true,[],[71,78,84,91,98,105],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M72A0X7X4TWS4ZWTEK8TJEC8","devops-automation","DevOps and IT Ops automation - CI\u002FCD, monitoring, incident management, and infrastructure workflows","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fdevops-automation\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"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":81,"categories":82,"keywords":83,"publishedAt":19},"01M72A0VPXF4Q5F48TPDG6S10Q","dev-slides","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fdev-slides\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M72A0Q1T0KN60CR3PAD93J6T","deep-research","Conduct comprehensive research on any topic. Synthesize information from multiple angles, provide structured analysis, and generate detailed research reports.","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fdeep-research\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":19},"01M72A0KWAYEWQJMDRGC0WTT7V","dcf-valuation","Build Discounted Cash Flow (DCF) valuation models. Calculate intrinsic value with customizable assumptions. Generate professional valuation reports.","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fdcf-valuation\u002FSKILL.md",[],[],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":19},"01M72A0GVWRZ3HZNXMW3RB5CF9","Database Sync","Automate database synchronization, replication, migration, and cross-platform data integration","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fdatabase-sync\u002FSKILL.md",[],[],{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":19},"01M72A0E16K862EDP0QYEAC9HJ","data-pipeline","Data pipeline and ETL automation - extract, transform, load workflows for data integration and analytics","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fdata-pipeline\u002FSKILL.md",[],[]]