docx-comments-to-text


Namedocx-comments-to-text JSON
Version 0.2.2 PyPI version JSON
download
home_pageNone
SummaryExtract reviewer comments from .docx files and insert them inline with the text
upload_time2025-08-09 23:31:18
maintainerNone
docs_urlNone
authorNone
requires_python>=3.13
licenseNone
keywords docx comments document text review
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # docx-comments-to-text

Extract reviewer comments from `.docx` files and insert them inline with the text they reference, creating a plain text output that keeps feedback in context.

## Installation

### From PyPI (recommended)
```bash
pip install docx-comments-to-text
```

### From source
```bash
# Clone the repository
git clone https://github.com/platelminto/docx-comments-to-text
cd docx-comments-to-text

# Install in development mode
uv sync --dev
# or: pip install -e .
```

## Usage

### Command Line Interface

```bash
# Basic usage - output to stdout
docx-comments-to-text document.docx

# Save to file
docx-comments-to-text document.docx -o output.txt

# Control author display
docx-comments-to-text document.docx --authors never    # Hide authors
docx-comments-to-text document.docx --authors always   # Always show authors
docx-comments-to-text document.docx --authors auto     # Show authors when multiple exist (default)

# Control comment placement
docx-comments-to-text document.docx --placement inline         # Inline with text (default)
docx-comments-to-text document.docx --placement end-paragraph  # At end of each paragraph
docx-comments-to-text document.docx --placement comments-only  # Comments only with context
```

### Development Usage

If working from source:
```bash
# Run with uv
uv run docx-comments-to-text document.docx

# Or use module syntax
uv run python -m docx_comments_to_text.cli document.docx
```

### Example Output

#### Inline placement (default)
```
Original text with [reviewer feedback] [COMMENT: "This needs clarification"] continues here.
More content [needs examples] [COMMENT John: "Consider adding examples"] and final text.
```

#### End-paragraph placement
```
Original text with reviewer feedback[1] continues here.
More content needs examples[2] and final text.

Comments:
1. This needs clarification
2. John: Consider adding examples
```

#### Comments-only placement
```
"reviewer feedback": This needs clarification
"needs examples": John: Consider adding examples
```

## Features

- Accurate comment positioning and text preservation
- Handles overlapping comments and multiple comment types  
- Configurable author display
- Multiple comment placement styles (inline, end-of-paragraph, comments-only)

## Technical Details

### DOCX Structure
- DOCX files are ZIP archives containing XML files
- `word/document.xml` - main document content
- `word/comments.xml` - comment definitions
- Comment ranges marked with `<w:commentRangeStart>` and `<w:commentRangeEnd>`

### Comment Insertion Strategy
1. Parse document XML to extract text and track character positions
2. Map comment ranges to their start/end positions in the text
3. Sort comments by position for safe insertion (reverse order)
4. Wrap commented text in brackets: `[commented text]`
5. Insert comment content after bracketed text: `[COMMENT: "feedback"]`

## Dependencies

- `python-docx` - DOCX file handling
- `lxml` - XML parsing
- `click` - Command line interface

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "docx-comments-to-text",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.13",
    "maintainer_email": null,
    "keywords": "docx, comments, document, text, review",
    "author": null,
    "author_email": "Giorgio Momigliano <gmomigliano@protonmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/49/98/25124c274ab947eb3f7cf0f5c0c3af7a3a73df30224bdbf9298ef5b16291/docx_comments_to_text-0.2.2.tar.gz",
    "platform": null,
    "description": "# docx-comments-to-text\n\nExtract reviewer comments from `.docx` files and insert them inline with the text they reference, creating a plain text output that keeps feedback in context.\n\n## Installation\n\n### From PyPI (recommended)\n```bash\npip install docx-comments-to-text\n```\n\n### From source\n```bash\n# Clone the repository\ngit clone https://github.com/platelminto/docx-comments-to-text\ncd docx-comments-to-text\n\n# Install in development mode\nuv sync --dev\n# or: pip install -e .\n```\n\n## Usage\n\n### Command Line Interface\n\n```bash\n# Basic usage - output to stdout\ndocx-comments-to-text document.docx\n\n# Save to file\ndocx-comments-to-text document.docx -o output.txt\n\n# Control author display\ndocx-comments-to-text document.docx --authors never    # Hide authors\ndocx-comments-to-text document.docx --authors always   # Always show authors\ndocx-comments-to-text document.docx --authors auto     # Show authors when multiple exist (default)\n\n# Control comment placement\ndocx-comments-to-text document.docx --placement inline         # Inline with text (default)\ndocx-comments-to-text document.docx --placement end-paragraph  # At end of each paragraph\ndocx-comments-to-text document.docx --placement comments-only  # Comments only with context\n```\n\n### Development Usage\n\nIf working from source:\n```bash\n# Run with uv\nuv run docx-comments-to-text document.docx\n\n# Or use module syntax\nuv run python -m docx_comments_to_text.cli document.docx\n```\n\n### Example Output\n\n#### Inline placement (default)\n```\nOriginal text with [reviewer feedback] [COMMENT: \"This needs clarification\"] continues here.\nMore content [needs examples] [COMMENT John: \"Consider adding examples\"] and final text.\n```\n\n#### End-paragraph placement\n```\nOriginal text with reviewer feedback[1] continues here.\nMore content needs examples[2] and final text.\n\nComments:\n1. This needs clarification\n2. John: Consider adding examples\n```\n\n#### Comments-only placement\n```\n\"reviewer feedback\": This needs clarification\n\"needs examples\": John: Consider adding examples\n```\n\n## Features\n\n- Accurate comment positioning and text preservation\n- Handles overlapping comments and multiple comment types  \n- Configurable author display\n- Multiple comment placement styles (inline, end-of-paragraph, comments-only)\n\n## Technical Details\n\n### DOCX Structure\n- DOCX files are ZIP archives containing XML files\n- `word/document.xml` - main document content\n- `word/comments.xml` - comment definitions\n- Comment ranges marked with `<w:commentRangeStart>` and `<w:commentRangeEnd>`\n\n### Comment Insertion Strategy\n1. Parse document XML to extract text and track character positions\n2. Map comment ranges to their start/end positions in the text\n3. Sort comments by position for safe insertion (reverse order)\n4. Wrap commented text in brackets: `[commented text]`\n5. Insert comment content after bracketed text: `[COMMENT: \"feedback\"]`\n\n## Dependencies\n\n- `python-docx` - DOCX file handling\n- `lxml` - XML parsing\n- `click` - Command line interface\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Extract reviewer comments from .docx files and insert them inline with the text",
    "version": "0.2.2",
    "project_urls": {
        "Homepage": "https://github.com/platelminto/docx-comments-to-text",
        "Issues": "https://github.com/platelminto/docx-comments-to-text/issues",
        "Repository": "https://github.com/platelminto/docx-comments-to-text"
    },
    "split_keywords": [
        "docx",
        " comments",
        " document",
        " text",
        " review"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "eae3edb9254c5b567e437c5a96c0faf69a6f5bbd54e7aeb71974e0dad8c47a9c",
                "md5": "5ef1aff45e38f5156d72d9399ad1bf84",
                "sha256": "fcf9ba5e1c74a4e8917f5565f826dcfa5664e3b540a661ba3759eaa1739f31e5"
            },
            "downloads": -1,
            "filename": "docx_comments_to_text-0.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5ef1aff45e38f5156d72d9399ad1bf84",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.13",
            "size": 9372,
            "upload_time": "2025-08-09T23:31:17",
            "upload_time_iso_8601": "2025-08-09T23:31:17.375096Z",
            "url": "https://files.pythonhosted.org/packages/ea/e3/edb9254c5b567e437c5a96c0faf69a6f5bbd54e7aeb71974e0dad8c47a9c/docx_comments_to_text-0.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "499825124c274ab947eb3f7cf0f5c0c3af7a3a73df30224bdbf9298ef5b16291",
                "md5": "3698eefd03ec6a0e72c423ec0effb5ff",
                "sha256": "bed74040e67a1824072ad6878dd7e5121cb75311895b11632b6c1c9bd253526b"
            },
            "downloads": -1,
            "filename": "docx_comments_to_text-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "3698eefd03ec6a0e72c423ec0effb5ff",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.13",
            "size": 15278,
            "upload_time": "2025-08-09T23:31:18",
            "upload_time_iso_8601": "2025-08-09T23:31:18.307322Z",
            "url": "https://files.pythonhosted.org/packages/49/98/25124c274ab947eb3f7cf0f5c0c3af7a3a73df30224bdbf9298ef5b16291/docx_comments_to_text-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-09 23:31:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "platelminto",
    "github_project": "docx-comments-to-text",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "docx-comments-to-text"
}
        
Elapsed time: 1.33785s