An electronic book creation and reading integrated system and method of code book

By deconstructing ebooks into digital engineering formats and constructing a full-dimensional semantic feature space, and providing visual editing tools, the problem of fixed ebook content, lack of interaction, high creation threshold, and weak multimodal collaboration capabilities is solved, realizing low-threshold deep multimodal content reconstruction and immersive experience.

CN122152296APending Publication Date: 2026-06-05HANGZHOU MAGIC BYTE TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HANGZHOU MAGIC BYTE TECHNOLOGY CO LTD
Filing Date
2026-03-08
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing e-books suffer from problems such as fixed content and lack of interaction, high creation threshold, difficulty in semantic understanding, and weak multimodal collaboration capabilities, making it impossible to achieve in-depth intervention and immersive experience.

Method used

By deconstructing ebooks into digital engineering formats, constructing a full-dimensional semantic feature space through semantic parsing and high-dimensional feature modeling, and providing visual editing tools and interactive modules, we can achieve low-threshold multimodal content reconstruction.

Benefits of technology

It achieves low-threshold, in-depth multimodal content reconstruction, ensuring logical consistency and immersive experience of the modified content, and supporting smooth operation on low-computing-power devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122152296A_ABST
    Figure CN122152296A_ABST
Patent Text Reader

Abstract

The application discloses an electronic book creation and reading integrated system and method of code as book. The system stores the electronic book in a digital engineering format, including structure code, style code, logic control code and multimedia resources. The system includes a user end and a computing end: the system firstly performs full-dimensional feature scanning on the electronic book text, extracts core elements and constructs a structured intermediate code with an anchor point mechanism and a topological network, and simultaneously generates a pre-calculated context state representation; then, macro and micro features are generated according to the intermediate code, and a high-dimensional feature data structure representing the text semantics is constructed; the user end integrates visual editing and plot intervention modules, allows the user to issue editing instructions through a visual tool and intervene in the content development; the computing end generates new code by using the automatic link designed in the scheme and returns the new code, and the user end is updated in real time through hot reloading; the application realizes the concept of "Code as Book, Reader as Writer" and the experience of "what you think is what you get".
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of digital publishing, computer natural language processing, and human-computer interaction, specifically to an integrated system and method for e-book creation and reading based on the concept of "code as book." This system utilizes semantic parsing, a unique e-book intermediate code, high-dimensional feature modeling, and projection reconstruction technology to transform traditional static e-books into dynamically editable and interactively reconstructable digital projects, achieving a deep integration of reading and creation.

[0002] The e-books described in this invention include not only text, comics, and electronic serials, but also story-driven video games, such as story-driven video games and online story-driven games created by adding buttons that allow users to choose their path based on comic e-books. Similarly, it also includes videos such as serialized cartoons created based on e-book comics. These are all variations of e-books and are all applicable to this invention. Background Technology

[0003] With the popularization of digital reading, e-books have become an important medium for information dissemination. However, existing e-books have significant limitations.

[0004] 1. Fixed Content and Lack of Interaction: Mainstream ebook formats (such as PDF, ePub, online novels, etc.) mostly contain fixed content, allowing readers only linear reading and lacking the ability to deeply intervene in the content. If readers are dissatisfied with the plot, character settings, or environmental descriptions, they can only abandon reading the ebook and cannot directly modify it according to their preferences through the reading interface. For example, the last forty chapters of *Dream of the Red Chamber*, the version continued by Gao E, are highly controversial and do not meet the expectations of most readers.

[0005] 2. High barrier to entry for creation: Existing e-book creation is mostly geared towards professionals, requiring literary skills and cultural knowledge, as well as rich experience. Layout often requires even more skills and knowledge. For ordinary readers, changing the style of a book (such as background color or word choice) or its logic (such as altering plot branches) often presents a significant barrier.

[0006] 3. Difficulty in Deep Semantic Understanding: Existing text generation or modification methods have begun to employ large language models, but they are mostly based on context and lack an understanding of the deeper semantic structures such as the overall worldview of the book and the topological network of character relationships. Modifications are also targeted at the content itself, lacking guidance from a high-dimensional content space. This often leads to problems such as inconsistencies, stylistic disjointedness, poor writing quality, or logical inconsistencies in the modified content.

[0007] 4. Weak multimodal collaboration capabilities: Traditional solutions struggle to integrate text content with background music, visual effects, and multimedia resources. For example, when a user changes the text's tone from "heartwarming" to "tense," the system needs to automatically adjust the background music's rhythm or the reading interface's color scheme to provide an immersive experience.

[0008] Therefore, there is an urgent need for an integrated e-book creation and reading system that can transform editing logic into code transformation and possesses deep semantic three-dimensional space and multimodal collaborative reconstruction capabilities. Summary of the Invention

[0009] The purpose of this invention is to overcome the shortcomings of the prior art and provide an integrated system and method for creating and reading code-as-book e-books. This system deconstructs e-books into digital engineering projects containing structure, style, logic, and multimedia resources, constructs full-dimensional semantic features, and transforms e-books into a pre-processed cache representation and intermediate code storage. It also proposes a new code-as-book three-dimensional spatial language, turning the modification of e-books into a process of projecting a high-dimensional model. Furthermore, it combines commonly available technologies such as large models, intelligent agents, and visual interactive tools to achieve low-threshold, deep-level, and multimodal content reconstruction.

[0010] To achieve the above objectives, the present invention provides the following technical solution.

[0011] (a) System architecture level.

[0012] This invention provides an integrated e-book creation and reading system where code is the book, and its core architecture includes the following five modules.

[0013] 1. Code storage module.

[0014] This module forms the system's underlying data foundation, configured to store ebook content on a remote server or locally. Unlike traditional closed binary formats, the ebooks in this invention are stored in a digital engineering format. This digital engineering format is a standardized digital engineering structure, including but not limited to: Structure files (such as HTML / XML commonly used on the web): define the chapter structure, paragraph hierarchy, and DOM node structure of the ebook; Style files (such as CSS / LESS): define visual elements such as fonts, colors, layouts, and animation effects; Logic files (such as JavaScript): define interactive events, plot transition logic, and data state management; Multimedia resource files: including images, audio, video, and 3D model assets.

[0015] By using element extraction design, every element of the e-book (from text and comic illustrations to interactive logic) becomes programmable, providing a foundation for subsequent intermediate code refactoring.

[0016] 2. Intermediate code build module.

[0017] This module acts as the system's "semantic brain circuit," configured to perform a full-dimensional feature scan and analysis of the ebook before secondary creation and editing or during system initialization. It extracts core elements (including but not limited to characters, plot, or worldview) or knowledge graphs to establish preprocessing and understanding structures and representation caches. This operation can occur before secondary creation and editing or as part of system preparation, and its specific functions include, but are not limited to, the following.

[0018] Semantic parsing and construction: Performing deep semantic analysis to transform unstructured linear content into structured intermediate code (constructing structured intermediate code with anchoring mechanisms or topological networks, or generating pre-computed caches, or pre-establishing contextual representations, or embedding and encoding node attributes and text fragments of the knowledge graph, or generating hierarchical semantic tensors). This process extracts core elements, including but not limited to characters, events, world-building, items, and props.

[0019] Anchor point mechanism establishment: For each extracted semantic element, an index pointing to the original text position (such as DOM node ID, character offset) is established to form a traceable anchor point mechanism.

[0020] Topological network construction: Semantic topological networks are constructed through the connections between graph nodes to represent the global logical structure of the text (such as character relationship networks and plot causal chains).

[0021] Cache precomputation: The extracted information is transformed into a precomputed cache (such as KV Cache) or context state representation to optimize the context understanding ability during subsequent Large Language Model (LLM) processing and reduce inference latency.

[0022] 3. Feature semantic space modeling module.

[0023] This module is configured to remap text semantics into feature vectors in a mathematical space based on structured intermediate code, constructing one or more high-dimensional feature data structures. The specific implementation is as follows: Constructing high-dimensional tensors: Constructing semantic high-dimensional structures composed of multi-scale vectors.

[0024] Macro-feature vector generation: This generates vectors that represent the overall attributes of the text, including but not limited to worldview vectors (such as science fiction, fantasy), theme vectors, style vectors, or emotional tone vectors (such as depressing, cheerful), and so on. Macro-feature vectors are used to locate the overall position of the text in the semantic space.

[0025] Micro-feature vector generation: Generate vectors that represent fine-grained content, including but not limited to paragraph vectors, sentence vectors, or character status vectors.

[0026] Vector association operation: Macro feature vectors and micro feature vectors are associated with each other in semantic space through specific matrix operations, so that the adjustment of macro parameters (such as dragging the "atmosphere slider") can be accurately mapped to vector translation, and then projected to produce micro text modification.

[0027] 4. Interactive module.

[0028] This module serves as the user's interaction window with the system, configured to provide visual editing tools and operation entry points. Its specific forms include: Extended visual editing toolbar: Integrated into the reading interface, it includes specific tools such as smooth stroke tools, global atmosphere adjustment knob, sound effect binding brush, time and space background migration slider, plot branch anchor points, and character perspective switcher, for receiving intuitive user operations.

[0029] Advanced interactive interfaces: including voice command tools, brain-computer interfaces, or plot intervention interfaces.

[0030] DAG Visual Node Editing Module: Used for visually editing plot logic and character relationships.

[0031] 3D Character Card Interaction Module: Used to change character relationships through interaction with 3D models.

[0032] 5. Refactor the module.

[0033] This module is the core of the system's execution, configured to invoke cloud computing resources or a large language model. Based on editing requests from the interactive module, it performs collaborative reconstruction. Depending on the instructions, it performs algebraic calculations or geometric transformations of the semantic space based on the aforementioned high-dimensional semantic space model, or directly performs collaborative reconstruction on intermediate code (or pre-computed cache, or contextual representation, or the aforementioned embedded encoding, or hierarchical semantic tensors) to generate an updated digital project. Its reconstruction objects cover one or more of the following: ebook content, style, logic, and multimedia resource references. Specifically, it includes: Semantic space operations: Based on high-dimensional feature data structures, perform vector replacement, numerical transformation or geometric transformation (such as rotation and translation), and project the transformation results back into the text space to generate code.

[0034] Multimodal collaborative reconstruction: Based on the modification of text content, CSS style code, JavaScript logic code and multimedia resource reference links are generated or updated synchronously to ensure the consistency of content and form.

[0035] (II) Core processing flow and technical details.

[0036] 1. Semantic parsing and intermediate code construction process.

[0037] The system first performs word segmentation and entity recognition on the original text, transforming it into a knowledge graph with an attribute graph structure. Nodes in the graph represent extracted semantic elements (such as "protagonist A" and "sword B"), and edges represent semantic relationships (such as "possess" and "hostile"). Subsequently, the system traverses the graph, creating an anchor index for each node and recording its DOM path in the original HTML file. Simultaneously, the system serializes the graph data into intermediate code in JSON format and pre-computes the context state to generate a KVCache. This process transforms "black box" or "bulk" text into computable and location-based structured data.

[0038] 2. Semantic transformation process in high-dimensional feature space.

[0039] The reconstruction process described in the claims can be implemented through high-dimensional linear algebra operations: for example, when a user adjusts the emotional tone from "warm" to "suspenseful" using a "global atmosphere adjustment knob," the interaction module parses the instruction and determines the target semantic direction vector. The reconstruction module calculates the projection or rotation angle of the original feature vector onto the target semantic plane in the latent space. For example, it performs a vector rotation operation, increasing the weight value of the "tension" dimension. Subsequently, the decoder model reads the transformed high-dimensional feature matrix, generates target text code that conforms to the new features through an attention mechanism, and simultaneously adjusts the RGB value vector of the background color and the BPM (beat) parameter of the background music.

[0040] 3. Specific implementation details of the visualization tools.

[0041] This invention integrates a variety of innovative editing tools into the interactive module, such as the following tools: Smooth Stroke Tool: In response to the user's selection of target text, the system locates anchor points through the DOM parsing engine, calls the cloud-based LLM to refine the selected text, and generates CSS style code for collaborative adjustment (such as adjusting letter spacing to match emotional changes), achieving WYSIWYG fine-grained editing.

[0042] A global atmosphere adjustment knob: A circular knob is displayed in the sidebar of the interface, divided into multiple emotional quadrants (such as tension, warmth, and sadness). The system responds to user drag operations, obtaining an emotional weight parameter vector mapped to the angle values. The cloud identifies the background color value and text tone of the current DOM node, calculates new CSS variable values ​​through a color psychology model, and modifies the audio control logic in JavaScript (such as switching to a fast-paced track), achieving a unified audiovisual atmosphere reconstruction.

[0043] Sound effects are linked to the drawing tool: In response to the user's drawing action on the text, the system displays a sound effect type selection overlay (ambient sound, action sound). After confirming the selection, the system generates a JavaScript code snippet containing event listeners and injects the corresponding audio file link into the project to enhance the auditory experience while reading.

[0044] Time-space background migration slider: Displays a timeline marked with era nodes. In response to the sliding operation, the cloud-based LLM identifies era-specific words in the text (such as replacing "horse-drawn carriage" with "hovercarriage"), and synchronously updates the URL references of background image resources and font style resources to achieve batch migration of world view settings.

[0045] Narrative branching anchors: In response to insertion operations, conditional containers are inserted after DOM nodes. The system obtains the branching options input by the user, generates subsequent text code blocks and routing logic code in the cloud, and constructs a multi-branch narrative structure.

[0046] Character perspective switcher: In response to the selection of a character's name, the cloud rewrites the text in the first-person or limited perspective of the target character and adjusts the CSS animation effects of the psychological descriptions (such as changing the text transparency or shaking frequency).

[0047] (III) Design under low computing power optimized architecture (Kindle-like experience of edge-cloud collaboration).

[0048] In addition to the system described in the claims, the present invention also designs a local-end and cloud-end collaborative architecture to support low-computing-power e-book devices.

[0049] Local client: Utilizes a color e-ink screen, responsible for loading ebooks in Web project format, rendering the visual interface, and capturing user commands through an extended toolbar or DAG module. The local client only performs lightweight DOM operations and view refreshes.

[0050] Cloud-based: Responsible for high-performance semantic parsing, intermediate code construction, construction of high-dimensional feature data structures for 3D vectors, and large-scale model inference and code generation tasks after receiving editing instructions.

[0051] Communication Mechanism: The system first creates intermediate code and constructs a high-dimensional feature data structure for the ebooks in the library. Then, the local mapping module captures the user's modification commands, generates an API request containing context information, target element location, and edit type identifier, and sends it to the cloud. The cloud parses the request, constructs a high-dimensional feature data structure based on the aforementioned intermediate code, calls a large language model for calculation, calculates the algebraic or geometric transformation of the high-dimensional feature data structure to be executed, and after execution, projects and generates new ebook code that conforms to the specifications and returns it. The local hot reload module receives the code and refreshes the rendered view in real time without restarting the application.

[0052] (iv) Implementation details of advanced interaction.

[0053] 1. DAG visualization node editing.

[0054] The system renders a directed acyclic graph interface on the touchscreen, where nodes represent plot events and lines represent logical flow. Sliding parameter adjustment controls (such as a "favorability slider") are rendered above the lines. The system monitors the user's numerical changes on the controls in real time and, based on preset mapping rules (e.g., a value > 80 triggers an "alliance" plot event, and a value < 20 triggers a "betrayal" plot event), calculates and updates the plot text preview content on the side of the interface in real time. This process visually demonstrates the causal relationship between numerical logic and text generation.

[0055] 2. Interactive 3D character cards.

[0056] The local system uses the GPU to render 3D character model cards with depth information. The system continuously monitors the user's multi-touch operations and calculates the overlapping area of ​​the cards on the screen projection surface. When the overlapping area exceeds a preset threshold, it is considered an "interaction event." The system then calls the GPU shader to render particle explosion effects, dynamically changes the edge light effects color of the cards, and sends a character relationship change command to the cloud (such as changing the "neutral" relationship to "hostile"), while simultaneously playing feedback sound effects through the local speaker. This design transforms the abstract character relationship editing into a concrete physical interaction.

[0057] IV. Theoretical Overview

[0058] This invention can also be applied to various derivative forms of e-books. Essentially, it provides a method for generating digital content. If further abstracted and summarized using mathematical language, it includes the following steps: Step S1: The terminal loads the content in digital engineering format and provides a view interaction interface; Step S2: Capture user actions on the visual interaction layer and convert them into multimodal editing requests that include element location features; Step S3: Parse the structured code, extract text information and generate an intermediate semantic graph containing semantic relationships (this step can also be done before S1). Step S4: Construct a high-dimensional semantic feature space based on the intermediate semantic graph, and map the edit request to the topological transformation parameters in this space; Step S5: Perform algebraic or geometric transformations on the semantic feature vector using topological transformation parameters to obtain the target semantic feature vector; Step S6: Utilize a generative model to reconstruct the text, style, and logic across modalities based on the target semantic feature vector, generating new structured code; Step S7: The terminal receives the new code and refreshes the presentation view in real time through an incremental update mechanism.

[0059] Preferably, the algebraic transformation in step S5 can be specifically manifested as: controlling the trajectory movement of the semantic feature vector on the semantic manifold according to the editing intention, thereby changing the semantic attributes or expression style of the content while maintaining the integrity of the content's logical skeleton.

[0060] V. Beneficial Effects.

[0061] Compared with the prior art, the present invention has the following significant advantages.

[0062] 1. Low-threshold creative experience: Through intuitive interactive tools such as "smooth strokes", "atmosphere knobs", and "3D character cards", complex code writing and logic construction are encapsulated in visual operations, enabling ordinary readers to carry out in-depth content reconstruction without having programming knowledge, truly realizing "reading is creation".

[0063] 2. Deep Semantic Logic Consistency: By constructing knowledge graphs, semantic topological networks, and high-dimensional feature tensors, the system can understand the macro-worldview and micro-level character relationships within a text. During the reconstruction process, the vector transformation mechanism in the claims ensures the consistency of the modified content in terms of style, emotion, and logic, avoiding the disjointed feel of traditional AI-generated content.

[0064] 3. Multimodal Collaborative Consistency: The refactoring module not only generates text but also simultaneously generates CSS style code and JavaScript logic code. When users modify content, the system can automatically and collaboratively adjust background color, sound effects rhythm, and visual effects, achieving integrated linkage of "text, images, sound, and effects," greatly enhancing the immersive reading experience.

[0065] 4. Efficient edge-cloud collaboration mechanism: Through the edge-cloud separation architecture described in the claims, the heavy computing semantic parsing and model inference are placed in the cloud, while the local end is only responsible for interaction and rendering. This enables complex AIGC functions to run smoothly on low computing devices such as mobile phones and tablets, and the modification results are presented in real time through hot reload technology.

[0066] 5. Visual programming of interactive narrative: The DAG node editing module transforms abstract plot logic into visual node connections and parameter adjustments, which not only reduces the difficulty of creating interactive novels, but also makes complex branching plot logic intuitive and controllable, providing powerful tool support for the development of interactive literature. Attached Figure Description

[0067] Figure 1 This is a schematic diagram of system modules provided in an embodiment of the present invention. For the sake of alignment, aesthetics, and ease of abbreviation, the code storage module is referred to as the code module, and the intermediate code construction module is referred to as the understanding module.

[0068] Figure 2 This is an example of establishing intermediate code in an embodiment of the present invention.

[0069] Figure 3 This is a flowchart illustrating the interaction logic of a local reader device in one embodiment of the present invention.

[0070] Figure 4 This is a schematic diagram of reconstruction, reloading, and rendering in one embodiment of the present invention.

[0071] Figure 5 This is a flowchart of the WEB communication process in the second embodiment of the present invention. Detailed Implementation

[0072] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.

[0073] One specific implementation case: a handheld e-book creation and reading device that integrates code as a book.

[0074] This tablet device transforms ebooks into digital projects that can be edited in real time, and combines the multimodal reconstruction capabilities of a cloud-based large language model to enable readers to deeply personalize the content, style, and plot of ebooks.

[0075] I. System Architecture and Rendering Mechanism.

[0076] The handheld device consists of an interactive end (local reader device) and a processing end (cloud server), which are described in detail below.

[0077] The interactive terminal includes: The interactive terminal includes: The code storage module is configured to store digital content in a digital engineering format, wherein the digital engineering includes, but is not limited to, one or more of the following: a structured description file for describing content and structure, a style definition file for defining presentation styles, a logic script file for defining interaction logic, and associated multimodal resource files.

[0078] The interaction module is configured to provide a presentation view and an optional description view (if any), and to capture user actions on the interaction layer or convert user actions into editing requests containing element positioning or features according to a preset mapping protocol. The presentation view is used to present digital content and its rendering effects, and to overlay the interaction layer. The description view (if any) is used to display and edit the underlying structured code.

[0079] The processing terminal includes: The intermediate code building module is configured to parse structured code, extract text information for semantic analysis, and generate an intermediate semantic graph containing structured identifiers, metadata features, or semantic relationships.

[0080] The feature semantic space modeling module is configured to construct a high-dimensional semantic feature space based on the intermediate semantic graph, and map the multimodal editing request to a topological transformation in the high-dimensional semantic feature space. By performing replacement or transformation operations on the semantic feature vector, the target semantic feature vector is generated.

[0081] (The feature semantic space modeling module is actually a manifold transformation engine, configured to perform the following operations: construct a high-dimensional feature manifold containing multiple semantic dimensions based on the global narrative features and local detail features in the intermediate semantic graph; establish a mapping relationship between user editing instructions and geometric transformation axes in the feature manifold, wherein the geometric transformation axes represent the style, emotion, plot direction, or visual intensity of the content; calculate transformation parameters to guide the semantic feature vector to move on the feature manifold according to the multimodal editing request. The algebraic transformation operation on the semantic feature vector specifically includes: in the high-dimensional semantic feature space, using the transformation parameters to perform at least one operation of translation, scaling, or nonlinear mapping on the original semantic feature vector; the operation is configured to project the original semantic feature vector from the original semantic subspace to the target semantic subspace, wherein the target semantic subspace corresponds to the content state adjusted by the user's editing intention; the transformed target semantic feature vector contains the modified text semantic features and the corresponding multimodal performance control parameters.)

[0082] The cross-modal reconstruction module is configured to utilize computational inference resources, such as generative artificial intelligence models, to perform consistent reconstruction of text content, style definitions, logic scripts, or multimodal resource references based on the target semantic feature vector, generate new code that conforms to digital engineering specifications, and return it to the terminal interaction end.

[0083] The local reader device runs on the user's high-performance tablet terminal and is built using the Electron framework to ensure cross-platform compatibility. Under this architecture, each ebook is no longer a single package file, but a standard web project (similar to the project structure of VS Code), containing structural code (such as `index.html`), style code (such as `style.css`), logic code (such as `main.js`), and a multimedia resource folder (` / assets`, containing images, audio, etc.).

[0084] The local side is set up with a dual-view rendering module: the left side is the command tool view (which can be switched to a code view) and supports syntax highlighting; the right side is wider and is the rendering view, based on the Chromium kernel, used to display the final effect of the e-book in real time.

[0085] II. Implementation of the extended visual editing toolbar.

[0086] In this embodiment, an extended visual editing toolbar floats above the rendered view, integrating the following core functions.

[0087] 1. Smooth strokes (text polishing and style coordination).

[0088] When a user finds a passage of text awkward, they can use the smooth stroke tool to select that passage. The system uses its DOM parsing engine to locate the intermediate code, HTML element nodes, and associated CSS style code corresponding to the target text. The instruction mapping module captures the DOM node ID (e.g., `para-12`) and the current CSS class name corresponding to the selection area, encapsulates the content of the target text, associated styles, intermediate code, and contextual information into a text polishing request, and sends it to the cloud. The cloud's large language model not only rewrites the text (semantic optimization) to make it smoother, but also analyzes the emotional tone of the rewritten text (e.g., a lighter feel), and returns a new CSS code that adjusts the `font-weight` of the paragraph to standard, slightly increases `letter-spacing`, and adds a `fade-in` animation class. Upon receiving the update, the local hot reload module instantly synchronizes the text content and style.

[0089] 2. Global Atmosphere Adjustment Knob (Emotional Visualization Mapping).

[0090] The toolbar features a circular rotary knob control, and the interface is logically divided into four emotional quadrants: tension (red), warmth (orange), suspense (purple), and sadness (blue).

[0091] When the user drags the knob to the "Suspense" area, the system obtains the current angle value (e.g., 270 degrees) and maps it to an emotional weight parameter. At this time, the system identifies all DOM elements within the currently visible area and extracts the background color value, text tone, and background music identifier. After receiving the parameters, the cloud-based multimodal reconstruction module switches to suspense mode.

[0092] 3. Sound effects bound to a drawing tool (interactive audio design).

[0093] The user selects a sound effect and binds it to a paintbrush, then paints on the sentence "Heavy rain pours outside the window." The system pops up a sound effect type selection overlay, with options for ambient sound, action sound, and dialogue. The user selects "Ambient Sound - Heavy Rain." The instruction mapping module generates a request: `Target: sentence-5, Event: onClick / Hover, Action: PlayAudio(rain_heavy.mp3)`. The cloud returns a JavaScript code snippet containing an event listener (monitoring click or hover events) and injects it into `main.js`. Simultaneously, the cloud automatically matches the rain sound audio URL from the resource library and updates the resource list.

[0094] 4. Character perspective switcher (narrative perspective reconstruction).

[0095] The user selects the name of a villainous character in the text and clicks "Switch Perspective." The character's profile (e.g., suspicious, cruel personality) is retrieved from the cloud. The large language model rewrites the current chapter from the character's first-person or limited-knowledge perspective, inserting descriptions of the character's inner thoughts into the text (e.g., italicized inner monologues). Simultaneously, in terms of CSS styling, a special light red background and subtle pulse animation are added to the character's inner monologue to reflect their inner turmoil.

[0096] III. Advanced Creation and Interaction Modules.

[0097] The local device in this embodiment also includes the following advanced modules to support deeper content building: 1. Multi-dimensional tag customization interface module.

[0098] This module provides a specific UI layout, logically divided into: the left character card pool area, which displays draggable character cards; the middle story template area, which displays story flow templates and slots; and the right style selection area, which displays multi-dimensional style tags.

[0099] The linkage generation mechanism is configured as follows: when it is detected that the user drags the character card on the left to the slot of the middle plot template, the template is locked and the corresponding plot branch is highlighted; when it is detected that the style tag on the right is checked, the sample chapter preview text is generated and displayed in real time.

[0100] 2. DAG visualization node editing module.

[0101] This module is configured to render a directed acyclic graph (DAG) interface on a touchscreen or monitor, including character nodes, scene nodes, and connecting lines.

[0102] Gesture interaction: Detects touch gestures such as single-finger drag to move nodes, two-finger pinch to zoom the canvas, and long-press to drag nodes to generate connecting lines.

[0103] Parameter Adjustment and Logic Mapping: A sliding parameter adjustment control is rendered on the connecting line. The system detects real-time changes in values ​​caused by user sliding, drives the graphical interface to redraw in real-time based on these changes, and updates the side-view plot text preview content. Different value ranges map to different plot development logics.

[0104] 3. 3D character card interaction module.

[0105] This module calls the terminal's graphics processing unit (GPU) to render a 3D character model card with depth information.

[0106] Interaction Detection: Detects multi-touch operations by the user and calculates the overlapping area of ​​the 3D character model card corresponding to the touch point on the screen projection surface. When the overlapping area exceeds a preset threshold, it is determined that an interaction event has been triggered.

[0107] Feedback Mechanism: Upon triggering the interaction, a character relationship change command is generated and sent to the cloud. Simultaneously, the GPU shader is invoked to render particle explosion light effects at the contact point between the two cards, and a feedback sound effect is played through the speaker. Furthermore, based on the character relationship change result returned from the cloud, the edge light effect color of the 3D character model card is dynamically changed.

[0108] IV. Instruction Mapping and Cloud Processing Logic.

[0109] In this embodiment, the local instruction mapping module is further configured to maintain a mapping table between visual operation types and code operation types. Code operation types include text content modification, style reconstruction, logic script modification, and multimedia resource replacement. When a user is detected using a visual editing tool, the module automatically identifies the DOM elements involved in the operation and their associated multimedia resource files, generating a standardized editing request message containing the file path, element ID, operation type, and modification parameters.

[0110] After receiving a request from the local end, the logic splicing and generation module of the cloud server performs the following steps.

[0111] 1. Intent parsing: Through the intent graph construction and parsing module, the natural language commands or interactive operations input by the user are parsed into structured search parameters.

[0112] 2. Element Search: Retrieves candidate literary element modules from the literary element database based on search parameters.

[0113] 3. Logical verification: Read the state machine data of the current e-book project and perform logical self-consistency verification on the candidate literary element modules.

[0114] 4. Assembly Generation: Logically assemble the validated literary element modules to the current plot node, and generate transition text and corresponding multimedia rendering code.

[0115] Case Study 2: Intelligent Novel Text Editing System Based on Web Websites

[0116] At first glance, this system resembles traditional online novel websites. However, it differs in that it can transform unstructured linear text into a computable and manipulable high-dimensional semantic structure, and allows for real-time modification of the text through semantic space geometric transformations based on user preferences. This embodiment of the system mainly consists of two parts: a browser-based web application and a cloud server. The browser-based web application runs on a modern browser on the user's device (such as Chrome, Firefox, Safari, etc.), and its front-end is built using HTML5, CSS3, and JavaScript technology stacks, enabling cross-platform access without the need for any client software installation. Unlike traditional e-book websites, the e-book loaded in this embodiment is no longer a single web file, but a standardized web project stored in the cloud, which is loaded and rendered in real-time by the user through their browser.

[0117] Its basic workflow includes the following steps: S1: Users access the website system through a browser and load ebooks from the cloud in web page engineering format. These ebooks have undergone preprocessing, generating intermediate code, contextual representations, preprocessing caches, and high-dimensional models.

[0118] S2: Display the ebook content in the rendered view and display an extended visual editing toolbar in response to user actions.

[0119] S3: Capture user actions on the visual editing tool, identify the underlying code elements (DOM nodes) corresponding to the operation area, and map visual editing instructions into code editing requests.

[0120] S4: Send code editing requests to the cloud API interface via HTTPS protocol. The request includes the target element location (such as element ID), editing type identifier, and context code snippet.

[0121] S5: Cloud-based parsing requests, based on the constructed feature model, performs multimodal collaborative reconstruction of text, style, logic, and multimedia resources to generate new code that conforms to web page specifications.

[0122] S6: The cloud pushes the refactored code to the browser via a WebSocket long connection. The browser refreshes and renders the view in real time through a dynamic DOM update mechanism, achieving "what you change is what you get".

[0123] 1. System overall architecture.

[0124] This embodiment features an extended visual editing toolbar that floats above the rendered view. This toolbar, implemented using web front-end technology, integrates tools such as smooth strokes, a global atmosphere adjustment knob, sound effect-bound brushes, a time-space background transition slider, story branch anchor points, and a character perspective switcher.

[0125] 1.1. Smooth strokes (text polishing and style coordination).

[0126] Similar to the previous example, when a user finds a passage of text awkward, they can use the smooth stroke tool to select that paragraph. The front-end script captures the preprocessing intermediate code, DOM node ID (e.g., `para-12`), and current CSS class name corresponding to the selected area. The system sends the intermediate code, corresponding text content, and "polishing" instructions to the cloud via an AJAX request. The cloud performs refactoring and style collaboration, analyzes the emotional tone of the rewritten text (e.g., more light and lively), and automatically generates matching CSS style code. For example, it adjusts the `font-weight` of the paragraph to standard, slightly increases `letter-spacing`, and adds a `fade-in` animation class. Upon receiving the update, the browser uses dynamic style injection technology to instantly synchronize the text content and style.

[0127] 1.2. Global Atmosphere Adjustment Knob (Emotional Visualization Mapping and High-Dimensional Feature Structure Rotation).

[0128] Similar to the previous example, when the toolbar has a circular knob control, the interface is logically divided into four emotional quadrants: tension (red), warmth (orange), suspense (purple), and sadness (blue).

[0129] When the user drags the knob to the "Suspense" area, the front end obtains the current semantic space cube angle value (e.g., 270 degrees) and maps it to an emotional weight parameter. The cloud-based reconstruction module receives the parameter and performs content reconstruction and style reconstruction: CSS reconstruction: Modifying global CSS variables, for example, setting `--primary-color` to dark purple and `--bg-filter` to `grayscale(80%) contrast(120%)`, making the image darker and with higher contrast; JS logic reconstruction: Modifying the background music playback logic, reducing the BGM playback speed to 0.8x, and adding echo effect code. Ultimately, the entire page's visual style and auditory atmosphere instantly switch to suspense mode.

[0130] 1.3. Spatiotemporal background migration slider (one-click scene switching and high-dimensional feature structure translation).

[0131] The toolbar has a timeline slider at the bottom, marked with nodes such as "Ancient", "Modern", and "Future".

[0132] Assuming the current chapter describes a war, the user drags the slider from "Ancient Times" to "Future." The system extracts the current chapter's text and DOM structure. A semantic cube vector translation operation is performed in the cloud to reconstruct the projected intermediate code: Text replacement: Identifying era-specific words such as "warhorse" and "spear" and replacing them with "mecha" and "laser cannon"; Resource replacement: Replacing the background image URL from an ancient battlefield to a cyberpunk-style ruin image; Style replacement: Replacing serif fonts (traditional Chinese seal script) with sci-fi-style sans-serif fonts (bold or digital fonts).

[0133] After the browser receives the update, the content and style of the entire chapter transcend time.

[0134] 1.4. Plot branch anchors (interactive narrative construction, intermediate code insertion, and high-dimensional feature structure transformation).

[0135] The user clicks the "Insert Anchor" button at the end of the paragraph. The front-end inserts a hidden conditional container node after the paragraph node in the DOM tree. The system then updates the intermediate code. The user inputs two branching options: "Draw your sword" and "Turn and run." Based on the intermediate code and the option text, the cloud-based system continues writing two completely different story text code blocks and generates control logic code. This code enables the loading of different story blocks when different options are clicked, transforming the ebook into an interactive game.

[0136] 1.5. The text modification system provided in this embodiment includes: a local cache script module, a structured reconstruction module, a knowledge graph construction module, a semantic vectorization module, a semantic space operation module, a projection generation module, a verification feedback module, and a text output module.

[0137] The local caching script module, loaded in the user's browser, receives the original novel text input by the user. This text can be a complete novel, a chapter excerpt, or a short story. The text input module supports importing text files in various formats, including but not limited to common document formats such as TXT, DOCX, PDF, and EPUB. During the text input process, this module also performs preprocessing on the text, including basic operations such as removing irrelevant formatting tags, standardizing character encoding, and recognizing chapter divisions.

[0138] The structured reconstruction module, one of the processing units of this system, performs deep semantic analysis on the input linear text, extracts multi-level semantic elements, and reorganizes these elements according to a predetermined structured format. This module employs a multi-level semantic analysis architecture, including an entity extraction unit, a style analysis unit, and a plot deconstruction unit. The entity extraction unit is responsible for identifying various named entities in the text, including characters, locations, times, and objects; the style analysis unit is responsible for analyzing the text's linguistic style features, including sentence structure, rhetorical devices, narrative perspective, and emotional tone; and the plot deconstruction unit is responsible for outlining the text's narrative thread and identifying causal relationships and event nodes.

[0139] The knowledge graph construction module is used to construct an intermediate code structure in the form of a knowledge graph from the semantic elements extracted by the structured reconstruction module. This knowledge graph uses an attribute graph as its underlying data model. Nodes in the graph represent various semantic elements, and edges represent the semantic relationships between elements. Rich attribute information can be attached to both nodes and edges. This module also includes an anchor management unit, used to establish a precise mapping relationship between the knowledge graph and the original text, ensuring that each semantic element can be traced back to its specific location in the original text.

[0140] The semantic vectorization module is used to transform semantic elements and structural information in the knowledge graph into high-dimensional vector representations. This module employs a multi-scale vectorization strategy, capable of generating both macro-level global semantic vectors and micro-level fine-grained semantic vectors. Macro-level vectors represent the overall tone, thematic direction, and stylistic features of the text; micro-level vectors represent the semantic connotations of specific paragraphs, sentences, and even words. These vectors collectively constitute a high-dimensional semantic space structure, which this embodiment figuratively refers to as a "semantic cube."

[0141] The semantic space operation module is a key module for achieving precise text modification in this system. This module provides a series of semantic space geometric transformation operations, including but not limited to vector translation, vector rotation, and vector scaling. Through these geometric transformations, the system can precisely control the text at the semantic level. For example, the "style rotation" operation can change the language style of the text, and the "plot rotation" operation can change the development of the story, while keeping other semantic dimensions unchanged.

[0142] The projection generation module is used to reproject the high-dimensional vectors, after semantic space operations, onto the text space to generate human-readable text output. This module employs an autoregressive or diffusion generation mechanism to decode the semantic representations in the latent space into a coherent text sequence. During the generation process, this module references structural constraints in the knowledge graph to ensure that the generated text maintains consistency with the original text in terms of character settings, world-building, etc.

[0143] The verification feedback module is used to perform quality assessment and consistency checks on the text generated by the projection. This module employs a discriminative model to perform multi-dimensional evaluations of the generated text, including semantic coherence assessment, character consistency assessment, plot plausibility assessment, and style consistency assessment. When the evaluation results do not meet preset thresholds, this module generates a feedback signal to guide the semantic space operation module to adjust its operating parameters, forming a closed-loop optimization mechanism.

[0144] The text output module is used to output the final generated text in the format specified by the user, and at the same time provide a comparison view before and after modification, marking the main modification points, so as to facilitate user review and further adjustment.

[0145] 2. Detailed implementation of the structured reconstruction module.

[0146] The structured reconstruction module adopts a multi-level progressive processing architecture. The specific implementation methods of each processing unit are described in detail below.

[0147] 2.1 Entity layer extraction unit.

[0148] The entity layer extraction unit adopts structured information extraction technology based on a large language model, and guides the model to output structured entity information through prompt templates.

[0149] Specifically, the entity extraction unit first segments the original text, dividing the long text into text blocks suitable for model processing. The segmentation of text blocks follows the principle of semantic integrity, that is, it is segmented by natural paragraphs or chapters, avoiding breaks in the middle of sentences. For each text block, the entity extraction unit calls the large language model to perform entity recognition tasks.

[0150] The specific implementation process of the entity recognition task is as follows: First, the system predefines a complete entity type system, which includes, but is not limited to, the following categories: People category is further subdivided into main characters, secondary characters, and group characters, with attribute fields covering name, age, gender, appearance, personality, ability, background, and target; Location category includes cities, buildings, regions, and fictional locations, with attribute fields including name, type, characteristics, and related events; Time category is divided into specific time, time period, and fuzzy time, with attribute fields set as time value, time type, and related events; Item category is divided into key props and ordinary items, with attribute fields including name, type, attributes, and ownership; Organization category involves forces, factions, and groups, with attribute fields including name, nature, members, and target.

[0151] For each person entity, the entity layer extraction unit extracts the following information: basic information includes the person's name (including formal name, alias, and nickname), age (specific value or age range description), gender, and physical characteristics description. This information is extracted directly from the text, preserving the original text's descriptive style.

[0152] Personality information includes personality tags and evidence of personality traits. Personality tags are labeled using a predefined vocabulary, such as "brave," "timid," "kind," "cunning," "intelligent," and "dull-witted." Evidence of personality traits consists of specific behaviors or dialogue excerpts extracted from the original text, serving as the basis for personality judgment.

[0153] Character goal information includes the character's explicit goals and implicit motivations. Explicit goals refer to the character's clearly expressed pursuits, such as "finding the missing sister" or "defeating the demon king"; implicit motivations refer to the deep-seated reasons that drive the character's behavior, such as "the desire to be recognized" or "inner fears".

[0154] Character relationship information includes all types of relationships between this character and other characters. Relationship types include, but are not limited to: kinship (father and son, mother and daughter, brothers, etc.), emotional relationships (love, hatred, jealousy, etc.), social relationships (superior and subordinate, teacher and student, friends, etc.), and antagonistic relationships (enemies, competitors, etc.). Each relationship record also includes a relationship strength value (a value between 0 and 1) and relationship evidence (a detailed description in the original text).

[0155] The entity extraction unit employs a confidence assessment mechanism when extracting entity information. For each extraction result, the model outputs a confidence score, indicating the reliability of the result. When the confidence score falls below a preset threshold, the system marks the result as "pending confirmation" and requests manual review or confirmation through cross-validation in subsequent processing.

[0156] 2.2 Style layer analysis unit.

[0157] The style layer analysis unit is responsible for analyzing the linguistic style features of the text, and its analysis results will serve as an important basis for subsequent style adjustment operations.

[0158] The style layer analysis unit specifically performs the following analysis tasks: Sentence structure analysis: This analysis task statistically analyzes the characteristics of sentences in the text, including sentence length distribution, sentence complexity, and sentence type. Sentence length distribution statistics include indicators such as average sentence length, standard deviation of sentence length, and ratio of long to short sentences. Sentence complexity analysis includes indicators such as nesting levels, number of clauses, and complexity of modifiers. Sentence type identification includes the proportional distribution of declarative, interrogative, exclamatory, and imperative sentences, as well as the proportional distribution of simple, compound, and complex sentences.

[0159] Rhetorical Device Recognition: This analysis task identifies various rhetorical devices used in the text and calculates their frequency of use. Recognizable rhetorical devices include, but are not limited to: metaphor (simile, metaphor, allegory), personification, hyperbole, parallelism, antithesis, rhetorical question, metonymy, synesthesia, and symbolism. For each identified rhetorical instance, the system records its location, rhetorical type, and object of the rhetoric.

[0160] Narrative perspective analysis: This analysis task identifies the narrative perspective type used in the text. Narrative perspective types include: first-person perspective (the narrator is a character in the story), third-person limited perspective (the narrator focuses on a specific character's perspective), third-person omniscient perspective (the narrator knows the thoughts and events of all characters), and shifting perspective (switching between different characters' perspectives in different paragraphs). The system also analyzes the consistency and switching patterns of perspectives.

[0161] Sentiment Tone Analysis: This analysis task identifies the overall sentiment tendency and sentiment change curve of the text. Sentiment tendency is represented using a multi-dimensional sentiment model, including but not limited to: positive-negative sentiment dimension, tension-relaxation dimension, excitement-calm dimension, sadness-happiness dimension, etc. The sentiment change curve records the trajectory of emotion as the plot progresses, identifying emotional turning points and emotional climaxes.

[0162] Rhythm Control Analysis: This analysis task examines the narrative rhythm characteristics of the text. Rhythm characteristics include: information density (the amount of information conveyed per unit of text), action density (the number of events occurring per unit of text), dialogue density (the proportion of dialogue content), and descriptive density (the proportion of environmental and psychological descriptions). The system also identifies rhythmic change points, such as the beginning and end of tense passages.

[0163] The output of the style layer analysis unit is organized into a structured style profile, which contains numerical results and textual evidence for the aforementioned analysis indicators. This style profile serves as a reference for subsequent style rotation operations. When a user wishes to adjust the text style, the system calculates the required style vector offset based on the difference between the target style and the current style.

[0164] 2.3 Plot layer deconstruction unit.

[0165] The plot deconstruction unit is responsible for outlining the story's narrative thread and constructing a plot structure diagram. This unit employs a hierarchical plot analysis framework, breaking the story down into multiple levels of plot units.

[0166] The plot deconstruction unit first identifies the overall plot structure of the text. For a complete story, the system identifies the classic three-act or five-act structure: beginning (introduction of the story's background, introduction of characters, establishment of the initial situation), development (introduction of conflict, advancement of the plot, escalation of the conflict), climax (intensification of conflict, key turning point, core event), and ending (resolution of conflict, conclusion of the story). The system marks the start and end positions of each structural unit in the original text.

[0167] The plot layer deconstruction unit further identifies multiple plot threads within the story. The main plot refers to the core storyline that runs throughout the entire text, usually revolving around the protagonist's core goals. Subplots refer to secondary storylines that support the main plot or develop independently, potentially involving minor characters or events. The system identifies the starting point, development path, intersection point (where it intersects with other plot threads), and ending point of each plot thread.

[0168] The plot layer deconstruction unit also constructs causal chains of events. For each important event in the story, the system analyzes its antecedents (preceding events or conditions that led to the event) and consequences (subsequent events or effects triggered by the event). In this way, the system constructs an event network with a directed acyclic graph structure, where nodes represent events and edges represent causal relationships.

[0169] The plot structure diagram output by the plot layer deconstruction unit is represented by a specific data structure, which mainly includes three parts: the overall story information part, which covers the story type (such as adventure, romance, suspense, fantasy, etc.), core theme, overall tone and target audience; the plot clue list part, which is divided into the main plot and the subplot list, where the main plot includes clue ID, starting position, ending position, core conflict description and key event sequence, while the structure of each subplot in the subplot list is consistent with the main plot; the event causal network part consists of the event node list and the causal edge list. Each event node records the event ID, event description, location, involved characters, event type and importance score, and each causal edge defines the antecedent event ID, the consequence event ID, the causal type (such as inevitable, possible, triggered) and the causal strength.

[0170] 3. Detailed implementation of the knowledge graph construction module.

[0171] The knowledge graph construction module receives structured data output from the structured reconstruction module and constructs a semantic knowledge graph. This knowledge graph serves as the "semantic skeleton" of the text and is the core data structure for all subsequent operations.

[0172] 3.1 Spectral data model.

[0173] This embodiment uses an attribute graph as the data model for the knowledge graph. The attribute graph consists of nodes, edges, and attributes: nodes represent semantic entities or concepts. The node types defined in this embodiment include: person nodes, location nodes, item nodes, time nodes, event nodes, concept nodes, topic nodes, style nodes, etc. Each node has a unique identifier and a set of attribute key-value pairs. Edges represent semantic relationships between nodes. The edge types defined in this embodiment include: person relationship edges (connecting two person nodes), location relationship edges (connecting a person and a location), affiliation relationship edges (connecting an item and a person or organization), participation relationship edges (connecting a person and an event), causal relationship edges (connecting two events), topic association edges (connecting an event and a topic), etc. Each edge can also have attributes, such as the strength of the relationship, the trajectory of relationship changes, etc. Attributes are metadata attached to nodes or edges. Attributes can be basic data types (strings, numbers, booleans) or complex data types (arrays, nested objects).

[0174] 3.2 Anchor point system.

[0175] A key innovation of the knowledge graph construction module is the design of the anchor system. The anchor system establishes a precise mapping relationship between the knowledge graph and the original text, ensuring that every semantic element in the graph can be traced back to a specific location in the original text.

[0176] Anchor points are identified using a hierarchical location coding method. The coding structure, from coarse to fine, includes volume number or section number (mainly applicable to very long novels), chapter number, paragraph number, sentence number, word number, and character offset, thereby achieving precise positioning of text content.

[0177] Through this hierarchical encoding, the system can precisely locate text fragments of any granularity. For example, an anchor point might point to "the second word in the third sentence of the fifteenth paragraph of Chapter Three".

[0178] The anchor system also supports cross-location references. When a semantic element appears multiple times in the text, that element is associated with multiple anchors, forming a list of anchors. For example, a character node may be associated with hundreds of anchors, pointing to all the locations where that character appears throughout the text.

[0179] The anchor system also includes an anchor weighting mechanism. For semantic elements associated with multiple anchors, each anchor is assigned a weight value, representing the importance of that position to the element. For example, for a character node, the anchor for the character's first appearance has the highest weight, the anchor for key scenes showcasing the character's personality has the next highest weight, and the anchor for brief mentions of the character has the lowest weight. These weight values ​​are used for context selection and attention allocation during subsequent generation.

[0180] 3.3 Map storage and indexing.

[0181] The knowledge graph construction module uses a graph database as the underlying storage engine. In this embodiment, Neo4j graph database is preferred, but other graph database products that support attribute graph models can also be used.

[0182] When storing graphs, the system creates various indexes to support efficient graph query operations: Node type index: An index is created based on node type, supporting fast retrieval of all nodes of a specific type, such as "query all character nodes".

[0183] Attribute Index: Indexes are created for commonly used query attributes, such as person names and location names, supporting quick node location by attribute values.

[0184] Full-text index: Creates a full-text index for text-type attribute values, supporting fuzzy queries and keyword searches.

[0185] Path index: Pre-computes and stores commonly used path patterns, such as "all relationship paths of a certain person", to accelerate complex graph queries.

[0186] 3.4 Map update mechanism.

[0187] Knowledge graphs support incremental update mechanisms. When a user modifies the text, the system does not need to rebuild the entire graph; instead, it performs incremental updates through the following steps: First, identify the text regions affected by the modification and locate the affected nodes and edges in the graph using an anchor point system.

[0188] Secondly, the affected map regions are locally reconstructed, including the re-extraction of entities, relationships, and attributes in the region.

[0189] Then, the reconstructed local map is merged with the original map. During the merging process, potential conflicts are handled, such as deduplication of newly added entities and existing entities, and updating relation weights.

[0190] Finally, update the relevant indexes and statistics.

[0191] This incremental update mechanism greatly reduces the computational overhead of iterative text modification, enabling the system to support rapid user interaction.

[0192] 4. Detailed implementation of the semantic vectorization module.

[0193] The semantic vectorization module is responsible for converting semantic information in the knowledge graph into vector representations and constructing a high-dimensional semantic space model.

[0194] 4.1 Multi-scale vectorization strategy.

[0195] This embodiment employs a multi-scale vectorization strategy to generate semantic vectors of different granularities: Macro-vectors: Macro-vectors represent the overall semantic features of the text, typically with dimensions between 512 and 4096. A macro-vector is formed by fusing the following sub-vectors: Worldview Vector: Encodes worldview settings (historical background, geographical environment, rule system, etc.) into vectors. The specific method is as follows: First, extract the structured description of the worldview settings, then use a text embedding model to convert the descriptive text into vectors, and finally integrate the vector representations of multiple settings through an attention fusion mechanism.

[0196] Theme Vectors: The core themes of the story are encoded as vectors. The system first extracts theme tags (such as "growth", "revenge", "love", "exploration", etc.) from the plot structure diagram, then converts the theme tags into vectors, and multiple theme vectors are weighted and merged according to their importance.

[0197] Style vectors: These encode the various metrics in the style profile into vectors. Style vectors are generated using a specialized style encoder, which is pre-trained on an annotated style dataset and can map style features to a continuous style vector space.

[0198] Sentiment tone vector: Encodes the overall sentiment tendency as a vector. Based on the hidden layer state extraction of the sentiment analysis model, the sentiment tone vector can represent the position of the text in the multidimensional sentiment space.

[0199] The process of fusing macroscopic vectors is as follows: Macro Vector = α1 × Worldview Vector + α2 × Theme Vector + α3 × Style Vector + α4 × Emotional Tone Vector Where α1, α2, α3, α4 are learnable fusion weights, satisfying α1 + α2 + α3 + α4 = 1 Meso-level vectors: Meso-level vectors represent semantic units of medium granularity, such as characters, plot lines, chapters, etc.

[0200] Character Vectors: Each character is represented by an independent vector. These vectors integrate information such as basic attributes, personality traits, behavioral patterns, and relationship networks. The generation method involves serializing the character's structured information into a text description, then converting it into a vector using an embedding model, and finally enhancing the context through a graph neural network on the character relationship graph.

[0201] Plot Clue Vector: Generates a vector representation for each plot clue. The plot clue vector encodes information such as the core conflict, development trajectory, characters involved, and emotional trajectory of the clue.

[0202] Chapter Vector: Generates a vector representation for each chapter. The chapter vector is formed by aggregating the vectors of all paragraphs within the chapter. The aggregation method can be average pooling, max pooling, or attention-weighted pooling.

[0203] Micro-vectors: Micro-vectors represent fine-grained semantic units, such as paragraphs, sentences, and words.

[0204] Paragraph vectors: The paragraph text is directly encoded using an embedding model, or the hidden state of the encoder model is used as a vector representation.

[0205] Sentence vectors: Sentences are encoded using sentence embedding models (such as Sentence-BERT) to generate fixed-dimensional vector representations.

[0206] Lexical vectors: Encode lexical units using word embedding models (such as Word2Vec, FastText) or contextual embedding models (such as BERT).

[0207] 4.2 Semantic Cube Construction.

[0208] This embodiment innovatively proposes the concept of a "semantic cube," which organizes multi-scale vectors into a high-dimensional tensor structure. The cube facilitates explanation and demonstration, but in practice, it can also be other high-dimensional space model structures.

[0209] The construction process of the semantic cube is as follows: First, determine the dimensional structure of the cube. The cube dimensions defined in this embodiment include: Semantic hierarchy dimensions: three levels: macro, meso, and micro; Semantic type dimensions: entities, plots, styles, emotions, etc.; Time dimension: Arranged according to the story timeline or text order.

[0210] Secondly, organize the various vectors into tensors according to their dimensional structure. For example, a four-dimensional tensor with the shape of [number of levels × number of types × number of time steps × vector dimension] can be constructed.

[0211] Then, the tensors are normalized and aligned. Since vectors from different sources may have different dimensions or distributions, they need to be mapped to a unified vector space through linear transformations.

[0212] The mathematical representation of a semantic cube is achieved by constructing a multi-scale vector matrix: the macroscopic vector set is defined as V_{macro} (containing m vectors), the mesoscopic vector set as V_{meso} (containing n vectors), and the microscopic vector set as V_{micro} (containing p vectors). The semantic cube C is represented as a matrix composed of these three sets, with dimensions (m+n+p) × d, where d represents the dimension of the vectors, and the entire matrix belongs to the real number space.

[0213] 4.3 Vector storage and retrieval.

[0214] The semantic vectorization module stores the generated vectors using a vector database. This embodiment preferably uses the Milvus vector database, but other products such as Pinecone, Chroma, and Weaviate are also supported. During vector storage, the system associates rich metadata with each vector, specifically including vector type (macro, meso, or micro), associated knowledge graph node ID, associated text location anchors, and timestamp information. Furthermore, the vector retrieval function supports multiple query modes, covering similarity retrieval of the k most similar vectors to a given vector, conditional filtering retrieval of vectors satisfying specific metadata conditions, and hybrid retrieval combining vector similarity and keyword matching.

[0215] 5. Detailed implementation of the semantic space operation module.

[0216] The semantic space operation module is one of the core innovative modules of this system, which realizes the function of precise manipulation of text in semantic space.

[0217] 5.1 Definition of semantic direction.

[0218] The foundation of semantic space operations is the concept of "semantic direction". Semantic direction is a vector in semantic space that represents a specific direction of semantic change.

[0219] Semantic direction can be defined in the following ways: Contrastive corpus-based learning: Collect text pairs with significant semantic differences (such as "sad text" and "happy text"), calculate their vector difference in the semantic space, and this difference vector is an estimate of the semantic direction. By averaging a large number of text pairs, a more robust semantic direction vector can be obtained.

[0220] For example, the semantic direction of "sad" is calculated as follows: by performing a difference operation on the vector representation of sad text \vec{v}_{sad\_text_i} and the vector representation of neutral text \vec{v}_{neutral\_text_i}, and averaging the calculation results of N samples, the semantic direction vector \vec{d}_{sad} is obtained.

[0221] Based on the definition of cue engineering: through carefully designed text cue, an embedding model is guided to generate a vector representation of a specific semantic direction. For example, constructing cue text "shift from a normal style to a humorous style" and encoding the cue text as a vector as a representation of the semantic direction.

[0222] Defined by manual annotation: Semantic direction vectors are defined or adjusted directly in the semantic space by domain experts. This method can precisely control semantic direction, but requires specialized knowledge and a significant amount of manual input.

[0223] Extraction based on hidden layers of the model: Certain semantic orientations can be directly extracted from the hidden layer states of a pre-trained model. Research has found that specific orientations exist in the hidden layers of large language models, corresponding to certain semantic attributes (such as sentiment, style, etc.). These orientations can be identified and extracted using a probe classifier.

[0224] This embodiment predefines a set of commonly used semantic directions, specifically covering the following categories: style directions include formal-colloquial, ornate-simple, serious-humorous, compact-relaxed, etc., used to control the language style of the text; emotion directions include sad-happy, angry-calm, fearful-reassuring, disgust-loving, etc., used to control the emotional tone of the text; plot directions involve tragedy-comedy, open-closed, complex-simple, unexpected-expected, etc., used to control the development direction of the story; rhythm directions include tense-relaxed, fast-slow, dense-sparse, etc., used to control the narrative rhythm.

[0225] 5.2 Semantic space geometric transformation operations.

[0226] The semantic space operations module provides the following geometric transformation operations: Translation operation: Translation operation is the most basic semantic space operation, which achieves semantic changes by superimposing semantic direction vectors on semantic vectors.

[0227] Mathematical representation: \vec{v}_{new} = \vec{v}_{original} + \alpha \cdot \vec{d}_{semantic} Where \vec{v}_{original} is the original semantic vector, \vec{d}_{semantic} is the semantic direction vector, and \alpha is the translation intensity factor, which controls the degree of semantic change.

[0228] Application example: To make a bland narrative more humorous.

[0229] Original vector: \vec{v}_{original} (the semantic vector of the current text) Humor direction: \vec{d}_{humor} (semantic direction vector from "serious" to "humorous") Translation operation: \vec{v}_{new} = \vec{v}_{original} + 0.5 \cdot \vec{d}_{humor} Result: The text corresponding to the translated vector will have a stronger humorous style.

[0230] Rotation operations: Rotation operations enable more complex transformations in semantic space. Rotation can keep the magnitude of a vector unchanged, only changing its direction, thereby altering other semantic properties while preserving certain semantic properties (such as text length and complexity).

[0231] Mathematical representation: Rotation operations are implemented using a rotation matrix: \vec{v}_{new} = R \cdot \vec{v}_{original} Where R is the rotation matrix. In the two-dimensional semantic subspace, the rotation matrix is: R(\theta) = \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix} In a high-dimensional semantic space, rotation can be defined as rotation about a certain semantic axis. Let the axis of rotation be \vec{a} (a unit vector), and the rotation angle be \theta, then the rotated vector is: \vec{v}_{new} = \vec{v}_{\parallel} + \vec{v}_{\perp}\cos\theta + (\vec{a} \times \vec{v}_{\perp})\sin\theta Where \vec{v}_{\parallel} is the projection component of \vec{v} on the rotation axis, and \vec{v}_{\perp} is the component perpendicular to the rotation axis.

[0232] Application example: Adjusting the story's perspective without changing the core plot.

[0233] Define the rotation axis: \vec{a}_{plot} (core plot direction) Rotate the target: from a "rational perspective" to an "emotional perspective"; rotation angle: α = 30° After the rotation operation, the text will maintain the same plot development, but the narrative perspective will be more inclined towards emotional expression.

[0234] Scaling operation: The scaling operation changes the magnitude of the semantic vector, which can enhance or weaken the strength of certain semantic features.

[0235] Mathematical representation: \vec{v}_{new} = \beta \cdot \vec{v}_{original} Or selective scaling of specific semantic dimensions: \vec{v}_{new} = \vec{v}_{original} \odot \vec{s} Where \vec{s} is the scaling factor vector, and \odot represents element-wise multiplication.

[0236] Application example: Enhance the drama of text while keeping other properties unchanged.

[0237] Identify the semantic dimensions (such as emotional intensity, conflict intensity, etc.) corresponding to "dramatic", set the scaling factor for these dimensions to a value greater than 1, and set the scaling factor for other dimensions to 1.

[0238] Projection operation: The projection operation projects a semantic vector onto a semantic subspace to extract or emphasize specific semantic features.

[0239] Mathematical representation: \vec{v}_{projected} = P \cdot \vec{v}_{original} Where P is the projection matrix. If the projection is onto the subspace spanned by the vector group \{\vec{b}_1, \vec{b}_2, ..., \vec{b}_k\}, then: P = B(B^TB)^{-1}B^T, where B = [\vec{b}_1, \vec{b}_2, ..., \vec{b}_k].

[0240] Application example: Extracting sentiment features from text and removing plot details. Define a set of basis vectors for the "sentiment subspace," project the original semantic vectors onto this subspace, and the resulting projected vectors primarily encode sentiment information.

[0241] 5.3 Combinatorial Transformation and Transformation Chain.

[0242] In practical applications, multiple transformation operations are often combined to achieve complex modification goals. The semantic space operation module supports the definition and execution of transformation chains. For example, a humorous translation (intensity 0.3) can be performed first, followed by a 15-degree rotation around the plot core axis, and finally, the intensity of the dramatic and conflict dimensions can be amplified by 1.2 times. The transformation chain is executed sequentially, with the output of each transformation operation serving as the input for the next. The system also supports the inverse operation of the transformation chain for undoing or reverting modifications.

[0243] 5.4 Local and global operations.

[0244] The semantic space operation module supports two granularities of operations: global operations and local operations.

[0245] Global operations affect the entire semantic cube, influencing the overall characteristics of the text. For example, global style adjustments will simultaneously affect the descriptive style of all paragraphs and all characters.

[0246] Local operations operate on specific regions of the semantic cube, affecting only a specific part of the text. Local operations require specifying the scope of the operation, which can be defined in the following ways.

[0247] Anchor-based range: Specifies a specific location range in the text; Graph-based range: Specifies a specific node or subgraph in the graph; Semantic-based range: Specifies a region that satisfies specific semantic conditions.

[0248] The implementation of local operations requires consideration of boundary handling. When only a portion of the text is modified, it is necessary to ensure a smooth transition between the modified and unmodified parts at the boundary. The system employs semantic gradient technology to handle boundaries: near the boundary of the operation area, the intensity of the operation is gradually reduced, making the semantic change transition natural.

[0249] 5.5 Preview and adjustment of operation effects.

[0250] The semantic space manipulation module provides a preview function for the operation effect. Users can preview the changes in the semantic space structure before making formal modifications.

[0251] The preview includes: a visualization of the semantic vector's change trajectory, a comparison of changes in key semantic metrics (such as sentiment score, style score, etc.), and a list of text segments expected to be affected. Users can adjust the operation parameters based on the preview results until they are satisfied before making formal modifications.

[0252] 6. Detailed implementation of the projection generation module.

[0253] The projection generation module is responsible for re-decoding the vectors after semantic space operations into text.

[0254] 6.1 Decoder Architecture.

[0255] In this embodiment, the projection generation module adopts an autoregressive decoder architecture based on Transformer. The decoder receives the processed semantic vector as conditional input and gradually generates a text sequence.

[0256] The decoder's inputs include: semantic condition vector: the output vector from the semantic space operation module; structural constraint information: structural information from the knowledge graph, such as character settings and worldview settings; and context cache: pre-computed cache from the KV Cache preprocessing module.

[0257] The decoder generation process is an iterative one. For each generation step, the system first acquires the currently generated text sequence, then calculates the multi-source attention distribution, encompassing semantic conditional vectors, structural constraint information, context buffers, and self-attention to the generated text. Based on this, the system fuses this attention information to predict the probability distribution of the next word, and then determines the next word and adds it to the sequence through a sampling or selection strategy. This iterative process continues until a terminator is generated or the sequence reaches its maximum length limit.

[0258] 6.2 Conditional injection mechanism.

[0259] To ensure the generated text conforms to the goals of semantic space operations, semantic condition vectors need to be effectively injected into the decoding process. This embodiment employs multiple condition injection mechanisms: Cross-attention injection: Semantic condition vectors are output by the encoder, and the decoder pays attention to these condition vectors through a cross-attention mechanism. At each decoding layer, the decoder's hidden state performs cross-attention computation with the semantic condition vectors, thus guiding the generation process with semantic conditions.

[0260] Adaptive Layer Normalization: Borrowing from the AdaLN (Adaptive Layer Normalization) technique in image generation, semantic conditional vectors are used to dynamically adjust the normalization parameters of each layer in the decoder. Specifically, the semantic conditional vectors generate scaling factors \gamma and offset factors \beta through a small MLP network, which are then used for layer normalization. \text{AdaLN}(h, c) = \gamma(c) \odot \frac{h \mu}{\sigma} + \beta(c) Where h is the hidden state and c is the semantic condition vector.

[0261] Prefix tuning: The semantic conditional vector is used as a learnable soft cue prefix and concatenated into the input embedding sequence of the decoder. The prefix vector learns how to guide the generation process during training.

[0262] 6.3 Structural constraints are satisfied.

[0263] The projection generation module needs to ensure that the generated text satisfies the structural constraints in the knowledge graph. The main constraint types include: Entity consistency constraint: Entities such as people and places mentioned in the generated text must be consistent with the settings in the knowledge graph. For example, a character's personality traits, appearance descriptions, and ability settings cannot contradict the original settings.

[0264] Implementation: During the decoding process, an entity state tracker is maintained. When generating content involving a specific entity, the entity's configuration information is retrieved from the knowledge graph and injected into the decoding process through an attention mechanism.

[0265] Plot consistency constraint: Newly generated plot content must be compatible with the original plot structure and cannot introduce timeline contradictions or causal contradictions.

[0266] Implementation: During the decoding process, the plot structure graph serves as an external knowledge source, providing plot constraints through Retrieval-Enhanced Generation (RAG). When generating content involving event causality, relevant causal chain information is retrieved for reference.

[0267] Style consistency constraint: The style of the modified text should be consistent with the target style, and should also flow smoothly with the unmodified parts.

[0268] Implementation: Style vectors are injected as global conditions throughout the generation process. Style interpolation techniques are used at the boundaries to ensure a smooth transition of style between modified and unmodified regions.

[0269] 6.4 Multiple candidate generation and selection.

[0270] The projection generation module supports a multi-candidate generation strategy. For each semantic space operation, the system can generate multiple candidate texts, and then select the optimal result through a scoring mechanism.

[0271] Multiple candidate generation is achieved in the following way: Multiple candidates can be generated using different sampling strategies (such as temperature sampling and kernel sampling); multiple variants can be generated using small random perturbations in the semantic space; and multiple candidates can be generated using different decoders or decoding configurations.

[0272] The scoring dimensions for candidate texts include: Semantic consistency score: The similarity between the semantic vector of the generated text and the semantic vector of the target text; Structure satisfaction score: the degree to which the generated text satisfies the constraints of the knowledge graph; Fluency score: The fluency and naturalness of the generated text; Originality score: The degree of innovation in the generated text (avoiding excessive imitation of the original text).

[0273] Finally, the candidate with the highest overall score is selected as the output result.

[0274] 7. Detailed implementation of the verification feedback module.

[0275] The verification feedback module evaluates the quality of the generated text and provides optimization feedback.

[0276] 7.1 Multi-dimensional evaluation system.

[0277] The verification feedback module implements the following evaluation dimensions: Semantic fidelity evaluation: This assesses whether the generated text accurately reflects the target of semantic space operations. Specifically, the generated text is re-encoded into a semantic vector, and the distance between this vector and the target vector is calculated. The smaller the distance, the higher the semantic fidelity.

[0278] Structural consistency assessment: Evaluate whether the generated text satisfies the structural constraints of the knowledge graph.

[0279] Character Consistency Assessment: Specifically assesses the consistency of content related to a character.

[0280] Plot plausibility assessment: Evaluate the logical plausibility of the plot development.

[0281] Style consistency assessment: Evaluate whether the style of the generated text is consistent with the target style.

[0282] Language quality assessment: This evaluates the language quality of the generated text, including grammatical correctness, fluency, and appropriateness of word choice. A pre-trained language model can be used to calculate perplexity as an evaluation metric.

[0283] 7.2 Feedback signal generation.

[0284] When the evaluation results do not meet the preset threshold, the verification feedback module generates a feedback signal to guide subsequent optimization.

[0285] The types of feedback signals include: Parameter adjustment feedback: It is recommended to adjust the parameters of semantic space operations. For example, if style consistency is insufficient, it is recommended to increase the intensity of style direction translation.

[0286] Feedback on scope adjustment: It is recommended to adjust the scope of the operation. For example, if the character consistency issue is concentrated in certain areas, it is recommended to reduce the scope of the operation or to handle these areas specially.

[0287] Constraint reinforcement feedback: It is recommended to strengthen certain constraints. For example, if the plot is not reasonable enough, it is recommended to increase the weight of the plot consistency constraint when regenerating.

[0288] Manual intervention request: When automatic optimization fails to resolve the issue, request manual review and intervention. The system will mark the problematic areas for manual inspection and modification.

[0289] 7.3 Closed-loop optimization process.

[0290] The verification feedback module, semantic space operation module, and projection generation module form a closed-loop optimization process. Specifically, the semantic space operation module first performs transformation operations, followed by the projection generation module generating candidate texts. The verification feedback module evaluates the candidate texts; if the evaluation passes, it outputs the final result; if the evaluation fails, it generates a feedback signal and adjusts the operation parameters or generates a configuration accordingly, then returns to the first step to re-execute. This iterative process is performed a maximum of N times. If the evaluation still fails after N iterations, the system will request manual intervention.

[0291] Closed-loop optimization ensures the quality of the output text while reducing reliance on human intervention.

[0292] 8. Detailed implementation of the KV Cache preprocessing module.

[0293] The KV Cache preprocessing module is a key module for improving system efficiency, reducing inference costs through pre-computation and caching mechanisms.

[0294] 8.1 The principle of extending KV Cache to structured information.

[0295] In the Transformer architecture, attention computation involves three projections: query, key, and value. For autoregressive generation, the keys and values ​​of the already generated parts can be pre-computed and cached, avoiding repeated computation when generating each new terminology.

[0296] This embodiment extends this idea to the processing of structured information. The setting information in the knowledge graph (such as character settings and world view settings) remains unchanged in multiple generations, and its KV cache can be pre-calculated and directly reused in subsequent generations.

[0297] 8.2 Hierarchical caching structure.

[0298] In this embodiment, the KV Cache preprocessing module adopts a hierarchical caching structure, specifically divided into three levels: L1 cache is a system-level setting, storing worldview settings (including historical background, geographical environment, and rule system) and general writing standards (including word usage standards and format standards), which are globally shared and rarely change; L2 cache is a document-level setting, containing character profiles (such as basic information, personality settings, and relationship networks), plot outlines (such as main plot and key events), and style guidelines (such as target style and style constraints), which are shared within the document and updated as the document is modified; L3 cache is a session-level context, storing context fragments related to the current modification and the KV Cache of generated content, which is only valid within the session and is released after the session ends.

[0299] 9. Taking the style adjustment of a fantasy novel as an example, the actual application process of the system will be demonstrated in detail.

[0300] 9.1. Load text.

[0301] In a fantasy novel passage, the following passage describes Alan standing on a cliff edge, gazing at the distant dark forest. A breeze ruffled his long hair, bringing a chill. He knew that what he sought lay there—the legendary Sword of Light. He had searched for this sword for three long years. Now, it was before him. "It's time to go," he said to himself, his voice faint in the wind. He took a step and walked into the dark forest. Each step felt like a step towards an unknown destiny.

[0302] 9.2. Structured Reconstruction.

[0303] The system first performs a structured reconstruction of the text. At the entity extraction level, it identifies the protagonist, Allen, and his physical and personality traits, clarifying his three-year quest for the Sword of Light, and defining his current location—the cliff—and his destination—the Dark Forest. Style analysis indicates that the narrative employs a limited third-person perspective, with a slow, measured rhythm and an emotional tone that blends determination with a sense of melancholy, emphasizing action and psychological aspects. Plot deconstruction pinpoints the timeline of the main storyline, with the core event focusing on Allen's preparation to enter the Dark Forest to obtain the sword.

[0304] 9.3. Knowledge Graph Construction.

[0305] The system constructs a knowledge graph containing nodes for characters, locations, and items. The character node "Allen" is associated with attributes such as appearance and duration of pursuit; the location nodes "cliff" and "dark forest" record location characteristics; and the item node "Sword of Light" is labeled with its legendary attributes. Each node has text anchors to trace back to the original text. Furthermore, the system connects the nodes through relational edges, clearly presenting the semantic relationships of Allen being located on the cliff, gazing into the dark forest, searching for the Sword of Light, and the sword being hidden in the forest.

[0306] 9.4. Semantic vectorization.

[0307] The system generated multi-scale semantic vectors. At the macro level, the 1024-dimensional vector encompasses the fantasy worldview, the theme of pursuit, and the calm and restrained style components, while the emotional components are quantified as steadfastness (0.7) and vicissitudes (0.5). At the meso level, 1024-dimensional character and plot vectors were constructed, respectively encoding Allen's attribute state and plot development. At the micro level, a 512-dimensional fine-grained vector representation was generated for each paragraph and sentence.

[0308] 9.5. User modification instructions.

[0309] The user issued the following modification instruction: "Change the style of this text to be more tense and suspenseful, but keep the plot and characters unchanged."

[0310] 9.6. Semantic space operations.

[0311] The system parses the modification instructions, transforming the style adjustment target into operational parameters in the semantic space. The target semantic direction is set to increase the "tension" and "suspense" components, employing a combination of translation and rotation operations. The system calculates the direction vectors from "calm" to "tension" and from "clarity" to "suspense," setting the translation intensities to 0.4 and 0.3 respectively. During the operation, the original vectors are translated and superimposed along these two directions, followed by a small 10-degree rotation around the core plot axis, ensuring that the plot trajectory remains unchanged while altering the stylistic tendency. The operation covers the entire text, while protection zones are set for character settings and plot nodes to ensure that core elements are not affected.

[0312] 9.7. Projection generation.

[0313] The decoder generates new text based on the processed semantic vectors, injecting multiple constraints during the process: it uses the processed semantic vectors as a benchmark, while adhering to the character settings of Allen, the item settings of the Sword of Light, and the structural constraints of the predetermined plot, and strictly enforces the style constraints of tension and suspense. The generation process progresses layer by layer: the opening section rewrites "standing on the edge of the cliff" as "standing on the edge of the cliff, fingers gripping the hilt of the sword," adding physical actions to suggest tension; the environmental description incorporates suspense elements, the chill brought by the night wind is given an uncertain source, and the dark forest is described as an existence that "swallows light"; the inner monologue introduces the detail of "someone who entered the forest and never returned," strengthening the atmosphere of tension; the tone of the dialogue is adjusted to have a "trembling that even he himself did not realize"; the ending, through the description of "as if something was spying in the forest," pushes the suspense to a climax.

[0314] 9.8. Verification feedback.

[0315] The system performs a multi-dimensional evaluation of the generated text. Semantic fidelity reaches 0.87, exceeding the threshold of 0.8, indicating that the semantic vector of the generated text is close to the target vector, and the style adjustment goal has been largely achieved. Character consistency score is 0.92, exceeding the threshold of 0.85, with Allen's personality and appearance description remaining consistent. Plot consistency is as high as 0.95, with all plot points fully preserved. Style consistency reaches 0.83, significantly enhancing the tension and suspense, meeting user expectations. Language quality score is 0.91, with fluent and natural language and no obvious grammatical problems. The comprehensive evaluation shows that all dimensions pass the thresholds, and the system outputs the final result.

[0316] 9.9. Output Results.

[0317] The system output of the modified text: Allen stood on the edge of the cliff, his fingers unconsciously tightening around the sword hilt. His gaze pierced the twilight, locking onto the distant, light-devouring dark forest. A night wind swept by, his long hair fluttering behind him, bringing an inexplicable chill—whether from the wind itself or something emanating from the depths of the forest, he couldn't tell. What he was looking for was there. It had to be there. The legend of the Sword of Light echoed in his mind, but even clearer were the stories of those who entered the forest and never returned. He had been searching for this sword for three whole years. Now, it was before him—or rather, waiting for him somewhere in that darkness. "I can't wait any longer," he whispered, his voice trembling slightly, a tremor he himself didn't even realize. He took a deep breath and took his first step. The outline of the dark forest loomed in the distance, as if something was watching him from within. With each step, he drew closer to the unknown.

[0318] 9.10. Modify the comparative analysis.

[0319] The system conducted a dimension-by-dimensional comparative analysis of the original and revised texts. Regarding the opening pacing, the original text employed a straightforward narrative, while the revised text effectively enhanced tension by adding action details and subtle hints. The environmental description shifted from a simple depiction of wind to a combination of the sound of wind and the uncertain source of the chill, successfully injecting suspense. In the inner monologue, the original text expressed a certain understanding, while the revised text created psychological tension through the contrast between legend and danger. The tone of the dialogue changed from calm and firm to a trembling yet resolute one, directly revealing the character's inner tension. The ending was changed from a definitive statement of "facing fate" to creating a feeling of being watched, significantly increasing suspense. Both the core plot and character settings remained unchanged, ensuring that the revised text was consistent with the original text at its core.

[0320] 10. Next, we will demonstrate how to modify the plot through semantic space operations.

[0321] 10.1. Scene setting.

[0322] The original plot was: the protagonist, Allen, enters the Dark Forest alone, successfully obtains the Sword of Light, defeats the guardian beast, and finally returns safely.

[0323] The user submitted the following modification command: "Change the ending to a tragic one—Alan obtains the Sword of Light, but pays the price with his life."

[0324] 10.2. Plot rotation operation.

[0325] The system recognizes that the request is for plot direction modification and requires plot rotation processing.

[0326] The semantic space analysis is as follows: the original plot vector is located in the "comedy ending" region, the target plot vector is located in the "tragedy ending" region, the rotation axis is the character's fate axis, and the rotation angle is approximately 120 degrees (from comedy to tragedy).

[0327] The protection and constraint settings include: the early plot remains unchanged (Allen enters the forest and faces the guardian beast), the core character settings remain unchanged (Allen's determination and courage), and the setting of the Sword of Light remains unchanged.

[0328] When executing a plot rotation, the system adjusts the causal chain in the plot structure diagram. The original causal chain shows Allen entering the forest, finding the Sword of Light, defeating the guardian beast, successfully obtaining the sword, and returning safely. The modified causal chain shows Allen entering the forest, finding the Sword of Light, fighting fiercely with the guardian beast, and facing the guardian beast's deadly attack, Allen seals it away at the cost of his life. In the end, the Sword of Light is left behind, and Allen sleeps eternally deep in the forest.

[0329] 10.3. Result Generation.

[0330] The system generates new text based on the modified plot structure (taking the ending paragraph as an example).

[0331] Original Ending: Allen gripped the Sword of Light, feeling the warm power it emanated. The guardian beast had fallen, and the gloom of the Dark Forest began to dissipate. He turned and walked back the way he had come. Three years of searching had finally yielded results. Sunlight pierced through the treetops, illuminating his face. He smiled.

[0332] Revised ending: The Sword of Light slipped from Allen's cooling hand with a crisp sound. The guardian beast's figure vanished in the light, but Allen knew that his own end had come.

[0333] With his last breath, he planted the sword on the stone platform in the center of the forest. The seal was complete. No more dark forces would ever emerge from this forest.

[0334] "Is it worth it?" he asked himself, his lips already unable to move.

[0335] Sunlight streamed through the treetops, illuminating his serene face. He smiled, and then closed his eyes forever.

[0336] The Sword of Light stands silently, awaiting the next brave soul. And Allen's name will be forever remembered as the legends of the forest are passed down.

[0337] 10.4. Related intermediate code.

[0338] This small section, after being transformed into the intermediate code of the current 0.1 version of code-as-book, will have significantly more characters, as shown below: / * ========================================== * Metadata Header * Includes global semantic vector index and document configuration * Original: Allen gripped the Sword of Light, feeling the warm power it emanated. The guardian beast had fallen, and the gloom of the Dark Forest began to dissipate. He turned and walked back the way he had come. Three years of searching had finally yielded results. Sunlight pierced through the treetops, illuminating his face. He smiled.

[0339] * ============================================ * / @META { "doc_id": "book_001_chap_12_sec_05", Title: "The Sword of Light: Final Chapter" "semantic_cube_ref": "cube: / / mem_pool / 0x8A2F...B9C1", / / Points to the storage address of the high-dimensional semantic cube "global_vector": { "macro": "vec_1024_dim [0.12, -0.45, ..., 0.88]", / / Macro semantics: victory, relief, warmth "style": "vec_256_dim [0.9 (epic), 0.1 (suspense)]" / / Style: Epic feel, weak suspense } } / * ========================================== * Knowledge Graph Layer * Define the node entities and their topological relationships in the network. * ============================================ * / @KNOWLEDGE_GRAPH { / * Entity node definition * / NODE n_char_01 { type: "Character", name: "Allen" anchor_ref: ["A1", "A5", "A7"], state: { "emotion": "joy_relief", / / Emotion: joy and relief "inventory": ["item_sword_01"], / / Backpack holdings "goal_status": "completed" / / Goal completed } } NODE n_item_01 { type: "Item", name: "Sword of Light" anchor_ref: ["A1"], attributes: { "element": "Light", "status": "Active", "sensory": "Warmth" / / Perceptual characteristic: warmth } } NODE n_mob_01 { type: "Mob", name: "Guardian Beast" anchor_ref: ["A2"], state: "Defeated" } NODE n_loc_01 { type: "Location", name: "Dark Forest" anchor_ref: ["A2", "A3"], state: "Clearing" / / Status: The haze has dissipated } / * Topological relation definition * / EDGE e_hold { from: "n_char_01", to: "n_item_01", relation: "HOLDING", weight: 1.0 } EDGE e_defeat { from: "n_char_01", to: "n_mob_01", relation: "DEFEATED", anchor_ref: ["A2"] } EDGE e_weather_change { from: "n_item_01", to: "n_loc_01", relation: "ENVIRONMENT_EFFECT", logic: "IF item.Active THEN loc.Haze_Clear"} } / * ========================================== * Anchor Index Layer * Establish a bidirectional mapping between graph nodes and original text fragments. * ============================================ * / @ANCHOR_SYSTEM { source_text_hash: "sha256#9f86d081...", A1: { text_segment: "Allen wields the sword of light", position: [0, 10], linked_nodes: ["n_char_01", "n_item_01"], semantic_micro_vector: "vec_512 [0.82 (Action), 0.15 (Dialogue)]" }, A2: { text_segment: "The guardian beast has fallen", position: [11, 19], linked_nodes: ["n_mob_01"], semantic_micro_vector: "vec_512 [0.90 (State_Change), -0.2(Tension)]" }, A3: { text_segment: "The gloom of the dark forest begins to dissipate", position: [20, 31], linked_nodes: ["n_loc_01"], / / Related high-dimensional operations: If a "style rotation" is performed here for a horror style, this vector will be inverted. semantic_micro_vector: "vec_512 [0.75 (Hope), -0.8 (Darkness)]" } } / * ========================================== * Narrative Logic Layer * Controlling the story flow, state changes, and branching conditions * ============================================ * / @NARRATIVE_LOGIC { SCENE "Ending_Victory" { / / Step 1: Interactive Actions ACTION { type: "INTERACTION", agent: "n_char_01", target: "n_item_01", anchor: "A1", / / Logic control code: haptic feedback signal: "SenseEvent(Warmth, Power)" } / / Step 2: Environmental Status Linkage STATE_UPDATE { trigger: "n_mob_01.state == Defeated", effect: { "n_loc_01 atmosphere": "Haze -> Clear", "Lighting": "Dark -> Sunlight" }, anchor: "A2, A3" } / / Step 3: Character Emotional Evolution CHARACTER_ARC { character: "n_char_01", timeline: { "T-3 years": "Seeking", "T-Now": "Result_Achieved" }, / / Kernel Logic: A Three-Year Pursuit of a Causal Closed Loop logic: "ASSERT goal_completed == TRUE" } / / Step 4: Visual Rendering Instructions VISUAL_RENDER { camera: "CloseUp -> Face", lighting: "GodRays(Trees, Face)", expression: "Smile", anchor: "A7" / / "He smiled" } } } / * ========================================== Semantic space operation interface * Reserved hot reload and intervention interface * ============================================ * / @SEMANTIC_INTERFACE { / / Semantic directions that allow user intervention OPERABLE_AXES: [ "DARKNESS_BRIGHTNESS", / / Light and dark tone "TRAGEDY_VICTORY", / / Ending Direction "PACE_TENSE_RELAX" / / Pace and Tempo ], / / Example: If the user drags the "Tragedy-Comedy" slider towards the tragedy side / / The system will perform the following vector transformations TRANSFORM_HOOK { id: "hook_ending_tone", operation: "VECTOR_ROTATE", axis: "TRAGEDY_VICTORY", affected_anchors: ["A1", "A3", "A7"], / / Pre-calculation: If rotated to the tragic ending, A7 "He smiled" will be projected and rewritten as "He shed tears". projection_target: "Tragic_Ending_Cluster" } }

[0340] Due to space limitations in the manual, a simplified explanation of the above intermediate code is provided below.

[0341] 1. Resources and Anchor Points: The code not only stores the text, but also binds text fragments (such as "Allen holds the sword of light") with specific character positions and micro-semantic vectors (`vec_512`) through `@ANCHOR_SYSTEM`.

[0342] Anchor point `A1` links both the character node `n_char_01` and the item node `n_item_01`, thus achieving a mapping from text to graph.

[0343] 2. Maps and Topology: The `@KNOWLEDGE_GRAPH` section not only lists entities but also defines logical rules. For example, `e_weather_change` defines the environmental impact logic of "Sword of Light" on "Dark Forest" (`IF item.Active THENloc.Haze_Clear`), enabling the system to understand the causal relationships in the plot, rather than just the meaning of words.

[0344] 3. High-dimensional semantic space association: Each anchor point and node comes with a vector index (e.g., `vec_512 [0.75 (Hope)]`).

[0345] The `@SEMANTIC_INTERFACE` code reserves `TRANSFORM_HOOK`. If a user feels the ending is too perfect in the reader and wants to change it to a tragedy, the system does not need to rewrite it. Instead, it directly finds the `TRAGEDY_VICTORY` axis in the semantic space and rotates it (`VECTOR_ROTATE`).

[0346] After rotation, the projection target becomes `Tragic_Ending_Cluster`, and the system will automatically rewrite the anchor point `A7` ("He smiled") with a sad expression, while updating the text seen by the user in real time through hot reload.

[0347] This format transforms the novel into a runnable "project file." It contains data (text), logic (state updates), presentation (rendering instructions), and interfaces (intervention hooks), and will continue to be refined to form a true "Code as Book."

[0348] Case Study 3: "Literary Cube System" Novel Text Intelligent Modification System.

[0349] I. System Overview.

[0350] 1.1 Core Concepts.

[0351] This system is named the "Literary Cube System". Its core concept is to transform linear text into a computable and operable high-dimensional semantic structure, realizing a paradigm upgrade from "text editing" to "semantic space operation".

[0352] 1.2 Design Philosophy.

[0353] The design philosophy of this system represents a fundamental shift: the object of operation has changed from directly modifying text to manipulating semantic structure; the reading comprehension mode has changed from linear reading to a three-dimensional knowledge network; and the content generation method has changed from prompt-driven rewriting to mathematical space projection transformation.

[0354] II. Overall Architecture.

[0355] The literary cube system architecture presents a multi-level processing flow: the original text first passes through the structured reconstruction module, then enters the vector space module for processing, and finally projects to generate new text. In this process, the structured reconstruction stage simultaneously constructs a knowledge graph (semantic net), while the vector space stage forms a semantic cube and performs projection transformation operations. This architecture achieves a complete closed loop from unstructured text input to controllable semantic output.

[0356] III. First Stage: Structured Reconstruction and Semantic Anchoring.

[0357] 3.1 Multi-level element extraction.

[0358] The goal of multi-level element extraction is to transform unstructured text into a semantic knowledge graph that machines can deeply understand.

[0359] 3.1.1 Entity layer extraction.

[0360] Entity extraction uses the original novel text as input and completes multi-dimensional entity recognition through a processing flow. For character entity recognition, the system extracts basic information (including name, age, and physical characteristics), personality tags (such as introversion / extroversion, bravery / caution, etc.), and relationship networks (types of relationships with others). Regarding world-building elements, the system extracts the spatiotemporal setting (historical background, geographical environment), rule system (magic system, technological level), and social structure (classes, organizations, power distribution). In addition, the system also extracts key items and their attributes, as well as key event nodes and causal relationships.

[0361] 3.1.2 Style layer analysis.

[0362] Style layer analysis encompasses five core dimensions: sentence structure analysis extracts the ratio of long and short sentences and sentence complexity, implemented using a syntax analyzer; rhetorical device analysis identifies metaphors, allegories, symbols, and other techniques, using large language models for structured extraction; narrative perspective analysis determines first-person, third-person, or omniscient perspectives, employing a combination of rule matching and machine learning classification; emotional tone analysis identifies emotional types such as sadness, joy, tension, and calmness, implemented using a sentiment analysis model; and rhythm control analysis evaluates the pace and pacing of the plot, using time series analysis techniques.

[0363] 3.1.3 Deconstruction of the plot layer.

[0364] The plot deconstruction begins with extracting the storyline. Regarding the main plot, the system identifies the complete timeline of cause, development, climax, and ending, and marks key turning points. For subplots, the system identifies the intersections between each subplot and the main plot, as well as the independent development trajectories of the subplots. Regarding causal chains, the system establishes causal relationships between events (event A leads to event B), and the chain logic of motivation, behavior, and consequences.

[0365] 3.2 Construction of "Semantic Fishing Net".

[0366] The core concept of "semantic fishing net" is to weave extracted elements into an interconnected knowledge network.

[0367] 3.2.1 Knowledge Graph Intermediate Code Structure.

[0368] The knowledge graph uses a JSON-formatted intermediate code structure for storage. Each node contains a unique identifier, type, name, and a set of attributes. Taking a person node as an example, the attribute set includes information such as age, an array of personality tags, and goals. Nodes also contain an array of anchor points, recording the precise location of the element in the original text. Edges define the relationships between nodes, including fields such as starting node, relationship type, target node, evidence location, and relationship strength.

[0369] 3.2.2 Anchor point system design.

[0370] The anchor system includes three types: positional anchors are used to precisely locate the position of an element in the original text, in the format of a hierarchical structure of chapter, paragraph, sentence, and word; semantic anchors are used to mark semantic boundaries and transitions, such as emotional turning points and plot branching points; and citation anchors are used to establish cross-element associations, marking situations where a sentence involves multiple people or events.

[0371] 3.3 Context cache preprocessing.

[0372] The goal of context cache preprocessing is to build an efficient model memory system and avoid redundant computations.

[0373] 3.3.1 KV Cache construction strategy.

[0374] The preprocessing process compresses and encodes structured information to complete the pre-computation of the KV Cache. The cache adopts a hierarchical structure design: Layer 1 stores the world setting, Layer 2 stores character profiles, Layer 3 stores the plot outline, and Layer 4 stores the style guide. This hierarchical design enables independent management and efficient retrieval of information at different granularities.

[0375] 3.3.2 Long context optimization.

[0376] Long context optimization employs three core technologies: Prompt Caching is used to cache invariant system prompts, suitable for stable information such as worldviews and character settings; Sliding Window uses a sliding window attention mechanism to optimize the efficiency of long text processing; and Hierarchical Attention uses a hierarchical attention mechanism to achieve multi-scale context understanding.

[0377] IV. Second Stage: High-Dimensional Latent Space Modeling

[0378] 4.1 Vector Space Construction.

[0379] The core concept of vector space construction is to map text to a high-dimensional mathematical space and achieve semantic operations through geometric transformations.

[0380] 4.1.1 Multi-scale vectorization.

[0381] The vectorization hierarchy presents a pyramid structure: the top layer consists of macro-vectors (global semantics), representing the overall tone, theme, and style; the middle layer includes three dimensions: chapter vectors, character vectors, and plot vectors; the bottom layer consists of micro-vectors (local semantics), representing semantic information at the paragraph, sentence, and word level. Vectors at each level achieve cross-scale semantic associations through aggregation and decomposition operations.

[0382] 4.1.2 Vector-matrix construction.

[0383] The Semantic Cube class encapsulates multi-dimensional vector representations: macro-level semantic vectors represent global semantic features, character vector matrices store high-dimensional representations of all characters, plot vector matrices store plot development trajectories, and style vectors represent text style features. When constructing the cube structure, the system combines the vectors of each dimension into a high-dimensional tensor to achieve a unified representation of the semantic space.

[0384] 4.2 Projection generation mechanism.

[0385] The core concept of the projection generation mechanism is "projection"—the decoding process from latent space to text space.

[0386] 4.2.1 Projection process.

[0387] The projection process maps from the latent space to the text space: a high-dimensional vector (cube) generates a text sequence through a decoder (using an autoregressive or diffusion model). The projection angle is controlled by parameters such as style direction and plot direction, and different angles produce output text with different styles.

[0388] 4.2.2 Closed-loop verification mechanism.

[0389] The generation process employs a closed-loop verification mechanism: the output text is evaluated by a discriminative model, generating feedback signals to adjust parameters, which are then reprojected to generate improved text. This iterative optimization process continues until the output meets the quality standards.

[0390] 4.3 "Rotation" operation: semantic space transformation.

[0391] The "rotate" operation is also a unique feature of this system, transforming style and plot modifications into mathematical calculations.

[0392] 4.3.1 Style Rotation.

[0393] The principle of style rotation lies in the fact that, in semantic space, style can be represented as a specific direction vector. Let the original text vector be V_original, and the style direction vector be V_style (such as "sad", "humorous", "serious"), then the rotation operation is V_new = V_original + α × V_style, where α controls the degree of rotation (style intensity). Examples of applications include: a plain narrative becomes a lighthearted and humorous narrative after being rotated by the humor vector; a heartwarming scene becomes an atmosphere of hidden mystery after being rotated by the suspense vector; and a direct dialogue becomes a sarcastic and ironic dialogue after being rotated by the irony vector.

[0394] 4.3.2 Plot rotation.

[0395] The plot vector space can be viewed as a multi-dimensional coordinate system, with each quadrant representing different ending types: comedic ending, tragic ending, suspenseful ending, and thriller ending. A rotation operation changes the plot's direction while maintaining the core elements. Example: The original plot is a happy ending where the protagonist defeats the villain. After performing a "tragic rotation" (moving the vector in the tragic direction), the new plot changes to the protagonist defeating the villain but paying a heavy price and leaving with regrets.

[0396] 4.3.3 Technical Implementation Path.

[0397] The technical implementation offers three solutions. Solution 1 is the vector offset method: rotation is achieved by obtaining the style direction vector (pre-trained or manually defined) and performing vector addition. Solution 2 is the LoRA fine-tuning method: the original model weights are W, the LoRA adapter is ΔW = B × A (low-rank decomposition), and style switching is achieved by loading different LoRA weights, i.e., W + ΔW_style, which is equivalent to "rotation" in the parameter space. Solution 3 is ControlNet-style control: similar to the ControlNet architecture for image generation, the original generation path is Prompt via LLM to generate Text, and the control path is structural conditions injected into LLM via ControlAdapter to achieve controllable text generation.

[0398] V. Technology Stack and Tool Selection.

[0399] 5.1 Core technology components.

[0400] The core technology components of the system are selected as follows: the structured extraction module uses GPT-4, Claude, or a local LLM for entity recognition and relation extraction; the knowledge graph module uses Neo4j or NetworkX for graph storage and querying; the vector database uses Milvus, Pinecone, or Chroma for vector storage and retrieval; the embedding module uses text-embedding-3 or BGE for text vectorization; the generative model uses LLaMA, Qwen, or GLM for text generation; and the fine-tuning framework uses LoRA or QLoRA for efficient fine-tuning.

[0401] 5.2 System Architecture.

[0402] The system architecture is divided into four layers: the user interaction layer provides entry points for functions such as text input, modification commands, style selection, and result preview; the business logic layer encapsulates the literature cube engine, including three core components: the structured module, the vectorized module, and the projection module; the data storage layer deploys a graph database, a vector database, a KV cache, and raw text storage; and the model service layer provides LLM API, Embedding services, discriminative models, and LoRA weight management.

[0403] Those skilled in the art should understand that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. An integrated e-book creation and reading system based on the principle that code is the book, characterized in that: include: A. A code storage module that can store ebook content in digital engineering format on a remote server or locally. The digital engineering includes, but is not limited to, files of the type such as structure files, style files, logic files, or multimedia resource files. B. Intermediate code building module: Before secondary creation and editing, or as part of the system's preparation work, the system will perform semantic parsing and construction, perform full-dimensional feature scanning of the e-book, extract core elements (including but not limited to characters, plot, or worldview) or knowledge graphs, build structured intermediate code with anchor mechanism or topological network, or generate pre-computed cache, or pre-build context representation, or embed and encode the node attributes and text fragments of the knowledge graph, or generate hierarchical semantic tensors; C. Feature semantic space modeling module, based on the above structured intermediate code (or pre-computed cache, or context representation, or the above embedding encoding, or hierarchical semantic tensor, collectively referred to as intermediate code in this paper), generates one or more high-dimensional semantic space models representing the overall attributes of the text (including but not limited to constructing high-dimensional feature data structures, or macro-feature vectors, or micro-feature vectors representing fine-grained content). D. Interaction module, which provides a reading interface and operation entry point for e-books (including but not limited to visual editing command tools, voice command tools, or plot intervention interfaces), and receives editing commands or plot intervention signals submitted by users; E. Reconstruction module, configured to call computing resources or large language model, and depending on the instructions, perform algebraic calculations or geometric transformations of the semantic space based on the above high-dimensional semantic space model, or directly perform collaborative reconstruction on intermediate code (or pre-computed cache, or context representation, or the above-mentioned embedded encoding, or hierarchical semantic tensor) to generate updated digital engineering.

2. The system according to claim 1, characterized in that, The specific process of constructing structured intermediate code through semantic parsing is as follows: Unstructured linear text is first transformed into a knowledge graph (including but not limited to attribute graph structure or JSON format). Nodes in the graph represent extracted semantic elements, and edges represent semantic relationships between elements. An anchor index pointing to the original text location is established for each node, forming an anchor mechanism for location and tracing; A semantic topology network is constructed by connecting the nodes in the graph to represent the global logical structure of the text. The extracted information is transformed into a pre-computed cache or context state representation.

3. The system according to any one of the preceding claims, characterized in that, The system has a feature semantic modeling module, and the modeling module constructs a high-dimensional feature data structure in the following way: Construct a semantic high-dimensional structure, which is a high-dimensional tensor composed of multi-scale vectors; Among them, macro-feature vectors include, but are not limited to, worldview vectors, theme vectors, style vectors, or sentiment tone vectors (one or more), which are used to characterize the overall semantic orientation of the text; Micro-feature vectors include, but are not limited to, paragraph vectors, sentence vectors, or character state vectors (one or more), used to represent local semantic details; The macroscopic feature vectors and microscopic feature vectors are correlated in the semantic space through specific operations, including but not limited to matrix operations.

4. The system according to any of the preceding claims, characterized in that, The specific process of the reconstruction module performing semantic space operations is as follows: Analyze the instructions issued by the interactive intervention module to determine the target semantic direction vector; In a high-dimensional feature data structure, replacement, numerical transformation, or geometric transformation operations are performed on the original semantic vector. The geometric transformation operations include, but are not limited to, translation along the semantic direction, rotation around the semantic axis, or scaling of the feature dimension. The transformed high-dimensional feature vector is then projected back into the text space or image space, and decoded to generate text content, structural code, intermediate code, or style code that conforms to the modification intent.

5. A method for integrating e-book creation and reading based on the principle that code is a book, characterized in that: Applied to any of the systems described above, the method includes the following steps: Step S1: Obtain the original e-book text or pictures, and use a semantic analysis model to perform multi-dimensional scanning on the original text or pictures to extract various elements in the text, including but not limited to worldview elements, character settings, plot structure and paragraph writing features. Step S2: Construct an intermediate code structure based on the extracted elements. The intermediate code structure includes anchor points that associate each element with its original position, as well as connection structures or topological network structures that describe the logical relationships between elements. At the same time, the elements are transformed into cached content that can be called by the large language model, including but not limited to KV Cache, computation cache, or pre-computed context state representation. Step S3: Based on the structured intermediate code, generate macro-feature vectors and micro-feature vectors through a feature mapping model, or further combine the macro-feature vectors and micro-feature vectors to construct a high-dimensional feature data structure, which forms a three-dimensional semantic mapping of the text in the latent space. Step S4: Receive text modification instructions and determine the semantic transformation method corresponding to the modification instructions in the latent space, including but not limited to replacement, numerical transformation or geometric transformation operations. For example, according to the semantic transformation direction, perform algebraic transformation operations or geometric transformation operations (vector rotation or translation) on the high-dimensional feature structure. Step S5: Project the transformed high-dimensional feature matrix back into the text or image space, and generate the modified target novel or comic through a decoding model or language generation algorithm.

6. The system according to any of the preceding claims, comprising an interaction terminal and a processing terminal, characterized in that: The interactive terminal includes: The code storage module is configured to store digital content in a digital engineering format, wherein the digital engineering includes, but is not limited to, one or more of the following: a structured description file for describing content and structure, a style definition file for defining presentation style, a logic script file for defining interaction logic, and associated multimodal resource files; The interaction module is configured to provide a presentation view and an optional description view (if any), and to capture user actions on the interaction layer or convert user actions into editing requests containing element positioning or features according to a preset mapping protocol. The presentation view is used to present digital content and its rendering effects, and to overlay the interaction layer. The description view (if any) is used to display and edit the underlying structured code. The processing terminal includes: The intermediate code building module is configured to parse structured code, extract text information for semantic analysis, and generate an intermediate semantic graph containing structured identifiers, metadata features, or semantic relationships. The feature semantic space modeling module is configured to construct a high-dimensional semantic feature space based on the intermediate semantic graph, and map the multimodal editing request to a topological transformation in the high-dimensional semantic feature space. By performing replacement or transformation operations on the semantic feature vector, the target semantic feature vector is generated. The refactoring module is configured to utilize computational inference resources, such as generative artificial intelligence models, to refactor the text content, style definitions, logic scripts, or multimodal resource references in a consistent manner based on the target semantic feature vector, generate new code that conforms to digital engineering specifications, and return it to the terminal interaction end.

7. The system according to any of the preceding claims, characterized in that, The high-dimensional feature data structure also includes a semantic embedding tensor, which is constructed as follows: Utilize pre-trained language models (such as BERT and GPT) to extract contextual embeddings of text; Pooling is performed on chapter-level text to generate document semantic vectors; Fine-grained encoding of character dialogues and scene descriptions is performed to generate entity semantic vectors; The document semantic vector and the entity semantic vector are concatenated to construct a hierarchical semantic tensor (with shape [N, M, D], where N is the number of chapters, M is the number of entities per chapter, and D is the embedding dimension). The association between macroscopic and microscopic semantics can be achieved through tensor decomposition (such as Tucker decomposition) or graph neural network propagation.

8. The system or method according to any of the preceding claims, characterized in that, include: S1: Digital Engineering Storage: Parses the content of an e-book or its variants into separately stored structural description files, style definition files, narrative logic files, and multimedia resource reference files; The e-books include, but are not limited to, text, comics, and electronic serials; Variations of the ebook include, but are not limited to: A story-driven video game is characterized by defining interactive controls with selectable paths through a logic script file on the basis of a comic, e-book, or its derivative video, thereby constructing an online story game with branching plots. The feature of serialized cartoon videos based on e-books or comics is that, based on e-book or comic materials, a logic script file controls the timing playback logic of multimodal resource files to convert static or interactive content into a continuous video stream. S2: Structured processing: Perform natural language processing on the structure description file to extract named entities and event relationships, and construct a knowledge graph with attribute graph structure; establish an inverted index pointing to the original text coordinates for the graph nodes; calculate the semantic distance matrix between nodes based on graph connectivity; S3: Semantic feature encoding: Using a pre-trained language model, the node attributes and text fragments of the knowledge graph are embedded and encoded to generate a hierarchical semantic tensor; S4: Interactive Reconstruction Request Reception: Receive editing instructions submitted by the user through a visual interface or voice input, and parse them into structured operation instructions for the knowledge graph or semantic tensor; S5: Collaborative Content Reconstruction: Call the large language model or other inference engine, and perform subgraph replacement or path rerouting on the knowledge graph based on the structured operation instructions, synchronously update the associated narrative logic file and style definition file, and generate reconstructed digital engineering code.

9. The system according to claim 8, characterized in that, The e-book is in the form of an interactive story game. The code includes the definition of story branch nodes, user interaction trigger conditions, and branch jump logic. In the interactive story game mode, the refactoring module is also used to execute dynamic content generation logic. When a user's interaction exceeds the scope of the preset logic control code, the system triggers semantic space operations; When a user triggers an interactive control, the system calculates the subsequent plot direction based on the preset branch logic or the semantic path generated in real time, generates new scene code and resource index, and loads the new game scene in real time through the hot reload rendering module to realize the dynamic evolution of non-linear narrative. Based on the current game state vector and high-dimensional feature data structure, the reconstruction module deduces and generates subsequent plot code in real time that conforms to the world view setting and character logic, dynamically expands the game content, and realizes a semi-open world narrative experience.

10. The system according to any of the preceding claims, characterized in that, The system outputs the following multiple formats based on the same digital engineering source file; The structured intermediate code serves as the core data layer, decoupled from the presentation layer. The high-dimensional feature data structure serves as the new content ontology; The hot reload rendering module is configured with multiple rendering backends, including but not limited to e-book reader backends, game engine backends, and video player backends. The system can render the same structured intermediate code and high-dimensional feature data structure into static text and image publications, interactive story games, or streaming videos by switching or combining different rendering backends.