Text processing methods, apparatuses, electronic devices and storage media
By performing secondary segmentation on the text to be processed, and referring to the type and scale value of the last character, the problem of inaccurate text processing is solved, and a more accurate and adaptable text processing effect is achieved.
Patent Information
- Application Number
- CN202411580315.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-07
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2044-11-07
AI Technical Summary
Existing technologies cannot accurately represent the meaning of the original text in text processing, resulting in poor text processing performance.
By acquiring the text to be processed, segmentation is performed based on the reference processing pattern to obtain multiple reference subtexts. The reference type of the last character is determined each time it is added. The final processing result is determined by combining the reference scale value and the reference substring.
It improves the accuracy and effectiveness of text processing, ensuring that the processing results can fully represent the meaning of the text being processed and adapt to the personalized needs of downstream applications.
Smart Images

Figure CN119514487B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a text processing method, apparatus, electronic device, and storage medium. Background Technology
[0002] Text can originate from user input, databases, files, and other sources. In some application scenarios (such as Artificial Intelligence (AI) scenarios), if the current text contains too many characters, or if the downstream application has a limited acceptable string length, the text needs to be segmented. The segmentation result can then be used by the downstream application. However, in related technologies, the processed text cannot accurately represent the meaning of the original text; therefore, the text processing is inaccurate and the results are unsatisfactory. Summary of the Invention
[0003] This disclosure aims to at least partially address one of the technical problems in the related art.
[0004] Therefore, the first objective of this disclosure is to propose a text processing method to improve the accuracy and effectiveness of text processing.
[0005] The second objective of this disclosure is to provide a text processing device.
[0006] The third objective of this disclosure is to propose an electronic device.
[0007] The fourth objective of this disclosure is to provide a computer-readable storage medium.
[0008] The fifth objective of this disclosure is to provide a computer program product.
[0009] To achieve the above objectives, a first aspect of this disclosure proposes a text processing method, comprising: acquiring a text to be processed; processing the text to be processed based on a reference processing mode to obtain multiple reference subtexts, wherein the reference processing mode has a corresponding processing type, and the type of the reference subtext is the same as the processing type; adding at least one reference subtext from the multiple reference subtexts to an initial substring to obtain a reference substring, wherein the reference substring has a corresponding reference scale value; determining the reference type of the last character of each added reference subtext after each addition; and determining the processing result corresponding to the text to be processed based on the reference scale value, the reference type, and the reference substring.
[0010] To achieve the above objectives, a second aspect of this disclosure provides a text processing apparatus, comprising: an acquisition module for acquiring text to be processed; a processing module for processing the text to be processed based on a reference processing mode to obtain multiple reference subtexts, wherein the reference processing mode has a corresponding processing type, and the type of the reference subtexts is the same as the processing type; an addition module for adding at least one reference subtext from the multiple reference subtexts to an initial substring to obtain a reference substring, wherein the reference substring has a corresponding reference scale value; a first determination module for determining the reference type of the last character of each added reference subtext; and a second determination module for determining the processing result corresponding to the text to be processed based on the reference scale value, the reference type, and the reference substring.
[0011] To achieve the above objectives, a third aspect of this disclosure provides an electronic device, including: a processor and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement a text processing method proposed in the first aspect of this disclosure.
[0012] To achieve the above objectives, a fourth aspect of this disclosure provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement a text processing method proposed in a first aspect of this disclosure.
[0013] To achieve the above objectives, a fifth aspect of this disclosure provides a computer program product, including a computer program that, when executed by a processor, implements a text processing method proposed in a first aspect of this disclosure.
[0014] The text processing method, apparatus, electronic device, non-transitory computer-readable storage medium storing computer instructions, and computer program product provided in this disclosure acquire text to be processed and process the text to be processed based on a reference processing mode to obtain multiple reference subtexts. The reference processing mode has a corresponding processing type, and the type of the reference subtext is the same as the processing type. At least one of the multiple reference subtexts is added to an initial substring to obtain a reference substring. The reference substring has a corresponding reference scale value. After each reference subtext is added, the reference type of the last character of the added reference subtext is determined, and the processing result corresponding to the text to be processed is determined based on the reference scale value, reference type, and reference substring. Since the text to be processed undergoes secondary segmentation, and the reference type of the last character of the added reference subtext and the reference scale value of the reference substring are also referenced during the second segmentation, the number of considerations for text processing is increased, thereby improving the accuracy and effect of text processing.
[0015] Additional aspects and advantages of this disclosure will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this disclosure. Attached Figure Description
[0016] The above and / or additional aspects and advantages of this disclosure will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, in which:
[0017] Figure 1 This is a flowchart illustrating a text processing method provided in an embodiment of the present disclosure;
[0018] Figure 2 This is a flowchart illustrating another text processing method provided in an embodiment of the present disclosure;
[0019] Figure 3 This is a schematic diagram of the application process in the embodiments of this disclosure;
[0020] Figure 4 This is a schematic diagram of the structure of a text processing device provided in an embodiment of the present disclosure;
[0021] Figure 5 This is a schematic diagram of the structure of an electronic device shown in an exemplary embodiment of the present disclosure. Detailed Implementation
[0022] Embodiments of this disclosure are described in detail below. Examples of these embodiments are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this disclosure, and should not be construed as limiting this disclosure.
[0023] It should be noted that all information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in this disclosure are authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. The acquisition, transmission, storage, use, and processing of data in the technical solution of this disclosure all comply with the relevant provisions of national laws and regulations.
[0024] It should be noted that in the embodiments disclosed herein, certain software, components, models, and other existing solutions in the industry may be mentioned. These should be considered as exemplary and are intended only to illustrate the feasibility of implementing the technical solutions disclosed herein. However, they do not mean that the applicant has used or necessarily used such solutions.
[0025] Figure 1This is a flowchart illustrating a text processing method provided in an embodiment of the present disclosure.
[0026] This embodiment illustrates the example of a text processing method configured in a text processing device. In this embodiment, the text processing method can be configured in a text processing device, which can be located in a server or an electronic device, without limitation.
[0027] This embodiment uses a text processing method configured in an electronic device as an example. The electronic device includes hardware devices with various operating systems, such as smartphones, tablets, personal digital assistants, and e-readers.
[0028] It should be noted that the execution entity of the embodiments disclosed herein may be, in hardware, a central processing unit (CPU) in a server or electronic device, and in software, a related background service in a server or electronic device, without limitation.
[0029] like Figure 1 As shown, the text processing method includes:
[0030] S101: Obtain the text to be processed.
[0031] The text to be segmented can be referred to as the text to be processed.
[0032] Optionally, in some embodiments, the text to be processed may be received from user input; or the matching text to be processed may be obtained from the database based on the processing request; or the text to be processed may be obtained by text recognition of the file to be processed, and there is no limitation on this.
[0033] S102: Process the text to be processed based on the reference processing mode to obtain multiple reference subtexts. The reference processing mode has a corresponding processing type, and the type of the reference subtext is the same as the processing type.
[0034] After obtaining the text to be processed, a reference processing mode can be used to process the text, resulting in multiple reference subtexts. The reference processing mode can be the processing mode used during the initial segmentation of the text. For example, it could be a character processing mode or a word count processing mode. A character processing mode segments the text based on the number of characters, while a word count processing mode segments the text based on the number of words, thus obtaining multiple reference subtexts. Of course, the reference processing mode can also be any other possible processing mode, such as segmenting the text based on the number of words, etc. There are no restrictions on this.
[0035] Here, "reference processing mode" refers to the processing mode of the requirement. A reference processing mode has a corresponding processing type, and the type of the reference subtext is the same as the processing type. For example, if the reference processing mode is a character processing mode, then the processing type corresponding to the character processing mode is the character type. If the reference processing mode is a word count processing mode, then the processing type corresponding to the word count processing mode is the word type or the word type.
[0036] Optionally, in some embodiments, the text to be processed is segmented based on a reference processing pattern to obtain multiple reference sub-texts, and the type of each reference sub-text is the same as the type corresponding to the reference processing pattern.
[0037] Optionally, in some embodiments, a reference processing mode can be determined based on actual processing needs, and the type corresponding to the reference processing model can be determined. Then, the text to be processed is initially processed to obtain multiple reference sub-texts that conform to the type, and then subsequent steps can be triggered.
[0038] Optionally, in some embodiments, the reference processing mode is a character processing mode or a word count processing mode, wherein the processing type of the character processing mode is character type, and the processing type of the word count processing mode is word type or word type.
[0039] Optionally, in some embodiments, in the process of processing the text to be processed based on the reference processing mode to obtain multiple reference subtexts, the text to be processed can be segmented based on the character processing mode to obtain multiple reference subtexts, wherein the type of the reference subtexts is character; or, the text to be processed can be segmented based on the word count processing mode to obtain multiple reference subtexts, wherein the type of the reference subtexts is character or word. This improves the flexibility of text processing, enables on-demand processing, and effectively expands the application scenarios of text processing.
[0040] S103: Add at least one reference subtext from a plurality of reference subtexts to the initial substring to obtain a reference substring, wherein the reference substring has a corresponding reference scale value.
[0041] The substring obtained by adding the reference subtext to the initial substring can be called the reference substring. The reference substring has a corresponding reference scale value, which can be used to represent the length of the reference substring. If the reference substring is of type character, the reference scale value can be, for example, the number of characters contained in the reference substring. If the reference substring is of type word or word, the reference scale value can be, for example, the number of words contained in the reference substring.
[0042] Optionally, in some embodiments, in the process of adding at least one reference subtext from multiple reference subtexts to an initial substring to obtain a reference substring, the reference position order of the reference subtexts in the text to be processed can be determined, and the corresponding reference subtexts can be added to the initial substring according to the reference position order of at least one reference subtext from multiple reference subtexts to obtain a reference substring. This achieves sequential processing of multiple reference subtexts, ensuring that each generated processing result can correctly represent the meaning of the text to be processed.
[0043] The reference position order refers to the order in which the reference subtexts are located within the text to be processed. Different reference subtexts will have different reference position orders within the text to be processed. For example, reference subtexts can be added to the initial substring one by one according to their reference position order from front to back. For instance, the reference subtext with reference position order 1 can be added to the initial substring first, resulting in a reference substring, which can then be used as the initial substring when adding the reference subtext with reference position order 2. The reference subtext with reference position order 1 must precede the reference subtext with reference position order 2, and the two must be adjacent in the text to be processed; this is not a restriction.
[0044] Optionally, in some embodiments, the reference substring obtained after adding each reference subtext is used as the initial substring when adding the next reference subtext. That is, after adding reference subtexts one by one to the initial substring, the reference substring obtained after this addition can be used as the initial substring for the next addition. In other words, in step S103 above, "adding at least one reference subtext from multiple reference subtexts to the initial substring," the initial substring used each time a reference subtext is added is the reference substring obtained after the previous addition. This significantly improves the integrity of the reference substring and ensures that the subsequent processing results can accurately represent the semantics of the text to be processed.
[0045] After processing the text to be processed based on the reference processing mode and obtaining multiple reference subtexts, at least one of the multiple reference subtexts can be added to the initial substring. After each addition, a reference substring will be obtained, and then subsequent steps can be triggered.
[0046] S104: After each reference subtext is added, determine the reference type of the last character of the added reference subtext.
[0047] The reference type refers to the semantic function type of a character. For example, whether the last character plays a specific semantic role in semantic expression, such as semantic segmentation or semantic enhancement.
[0048] After adding each reference subtext to the initial substring, the reference substring is obtained. Then, the reference type of the last character of each added reference subtext can be determined. For example, the semantics of the reference substring containing the last character can be parsed to determine whether the last character carries a corresponding semantic function within its reference substring, thus determining the reference type of the last character.
[0049] S105: Determine the processing result corresponding to the text to be processed based on the reference scale value, reference type, and reference substring.
[0050] After adding each reference subtext and determining the reference type of the last character of the added reference subtext, the processing result corresponding to the text to be processed can be determined based on the reference scale value, reference type, and reference substring.
[0051] Optionally, in some embodiments, in the process of determining the processing result corresponding to the text to be processed based on the reference scale value, reference type, and reference substring, the reference scale value and reference type can be analyzed in combination with some processing rules, and the result of the analysis can be used to determine whether to select the reference substring as the processing result, and whether to determine the processing result based on the last character of the reference subtext added in this time; or the reference scale value, reference type, and reference substring can be processed based on artificial intelligence to determine the processing result corresponding to the text to be processed; or any other possible method can be used to determine the processing result corresponding to the text to be processed based on the reference scale value, reference type, and reference substring, such as character (or word, phrase) comparison, etc., without limitation.
[0052] In this embodiment, the text to be processed is obtained and processed based on a reference processing mode to obtain multiple reference subtexts. Each reference processing mode has a corresponding processing type, and the type of the reference subtext is the same as the processing type. At least one reference subtext is added to the initial substring to obtain a reference substring. The reference substring has a corresponding reference scale value. After each reference subtext is added, the reference type of the last character of the added reference subtext is determined, and the processing result corresponding to the text to be processed is determined based on the reference scale value, reference type, and reference substring. Since this is a secondary segmentation process of the text to be processed, and the reference type of the last character of the added reference subtext and the reference scale value of the reference substring are also referenced during the second segmentation process, the number of dimensions considered in text processing is increased. This improves the accuracy and effectiveness of text processing.
[0053] In some embodiments of this disclosure, during the process of determining the processing result corresponding to the text to be processed based on a reference scale value, a reference type, and a reference substring, an upper scale value can be obtained, where the upper scale value represents the maximum scale value of the substring. The processing result corresponding to the text to be processed is then determined based on the reference scale value, the upper scale value, the reference type, and the reference substring. This allows the processing result obtained from processing the text to be processed to be effectively adapted to downstream applications, supporting applications suitable for personalized downstream use.
[0054] The upper limit of the scale can be customized according to the needs of downstream applications, or it can be customized according to the text processing needs, without any restrictions.
[0055] Figure 2 This is a flowchart illustrating another text processing method provided in an embodiment of the present disclosure.
[0056] like Figure 2 As shown, the text processing method includes:
[0057] S201: Obtain the text to be processed.
[0058] S202: Process the text to be processed based on the reference processing mode to obtain multiple reference subtexts. The reference processing mode has a corresponding processing type, and the type of the reference subtext is the same as the processing type.
[0059] S203: Add at least one reference subtext from a plurality of reference subtexts to the initial substring to obtain a reference substring, wherein the reference substring has a corresponding reference scale value.
[0060] S204: After each reference subtext is added, determine the reference type of the last character of the added reference subtext.
[0061] For a detailed description of S201-S204, please refer to the above embodiments, which will not be repeated here.
[0062] S205: Get the upper limit of the scale, where the upper limit of the scale represents the maximum scale value of the substring.
[0063] The upper limit of the scale can be customized according to the needs of downstream applications, or it can be customized according to the text processing needs, without any restrictions.
[0064] Optionally, in some embodiments, the functional characteristics of downstream applications can be obtained and analyzed to determine the upper limit of the scale that conforms to the functional characteristics of the downstream applications. The upper limit of the scale can be specifically described by the number of characters contained in the substring, and there is no limitation thereto.
[0065] S206: Determine whether the reference scale value has reached the upper limit of the scale, and obtain the first determination result.
[0066] After obtaining the reference substring and determining the reference scale value corresponding to it, it can be determined whether the reference scale value has reached the upper limit of the scale, thus obtaining a first determination result. For example, it can be determined whether the number of characters corresponding to the reference scale value has reached the number of characters corresponding to the upper limit of the scale, thus obtaining a first determination result. This first determination result can be used to determine the processing result corresponding to the text to be processed.
[0067] S207: Determine whether the reference type is the first type and obtain the second determination result, wherein the characters of the first type are used for semantic segmentation of the text to be processed.
[0068] After adding reference subtext to the initial substring and obtaining the reference substring, the reference type of the last character of the added reference subtext can be determined. Then, it is determined whether the reference type is the same as the first type, resulting in a second determination. Characters of the first type are used for semantic segmentation of the text to be processed. For example, characters of the first type could be semantic delimiters.
[0069] In other words, if the reference type is the same as the first type, it means that the last character of the reference subtext added in the reference substring is used for semantic segmentation of the text to be processed. If the reference type is different from the first type, it means that the last character of the reference subtext added in the reference substring is not used for semantic segmentation of the text to be processed.
[0070] S208: Determine the processing result corresponding to the text to be processed based on the first judgment result, the second judgment result, and the reference substring.
[0071] After obtaining the first and second determination results, the processing result corresponding to the text to be processed can be determined based on the first determination result, the second determination result, and the reference substring.
[0072] Optionally, in some embodiments, the process of determining the processing result corresponding to the text to be processed based on the first determination result, the second determination result, and the reference substring may include any of the following: if the first determination result is that the reference scale value reaches the upper limit of the scale, and the second determination result is that the reference type is the first type, the reference substring is used as the processing result; if the first determination result is that the reference scale value reaches the upper limit of the scale, and the second determination result is that the reference type is not the first type, a processing result is generated based on the reference substring; if the first determination result is that the reference scale value does not reach the upper limit of the scale, the next reference subtext among multiple reference subtexts is added to the reference substring until the reference scale value of the reference substring obtained by adding the next reference subtext reaches the upper limit of the scale. This achieves accurate segmentation of the text to be processed, enabling the processing result to carry the semantic information of the text to be processed relatively completely, allowing downstream applications to obtain more complete semantic information from the text.
[0073] Optionally, in some embodiments, when generating the processing result based on the reference substring, if the reference substring does not contain characters of the first type, the reference substring can be used as the processing result; if the reference substring does contain characters of the first type, all characters in the reference substring preceding the characters of the first type can be used as the processing result. This significantly improves the accuracy of text segmentation and maximizes the preservation of semantic information carried in the text to be processed.
[0074] In this embodiment, the text to be processed is obtained and processed based on a reference processing mode to obtain multiple reference subtexts. Each reference processing mode has a corresponding processing type, and the type of the reference subtext is the same as the processing type. At least one reference subtext is added to the initial substring to obtain a reference substring. The reference substring has a corresponding reference scale value. After each reference subtext is added, the reference type of the last character of the added reference subtext is determined, and the processing result corresponding to the text to be processed is determined based on the reference scale value, reference type, and reference substring. Since this is a secondary segmentation process of the text to be processed, and the reference type of the last character of the added reference subtext and the reference scale value of the reference substring are also referenced during the second segmentation process, the number of dimensions considered in text processing is increased. This improves the accuracy and effectiveness of text processing. A first determination result is obtained by determining whether the reference scale value reaches the upper limit of the scale, and a second determination result is obtained by determining whether the reference type is the first type. Characters of the first type are used for semantic segmentation of the text to be processed. The processing result corresponding to the text to be processed is determined based on the first determination result, the second determination result, and the reference substring. Therefore, when segmenting strings in text, it can both meet the personalized needs of downstream applications for input length (an optional example of the upper limit of the scale) and ensure that the original semantic information of the strings in the text is not truncated or destroyed as much as possible, allowing downstream applications to obtain more complete semantic information from the text.
[0075] Examples of the above embodiments are illustrated below:
[0076] In this embodiment of the disclosure, when splitting a string by word count, consecutive English characters and half-width characters (excluding spaces) can be considered as one word; if spaces are present in between, they are considered as two different words. Chinese characters and full-width characters are each considered as one word (or character). The string can be split by traversing it sequentially from beginning to end. During this process, it can be recorded whether the encountered characters are semantic delimiters (an optional example of characters of the first type). When the traversal reaches a character cutting threshold (also known as the current truncation point), i.e., when the substring length (an optional example of a reference scale value) reaches a set upper limit (an optional example of an upper limit scale value), it is determined whether the current truncation point is a semantic delimiter. If it is, it is directly truncated and the next substring is split; otherwise, the index of the nearest semantic delimiter in the preceding characters is found and truncated to ensure the semantic integrity of the substring.
[0077] like Figure 3 As shown, Figure 3 This is a schematic diagram of the application process in an embodiment of this disclosure. It includes the following steps:
[0078] (1) You can first input the string to be cut and the upper limit of the substring length (an optional example of the upper limit value of the scale).
[0079] (2) Select the character or word (word) input string in step (1) to cut the string according to the cutting mode (an optional example of the reference processing mode) to obtain a character array or word array (where multiple character or multiple word arrays are an optional example of multiple reference subtexts).
[0080] (3) In step (2), output the characters in the character array or the words in the word array.
[0081] (4) Add the characters or words looped in step (3) to the substring (an optional example of the initial substring; if there is no substring currently, create a new substring and add the characters or words), and determine and record whether the last character in the current character or word (an optional example of the last character mentioned above) is a semantic separator. Here, a semantic separator is a symbol (character) that has a semantic segmentation function.
[0082] (5) Determine whether the length of the current substring is equal to the upper limit of the substring length specified in step (1) after the current symbol is added. Otherwise, skip to step (9).
[0083] (6) Determine whether the delimiter was recorded in step (4) of the current substring. Otherwise, proceed to step (8).
[0084] (7) Extract all characters before (including) the last semantic delimiter of the current substring and add them to the result set (an optional example of processing the result). Change the loop index to the position of the last semantic delimiter. Create a new substring and jump to step (3) to continue looping to the next character or word.
[0085] (8) Add the current substring to the result set and create a new substring.
[0086] (9) Determine if there are any characters left to process in the string loop. If so, jump to step (2) to continue looping to the next character.
[0087] (10) If the substring contains characters, add it to the result set and output the entire result set.
[0088] (11) End.
[0089] Figure 4 This is a schematic diagram of the structure of a text processing device provided in an embodiment of the present disclosure.
[0090] like Figure 4 As shown, the text processing device 40 includes:
[0091] The acquisition module 401 is used to acquire the text to be processed.
[0092] The processing module 402 is used to process the text to be processed based on a reference processing mode to obtain multiple reference sub-texts. The reference processing mode has a corresponding processing type, and the type of the reference sub-text is the same as the processing type.
[0093] The addition module 403 is used to add at least one reference subtext from multiple reference subtexts to the initial substring to obtain a reference substring, wherein the reference substring has a corresponding reference scale value.
[0094] The first determining module 404 is used to determine the reference type of the last character of each added reference subtext after it has been added.
[0095] The second determining module 405 is used to determine the processing result corresponding to the text to be processed based on the reference scale value, reference type and reference substring.
[0096] It should be noted that the foregoing explanation of the text processing method also applies to the text processing device of this embodiment, and will not be repeated here.
[0097] In this embodiment, the text to be processed is obtained and processed based on a reference processing mode to obtain multiple reference subtexts. Each reference processing mode has a corresponding processing type, and the type of the reference subtext is the same as the processing type. At least one reference subtext is added to the initial substring to obtain a reference substring. The reference substring has a corresponding reference scale value. After each reference subtext is added, the reference type of the last character of the added reference subtext is determined, and the processing result corresponding to the text to be processed is determined based on the reference scale value, reference type, and reference substring. Since this is a secondary segmentation process of the text to be processed, and the reference type of the last character of the added reference subtext and the reference scale value of the reference substring are also referenced during the second segmentation process, the number of dimensions considered in text processing is increased. This improves the accuracy and effectiveness of text processing.
[0098] As an example, Figure 5 This is a schematic diagram of the structure of an electronic device shown in an exemplary embodiment of this disclosure, as follows: Figure 5 As shown, the aforementioned electronic device 700 may further include:
[0099] The memory 710 and the processor 720 are connected by a bus 730, which connects the different components (including the memory 710 and the processor 720). The memory 710 stores a computer program, and when the processor 720 executes the program, it implements the text processing method of the present disclosure embodiment.
[0100] Bus 730 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. Examples of these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0101] Electronic device 700 typically includes a variety of electronic device readable media. These media can be any available media that can be accessed by electronic device 700, including volatile and non-volatile media, removable and non-removable media.
[0102] The memory 710 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 740 and / or cache memory 750. The electronic device 700 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 760 can be used to read and write non-removable, non-volatile magnetic media (…). Figure 5 Not shown; usually referred to as a "hard drive"). Although Figure 5 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 730 via one or more data media interfaces. Memory 710 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of this disclosure.
[0103] A program / utility 780 having a set (at least one) of program modules 770 may be stored in, for example, memory 710. Such program modules 770 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 770 typically perform the functions and / or methods described in the embodiments of this disclosure.
[0104] Electronic device 700 can also communicate with one or more external devices 790 (e.g., keyboard, pointing device, display 791, etc.), and with one or more devices that enable a user to interact with electronic device 700, and / or with any device that enables electronic device 700 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 792. Furthermore, electronic device 700 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 793. As shown, network adapter 793 communicates with other modules of electronic device 700 via bus 730. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0105] The processor 720 executes various functional applications and data processing by running programs stored in the memory 710.
[0106] It should be noted that the implementation process and technical principles of the electronic device in this embodiment are explained in the foregoing description of the text processing method of this disclosure embodiment, and will not be repeated here.
[0107] To implement the above embodiments, this disclosure also proposes an electronic device, including: a processor and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the method provided in the foregoing embodiments.
[0108] To implement the above embodiments, this disclosure also proposes a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods provided in the foregoing embodiments.
[0109] To implement the above embodiments, this disclosure also proposes a computer program product, including a computer program that, when executed by a processor, implements the methods provided in the foregoing embodiments.
[0110] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in this disclosure all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0111] It should be noted that personal information collected from users should be used for legitimate and reasonable purposes and should not be shared or sold outside of these legitimate uses. Furthermore, such collection / sharing should only be conducted after receiving the user's informed consent, including but not limited to notifying the user to read the user agreement / user notice and sign an agreement / authorization that includes authorization of relevant user information before the user uses the function. In addition, any necessary steps must be taken to protect and safeguard access to such personal information data and ensure that others with access to personal information data comply with their privacy policies and procedures.
[0112] This disclosure is intended to provide implementation schemes for users to selectively prevent the use or access to their personal information data. Specifically, this disclosure is intended to provide hardware and / or software to prevent or block access to such personal information data. Once personal information data is no longer needed, risks can be minimized by restricting data collection and deleting data. Furthermore, where applicable, such personal information is de-identified to protect user privacy.
[0113] In the foregoing descriptions of the embodiments, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this disclosure. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0114] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this disclosure, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0115] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of preferred embodiments of this disclosure includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which embodiments of this disclosure pertain.
[0116] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.
[0117] It should be understood that various parts of this disclosure can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0118] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
[0119] Furthermore, the functional units in the various embodiments of this disclosure 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.
[0120] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of the present disclosure 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 disclosure. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present disclosure.
Claims
1. A text processing method, characterized in that, Includes the following steps: Get the text to be processed; The text to be processed is processed based on a reference processing mode to obtain multiple reference sub-texts, wherein the reference processing mode has a corresponding processing type, and the type of the reference sub-text is the same as the processing type; At least one of the multiple reference subtexts is added to the initial substring to obtain a reference substring, wherein the reference substring has a corresponding reference scale value; After each added reference subtext, determine the reference type of the last character of the added reference subtext; and Obtain the upper limit value of the scale, where the upper limit value of the scale represents the maximum scale value of the substring; Determine whether the reference scale value has reached the upper limit of the scale to obtain a first determination result; Determine whether the reference type is the first type to obtain a second determination result, wherein the characters of the first type are used to perform semantic segmentation on the text to be processed. If the reference type is the same as the first type, it means that the last character of the reference subtext added in the reference substring is used to perform semantic segmentation on the text to be processed. If the reference type is not the same as the first type, it means that the last character of the reference subtext added in the reference substring is not used to perform semantic segmentation on the text to be processed. If the first determination result is that the reference scale value reaches the upper limit of the scale, and the second determination result is that the reference type is the first type, the reference substring is taken as the processing result corresponding to the text to be processed. If the first determination result is that the reference scale value reaches the upper limit of the scale, and the second determination result is that the reference type is not the first type, a processing result corresponding to the text to be processed is generated based on the reference substring. If the first determination result is that the reference scale value has not reached the upper limit of the scale, the next reference subtext among the plurality of reference subtexts is added to the reference substring until the reference scale value of the reference substring obtained by adding the next reference subtext reaches the upper limit of the scale.
2. The method according to claim 1, characterized in that, The reference processing mode is either a character processing mode or a word count processing mode. The character processing mode processes characters, while the word count processing mode processes characters or words. The text to be processed is then processed based on the reference processing mode to obtain multiple reference sub-texts, including: The text to be processed is segmented based on the character processing mode to obtain the plurality of reference sub-texts, wherein the type of the reference sub-texts is character; or, The text to be processed is segmented based on the character count processing mode to obtain the plurality of reference sub-texts, wherein the type of the reference sub-texts is character type or word type.
3. The method according to claim 1, characterized in that, The step of adding at least one reference subtext from the plurality of reference subtexts to the initial substring to obtain the reference substring includes: Determine the reference position order of the reference subtext in the text to be processed; The reference substring is obtained by adding the corresponding reference subtext to the initial substring according to the reference position order of at least one reference subtext among the plurality of reference subtexts.
4. The method according to claim 1, characterized in that, The method further includes: The reference substring obtained after adding each reference subtext is used as the initial substring when adding the next reference subtext.
5. The method according to claim 1, characterized in that, The step of generating the processing result based on the reference substring includes: If the reference substring does not contain characters of the first type, the reference substring is taken as the processing result; If the reference substring includes characters of the first type, all characters in the reference substring preceding the characters of the first type are taken as the processing result.
6. A text processing device, characterized in that, include: The acquisition module is used to acquire the text to be processed; The processing module is used to process the text to be processed based on a reference processing mode to obtain multiple reference sub-texts, wherein the reference processing mode has a corresponding processing type, and the type of the reference sub-text is the same as the processing type; An adding module is used to add at least one reference subtext from the plurality of reference subtexts to an initial substring to obtain a reference substring, wherein the reference substring has a corresponding reference scale value; The first determining module is used to determine the reference type of the last character of the added reference subtext after each added reference subtext; The second determining module is used to obtain the upper limit value of the scale, wherein the upper limit value of the scale represents the maximum scale value of the substring; Determine whether the reference scale value has reached the upper limit of the scale to obtain a first determination result; Determine whether the reference type is the first type to obtain a second determination result, wherein the characters of the first type are used to perform semantic segmentation on the text to be processed. If the reference type is the same as the first type, it means that the last character of the reference subtext added in the reference substring is used to perform semantic segmentation on the text to be processed. If the reference type is not the same as the first type, it means that the last character of the reference subtext added in the reference substring is not used to perform semantic segmentation on the text to be processed. If the first determination result is that the reference scale value reaches the upper limit of the scale, and the second determination result is that the reference type is the first type, the reference substring is taken as the processing result corresponding to the text to be processed. If the first determination result is that the reference scale value reaches the upper limit of the scale, and the second determination result is that the reference type is not the first type, a processing result corresponding to the text to be processed is generated based on the reference substring. If the first determination result is that the reference scale value has not reached the upper limit of the scale, the next reference subtext among the plurality of reference subtexts is added to the reference substring until the reference scale value of the reference substring obtained by adding the next reference subtext reaches the upper limit of the scale.
7. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-5.
9. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1-5.
Citation Information
Patent Citations
Text processing method and device, storage medium and electronic device
CN111507082A
Text processing method, text processing device and text processing equipment
CN113761192A