docxparse

package
v1.0.89 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 10 Imported by: 0

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