A method, device and storage medium for text processing

By performing multi-dimensional risk scoring and bitmap matching on text fragments in big data scenarios, the problems of low efficiency and insufficient accuracy in existing technologies are solved, achieving efficient and low false positive rate text security filtering.

CN121580041BActive Publication Date: 2026-05-19E-SURFING DIGITAL LIFE TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
E-SURFING DIGITAL LIFE TECH CO LTD
Filing Date
2026-01-26
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

Existing technologies are inefficient and inaccurate in text security filtering in big data scenarios, cannot adapt to diverse characteristics, and cannot quickly respond to new risks.

Method used

By determining the dimensional scores of text fragments in various risk dimensions, a bitmap is generated to perform multi-dimensional risk assessment. The bitmap is then matched with a preset template, and the risk dimension weights are dynamically updated using the gradient descent algorithm.

Benefits of technology

It improves text processing efficiency, reduces false positive and false negative rates, adapts to new risks in big data scenarios, and meets real-time requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121580041B_ABST
    Figure CN121580041B_ABST
Patent Text Reader

Abstract

The application relates to a text processing method, device and storage medium. The method comprises the following steps: determining a dimension score of each text segment in each risk dimension in a text, determining the safety degree of each text segment according to each dimension score; determining the bitmap of each text segment according to the safety degree of each text segment, each dimension score and a risk threshold; matching the bitmap of each text segment with at least one preset risk template, determining a risk text segment according to a matching result; and processing the text according to the risk text segment. The method greatly improves the processing efficiency, realizes double judgment, reduces the misjudgment rate and the missed judgment rate, avoids the false interception caused by a single sensitive word, and can quickly respond to new risks in a big data scene and has high adaptability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application mainly relates to the field of big data, and in particular to a method, device and storage medium for text processing. Background Technology

[0002] In big data scenarios, large models need to process massive amounts of input and output text, and the secure filtering of these input and output texts has become a key link in ensuring the health of the information ecosystem and avoiding compliance risks.

[0003] Current large-scale model input / output security filtering technologies still rely on simple word segmentation and rule matching. They employ dictionary-based forward maximum matching or backward maximum matching methods for word segmentation of input and output text in large data streams, breaking the text down into individual words or phrases. A static risk lexicon (e.g., sensitive words) is established to store known risk words and a small number of variations. In large-scale scenarios, the word segmentation results of each text need to be compared word-by-word with the lexicon, using exact or fuzzy string matching to determine if sensitive words are present. During filtering, if a matching sensitive word is found, the text is directly blocked or filtered; if no sensitive word is found, it is considered safe and allowed to pass. Some solutions count the frequency of sensitive words and block text when the count exceeds a threshold. However, they do not consider the correlation of risk dimensions or the overall risk level. Furthermore, text segmentation of massive amounts of text often results in low segmentation efficiency and semantic fragmentation. Summary of the Invention

[0004] One objective of this application is to provide a text processing method, apparatus, and storage medium that addresses the dual shortcomings in efficiency and accuracy of secure text filtering in the prior art.

[0005] According to one aspect of this application, a text processing method is provided, the method comprising:

[0006] Determine the dimensional score of each text segment in the text across various risk dimensions, and determine the safety level of each text segment based on the dimensional score;

[0007] The bitmap of each text segment is determined based on the security level of each text segment, the score of each dimension, and the risk threshold;

[0008] The bitmap of each text fragment is matched with at least one preset risk template, and the risk text fragment is determined based on the matching result;

[0009] The text is processed according to the risky text fragment.

[0010] Optionally, determining the safety level of each text fragment based on the score for each dimension includes:

[0011] The overall score for each text segment is determined based on the score for each dimension and the corresponding risk dimension weight;

[0012] The security level of each text segment is determined based on the overall score of each text segment.

[0013] Optionally, determining the bitmap of each text segment based on the security level of each text segment, the score of each dimension, and the risk threshold includes:

[0014] The security level of each text fragment is converted into binary and stored in the highest four bits of the bitmap;

[0015] Associating each bit in the first N bits of the bitmap with each dimension score, where N is the number of risk dimensions;

[0016] Set the bit associated with the risk dimension whose dimension score is greater than or equal to the risk threshold to 1, and set the bit associated with the risk dimension whose dimension score is less than the risk threshold to 0.

[0017] The highest four bits and the first N bits of the bitmap are combined to generate a bitmap encoding.

[0018] Optionally, the method includes:

[0019] Obtain the preset number of bits in the bitmap;

[0020] An extended dimension bit is allocated between the highest four bits of the bitmap and the first N bits;

[0021] Compare the score of each extended dimension with the risk threshold, and store the comparison result in the corresponding extended dimension bit.

[0022] The highest four bits of the bitmap, the first N bits, and the extended dimension bits are combined to generate a bitmap.

[0023] Optionally, the step of matching the bitmap of each text fragment with at least one preset risk template, and determining the risk text fragment based on the matching result, includes:

[0024] The bitmap of each text fragment is matched bit-by-bit with at least one preset risk template;

[0025] For each text segment, if any bit matches successfully, the corresponding text segment is determined to be a risky text segment.

[0026] Optionally, processing the text according to the risky text fragment includes:

[0027] The proportion of risky text fragments is determined based on the risky text fragments and the total number of text fragments.

[0028] The text is processed based on the proportion of risky segments and the interception threshold.

[0029] Optionally, the method further includes:

[0030] Based on historical text, the gradient descent algorithm is used to train the weights of each risk dimension.

[0031] The weights of each risk dimension are updated based on the results of text processing.

[0032] Optionally, the method includes:

[0033] After encoding the text, it is split into multiple text segments according to a preset character length.

[0034] According to another aspect of this application, an electronic device is also provided, the device comprising:

[0035] One or more processors; and a memory storing computer-readable instructions that, when executed, cause the processors to perform operations as described above.

[0036] According to another aspect of this application, a computer-readable storage medium is also provided, having stored thereon computer-readable instructions that can be executed by a processor to implement the method described above.

[0037] Compared with existing technologies, this application determines the security level of each text segment by assigning a dimensional score to each text segment across various risk dimensions; determines the bitmap of each text segment based on the dimensional score; matches the bitmap of each text segment with at least one preset risk template; identifies risky text segments based on the matching results; and processes the text based on the risky text segments. This significantly improves processing efficiency, enables dual-judgment, reduces false positive and false negative rates, avoids false blocking due to a single sensitive word, and allows for rapid response to new risks in big data scenarios, demonstrating high adaptability. Attached Figure Description

[0038] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the specific embodiments of this application will be described in detail below with reference to the accompanying drawings, wherein:

[0039] Figure 1 This diagram illustrates a flowchart of a prior art method for secure filtering of large model input and output text.

[0040] Figure 2 This diagram illustrates a text processing method according to one aspect of this application;

[0041] Figure 3 This illustration shows a bitmap construction process based on security level in one embodiment of this application;

[0042] Figure 4 This diagram illustrates a structural schematic of an electronic device according to another aspect of this application.

[0043] The same or similar reference numerals in the accompanying drawings represent the same or similar parts. Detailed Implementation

[0044] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the specific embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0045] Many specific details are set forth in the following description in order to provide a full understanding of this application. However, this application may also be implemented in other ways different from those described herein, and therefore this application is not limited to the specific embodiments disclosed below.

[0046] As indicated in this application and claims, unless the context clearly indicates otherwise, the words "a," "an," "an," and / or "the" are not specifically singular and may include plural forms. Generally speaking, the terms "comprising" and "including" only indicate the inclusion of explicitly identified steps and elements, which do not constitute an exclusive list, and the method or apparatus may also include other steps or elements.

[0047] Before providing a detailed description of the embodiments of this application, some of the nouns and terms involved in the embodiments of this application will be explained first. The nouns and terms involved in the embodiments of this application are subject to the following interpretations.

[0048] (1) Big Data Scenario: refers to application scenarios where the input and output text data of large models have the "4V" characteristics (Volume, Velocity, Variety, Value). Specifically, it is a scenario where the amount of text processed in a single batch exceeds 100,000, the text types cover various forms such as dialogue, document generation, and command interaction, and the single text needs to be filtered securely within 100ms, such as large model API service clusters and intelligent dialogue systems with multiple users interacting at the same time.

[0049] (2) Large Language Model (LLM): A model with a parameter scale of over 10 billion, trained on massive text data, capable of performing complex tasks such as natural language understanding, generation, and logical reasoning. Its input and output texts need to be filtered for security to avoid risks.

[0050] (3) BitMap (Bitmap): An efficient and compact binary data structure.

[0051] (4) Text Segment: The smallest analysis unit obtained by splitting the massive input and output texts in the big data scenario according to semantic logic (such as clause splitting, phrase splitting) or fixed character length (1 - 8 characters, balancing precision and efficiency).

[0052] Such as Figure 1 As shown in the existing security filtering scheme based on simple word segmentation and rule matching, the problems existing in the current security filtering scheme are as follows:

[0053] 1) The processing efficiency in the big data scenario is extremely low; traditional rule matching needs to compare each word segmentation result of the massive text with the sensitive word library line by line. When the scale of the sensitive word library reaches 100,000 levels and the text volume reaches 100,000 pieces, the single - batch processing time exceeds 1 hour, which cannot meet the real - time requirement of "processing a single piece within 100 ms and completing a batch within minutes" in the big data scenario, and is likely to cause text backlog and service delay.

[0054] 2) The risk assessment accuracy is insufficient, and false positives and false negatives are likely to occur; the traditional method only relies on the existence judgment of sensitive words and does not consider the comprehensive influence of risk dimensions (for example, the risk levels of "violence" in "describing historical violent events" and "inciting the implementation of violence" are different, but the traditional method judges them as sensitive words), resulting in a false positive rate exceeding 20%; in addition, in the big data scenario, text variants (such as homophonic "bao 力", pinyin "baoli", special symbol "暴|力") emerge in an endless stream, and the static rule library cannot cover all variants, with a false negative rate exceeding 15%.

[0055] 3) It cannot adapt to the diversity characteristics of big data. The sensitive word library and rules of traditional methods are statically configured. When the text type in the big data scenario expands from "dialogue" to "document generation" and "code explanation" (such as when the user inputs "generate code to obtain others' mobile phone numbers"), the existing rules cannot identify the "risk of code - type privacy leakage", and adding new rules requires manual update of the word library, with a cycle of up to 1 - 2 weeks, and cannot quickly respond to new risks.

[0056] In view of the above problems, this application proposes a text processing method, which can achieve millimeter - level processing and secure filtering with low false positives and low false negatives in a massive, high - speed, and diverse big data environment.

[0057] 4] Such as Figure 2 As shown, in step S11, determine the dimension scores of each text segment in the text for each risk dimension, and determine the security level of each text segment according to each dimension score.

[0058] The text can be either input or output text for a large model. Each text data point is split into multiple text segments, which serve as the basic unit for security assessment and bitmap mapping, supporting parallel batch processing. Each text segment is scored according to multiple preset risk dimensions, resulting in a dimension score for each risk dimension. Based on these scores, the security status of each text segment can be determined, thus obtaining the security level of each text segment.

[0059] Security Degree is a core indicator for quantitatively assessing the security risks of input text (Prompt) or output text (Response) of large models in big data scenarios. The value of the security degree can range from 0 to 10, where 0 indicates no security risk (such as regular compliant dialogue) and 10 indicates extremely high security risk (such as containing prohibited content such as illegal, violent, or pornographic content). The security degree is calculated by comprehensively assessing the text's performance across multiple risk dimensions.

[0060] In one embodiment of this application, when processing text, the text can be encoded and then split according to a preset character length to obtain multiple text fragments.

[0061] Perform big data preprocessing and text segmentation. Parallel preprocessing is performed on the massive text streams input or output to the model. This preprocessing includes removing special symbols and unifying encoding. Text segments are split according to semantic logic and fixed character length (e.g., 1-8 characters) to achieve fine-grained and parallel text analysis.

[0062] For example, in the scenario of "large model API service cluster" (processing 100,000 user input texts in a single batch, the text type is dialogue instructions, and filtering needs to be completed within 5 minutes), the text fragments are first split. The trigger condition is that the text access gateway receives the user input text stream (1,000 texts per second, a total of 100,000 texts), triggering the preprocessing process.

[0063] Execution entity: Distributed preprocessing nodes, such as 10 nodes, which process in parallel based on the Spark framework.

[0064] Processing steps: Encode each text message uniformly (convert UTF-8 / GBK encoding to UTF-8), filter special symbols (remove semantically meaningless symbols such as "@" and "#"); split the text into segments based on "semantic logic + 8-character length" (e.g., split the text "How to get someone else's phone number" into three segments: "How to get", "someone else's phone number", and "phone number"); assign a unique ID to each text segment to associate it with the original text, and store the segments by node partitioning, with each node capable of processing 10,000 text segments.

[0065] Results and effects: Output 150,000 text fragments, with each text fragment being split into 1.5 fragments on average, achieving fine-grained text splitting and parallel storage, providing efficient input for subsequent BitMap construction, with single-node splitting time ≤30ms.

[0066] In one embodiment of this application, a comprehensive score for each text segment is determined based on the risk dimension score and the corresponding risk dimension weight; the security level of each text segment is determined based on the comprehensive score of each text segment.

[0067] The weight of each risk dimension is obtained, which can be obtained by training with historical big data, including labeled safe text and risk text; for example, the risk dimension weight of illegal information is 0.3, and the weight of privacy leakage is 0.2; thus, a multi-dimensional risk score is calculated based on the text fragments, and the comprehensive security level of each text fragment is obtained.

[0068] In one specific embodiment of this application, the triggering condition is that after the distributed preprocessing node completes the text fragment splitting, it sends a fragment processing request to the BitMap construction engine, triggering the security level calculation.

[0069] The execution entity is the BitMap construction engine, which has a built-in security level model. The model weights are trained based on 1 million labeled historical data, resulting in dimensions such as "privacy leakage" with a weight of 0.25, "illegal information" with a weight of 0.3, and "violent content" with a weight of 0.2.

[0070] Processing Action: Calculate multi-dimensional risk scores for each text fragment. For example, the fragment "obtaining another person's phone number" scores 0.8 in the "privacy leakage" dimension, 0.6 in the "illegal information" dimension, and 0 in other dimensions. Calculate the comprehensive score using the formula "Comprehensive Score = Σ (Dimension Score × Dimension Weight)". For example, 0.8 × 0.25 + 0.6 × 0.3 + 0 × Other = 0.2 + 0.18 = 0.38, resulting in a comprehensive score of 0.38. Quantize the comprehensive score into integers according to the rule of "0.1 corresponds to 1 point", resulting in a corresponding security level of 4.

[0071] Results and effects: Output the "multi-dimensional score + comprehensive security level" of each text fragment. For example, the text fragment above scores 0.8 in the "privacy leakage" dimension, 0.6 in the "illegal information" dimension, and has a comprehensive security level of 4. It provides a quantitative basis for BitMap mapping, and the calculation time for a single fragment is ≤10ms.

[0072] Step S12: Determine the bitmap of each text segment based on the security level of each text segment, the score of each dimension, and the risk threshold.

[0073] The security level-based bitmap construction maps the security level of each text fragment to a bitmap of a preset number of bits, such as a 32-bit bitmap. Bits are allocated according to preset rules, and the values ​​of the corresponding bits are set according to the comparison results of the risk score (i.e., dimension score) of the text fragment in each security risk dimension with the risk threshold. The security level is then encoded and mapped to the corresponding bit of the bitmap, thereby achieving a dual mapping between security risk dimensions and security levels.

[0074] The Security Risk Dimension represents the risk categories that the input and output text of the large model may involve in a big data scenario, including but not limited to illegal information, violent content, pornographic content, false information, and privacy leakage risks. Each dimension corresponds to one independent bit in a BitMap. For example, a total of 32 core dimensions can be set to adapt to a 32-bit BitMap, balancing risk coverage and storage efficiency.

[0075] In one embodiment of this application, the security level of each text fragment is converted into binary and stored in the highest four bits of a bitmap; each bit in the first N bits of the bitmap is associated with each dimension score, where N is the number of risk dimensions; the bits associated with risk dimensions whose dimension scores are greater than or equal to the risk threshold are set to 1, and the bits associated with risk dimensions whose dimension scores are less than the risk threshold are set to 0; the highest four bits and the first N bits of the bitmap are combined to generate a bitmap encoding.

[0076] When allocating bits according to a preset rule, the preset rule can be to allocate the security level to the highest 4 bits of the bitmap, and to allocate one bit to each risk dimension in sequence. For example, the first bit corresponds to "illegal information", the second bit corresponds to "violent content", and the third bit corresponds to "privacy leakage". If the score of a text fragment in a certain dimension is greater than or equal to the risk threshold (such as 0.5), the corresponding bit is set to "1"; otherwise, it is set to "0". At the same time, the security level (0~10) of the text fragment is encoded into the highest 4 bits of the Bitmap, such as the security level "8" is encoded as 1000.

[0077] By mapping the security level characteristics of text using bitmaps, each bit corresponds to one security risk dimension (such as illegal information, violent content, etc.). A bit value of "1" indicates that the text has a risk in that dimension, and a bit value of "0" indicates no risk. By combining multiple bits, the overall security status of the text can be quickly characterized, which is suitable for the high-speed processing needs of big data scenarios.

[0078] By mapping risk dimensions to bits one by one and embedding security level codes, a compact representation of text security features is achieved; BitMap storage efficiency is 90% higher than traditional text rules, and the time complexity of bit operation matching is reduced to O(1), solving the problems of high storage consumption and low matching efficiency in big data scenarios.

[0079] In one embodiment of this application, a preset number of bits of the bitmap can also be obtained; extended dimension bits can be allocated between the highest four bits of the bitmap and the first N bits; the score of each extended dimension and the risk threshold can be compared, and the comparison result can be stored in the corresponding extended dimension bit; the highest four bits of the bitmap, the first N bits and the extended dimension bits can be combined to generate a bitmap.

[0080] Obtain the preset total bitmap bit length (e.g., 32 bits), and allocate extended dimension bits (e.g., bits N+1 to 28) between the core dimension bits (first N bits) and the security level bits (highest 4 bits). These extended dimensions are additional bits used for more dimensions and are stored in the middle position. For each extended dimension, if the dimension score is greater than or equal to the risk threshold, the corresponding extended bit is set to 1; otherwise, it is set to 0. The core dimension bits and the highest four bits are set as described above, and then the highest four bits + first N bits (core dimension) + extended dimensions are combined to output the final bitmap.

[0081] like Figure 3 As shown, a 32-bit BitMap is pre-defined with bit mapping rules. The lower 28 bits store information for various dimensions, and the highest 4 bits store the comprehensive security level code. For a score (0-1) of a certain dimension, if the score is ≥0.5 (risk threshold), the corresponding bit is set to 1, otherwise it is set to 0. For the comprehensive security level, the security level is converted into binary and stored in the highest 4 bits of the BitMap. This generates a BitMap of the text fragment.

[0082] Specifically, after the BitMap construction engine obtains the security level of a text fragment, it automatically triggers the BitMap mapping process. Processing actions: A preset 32-bit BitMap bit mapping rule is used, such as bit 1 = illegal information, bit 2 = violent content, bit 3 = privacy leak, bits 4-28 correspond to other risk dimensions, and the highest 4 bits = comprehensive security level code, such as security level 4 being encoded as 0100; if the score of a certain dimension of the text fragment is ≥0.5 (risk threshold), the corresponding bit is set to "1", otherwise it is set to "0". For example, in the fragment "obtaining other people's mobile phone numbers", the "privacy leakage" score is 0.8 ≥ 0.5, so the 3rd bit is set to 1; the "illegal information" score is 0.6 ≥ 0.5, so the 1st bit is set to 1; the scores of other dimensions (extended dimensions) are < 0.5, so the corresponding bits are set to 0; the highest 4 bits are 0100; then after combining them, the BitMap of the generated text fragment is "0100 0000 0000 0000 0000 0000 0000 0101". In this binary representation, the highest 4 bits 0100 correspond to a security level of 4, and the 1st and 3rd bits are 1.

[0083] Results and effects: Generates BitMaps corresponding to 150,000 text fragments. Each BitMap occupies only 4 bytes (32 bits), improving storage efficiency by 90% compared to traditional text rules. The construction time for a single fragment BitMap is ≤5ms.

[0084] Step S13: Match the bitmap of each text fragment with at least one preset risk template, and determine the risk text fragment based on the matching result.

[0085] Parallel Bitmap Matching and Filtering Decisions in Big Data Scenarios. A distributed Bitmap matching engine is built to perform parallel comparisons of Bitmaps from massive amounts of text fragments. High-risk Bitmap templates are pre-defined, and these templates can be set according to risk dimensions and security levels. For example, templates can include security-level templates, illegal templates, violent templates, or any combination of several risk dimensions. For instance, a pre-defined illegal template would have the first bit set to 1 and the next four bits ≥ 1000, corresponding to "illegal + high security risk". The constructed text fragment's Bitmap is matched against at least one template. If a text fragment's Bitmap matches a template successfully, it is marked as high-risk, resulting in a high-risk text fragment.

[0086] In one embodiment of this application, the bitmap of each text segment is matched bit-by-bit with at least one preset risk template; for each text segment, when any bit is successfully matched, the corresponding text segment is determined to be a risky text segment.

[0087] By comparing the bitmap bit by bit with the preset template, such as using binary AND operation, when any bit matches successfully (i.e., the bit value = 1 and the corresponding bit in the template = 1), the risk is determined; no full-dimensional matching is required, which improves the recall rate of high-risk segments; by using bitmap bit operations, the time complexity is reduced, thus greatly reducing the time consumption of single segment detection and meeting the needs of high-concurrency scenarios.

[0088] Step S14: Process the text according to the risk text fragment.

[0089] Risky text fragments or their matching with bitmaps can be categorized and processed accordingly. For example, high-risk fragments (matching core risk dimensions, such as privacy leaks) can be immediately intercepted and reported, while medium-risk fragments (matching extended dimensions of non-core risk dimensions) can be subject to secondary review. Low-risk fragments can be logged or automatically optimized.

[0090] The text can also be processed based on the total number of risky fragments and text fragments. Specifically, the proportion of risky fragments can be determined based on the risky text fragments and the total number of text fragments; the text can then be processed based on the proportion of risky fragments and the interception threshold.

[0091] If the percentage of high-risk segments in a text exceeds the interception threshold (e.g., 30%), the text is blocked; otherwise, it is allowed or subjected to a second, more detailed verification.

[0092] In big data scenarios, BitMap parallel matching and filtering decisions are triggered by the following conditions: After the BitMap building engine stores all BitMaps in shared memory, it sends a matching request to the BitMap matching cluster, thus triggering parallel matching.

[0093] Execution entity: BitMap matching cluster, such as 5 nodes, based on Redis storage of 2 types of high-risk BitMap templates, such as template 1 "high 4 bits ≥ 1000 (security level ≥ 8)" and template 2 "first bit = 1 and third bit = 1 (illegal + privacy leakage)".

[0094] Processing steps: Each matching node reads 20,000 BitMaps from shared memory and performs bitwise operations with the template, such as AND operations. If the result of an AND operation between the fragment BitMap and template 2 is non-zero, the match is successful. The percentage of high-risk fragments in each original text is calculated. For example, if a text contains 3 fragments and 2 fragments match template 2 successfully, the percentage is 66.7%. The matching result, consisting of the text ID and the percentage of high-risk fragments, is then transmitted to the filtering decision node.

[0095] Results and effects: Parallel matching of 5 nodes takes ≤200ms and outputs matching results for 100,000 texts. Among them, 800 texts have a high risk segment ratio of ≥30% (interception threshold) and are judged as high risk; 99,200 texts have a ratio of <30% and are judged as safe.

[0096] In one embodiment of this application, the weights of each risk dimension are trained using a gradient descent algorithm based on historical text; and the weights of each risk dimension are updated according to the results of text processing.

[0097] Based on historical data (including labeled safe and risky text), the gradient descent algorithm can be used to train the weights for each security risk dimension. The text (converted to a spatial vector) is used as input, and the labels (also converted to spatial vectors) are used as output. Through iterative training, a model can be obtained. Once trained, the model can output a vector based on the input text, containing the weights and scores for different dimensions. For example, "illegal information" might have a weight of 0.3, and "privacy leakage" a weight of 0.2. Multiple risk dimensions can be set according to specific business scenarios.

[0098] The weights of each risk dimension are trained based on historically labeled big data, and the text risk is quantified by “comprehensive score = Σ (dimensional score × weight)”, rather than judging a single sensitive word; the weights are trained using TensorFlow, combined with semantic understanding (such as distinguishing the score difference between “describing violence” and “inciting violence”); to avoid false blocking caused by a single sensitive word, such as “description of historical violent events” having low security and not triggering high-risk templates, thus improving the filtering accuracy.

[0099] After performing parallel bitmap matching and filtering decisions, based on the filtering feedback data in big data scenarios (such as misjudged text and new risk text), the bit mapping rules of BitMap and the weights of each risk dimension are updated regularly to achieve dynamic optimization of risk identification capabilities.

[0100] For example, 800 high-risk texts are blocked, and the user is returned with "The input content has security risks, please adjust it"; 99,200 safe texts are allowed to pass and transmitted to the large model; feedback from manual review is collected (e.g., 10 blocked texts are actually safe texts and are judged as false positives), and the weights of the risk dimensions are updated based on the feedback data (e.g., the weight of the "privacy leakage" dimension is reduced to 0.2) and the Bitmap template (e.g., the trigger threshold of template 2 is adjusted to "high-risk fragments account for ≥40%").

[0101] Results and effects: It completes security filtering in big data scenarios, with a total time of ≤3 minutes per batch, a false positive rate of 4.5%, a false negative rate of 7.2%, and achieves dynamic optimization of BitMap and model.

[0102] By optimizing model weights using the gradient descent algorithm and adjusting the BitMap template, the update cycle for new risk dimensions (such as code privacy leaks) has been shortened from 1 to 2 weeks to 1 day. The false positive rate has been reduced to below 5% and the false negative rate to below 8%, solving the problem that existing technologies cannot adapt to the diversity of big data and lack accuracy.

[0103] The core reason for the low efficiency of existing technologies is the linear comparison logic: the word-by-word matching between the segmentation results and the sensitive word library is essentially O(n) time-consuming. The time complexity is O(m) (where n is the number of word segments and m is the size of the sensitive word database). In big data scenarios, the increase of n and m directly leads to an exponential increase in time complexity. In this application, BitMap uses binary storage and bitwise operations (such as AND / OR) for matching, reducing the time complexity to O(1). The processing time for a single text is ≤50ms, and the processing time for a single batch of 100,000 texts is ≤5 minutes, which meets the real-time requirements of big data.

[0104] The core reason for the insufficient accuracy of existing technologies is the single-dimensional judgment: it only uses "whether it contains sensitive words" as the standard, without quantifying the degree of risk, without associating multiple risk dimensions, and the static rules cannot cover the dynamic variations in big data. In contrast, this application achieves a dual judgment of "risk dimension + risk degree" through multi-dimensional weighting and comprehensive security quantification, reducing the false positive rate to below 5% and the false negative rate to below 8%, avoiding false blocking caused by a single sensitive word (such as text fragments "describing historical violent events" having low security, and the corresponding BitMap bit position not triggering a high-risk template).

[0105] The poor adaptability of existing technologies stems from the lag in rule updates; manually maintained thesaurus cannot keep up with the rapid emergence of new risks in big data scenarios. This application, however, dynamically updates the BitMap mapping rules and security level model. When a new risk dimension (such as "code privacy leakage") is added, only the bit allocation needs to be adjusted (e.g., setting the 33rd bit as a new dimension to adapt to a 64-bit BitMap), shortening the update cycle to one day and enabling rapid response to new risks in big data scenarios.

[0106] This application efficiently optimizes the security filtering of large model inputs and outputs in big data scenarios, and can be applied to scenarios such as indicator question answering, intelligent data querying, intelligent data usage recommendation, and intelligent data reporting, meeting the big data intelligent analysis needs of fields such as home networks, smart communities, digital villages, and cloud storage.

[0107] Figure 4 The diagram illustrates an electronic device structure according to another aspect of this application, the device including at least a processor 401 and a memory 402.

[0108] Processor 401 may include one or more processing cores, such as a quad-core processor or an octa-core processor. Processor 401 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 401 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 401 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 401 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.

[0109] Memory 402 may include one or more computer-readable storage media, which may be non-transitory. Memory 402 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in memory 402 are used to store at least one instruction, which is executed by processor 401 to implement a text processing method provided in the method embodiments of this application.

[0110] In some embodiments, the electronic device may also optionally include: a peripheral device interface and at least one peripheral device. The processor 401, memory 402, and peripheral device interface can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface via a bus, signal line, or circuit board. Indicatively, peripheral devices include, but are not limited to: radio frequency circuits, touch displays, audio circuits, and power supplies.

[0111] Of course, the electronic device may also include fewer or more components, and this embodiment does not limit this.

[0112] This application also provides a computer-readable storage medium having computer-readable instructions stored thereon, which can be executed by a processor to implement a text processing method as described above.

[0113] When a text processing method is implemented as a computer program, it can also be stored as an article of art in a computer-readable storage medium. For example, a computer-readable storage medium may include, but is not limited to, magnetic storage devices (e.g., hard disks, floppy disks, magnetic stripes), optical discs (e.g., compact discs (CDs), digital multifunction discs (DVDs)), smart cards, and flash memory devices (e.g., electrically erasable programmable read-only memory (EPROM), cards, sticks, key drives). Furthermore, the various storage media described herein can represent one or more devices and / or other machine-readable media for storing information. The term "machine-readable medium" may include, but is not limited to, wireless channels and various other media (and / or storage media) capable of storing, containing, and / or carrying code and / or instructions and / or data.

[0114] It should be understood that the embodiments described above are merely illustrative. The embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or any combination thereof. For hardware implementation, the processor may be implemented within one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, and / or other electronic units designed to perform the functions described herein, or combinations thereof.

[0115] Some aspects of this application can be executed entirely by hardware, entirely by software (including firmware, resident software, microcode, etc.), or by a combination of hardware and software. The aforementioned hardware or software may be referred to as a "data block," "module," "engine," "unit," "component," or "system." The processor may be one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DAPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, or combinations thereof. Furthermore, aspects of this application may manifest as computer products residing in one or more computer-readable media, including computer-readable program code. For example, computer-readable media may include, but are not limited to, magnetic storage devices (e.g., hard disks, floppy disks, magnetic tapes, etc.), optical discs (e.g., compressed CDs, digital multifunction DVDs, etc.), smart cards, and flash memory devices (e.g., cards, sticks, key drives, etc.).

[0116] A computer-readable medium may contain a propagated data signal containing computer program code, for example, on baseband or as part of a carrier wave. This propagated signal may take various forms, including electromagnetic, optical, and so on, or suitable combinations thereof. A computer-readable medium can be any computer-readable medium other than a computer-readable storage medium, which can be connected to an instruction execution system, apparatus, or device to enable communication, propagation, or transmission of a program for use. The program code located on the computer-readable medium can be propagated through any suitable medium, including radio, cable, fiber optic cable, radio frequency signals, or similar media, or any combination of the above media.

[0117] The basic concepts have been described above. Obviously, for those skilled in the art, the above disclosure is merely illustrative and does not constitute a limitation of this application. Although not explicitly stated herein, those skilled in the art may make various modifications, improvements, and corrections to this application. Such modifications, improvements, and corrections are suggested in this application, and therefore remain within the spirit and scope of the exemplary embodiments of this application.

[0118] Furthermore, this application uses specific terms to describe embodiments of the application. For example, "an embodiment," "one embodiment," and / or "some embodiments" refer to a particular feature, structure, or characteristic related to at least one embodiment of the application. Therefore, it should be emphasized and noted that "an embodiment," "one embodiment," or "an alternative embodiment" mentioned twice or more in different locations in this specification do not necessarily refer to the same embodiment. In addition, certain features, structures, or characteristics in one or more embodiments of the application can be appropriately combined.

[0119] In some embodiments, numbers describing the quantity of components and attributes are used. It should be understood that such numbers used in the description of embodiments are modified in some examples with the terms "approximately," "approximately," or "generally." Unless otherwise stated, "approximately," "approximately," or "generally" indicates that the numbers are allowed to vary by ±20%. Accordingly, in some embodiments, the numerical parameters used in the specification and claims are approximate values, which may be changed depending on the characteristics required by individual embodiments. In some embodiments, numerical parameters should take into account specified significant digits and employ a general method of digit reservation. Although the numerical ranges and parameters used to confirm their breadth of scope in some embodiments of this application are approximate values, in specific embodiments, such values ​​are set as precisely as feasible.

Claims

1. A text processing method, characterized in that, The method includes: Determine the dimensional score of each text segment in the text across various risk dimensions, and determine the safety level of each text segment based on the dimensional score; The bitmap of each text segment is determined based on the security level of each text segment, the score of each dimension, and the risk threshold; The bitmap of each text fragment is matched with at least one preset risk template, and the risk text fragment is determined based on the matching result; Process the text according to the risk text fragment; The step of determining the bitmap of each text segment based on the security level of each text segment, the score of each dimension, and the risk threshold includes: The security level of each text fragment is converted into binary and stored in the highest four bits of the bitmap; Associating each bit in the first N bits of the bitmap with each dimension score, where N is the number of risk dimensions; Set the bit associated with the risk dimension whose dimension score is greater than or equal to the risk threshold to 1, and set the bit associated with the risk dimension whose dimension score is less than the risk threshold to 0. The highest four bits and the first N bits of the bitmap are combined to generate a bitmap encoding.

2. The method according to claim 1, characterized in that, The process of determining the safety level of each text fragment based on the score of each dimension includes: The overall score for each text segment is determined based on the score for each dimension and the corresponding risk dimension weight; The security level of each text segment is determined based on the overall score of each text segment.

3. The method according to claim 1, characterized in that, The method includes: Obtain the preset number of bits in the bitmap; An extended dimension bit is allocated between the highest four bits of the bitmap and the first N bits; Compare the score of each extended dimension with the risk threshold, and store the comparison result in the corresponding extended dimension bit. The highest four bits of the bitmap, the first N bits, and the extended dimension bits are combined to generate a bitmap.

4. The method according to claim 1, characterized in that, The step of matching the bitmap of each text fragment with at least one preset risk template, and determining the risk text fragment based on the matching result, includes: The bitmap of each text fragment is matched bit-by-bit with at least one preset risk template; For each text segment, if any bit matches successfully, the corresponding text segment is determined to be a risky text segment.

5. The method according to claim 1, characterized in that, The process of processing the text based on the risky text fragment includes: The proportion of risky text fragments is determined based on the risky text fragments and the total number of text fragments. The text is processed based on the proportion of risky segments and the interception threshold.

6. The method according to claim 2, characterized in that, The method further includes: Based on historical text, the gradient descent algorithm is used to train the weights of each risk dimension. The weights of each risk dimension are updated based on the results of text processing.

7. The method according to claim 1, characterized in that, The method includes: After encoding the text, it is split into multiple text segments according to a preset character length.

8. An electronic device, characterized in that, The device includes: One or more processors; and A memory storing computer-readable instructions, which, when executed, cause the processor to perform the operations of the method as described in any one of claims 1 to 7.

9. A computer-readable storage medium storing computer-readable instructions thereon, characterized in that, The computer-readable instructions can be executed by a processor to implement the method as described in any one of claims 1 to 7.