Text processing method and device, electronic equipment and storage medium

By performing secondary segmentation processing based on the reference processing mode on the text to be processed, a reference substring is formed, and the processing results are determined based on its scale value and type, the problem of inaccurate text processing in the prior art is solved, and higher processing accuracy and effect are achieved.

CN119514487AActive Publication Date: 2025-02-25CHINA CONSTRUCTION BANK +1
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411580315.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-07
Publication Date
2025-02-25
Estimated Expiration
2044-11-07

AI Technical Summary

Technical Problem

When processing text, it is difficult for the prior art to accurately represent the meaning of the original text, resulting in insufficient text processing and poor results.

Method used

By obtaining the pending text and processing it based on the reference processing mode, multiple reference subtexts are obtained. Then, these reference subtexts are added to the initial substring to form a reference substring, and the processing result is determined based on the reference scale value, reference type, and reference substring.

Benefits of technology

Through the secondary segmentation processing and the consideration of reference types and scale values, the accuracy and effectiveness of text processing are improved, and the dimension of processing consideration is increased.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119514487A_ABST
    Figure CN119514487A_ABST
Patent Text Reader

Abstract

The invention provides a text processing method and device, electronic equipment and a storage medium, and relates to the technical field of computers.The text processing method comprises the steps that a to-be-processed text is obtained; the to-be-processed text is processed based on a reference processing mode to obtain a plurality of reference sub-texts, the reference processing mode has a corresponding processing type, and the type of the reference sub-texts is the same as the processing type; at least one reference sub-text in the multiple reference sub-texts is added into the initial sub-string, a reference sub-string is obtained, and the reference sub-string has a corresponding reference scale value; after each reference sub-text is added, determining the reference type of the last character of the added reference sub-text; and determining a processing result corresponding to the to-be-processed text according to the reference scale value, the reference type and the reference substring. The technical problems that in the prior art, text processing is not accurate enough, and the text processing effect is poor are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a text processing method, device, electronic device and storage medium. Background Art

[0002] The text may come from user input, databases, files and other carriers. In some application scenarios (such as artificial intelligence (AI) scenarios), if the current text contains too many characters, or the length of the string acceptable to the downstream application is limited, the string contained in the text needs to be segmented, and the processing results obtained by the segmentation process can be used in downstream applications. In the related art, when processing the text, the processing results obtained cannot accurately represent the meaning of the original text. Therefore, the text processing is not accurate enough and the text processing effect is not good. Summary of the invention

[0003] The present disclosure aims to solve one of the technical problems in the related art at least to some extent.

[0004] To this end, the first purpose of the present disclosure is to propose a text processing method to improve the accuracy of text processing and improve the effect of text processing.

[0005] The second objective of the present disclosure is to provide a text processing device.

[0006] A third objective of the present disclosure is to provide an electronic device.

[0007] A fourth objective of the present disclosure is to provide a computer-readable storage medium.

[0008] A fifth object of the present disclosure is to provide a computer program product.

[0009] To achieve the above-mentioned purpose, the first aspect of the present disclosure proposes a text processing method, including: obtaining a text to be processed; processing 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; adding at least one reference sub-text among the multiple reference sub-texts to an initial substring to obtain a reference substring, wherein the reference substring has a corresponding reference scale value; after each reference sub-text is added, determining the reference type of the last character of the added reference sub-text; and determining a processing result corresponding to the text to be processed according to the reference scale value, the reference type and the reference substring.

[0010] To achieve the above-mentioned purpose, the second aspect of the present disclosure proposes a text processing device, including: an acquisition module, used to acquire a text to be processed; a processing module, 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, used to add at least one reference sub-text among the multiple reference sub-texts to an initial substring to obtain a reference substring, wherein the reference substring has a corresponding reference scale value; a first determination module, used to determine the reference type of the last character of the added reference subtext after each reference sub-text is added; and a second determination module, used to determine the processing result corresponding to the text to be processed according to the reference scale value, the reference type and the reference substring.

[0011] To achieve the above-mentioned purpose, the third aspect embodiment of the present disclosure proposes an electronic device, including: a processor, and a memory communicatively connected to the processor; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory to implement a text processing method proposed in the first aspect embodiment of the present disclosure.

[0012] To achieve the above-mentioned purpose, the fourth aspect embodiment of the present disclosure proposes a computer-readable storage medium, in which computer execution instructions are stored. When the computer execution instructions are executed by a processor, they are used to implement a text processing method proposed in the first aspect embodiment of the present disclosure.

[0013] To achieve the above-mentioned purpose, the fifth aspect of the present disclosure proposes a computer program product, including a computer program, which, when executed by a processor, implements a text processing method proposed in the first aspect of the present disclosure.

[0014] The text processing method, device, electronic device, non-transitory computer-readable storage medium storing computer instructions, and computer program product provided by the present disclosure obtain a text to be processed, and process 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, and at least one reference subtext among the multiple reference subtexts is added to an initial substring to obtain a reference substring, and the reference substring has a corresponding reference scale value, wherein 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 according to the reference scale value, the reference type and the reference substring. Since the text to be processed is subjected to a second segmentation process, and during the second segmentation process, the reference type of the last character of the added reference subtext and the reference scale value of the reference substring are also referred to, thereby increasing the consideration dimension of text processing, thereby achieving improved text processing accuracy and improved text processing effect.

[0015] Additional aspects and advantages of the present disclosure will be given in part in the following description and in part will be obvious from the following description or learned through practice of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The above and / or additional aspects and advantages of the present disclosure will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0017] Figure 1 A flowchart of a text processing method provided by an embodiment of the present disclosure;

[0018] Figure 2 A flowchart of another text processing method provided by an embodiment of the present disclosure;

[0019] Figure 3 is a schematic diagram of an application flow in an embodiment of the present disclosure;

[0020] Figure 4 A structural schematic diagram of a text processing device provided by an embodiment of the present disclosure;

[0021] Figure 5 It is a schematic diagram of the structure of an electronic device shown in an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION

[0022] Embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.

[0023] It should be noted that the 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 all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions. The acquisition, transmission, storage, use and processing of data in the technical solution of this disclosure are in compliance with the relevant provisions of national laws and regulations.

[0024] It should be noted that in the embodiments of the present disclosure, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present disclosure, but it does not mean that the applicant has or will necessarily use the solution.

[0025] Figure 1A flowchart of a text processing method provided by an embodiment of the present disclosure.

[0026] This embodiment takes the text processing method being configured in a text processing device as an example. In this embodiment, the text processing method can be configured in a text processing device, and the text processing device can be set in a server or in an electronic device, without limitation.

[0027] This embodiment takes the text processing method configured in an electronic device as an example, wherein the electronic device is a hardware device with various operating systems, such as a smart phone, a tablet computer, a personal digital assistant, an e-book, etc.

[0028] It should be noted that the execution subject of the embodiment of the present disclosure may be, for example, a central processing unit (CPU) in a server or electronic device in terms of hardware, or may be, for example, a related background service in a server or electronic device in terms of software, without limitation.

[0029] like Figure 1 As shown, the text processing method comprises:

[0030] S101: Obtain the text to be processed.

[0031] The text to be segmented may be referred to as text to be processed.

[0032] Optionally, in some embodiments, text to be processed may be received from a user input; or matching text to be processed may be obtained by indexing from a database based on a processing request; or text recognition may be performed on the file to be processed to obtain the text to be processed, and there is no limitation on this.

[0033] S102: Processing the text to be processed based on a reference processing mode to obtain a plurality of 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.

[0034] After obtaining the text to be processed as described above, the reference processing mode can be used to process the text to be processed to obtain multiple reference sub-texts. Among them, the reference processing mode can be the processing mode used when the text to be processed is initially segmented. The reference processing mode is, for example, a character processing mode or a word count processing mode, wherein the character processing mode refers to segmenting the text to be processed based on the dimension of characters, and the word count processing mode refers to segmenting the text to be processed based on the dimension of the number of words, thereby obtaining multiple reference sub-texts. Of course, the reference processing mode can also be any other possible processing mode, such as segmenting the text to be processed based on the dimension of words, etc., and there is no limitation on this.

[0035] The reference processing mode may refer to the processing mode of the requirement. The 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, the processing type corresponding to the character processing mode is a character type. If the reference processing mode is a word processing mode, the processing type corresponding to the word processing mode is a word type or a word type.

[0036] Optionally, in some embodiments, the text to be processed is segmented based on the reference processing mode 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 mode.

[0037] Optionally, in some embodiments, a reference processing mode can be determined based on actual processing requirements, 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 number processing mode, the processing type of the character processing mode is a character type, and the processing type of the word number processing mode is a word type or a 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 may be segmented based on the character processing mode to obtain multiple reference subtexts, wherein the type of the reference subtext is a character type; or the text to be processed may be segmented based on the word count processing mode to obtain multiple reference subtexts, wherein the type of the reference subtext is a word type or a word type. Thus, the flexibility of text processing is improved, on-demand processing is achieved, and the application scenarios of text processing are effectively expanded.

[0040] S103: Add at least one reference subtext from the plurality of reference subtexts to the initial substring to obtain a reference substring, wherein the reference substring has a corresponding reference scale value.

[0041] Among them, the substring obtained after adding the reference subtext to the initial substring can be called the reference substring. The reference substring has a corresponding reference scale value, and the reference scale value can be used to represent the length of the reference substring. If the type of the reference substring is a character type, the reference scale value can be, for example, the number of characters contained in the reference substring. If the type of the reference substring is a character type or a word type, the reference scale value can be, for example, the number of characters or the number of words contained in the reference substring.

[0042] Optionally, in some embodiments, in the process of adding at least one reference subtext among multiple reference subtexts to the initial substring to obtain the reference substring, the reference position order of the reference subtexts in the text to be processed may be determined, and the corresponding reference subtext is added to the initial substring according to the reference position order of at least one reference subtext among multiple reference subtexts to obtain the reference substring. The multiple reference subtexts are processed in order to ensure that each generated processing result can correctly represent the meaning of the text to be processed.

[0043] Among them, the reference position order represents the position order of the reference subtext in the text to be processed. Different reference subtexts have different reference position orders in the text to be processed. For example, the corresponding reference subtexts can be added to the initial substring one by one in the reference position order from front to back. For example, the reference subtext with a reference position order of 1 is first added to the initial substring to obtain a reference substring, and the reference substring is used as the initial substring when adding the reference subtext with a reference position order of 2. The reference subtext with a reference position order of 1 is before the reference subtext with a reference position order of 2, and the two are adjacent in the text to be processed, and there is no restriction on this.

[0044] Optionally, in some embodiments, the reference substring obtained after each addition of a reference subtext is used as the initial substring when adding the next reference subtext. That is to say, after adding the reference subtexts one by one in the initial substring, the reference substring obtained after adding the reference subtext this time can be used as the initial substring used when adding the reference subtext next time. That is, in the above step S103, "at least one reference subtext among the multiple reference subtexts is added to the initial substring", the initial substring used each time a reference subtext is added is the reference substring obtained after the reference subtext was added last time. In this way, the integrity of the reference substring can be greatly improved, and it can be ensured as much as possible that the subsequent processing results can carry out accurate semantic representation of the text to be processed.

[0045] After the text to be processed is processed based on the reference processing mode to obtain multiple reference sub-texts, at least one of the multiple reference sub-texts can be added to the initial substring. After each addition, a reference substring will be obtained, and then the subsequent steps can be triggered.

[0046] S104: After each reference subtext is added, the reference type of the last character of the added reference subtext is determined.

[0047] The reference type refers to the semantic function type of a character, such as whether the last character has a specific semantic function in the semantic expression, such as semantic segmentation function, semantic enhancement function, etc.

[0048] After adding the reference subtexts to the initial substring one by one, after obtaining the reference substring, the reference type of the last character of the reference subtext added to the reference substring can be obtained. For example, the semantics of the reference substring where the last character is located can be parsed to determine whether the last character has a corresponding semantic function in the reference substring where it is located, so as to judge the reference type of the last character.

[0049] S105: Determine a processing result corresponding to the text to be processed according to the reference scale value, the reference type and the reference substring.

[0050] After each reference subtext is added, after the reference type of the last character of the added reference subtext is determined, the processing result corresponding to the text to be processed can be determined according to the reference scale value, the reference type and the 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 may be analyzed in combination with some processing rules, and based on the result of the analysis, it may be determined whether to select the reference substring as the processing result, and whether the processing result is determined based on the last character of the reference subtext added to the reference substring this time; or the reference scale value, reference type and reference substring may be processed based on artificial intelligence to determine the processing result corresponding to the text to be processed; or any other possible method may 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, word) comparison method, etc., without limitation.

[0052] In this embodiment, a text to be processed is obtained, and the text to be processed is processed based on a reference processing mode to obtain a plurality of 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, and at least one reference subtext among the plurality of reference subtexts is added to an initial substring to obtain a reference substring, and the reference substring has a corresponding reference scale value, wherein after each reference subtext is added, the reference type of the last character of the added reference subtext is determined, and a processing result corresponding to the text to be processed is determined according to the reference scale value, the reference type and the reference substring, and since the text to be processed is subjected to a second segmentation process, and in the second segmentation process, the reference type of the last character of the added reference subtext and the reference scale value of the reference substring are also referred to, thereby increasing the consideration dimension of text processing, thereby achieving improved text processing accuracy and improved text processing effect.

[0053] In some embodiments of the present disclosure, in the process of determining the processing result corresponding to the text to be processed according to the reference scale value, the reference type and the reference substring, the scale upper limit value can be obtained, wherein the scale upper limit value represents the maximum scale value of the substring, and the processing result corresponding to the text to be processed is determined according to the reference scale value, the scale upper limit value, the reference type and the reference substring. Thus, the processing result obtained by processing the text to be processed can be effectively adapted to downstream applications, supporting downstream applications suitable for personalization.

[0054] The upper limit value of the scale may be personalized according to the requirements of downstream applications, or the upper limit value of the scale may be personalized according to the requirements of text processing, and there is no restriction on this.

[0055] Figure 2 A flowchart of another text processing method provided by an embodiment of the present disclosure.

[0056] like Figure 2 As shown, the text processing method comprises:

[0057] S201: Obtain the text to be processed.

[0058] S202: Processing the text to be processed based on a reference processing mode to obtain a plurality of 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.

[0059] S203: Add at least one reference subtext from the 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, the reference type of the last character of the added reference subtext is determined.

[0061] For the description of S201 - S204 , please refer to the above embodiment for details, which will not be repeated here.

[0062] S205: Obtain a scale upper limit value, where the scale upper limit value represents a maximum scale value of the substring.

[0063] The upper limit value of the scale may be personalized according to the requirements of downstream applications, or the upper limit value of the scale may be personalized according to the requirements of text processing, and there is no restriction on this.

[0064] Optionally, in some embodiments, functional characteristics of downstream applications may be obtained and analyzed to find upper limits of scales that meet the functional characteristics of downstream applications. The upper limit of scales may be described specifically by the number of characters included in the substring, and there is no limitation on this.

[0065] S206: Determine whether the reference scale value reaches the scale upper limit value, and obtain a first determination result.

[0066] After obtaining the reference substring and determining the reference scale value corresponding to the reference substring, it is possible to determine whether the reference scale value reaches the scale upper limit value to obtain a first determination result. For example, it is possible to determine whether the number of characters corresponding to the reference scale value reaches the number of characters corresponding to the scale upper limit value to obtain a first determination result. The first determination result can be used to determine a processing result corresponding to the text to be processed.

[0067] S207: Determine whether the reference type is the first type, and obtain a second determination result, wherein the characters of the first type are used to perform semantic segmentation on the text to be processed.

[0068] After adding the reference subtext to the initial substring to obtain the reference substring, the reference type of the last character of the reference subtext added to the reference substring can be determined, and then it is determined whether the reference type is the same as the first type to obtain a second determination result. The first type of characters is used to perform semantic segmentation on the text to be processed. For example, the first type of characters can be, for example, semantic separators.

[0069] That is to say, 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 a processing result corresponding to the text to be processed according to the first determination result, the second determination result and the reference substring.

[0071] After the first determination result and the second determination result are obtained, the processing result corresponding to the text to be processed can be determined according to the first determination result, the second determination result and the reference substring.

[0072] Optionally, in some embodiments, in the process of determining the processing result corresponding to the text to be processed according to the first determination result, the second determination result and the reference substring, any of the following situations may be included: when 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; when 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, the processing result is generated according to the reference substring; when the first determination result is that the reference scale value does not reach the upper limit of the scale, the next reference subtext among the 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. In this way, the text to be processed is accurately segmented, so that the processing result can relatively completely carry the semantic information of the text to be processed, so that the downstream application can obtain more complete semantic information in the text.

[0073] Optionally, in some embodiments, in the process of generating a processing result according to a reference substring, when the reference substring does not include characters of the first type, the reference substring is used as the processing result, and when the reference substring includes characters of the first type, all characters before the characters of the first type in the reference substring are used as the processing result. Thus, the accuracy of the text segmentation process is greatly improved, and the semantic information carried in the text to be processed can be retained to the greatest extent.

[0074] In this embodiment, a text to be processed is obtained, and the text to be processed is processed based on a reference processing mode to obtain a plurality of 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, and at least one reference subtext among the plurality of reference subtexts is added to an initial substring to obtain a reference substring, and the reference substring has a corresponding reference scale value, wherein after each reference subtext is added, the reference type of the last character of the added reference subtext is determined, and a processing result corresponding to the text to be processed is determined according to the reference scale value, the reference type and the reference substring, and since the text to be processed is subjected to a second segmentation process, and in the second segmentation process, the reference type of the last character of the added reference subtext and the reference scale value of the reference substring are also referred to, thereby increasing the consideration dimension of text processing, thereby achieving improved text processing accuracy and improved text processing effect. By determining whether the reference scale value reaches the scale upper limit value, a first determination result is obtained, and determining whether the reference type is the first type, a second determination result is obtained, wherein the characters of the first type are used to semantically segment the text to be processed, and the processing result corresponding to the text to be processed is determined according to the first determination result, the second determination result and the reference substring. Thus, when segmenting the character string in the text, it can not only meet the personalized requirements of the downstream application for the input length (an optional example of the scale upper limit value), but also ensure that the original semantic information of the character string in the text is not truncated and destroyed as much as possible, so that the downstream application can obtain more complete semantic information in the text.

[0075] The examples for the above embodiment are as follows:

[0076] In the disclosed embodiment, when the character string is segmented by the number of words, continuous English characters and half-width characters (excluding spaces) can be regarded as one word, and if there are spaces in the middle, they are regarded as two different words. Chinese characters and full-width characters, each character is regarded as a word (or word). The character string can be traversed in order from beginning to end. During this process, it can be recorded whether the encountered characters are semantic delimiters (an optional example of the first type of characters). When the character cutting critical point (also referred to as the current truncation point) is traversed, that is, the substring length (an optional example of the reference scale value) reaches the set upper limit (an optional example of the scale upper limit 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 cut, otherwise the nearest semantic delimiter subscript in the preceding character is found and truncated to ensure the semantic integrity of the substring.

[0077] like Figure 3 As shown, Figure 3 It is a schematic diagram of the application process in the embodiment of the present 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) According to the cutting mode (an optional example of the reference processing mode), the character string input in step (1) is cut by characters or words to obtain a character array or a word array (wherein, multiple characters or multiple word arrays are an optional example of multiple reference sub-texts).

[0080] (3) Output the characters in the character array or the words in the word array in the loop step (2).

[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. The semantic separator is a symbol (character) that has a semantic segmentation function.

[0082] (5) Determine whether the current substring length after the current symbol is added is equal to the upper limit of the substring length specified in step (1). If not, jump to step (9).

[0083] (6) Determine whether the current substring has a delimiter recorded in step (4). If not, jump to step (8).

[0084] (7) All characters before (including) the last semantic delimiter of the current substring are intercepted as the determined substring and added to the result set (an optional example of the processing result). The loop subscript is modified to the position of the last semantic delimiter. A new substring is created and the process jumps to step (3) to continue looping the next character or word.

[0085] (8) Add the current substring to the result set and create a new substring.

[0086] (9) Determine whether there are more characters to be processed in the string loop. If so, jump to step (2) and continue looping for 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 A structural schematic diagram of a text processing device provided by 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 the 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.

[0093] The adding module 403 is configured to add at least one reference subtext from among the 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 determination module 404 is used to determine the reference type of the last character of the added reference subtext after each reference subtext is added.

[0095] The second determination module 405 is used to determine the processing result corresponding to the text to be processed according to the reference scale value, the reference type and the reference substring.

[0096] It should be noted that the above explanation of the text processing method is also applicable to the text processing device of this embodiment and will not be repeated here.

[0097] In this embodiment, a text to be processed is obtained, and the text to be processed is processed based on a reference processing mode to obtain a plurality of 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, and at least one reference subtext among the plurality of reference subtexts is added to an initial substring to obtain a reference substring, and the reference substring has a corresponding reference scale value, wherein after each reference subtext is added, the reference type of the last character of the added reference subtext is determined, and a processing result corresponding to the text to be processed is determined according to the reference scale value, the reference type and the reference substring, and since the text to be processed is subjected to a second segmentation process, and in the second segmentation process, the reference type of the last character of the added reference subtext and the reference scale value of the reference substring are also referred to, thereby increasing the consideration dimension of text processing, thereby achieving improved text processing accuracy and improved text processing effect.

[0098] As an example, Figure 5 is a schematic diagram of the structure of an electronic device shown in an exemplary embodiment of the present disclosure, such as Figure 5 As shown, the electronic device 700 may further include:

[0099] The memory 710 and the processor 720 , and the bus 730 connecting 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, the text processing method of the embodiment of the present disclosure is implemented.

[0100] Bus 730 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.

[0101] The electronic device 700 typically includes a variety of electronic device readable media. These media can be any available media that can be accessed by the 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 may be used to read and write non-removable, non-volatile magnetic media ( Figure 5 not shown, usually called 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, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 730 via one or more data medium interfaces. The memory 710 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present disclosure.

[0103] A program / utility 780 having a set (at least one) of program modules 770 may be stored, for example, in the memory 710, such program modules 770 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 770 generally perform the functions and / or methods of the embodiments described in the present disclosure.

[0104] The electronic device 700 may also communicate with one or more external devices 790 (e.g., keyboard, pointing device, display 791, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 700, and / or communicate with any device that enables the electronic device 700 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed through an input / output (I / O) interface 792. Furthermore, the electronic device 700 may also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN) and / or public network, such as the Internet) through a network adapter 793. As shown, the network adapter 793 communicates with other modules of the electronic device 700 through a bus 730. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the 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 the programs stored in the memory 710 .

[0106] It should be noted that the implementation process and technical principles of the electronic device of this embodiment refer to the aforementioned explanation of the text processing method of the embodiment of the present disclosure, and will not be repeated here.

[0107] In order to implement the above embodiments, the present 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 by the above embodiments.

[0108] In order to implement the above embodiments, the present disclosure further proposes a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the methods provided by the above embodiments.

[0109] In order to implement the above embodiments, the present disclosure also proposes a computer program product, including a computer program, which implements the methods provided by the above embodiments when executed by a processor.

[0110] The collection, storage, use, processing, transmission, provision and disclosure of user personal information involved in this disclosure shall comply with the relevant laws and regulations and shall not violate public order and good morals.

[0111] It should be noted that personal information from users should be collected for legitimate and reasonable purposes and should not be shared or sold outside of these legitimate uses. In addition, such collection / sharing should be carried out after receiving the user's informed consent, including but not limited to notifying the user to read the user agreement / user notice and sign the agreement / authorization including authorization of relevant user information before the user uses the function. In addition, any necessary steps should be taken to protect and safeguard access to such personal information data and ensure that others who have access to personal information data comply with its privacy policy and procedures.

[0112] The present disclosure anticipates providing implementation schemes for users to selectively block the use or access of personal information data. That is, the present disclosure anticipates providing hardware and / or software to prevent or block access to such personal information data. Once the personal information data is no longer needed, risks can be minimized by limiting data collection and deleting the data. In addition, when applicable, such personal information is de-identified to protect the privacy of the user.

[0113] In the description of the aforementioned embodiments, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.

[0114] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, "plurality" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0115] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present disclosure includes additional implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present disclosure belong.

[0116] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute the instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.

[0117] It should be understood that the various parts of the present disclosure can be implemented in hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used to implement: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0118] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0119] In addition, each functional unit in each embodiment of the present disclosure may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0120] The storage medium mentioned above may be a read-only memory, a disk or an optical disk, etc. Although the embodiments of the present disclosure have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations of the present disclosure. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present disclosure.

Claims

1. A text processing method, characterized in that: The following steps are involved: Get the text to be processed; Processing the text to be processed based on a reference processing mode to obtain a plurality of 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; Adding at least one reference subtext from the plurality of reference subtexts to the initial substring to obtain a reference substring, wherein the reference substring has a corresponding reference scale value; After each reference subtext is added, determining the reference type of the last character of the added reference subtext; and A processing result corresponding to the text to be processed is determined according to the reference scale value, the reference type and the reference substring.

2. The method according to claim 1, characterized in that The reference processing mode is a character processing mode or a word number processing mode, the processing type of the character processing mode is a character type, and the processing type of the word number processing mode is a word type or a word type; wherein the text to be processed is processed based on the reference processing mode to obtain a plurality of reference sub-texts, including: Segmenting the text to be processed based on the character processing mode to obtain the multiple reference sub-texts, wherein the type of the reference sub-texts is a character type; or The text to be processed is segmented based on the word count processing mode to obtain the multiple reference sub-texts, wherein the type of the reference sub-text is a character type or a 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 a reference substring includes: Determining the reference position order of the reference subtexts in the text to be processed; According to the reference position order of at least one reference subtext among the multiple reference subtexts, the corresponding reference subtext is added to the initial substring to obtain the reference substring.

4. The method according to claim 1, characterized in that The method further comprises: 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 determining of a processing result corresponding to the to-be-processed text according to the reference scale value, the reference type and the reference substring includes: Obtaining a scale upper limit value, wherein the scale upper limit value represents a maximum scale value of the substring; A processing result corresponding to the text to be processed is determined according to the reference scale value, the scale upper limit value, the reference type and the reference substring.

6. The method according to claim 5, characterized in that The determining of a processing result corresponding to the to-be-processed text according to the reference scale value, the scale upper limit value, the reference type and the reference substring includes: Determine whether the reference scale value reaches the scale upper limit value to obtain a first determination result; Determining whether the reference type is a first type, and obtaining a second determination result, wherein the characters of the first type are used to perform semantic segmentation on the text to be processed; A processing result corresponding to the text to be processed is determined according to the first determination result, the second determination result and the reference substring.

7. The method according to claim 6, characterized in that The determining a processing result corresponding to the to-be-processed text according to the first determination result, the second determination result and the reference substring includes: When the first determination result is that the reference scale value reaches the scale upper limit value, and the second determination result is that the reference type is the first type, taking the reference substring as the processing result; When the first determination result is that the reference scale value reaches the scale upper limit value, and the second determination result is that the reference type is not the first type, generating the processing result according to the reference substring; When the first determination result is that the reference scale value does not reach the scale upper limit value, a next reference subtext among the 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 scale upper limit value.

8. The method according to claim 7, characterized in that The generating the processing result according to the reference substring includes: In a case where the reference substring does not include the first type of characters, taking the reference substring as the processing result; In a case where the reference substring includes the first type of characters, all characters before the first type of characters in the reference substring are taken as the processing result.

9. A text processing device, characterized in that: include: An acquisition module is used to obtain the text to be processed; A processing module, used for processing the text to be processed based on a reference processing mode to obtain a plurality of 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, configured to add at least one reference subtext of the plurality of reference subtexts to the initial substring to obtain a reference substring, wherein the reference substring has a corresponding reference scale value; A first determination module, configured to determine the reference type of the last character of the added reference subtext after each reference subtext is added; The second determination module is used to determine a processing result corresponding to the text to be processed according to the reference scale value, the reference type and the reference substring.

10. An electronic device, characterized in that: include: 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 according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 8 when executed by a processor.

12. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 8 when being executed by a processor.

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

  • Text processing method, device and equipment

    CN114722806A

  • Text processing method and device, electronic equipment and computer readable storage medium

    CN115688797A

  • Language model pre-training method and device, electronic equipment and storage medium

    CN115994530A