docxparse

package
v1.0.99 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package docxparse parses LarkOpenCLI DocxXML into a small DOM for the docs +script shortcut.

Index

Constants

View Source
const (
	MaxInputBytes   = 20_000_000
	MaxNestingDepth = 1024
)

Variables

This section is empty.

Functions

func IsPresentationBlockType

func IsPresentationBlockType(tag string) bool

IsPresentationBlockType reports whether tag is both counted by the profile and suitable for a Presentation Decision block plan. The centralized catalog keeps planning policy independent from individual component fields.

Types

type BlockShare

type BlockShare struct {
	Type  string  `json:"type"`
	Count int     `json:"count"`
	Ratio float64 `json:"ratio"`
}

BlockShare reports one LarkOpenCLI block type's count and share. Structural and inline-only tags are intentionally excluded.

type Format

type Format string

Format is an accepted source document format.

const (
	FormatXML Format = "xml"
)

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node is the internal DocxXML DOM representation.

type ParseResult

type ParseResult struct {
	Format  Format  `json:"format"`
	XML     string  `json:"xml"`
	Profile Profile `json:"profile"`
}

ParseResult is the complete result returned by Parse.

func Parse

func Parse(source string, format Format) (ParseResult, error)

Parse checks XML syntax, then builds its structure and visible-text profile. XML business semantics are deliberately left to the document writer and service.

type Profile

type Profile struct {
	WordCount  int           `json:"word_count"`
	CharCount  int           `json:"char_count"`
	Breakdown  TextBreakdown `json:"breakdown"`
	BlockCount int           `json:"block_count"`
	Blocks     []BlockShare  `json:"blocks"`
}

Profile describes LarkOpenCLI document structure and visible text without requiring callers to inspect the full XML.

func ParseCompatibleXML

func ParseCompatibleXML(source string) (Profile, error)

ParseCompatibleXML builds a profile after deterministic recovery of common malformed XML emitted while authoring a draft.

type TextBreakdown

type TextBreakdown struct {
	HanChars            int `json:"han_chars"`
	EnglishWords        int `json:"english_words"`
	NumberWords         int `json:"number_words"`
	ChinesePunctuations int `json:"chinese_punctuations"`
	EnglishLetters      int `json:"english_letters"`
	Digits              int `json:"digits"`
	EnglishPunctuations int `json:"english_punctuations"`
	SymbolWords         int `json:"symbol_words"`
	SymbolChars         int `json:"symbol_chars"`
}

type TextProfile

type TextProfile struct {
	WordCount int           `json:"word_count"`
	CharCount int           `json:"char_count"`
	Breakdown TextBreakdown `json:"breakdown"`
}

TextProfile is the internal result of the LarkOpenCLI semantic counter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL