Short message compression method and system
By acquiring SMS templates and mapping libraries, calculating similarity from multiple dimensions and merging fields, and combining priority compression and large language model verification, the problems of information integrity and efficiency in SMS compression are solved, achieving efficient and accurate SMS transmission.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- E SURFING IOT CO LTD
- Filing Date
- 2026-02-05
- Publication Date
- 2026-05-01
AI Technical Summary
Existing SMS compression methods struggle to balance information integrity and compression rate when processing alarm messages, leading to the loss or distortion of critical information, increased operating costs, and reduced user reading efficiency.
By acquiring the target SMS template and the field information to be processed, standardization is performed using a mapping library. Field similarity is calculated from multiple dimensions and fields are merged according to the similarity fusion strategy. Compression is performed based on field priority, and the compression results are verified using a large language model to ensure semantic consistency.
It improves the readability and transmission efficiency of SMS content, ensures accurate information delivery, avoids semantic loss caused by compression, and enhances the timeliness and reliability of emergency response.
Smart Images

Figure CN121968032A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data compression technology, and in particular relates to a method and system for compressing text messages. Background Technology
[0002] With the widespread deployment of the Internet of Things (IoT) and smart devices, especially in high-frequency alarm scenarios such as fire safety, security monitoring, smart city operation and maintenance, and industrial control, systems need to quickly notify relevant responsible persons of critical information when alarm events occur. Due to coverage and reliability requirements, SMS remains one of the most mainstream and stable alarm channels. However, SMS has length limitations, and alarm information often contains many fields. Forcibly compressing it can easily lead to information distortion, while leaving it uncompressed can result in excessively long SMS messages, increasing operating costs and reducing user reading efficiency. Therefore, how to better implement SMS compression has become an urgent problem to be solved. Summary of the Invention
[0003] In view of the shortcomings of the prior art, the purpose of the invention is to provide a method and system for compressing text messages.
[0004] In a first aspect, the present invention proposes a method for compressing text messages, comprising: S1, obtaining a target text message template and field information to be processed corresponding to the target text message template; S2, extracting a target field from the field information to be processed, and matching the target field with a mapping library to obtain a standardized target field; S3, calculating the similarity between the standardized target fields from multiple dimensions, and determining, based on a similarity fusion strategy, to merge the standardized target fields, and obtaining the total length of the text message content; S4, if the total length of the text message content satisfies the compression conditions, compressing the field content according to the priority of the standardized target fields, verifying the compressed text message content, and determining the target text message based on the verification results.
[0005] Further, extracting the target field from the field information to be processed includes: performing entity recognition on the field information to be processed and extracting entity fields; identifying non-standard fields in the field information to be processed and extracting sub-fields from the non-standard fields; and using the entity fields and the sub-fields as the target fields in the field information to be processed.
[0006] Furthermore, the multi-dimensional approach includes characters, tokens, semantics, and pinyin. The multi-dimensional calculation of the similarity between the standardized target fields includes: calculating the character similarity between the standardized target fields; calculating the token similarity between the standardized target fields; calculating the semantic similarity between the standardized target fields; and calculating the pinyin similarity between the standardized target fields. When the standardized target fields are determined to be merged according to the similarity fusion strategy, obtaining the total length of the SMS content includes: weighting and summing the character similarity, token similarity, semantic similarity, and pinyin similarity to obtain a target similarity score; determining whether the target similarity score is not less than a similarity threshold; if so, merging the standardized target fields to obtain the merged SMS content, and determining the total length of the SMS content.
[0007] Further, determining that the total length of the SMS content meets the compression condition includes: judging whether the total length of the SMS content is not greater than a length threshold; if not, then determining that the total length of the SMS content meets the compression condition; wherein, compressing the field content according to the priority of the standardized target field includes: determining the priority of the standardized target field, and obtaining the standardized target field corresponding to the low priority and the standardized target field corresponding to the high priority; compressing the standardized target field corresponding to the first low priority to obtain the total length of the first compressed SMS content, and judging whether the total length of the first compressed SMS content is not greater than the length threshold; if not, compressing the standardized target field corresponding to the second low priority to obtain the total length of the second compressed SMS content, and judging whether the total length of the second compressed SMS content is not greater than the length threshold; if not, compressing the standardized target field corresponding to the next low priority, until the total length of the compressed SMS content is not greater than the length threshold.
[0008] Furthermore, it also includes: compressing all the standardized target fields of low priority; if the total length of the compressed SMS content is greater than the length threshold, compressing the standardized target fields corresponding to the first high priority until the total length of the compressed SMS content is not greater than the length threshold.
[0009] Furthermore, based on verifying the compressed SMS content and determining the target SMS based on the verification result, the process includes: obtaining the SMS content before compression; performing a semantic comparison between the SMS content before compression and the SMS content after compression based on a Large Language Model (LLM); if the SMS content before compression and the SMS content after compression are semantically consistent, the verification result is passed, and the compressed SMS content is taken as the target SMS.
[0010] Furthermore, if the verification result is unsuccessful, the target field in the field information to be processed is marked, and the marking result is manually modified or iterated in the next timed scheduling.
[0011] A second aspect of the present invention provides a text message compression system, comprising: a first acquisition module for acquiring a target text message template and corresponding field information to be processed; a matching module for extracting a target field from the field information to be processed and matching the target field with a mapping library to obtain a standardized target field; a second acquisition module for calculating the similarity between the standardized target fields in multiple dimensions and, based on a similarity fusion strategy, determining that the standardized target fields should be merged, acquiring the total length of the text message content; and a compression and determination module for compressing the field content according to the priority of the standardized target fields when the total length of the text message content meets the compression conditions, verifying the compressed text message content, and determining the target text message based on the verification result.
[0012] A third aspect of the present invention provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method described in any one aspect of the present invention.
[0013] A fourth aspect of the present invention provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to perform the method described in any one of the first aspects of the present invention.
[0014] The beneficial effects of this invention are as follows: The SMS compression method and system of this invention obtains a target SMS template and corresponding field information to be processed; extracts target fields from the field information to be processed and matches them with a mapping library to obtain standardized target fields; calculates the similarity between standardized target fields from multiple dimensions, and determines the total length of the SMS content when merging standardized target fields according to a similarity fusion strategy; compresses the field content according to the priority of standardized target fields when the total length of the SMS content meets the compression conditions; verifies the compressed SMS content; and determines the target SMS based on the verification results. This method improves the readability and transmission efficiency of SMS content, ensures accurate delivery of SMS content, and avoids semantic loss caused by overall SMS content compression. Attached Figure Description
[0015] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts. It is obvious that the drawings described below are merely some embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings.
[0016] Figure 1 This is a flowchart of a text message compression method according to an embodiment of the present invention; Figure 2 This is a flowchart of a text message compression method according to a specific embodiment of the present invention; Figure 3 This is a schematic diagram of a text message compression system according to an embodiment of the present invention; Figure 4 This is a structural block diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0017] To enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. It should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0018] Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts disclosed in this invention.
[0019] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicating orientation or positional relationships based on the orientation or positional relationships shown in the accompanying drawings, are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance. The terms "installed," "connected," and "linked" should be interpreted broadly; for example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal communication of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0020] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of methods and systems consistent with some aspects of the invention as detailed in the appended claims.
[0021] Most existing SMS compression methods rely on template replacement or general text compression algorithms. When processing alarm SMS messages containing key information such as time, location, device, and event, these methods often result in semantic incompleteness or missing key information. Since SMS messages are usually limited to 70 characters, traditional methods often struggle to simultaneously achieve both completeness and compression rate, making it easy for recipients to misinterpret the alarm content due to the loss of key information.
[0022] To address this, the present invention proposes a method, system, and related equipment for SMS compression. Specifically, the SMS compression method, system, and related equipment of the present invention are described below with reference to the accompanying drawings.
[0023] Figure 1 This is a flowchart of a text message compression method according to an embodiment of the present invention. It should be noted that the text message compression method of this embodiment can be applied to the text message compression system of this embodiment. This text message compression system can be configured on an electronic device or in a server. This application does not limit the scope of this application.
[0024] like Figure 1 As shown, SMS compression methods include: S110, obtain the target SMS template and the corresponding fields to be processed.
[0025] In embodiments of the present invention, the target SMS template can be preset. For example, the target SMS template is: at {time}, at {location name} {device name} {alarm event}.
[0026] In embodiments of the present invention, the text message content to be processed can be obtained, and the field information to be processed corresponding to the target text message template can be determined based on the target text message template and the text message content to be processed.
[0027] In other words, based on the content of the SMS message to be processed, the fields to be filled in the target SMS template are determined, and the fields to be filled in are used as the field information to be processed.
[0028] For example, the following fields are to be processed: Time (2025-09-05 10:08:22), Location Name (No. 33, East Third Section of Second Ring Road, XX Community, Non-motorized Vehicle Garage, XX Campus Family Compound Intersection, 1st), Device Name (Smoke Detector_MD-2105R_809131, No. 33, East Third Section of Second Ring Road, XX Community, Non-motorized Vehicle Garage, XX Campus Family Compound Intersection, 1st - New), Alarm Event (Smoke Alarm Occurred). Specifically, 2025-09-05 10:08:22, No. 33, East Third Section of Second Ring Road, XX Community, Non-motorized Vehicle Garage, XX Campus Family Compound Intersection, 1st - New, Smoke Detector_MD-2105R_809131, No. 33, East Third Section of Second Ring Road, XX Community, Non-motorized Vehicle Garage, XX Campus Family Compound Intersection, 1st - New, Smoke Alarm Occurred.
[0029] S120: Extract the target field from the field information to be processed, and match the target field with the mapping library to obtain the standardized target field.
[0030] In an embodiment of the present invention, when the field information to be processed is obtained, the target field can be extracted from the field information to be processed, and then the target field can be matched with the mapping library to obtain the standardized target field.
[0031] The process involves entity recognition to extract entity fields from the field information to be processed; identifying non-standard fields in the field information to be processed and extracting sub-fields from the non-standard fields; and using the entity fields and sub-fields as target fields in the field information to be processed.
[0032] The key to identifying entity fields and non-standard fields lies in first identifying field boundaries using preset templates or rules, and then deciding whether to decompose them based on the complexity of the field content. Simple fields (such as time and event type) can be directly used as entity fields; complex fields (such as address and device description) are considered non-standard fields and need to be further decomposed into more granular entity fields.
[0033] The entity fields include, but are not limited to, time, location, event, person, and equipment name.
[0034] Non-standard fields include address, device description, building description, etc.
[0035] The mapping library includes predefined abbreviations for device models and locations. In other words, given the target field, it is matched against the mapping library for standardization. This results in the standardized target field. For example, the target field "smoke alarm" is mapped to "smoke sensor".
[0036] In this process, non-standard fields input by users (such as long addresses and complex device descriptions) are sent to a large language model for structured parsing, which identifies entity types (such as communities, addresses, device types, models, etc.) and generates standardized mapping items, which are then stored in the mapping library.
[0037] For example, matching the location name (No. 33, East Third Section of Second Ring Road, XX Community, the first one at the intersection of XX Campus Staff Quarters) with the mapping database yields the standardized target fields. That is: Community: XX Community; Address: No. 33, East Third Section of Second Ring Road; Building: Non-motorized vehicle garage; Landmark: First one at the intersection of XX Campus Staff Quarters.
[0038] For example, matching the device name (Smoke and Heat Detector_MD-2105R_809131, No. 33, East Third Section of Second Ring Road, XX Community, Non-motorized Vehicle Garage, XX Campus Family Compound, First Entrance - New) with the mapping database yields the standardized target fields. These are: Device Type: Smoke and Heat Detector; Model: MD-2105R_809131; Address: No. 33, East Third Section of Second Ring Road, XX Community; Building: Non-motorized Vehicle Garage; Landmark: First Entrance at XX Campus Family Compound; Status: New.
[0039] S130: Calculate the similarity between the standardized target fields from multiple dimensions, and obtain the total length of the SMS content when the standardized target fields are merged according to the similarity fusion strategy.
[0040] In an embodiment of the present invention, given the standardized target fields, the similarity between the standardized target fields can be calculated from multiple dimensions. The target similarity scores of the standardized target fields calculated from multiple dimensions are compared with a similarity threshold. The standardized target fields are then merged based on the comparison results to obtain the merged SMS content, and the total length of the SMS content is determined. Specific implementation details can be found in subsequent embodiments.
[0041] S140, if the total length of the SMS content meets the compression conditions, compress the field content according to the priority of the standardized target field, verify the compressed SMS content, and determine the target SMS based on the verification result.
[0042] In an embodiment of the present invention, given the total length of the SMS content, it is determined whether the total length of the SMS content is not greater than a length threshold; if not, the total length of the SMS content is determined to meet the compression condition. Then, the field content is compressed according to the priority of the standardized target field, and the compressed SMS content is verified, with the target SMS determined based on the verification result. Specific implementation details can be found in subsequent embodiments.
[0043] In embodiments of the present invention, the SMS compression method of the present invention can be applied to the compression of alarm SMS messages.
[0044] In an embodiment of the present invention, for a successfully compressed and verified SMS message, the mapping entry used can be recorded, and the credibility of the mapping library can be updated according to the following rules: if the mapping is successfully used and does not cause ambiguity, its credibility weight is increased; if the compressed SMS message is corrected or rejected in the verification process, the credibility of the corresponding mapping entry is reduced, and manual review is triggered.
[0045] According to an embodiment of the present invention, a text message compression method is used to obtain a target text message template and corresponding field information to be processed; extract target fields from the field information to be processed and match the target fields with a mapping library to obtain standardized target fields; calculate the similarity between standardized target fields from multiple dimensions, and determine the total length of the text message content when merging standardized target fields according to a similarity fusion strategy; if the total length of the text message content meets the compression conditions, compress the field content according to the priority of the standardized target fields; verify the compressed text message content; and determine the target text message based on the verification results. This method improves the readability and transmission efficiency of text message content, ensures accurate delivery of text message content, and avoids semantic loss due to overall compression of text message content.
[0046] To enable those skilled in the art to more readily understand the present invention, Figure 2 This is a text message compression method according to a specific embodiment of the present invention, such as... Figure 2 As shown, the SMS compression method includes: S210, Obtain the target SMS template and the corresponding fields to be processed.
[0047] S220: Extract the target field from the field information to be processed, and match the target field with the mapping library to obtain the standardized target field.
[0048] In the embodiments of the present invention, the implementation of steps S210-S220 can refer to the implementation of steps S110-S120 described above, and the present invention will not repeat the details.
[0049] S230, multi-dimensional calculation of similarity between standardized target fields.
[0050] In embodiments of the present invention, the multiple dimensions include characters, tokens, semantics, and pinyin.
[0051] In embodiments of the present invention, given the standardized target fields, the character similarity between the standardized target fields is calculated; the token similarity between the standardized target fields is calculated; the semantic similarity between the standardized target fields is calculated; and the pinyin similarity between the standardized target fields is calculated.
[0052] Once the standardized target fields are obtained, they can be grouped by type (e.g., time, location, device, event, etc.), and then similarity calculations can be performed within fields of the same type. For example, standardized entity fields can be grouped by type, and similarity calculations can be performed within fields of the same type. Similarly, similarity calculations can be performed on subfields within the same standardized non-standard field.
[0053] Character similarity can be understood as edit distance. Edit distance refers to the minimum number of editing operations (usually including insertion, deletion, and replacement) required to transform one string into another. Edit distance is then normalized into a similarity score.
[0054] For example, the Levenshtein distance (i.e., edit distance) algorithm can be used to calculate the character differences between two strings. The specific steps include: comparing each character in string A and string B, recording the number of insertions, deletions, and replacements; and calculating the edit distance based on the minimum number of edit operations (insertions, deletions, and replacements). The edit distance is normalized to a range of 0 to 1, where 1 indicates that the two strings are identical, and 0 indicates that they are completely different.
[0055] Token similarity can be understood as dividing a string into tokens (which can be character-level n-grams or word-level n-grams) and then calculating the similarity of the n-gram sets of the two strings. A commonly used method is Jaccard similarity. For example, for two strings, obtain their bigram sets and then calculate the Jaccard similarity.
[0056] For example, a string can be broken down into tokens (e.g., words or n-grams), and the similarity of the token sets can be calculated using Jaccard similarity. The specific steps are as follows: split each string into basic words or n-grams (multiple consecutive characters or words); calculate the intersection and union of the token sets; calculate the ratio of the size of the intersection to the size of the union, i.e., the Jaccard similarity.
[0057] Semantic similarity can be understood as representing each field as a vector using pre-trained word vectors or sentence vectors, and then calculating the cosine similarity between the two vectors. If the field is long, a sentence encoder (such as BERT) can be used to obtain the vector representation of the sentence.
[0058] For example, word vector models (such as Word2Vec and BERT) are used to convert text into vector representations and calculate semantic similarity. The steps are as follows: Convert two texts into vector representations using a pre-trained word vector model. Calculate the cosine similarity between the two text vectors to measure their semantic similarity.
[0059] Pinyin similarity can be understood as converting Chinese characters into pinyin, calculating the edit distance of the pinyin strings, and normalizing it into a similarity score. This can capture fields with similar pronunciations.
[0060] For example, use a pinyin conversion tool to convert Chinese characters into pinyin; calculate the edit distance between pinyin strings and normalize it into similarity.
[0061] S240, if the standardized target fields are determined to be merged according to the similarity fusion strategy, the total length of the SMS content is obtained.
[0062] In an embodiment of the present invention, after calculating character similarity, token similarity, semantic similarity, and pinyin similarity, the character similarity, token similarity, semantic similarity, and pinyin similarity are weighted and summed to obtain a target similarity score; it is determined whether the target similarity score is not less than the similarity threshold; if so, the standardized target fields are merged to obtain the merged SMS content, and the total length of the SMS content is determined.
[0063] For example, S = w_str·S_str + w_tok·S_tok + w_emb·S_emb + w_phon·S_phon. If S ≥ T_merge, the standardized target fields are merged. Here, S represents the target similarity score, w_str represents the weight of character similarity, S_str represents character similarity, w_tok represents the weight of token similarity, S_tok represents token similarity, w_emb represents the weight of semantic similarity, S_emb represents semantic similarity, w_phon represents the weight of pinyin similarity, S_phon represents pinyin similarity, and T_merge represents the similarity threshold.
[0064] The address is split into multiple subfields (community, road, house number, building, landmark), and the device name is also split into multiple subfields (device type, model, address, etc.). Therefore, if the similarity calculation meets the merging conditions, the address subfield in the device name and the address subfield in the location name can be merged.
[0065] S250, determine that the total length of the SMS content meets the compression conditions.
[0066] In an embodiment of the present invention, given the total length of the SMS content, it is determined whether the total length of the SMS content is not greater than a length threshold; if not, the total length of the SMS content is determined to meet the compression condition. That is, by determining whether the total length of the SMS content is less than or equal to the length threshold, if not, the SMS content needs to be compressed, thus determining that the total length of the SMS content meets the compression condition. For example, the SMS content is: 2025-09-05 10:08:22, [Name of Community], No. 33, East Third Section of Second Ring Road, Non-motorized Vehicle Garage, [Name of Campus] Family Compound Intersection First, Smoke Detector, MD-2105R_80913, Non-motorized Vehicle Garage, [Name of Campus] Family Compound Intersection First, New, Smoke Alarm Occurred.
[0067] In an embodiment of the present invention, if the total length of the SMS content is less than or equal to the length threshold, the SMS content is directly output.
[0068] S260 compresses the field content based on the priority of the standardized target field.
[0069] In an embodiment of the present invention, when the total length of the SMS content meets the compression conditions, the priority of the standardized target field is determined, and the standardized target fields corresponding to the low priority and the high priority are obtained; the standardized target fields corresponding to the first low priority are compressed to obtain the total length of the first compressed SMS content, and it is determined whether the total length of the first compressed SMS content is not greater than the length threshold; if not, the standardized target fields corresponding to the second low priority are compressed to obtain the total length of the second compressed SMS content, and it is determined whether the total length of the second compressed SMS content is not greater than the length threshold; if not, the standardized target fields corresponding to the next low priority are compressed until the total length of the compressed SMS content is not greater than the length threshold.
[0070] The priority of the standardized target fields can be preset. For example, fields such as event type, location, and time of occurrence have high priority, while fields such as the name of the responsible person, contact information, or equipment model have low priority.
[0071] In this process, the priority of the standardized target fields is determined by sorting them according to their priority, with lower priority fields first and higher priority fields last, thereby obtaining the standardized target fields corresponding to the lower priority fields and the higher priority fields.
[0072] The standardized target field can be compressed by abbreviation, deletion of redundant words, replacement with abbreviated words, or merging of similar information.
[0073] Specifically, if the total length of the first compressed SMS content is less than or equal to the length threshold, then the first compressed SMS content is directly output.
[0074] Specifically, if the total length of the second compressed SMS content is less than or equal to the length threshold, the second compressed SMS content will be output directly.
[0075] In an embodiment of the present invention, all standardized target fields of low priority are compressed. If the total length of the compressed SMS content is greater than the length threshold, the standardized target fields corresponding to the first high priority are compressed until the total length of the compressed SMS content is not greater than the length threshold.
[0076] In this process, the standardized target fields corresponding to high priority are compressed, which can be understood as slight compression or abbreviation, to ensure that key information is not deleted.
[0077] For example, if the standardized target field corresponding to the highest priority is a time field, only the time format (e.g., "September 5, 2025, 12:30:45" abbreviated to "09-05 12:30") is optimized to achieve compression. Similarly, if the standardized target field corresponding to the highest priority is the location, redundant modifiers in the location field (e.g., "Non-motorized vehicle garage at No. 33, East Third Section of Second Ring Road, XX Community" abbreviated to "Non-motorized vehicle garage of XX Community") are optimized to achieve compression.
[0078] For example, the compressed text message reads: "At 10:08:22 on September 5, 2025, a smoke alarm was triggered at the intersection of the non-motorized vehicle garage at No. 33, East Third Section of the Second Ring Road and the family compound of a certain school."
[0079] S270 verifies the compressed SMS content and determines the target SMS based on the verification result.
[0080] In an embodiment of the present invention, the text message content before compression is obtained; the text message content before compression and the text message content after compression are semantically compared based on the Large Language Model (LLM); if it is determined that the text message content before compression and the text message content after compression are semantically consistent, the verification result is passed, and the compressed text message content is used as the target text message.
[0081] For example, the uncompressed and compressed SMS content are input into the Large Language Model (LLM) to obtain the first vector of the uncompressed SMS content and the second vector of the compressed SMS content. Then, the cosine similarity between the first and second vectors is calculated. If the cosine similarity is higher than a preset threshold, the semantics are determined to be consistent.
[0082] In an embodiment of the present invention, if the verification result is unsuccessful, the target field in the field information to be processed is marked, and the marking result is manually modified or iterated in the next timed scheduling.
[0083] According to the SMS compression method of this invention, unstructured raw SMS messages are converted into standardized information with clear structure and well-defined fields by combining templates and mapping libraries. Complex fields such as addresses and device descriptions are decomposed and standardized, and fields with highly similar semantics are merged to avoid the confusion of repeated expression of the same information in multiple places. Multi-dimensional calculations, including character, semantic, and pinyin calculations, can more accurately identify fields that are "different in expression but the same in substance". Layered processing is performed according to the importance of fields (e.g., events and locations are high priority). Secondary information is compressed first, while retaining core content to the maximum extent. When the compressed message is still too long, high-priority fields can be "lightly" optimized (e.g., simplifying time formats), improving the flexibility of the strategy. The semantic consistency of the content before and after compression is compared using a large language model, which fundamentally prevents the distortion or loss of key information due to compression and improves the reliability of compression. When verification fails, problematic fields are marked and manual intervention or timed iteration is supported, enabling continuous learning and improvement of the mapping library and compression rules, becoming more accurate with use. This method improves information transmission efficiency by compressing SMS content, keeping the length of a single SMS message within a preset limit and reducing the need for segmented sending. This not only reduces operating costs but also allows users to quickly and accurately learn the location and nature of the problem, thereby improving the timeliness and reliability of emergency response and ensuring the integrity of critical information. Utilizing semantic-level field recognition and cross-field association compression, it avoids the risk of information loss and misunderstanding, ensuring accurate delivery and timely response of alarm SMS messages. Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.
[0084] According to one aspect of the present invention, a text message compression system is also proposed. Figure 3 This is a schematic diagram of a text message compression system according to an embodiment of the present invention; as shown Figure 3 As shown, it includes: The first acquisition module 310 is used to acquire the target SMS template and the field information to be processed corresponding to the target SMS template; The matching module 320 is used to extract the target field from the field information to be processed, and match the target field with the mapping library to obtain the standardized target field; The second acquisition module 330 is used to calculate the similarity between the standardized target fields in multiple dimensions, and to obtain the total length of the SMS content when the standardized target fields are merged according to the similarity fusion strategy. The compression and determination module 340 is used to compress the field content according to the priority of the standardized target field when the total length of the SMS content meets the compression conditions, and to verify the compressed SMS content and determine the target SMS based on the verification result.
[0085] According to an embodiment of the present invention, a text message compression system obtains a target text message template and corresponding field information to be processed; extracts target fields from the field information to be processed and matches the target fields with a mapping library to obtain standardized target fields; calculates the similarity between standardized target fields from multiple dimensions, and determines the total length of the text message content when merging standardized target fields based on a similarity fusion strategy; if the total length of the text message content meets the compression conditions, compresses the field content according to the priority of the standardized target fields, verifies the compressed text message content, and determines the target text message based on the verification results. This improves the readability and transmission efficiency of text message content, ensures accurate delivery of text message content, and avoids semantic loss due to overall compression of text message content.
[0086] Optionally, the matching module 320 is specifically used to perform entity recognition on the field information to be processed, extract entity fields; determine non-standard fields in the field information to be processed, and extract sub-fields from the non-standard fields; and use the entity fields and the sub-fields as the target fields in the field information to be processed.
[0087] Optionally, the multi-dimensional aspects include characters, tokens, semantics, and pinyin. Specifically, the second acquisition module 330 is used to calculate the character similarity between the standardized target fields; calculate the token similarity between the standardized target fields; calculate the semantic similarity between the standardized target fields; calculate the pinyin similarity between the standardized target fields; perform a weighted summation of the character similarity, token similarity, semantic similarity, and pinyin similarity to obtain a target similarity score; determine whether the target similarity score is not less than a similarity threshold; if so, merge the standardized target fields to obtain the merged SMS content, and determine the total length of the SMS content.
[0088] Optionally, the compression and determination module 340 is specifically used to determine whether the total length of the SMS content is not greater than a length threshold; if not, determine that the total length of the SMS content meets the compression condition; determine the priority of the standardized target field, and obtain the standardized target field corresponding to the low priority and the standardized target field corresponding to the high priority; compress the standardized target field corresponding to the first low priority to obtain the total length of the first compressed SMS content, and determine whether the total length of the first compressed SMS content is not greater than the length threshold; if not, compress the standardized target field corresponding to the second low priority to obtain the total length of the second compressed SMS content, and determine whether the total length of the second compressed SMS content is not greater than the length threshold; if not, compress the standardized target field corresponding to the next low priority until the total length of the compressed SMS content is not greater than the length threshold.
[0089] Optionally, the compression and determination module 340 is specifically used to compress all the standardized target fields of low priority, and if the total length of the compressed SMS content is greater than the length threshold, to compress the standardized target fields corresponding to the first high priority, until the total length of the compressed SMS content is not greater than the length threshold.
[0090] Optionally, the compression and determination module 340 is specifically used to obtain the SMS content before compression; perform semantic comparison between the SMS content before compression and the SMS content after compression based on the Large Language Model (LLM); if it is determined that the SMS content before compression and the SMS content after compression are semantically consistent, the verification result is passed, and the compressed SMS content is used as the target SMS.
[0091] Optionally, the compression and determination module 340 is specifically used to mark the target field in the field information to be processed when the verification result is unsuccessful, and to manually modify the marking result or to iterate in the next timed scheduling.
[0092] According to one aspect of the present invention, an electronic device is provided.
[0093] Figure 4 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Figure 4 As shown, an electronic device may include one or more ( Figure 4Only one is shown in the image. A processor 102 (which may include, but is not limited to, a microprocessor unit (MPU) or a programmable logic device (PLD)) and a memory 104 for storing data are also shown. In one exemplary embodiment, the electronic device may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 4 The structure shown is for illustrative purposes only and does not limit the structure of the terminal device described above. For example, the terminal device may also include components that are more... Figure 4 The more or fewer components shown, or having the same Figure 4 Equivalent functions or ratios shown Figure 4 The functions shown have more different configurations.
[0094] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the SMS compression method in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to terminal devices via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0095] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the switching device. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0096] This invention proposes a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute a text message compression method.
[0097] The applicant of this invention has provided a detailed description of the embodiments of the invention in conjunction with the accompanying drawings. However, those skilled in the art should understand that the above embodiments are merely preferred embodiments of the invention. The detailed description is only intended to help readers better understand the spirit of the invention and is not intended to limit the scope of protection of the invention. On the contrary, any improvements or modifications made based on the inventive spirit of the invention should fall within the scope of protection of the invention.
[0098] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0099] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present invention.
[0100] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the protection scope of the present invention.
Claims
1. A method for compressing text messages, characterized in that, include: S1, Obtain the target SMS template and the field information to be processed corresponding to the target SMS template; S2, extract the target field from the field information to be processed, and match the target field with the mapping library to obtain the standardized target field; S3, calculate the similarity between the standardized target fields from multiple dimensions, and obtain the total length of the SMS content when the standardized target fields are merged according to the similarity fusion strategy. S4, if the total length of the SMS content meets the compression conditions, compress the field content according to the priority of the standardized target field, verify the compressed SMS content, and determine the target SMS based on the verification result.
2. The SMS compression method according to claim 1, characterized in that, Extracting the target field from the field information to be processed includes: Entity recognition is performed on the field information to be processed to extract the entity fields; Identify non-standard fields in the field information to be processed, and extract sub-fields from the non-standard fields; The entity field and the subfield are used as the target field in the field information to be processed.
3. The SMS compression method according to claim 1, characterized in that, The multi-dimensional approach includes characters, tokens, semantics, and pinyin. The multi-dimensional calculation of the similarity between the standardized target fields includes: Calculate the character similarity between the standardized target fields; Calculate the token similarity between the standardized target fields; Calculate the semantic similarity between the standardized target fields; Calculate the pinyin similarity between the standardized target fields; In the case where the standardized target fields are merged according to the similarity fusion strategy, the total length of the SMS content is obtained, including: The target similarity score is obtained by weighted summing of the character similarity, token similarity, semantic similarity, and pinyin similarity. Determine whether the target similarity score is not less than the similarity threshold; If so, the standardized target fields are merged to obtain the merged SMS content, and the total length of the SMS content is determined.
4. The SMS compression method according to claim 1, characterized in that, Determining that the total length of the SMS content meets the compression conditions includes: Determine whether the total length of the SMS content is not greater than a length threshold; If not, then the total length of the SMS content is determined to meet the compression conditions; The compression of field content based on the priority of the standardized target field includes: Determine the priority of the standardized target field, and obtain the standardized target field corresponding to the low priority and the standardized target field corresponding to the high priority; The standardized target field corresponding to the first low priority is compressed to obtain the total length of the first compressed SMS content, and it is determined whether the total length of the first compressed SMS content is not greater than the length threshold. If not, the standardized target field corresponding to the second low priority is compressed to obtain the total length of the second compressed SMS content, and it is determined whether the total length of the second compressed SMS content is not greater than the length threshold. If not, then the standardized target field corresponding to the next lower priority is compressed until the total length of the compressed SMS content is not greater than the length threshold.
5. The SMS compression method according to claim 4, characterized in that, Also includes: If the total length of the compressed SMS content exceeds the length threshold after all the standardized target fields of the lower priority are compressed, then the standardized target fields corresponding to the first higher priority are compressed until the total length of the compressed SMS content does not exceed the length threshold.
6. The SMS compression method according to claim 1, characterized in that, Based on the verification of the compressed SMS content, and based on the verification results, the target SMS is determined, including: Obtain the original text message content before compression; The semantic comparison of the SMS content before and after compression is performed based on the Large Language Model (LLM). If the semantics of the SMS content before compression and the SMS content after compression are confirmed to be consistent, the verification result is passed, and the compressed SMS content is used as the target SMS.
7. The SMS compression method according to claim 6, characterized in that, If the verification result is unsuccessful, the target field in the field information to be processed is marked, and the marking result is manually modified or iterated in the next timed scheduling.
8. A text message compression system, characterized in that, include: The first acquisition module is used to acquire the target SMS template and the field information to be processed corresponding to the target SMS template; The matching module is used to extract the target field from the field information to be processed, and match the target field with the mapping library to obtain the standardized target field; The second acquisition module is used to calculate the similarity between the standardized target fields in multiple dimensions, and to obtain the total length of the SMS content when the standardized target fields are merged according to the similarity fusion strategy. The compression and determination module is used to determine that, if the total length of the SMS content meets the compression conditions, compress the field content according to the priority of the standardized target field, verify the compressed SMS content, and determine the target SMS based on the verification result.
9. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 7.