Word parsing

Updated at:

The Word parsing operator parses selected Word files, extracts text and images, and generates Markdown files. If a document is in the .doc format, it is converted to the .docx format before parsing. This document describes how to configure the Word parsing operator.

Prerequisites

  • To use the workflow feature, you must purchase the unstructured data feature for your instance.

  • You have created a workflow. For detailed steps, see Create and manage workflows.

Permissions

In a Basic project, project administrators, developers, analysts, and custom project roles with the Dataset-Use permission can use any dataset in the project as an input or output for the operator.

Supported formats

The Word parsing operator supports the following file formats: .doc and .docx.

Procedure

  1. In the top menu bar of the Dataphin homepage, choose Development > Data Development.

  2. In the top menu bar of the Development page, select a Project.

  3. In the left-side navigation pane, choose Data Processing > Workflow. In the Workflow list, click a workflow to open its canvas. From the Operator Library on the left, drag the Word parsing operator to the canvas. In the Word parsing panel on the right, configure the following parameters.

    Parameter

    Description

    Step name

    The name can be up to 256 characters long.

    Input configuration

    Dataset

    The input dataset to process. You can select only a hybrid dataset. After you select a dataset, you must also select its Version. By default, the earliest version is selected.

    If this operator follows another operator in the workflow, the dataset selected here is typically the same as the output dataset of the upstream operator.

    Input field

    Select the field from the input dataset that contains the storage path of the Word files. You can select only fields for which the Is URL parameter is set to Yes.

    Filter condition (Optional)

    Use SQL syntax. You only need to enter the filter condition that follows the WHERE clause. You can use global system variables, such as ${bizdate} for the business date.

    Operator configuration

    Model-assisted correction

    If this option is disabled, only the built-in model is used for layout analysis and table extraction. If this option is enabled and the built-in model produces poor parsing results (such as layout misalignments), the operator automatically uses a large model to improve the output accuracy.

    Image content understanding

    If this option is enabled, the operator calls a large model to analyze the content of images in the Word document and replaces images with text descriptions in the output Markdown. You must also enter an Image Understanding Prompt of up to 2,000 characters.

    Model

    This parameter is available only when Model-assisted correction or Image content understanding is enabled. Both features share the same model. You can only select a model that is Enabled in Intelligent Application Management > Model Configuration and whose model type includes Text or Vision (Images and Videos).

    Note
    • For information about system model pricing coefficients, see Built-in models supported by intelligent applications.

    • If you have purchased an advanced license package for your own models, no Credits are deducted. Otherwise, Credit usage is calculated with a 0.2x coefficient.

    Output configuration

    Dataset

    You can select Source Dataset or Other Dataset. If the source dataset is a table dataset, Other Dataset is selected by default.

    When you select another dataset, you must also specify a hybrid dataset and its version as the output dataset. By default, the first version of this dataset in ascending order is used. You can also select other versions of the source dataset.

    When you select a source dataset, the operator writes the generated metadata to the metadata table for the same version of the source dataset.

    File output path

    Enter a directory name. The system creates this directory if it does not exist.

    • Parsed text files are named in the format ${WordFileName+AutoIncrementingNumberStartingFrom1}.md.

    • The operator creates a folder for the parsed images and stores them there.

    Include image links in output Markdown text

    If you select Yes, the output Markdown file will contain links to the extracted images. If you select No, these links will be omitted.

    Loading policy

    If the metadata table of the selected output dataset has a primary key, update on primary key conflict is selected by default. If no primary key exists, append data is selected by default.

    • Append data: Appends new data directly to the destination table. An error occurs if a primary key or constraint conflict is detected.

    • Update on primary key conflict: If a new row has the same primary key as an existing row, the existing row is deleted and the new row is inserted.

    • Overwrite: Deletes all existing data from the destination table before inserting the new data.

    Note

    If you select Source Dataset as the output dataset, the only supported loading policy is update on primary key conflict.

    Field mapping

    The Word parsing operator outputs the following fields:

    • markdown_url: The storage path of the Markdown file.

    • markdown_content: The content of the Markdown file. This is an optional field. If the content is excessively long, we recommend that you do not map this field to the output dataset.

    • image_folder_url: The storage path of the image folder.

    By default, the operator's output fields are mapped to fields with the same names in the output dataset. You can also manually select target fields for custom mapping. In addition, you can map pass-through fields from the source dataset to the destination dataset. You can manage the field mapping in the following ways:

    • Add Output Field: Click to add a blank field mapping row. This feature is available only when the output dataset is set to Other Dataset.

    • Batch Mapping: Click to select batch manual mapping, same-name mapping, or same-row mapping. This feature is available only when the output dataset is set to Other Dataset.

    • Delete Mapping: Click the Delete icon to delete the corresponding field mapping row. You cannot delete mappings for the operator's fixed output fields.

  4. When you finish configuring the operator, click Save on the canvas toolbar.

    You can then add other operators to build out your workflow.

Appendix: Word to Markdown mapping rules

Word element

Markdown output

Notes

Table of Contents (TOC)

Skipped, not converted.

A TOC is auto-generated and does not contain unique content.

Headings (Heading 1–6)

# to ######

Strictly mapped based on the Word outline level.

Body paragraphs

Plain text paragraphs.

Blank lines between paragraphs are preserved.

Bold/italic/strikethrough

**Bold**/*Italic*/~~Strikethrough~~

-

Ordered lists

1. 2. 3.

Multi-level lists are supported.

Unordered lists

-

Multi-level lists are supported.

Tables

Markdown Table

-

Embedded images

![image](oss://path/img_N.png)

Images are extracted to Object Storage Service (OSS), and a reference is inserted into the Markdown file.

Hyperlinks

[text](URL)

The link text and destination URL are preserved.

Code blocks

Inline-block

-

Headers/footers

Skipped, not converted.

Repetitive content with low semantic value.

Comments

Skipped, not converted.

In most cases, comment content is not required.

Page breaks

--- (horizontal rule)

Marks page boundaries.