Text processing method, device, electronic device and storage medium

By matching the results and scene type determination module, combining the rule system and classification model, the accuracy problem when converting Chinese numerical text to Arabic numerals is solved, and more efficient and accurate conversion processing is achieved.

CN114444445BActive Publication Date: 2025-08-26BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210123167.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-07
Publication Date
2025-08-26
Estimated Expiration
2042-02-07

AI Technical Summary

Technical Problem

When converting Chinese numerical text into Arabic numerals, conversion errors are prone to occur, especially the inability to accurately judge the necessity and scene type of conversion, resulting in inaccurate conversion.

Method used

The matching result determination module and the scene type determination module are used to determine the matching result and scene type of the to-be-processed text and the predetermined target text, and combine the rule system and classification model to accurately determine whether conversion is needed.

Benefits of technology

Improve the accuracy of converting Chinese numeric text into Arabic numerals, avoiding the incorrect conversion of text without conversion, simplifying the computing resource requirements, and improving processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114444445B_ABST
    Figure CN114444445B_ABST
Patent Text Reader

Abstract

This disclosure provides a text processing method, apparatus, electronic device, and storage medium, relating to the field of artificial intelligence technology, particularly deep learning and speech technology. The specific implementation scheme comprises: determining a match between a to-be-processed text and a predetermined target text; determining a scenario type for the to-be-processed text; and determining an output result for the to-be-processed text based on the match result and the scenario type.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, in particular to the fields of deep learning and voice technology. More specifically, the present disclosure provides a text processing method, device, electronic device, storage medium and computer program product. Background Art

[0002] In the fields of speech recognition and image text recognition, it is necessary to convert Chinese text representing numbers in the recognition results into Arabic numerals to facilitate intuitive reading and subsequent processing. For example, "runway length three thousand meters" can be converted into "runway length 3000" or "dial one one zero" can be converted into "dial 110." Summary of the Invention

[0003] The present disclosure provides a text processing method, apparatus, electronic device, storage medium, and computer program product.

[0004] According to one aspect of the present disclosure, a text processing device is provided, comprising a matching result determination module for determining a matching result between a text to be processed and a predetermined target text; a scene type determination module for determining a scene type for the text to be processed; and an output result determination module for determining an output result for the text to be processed based on the matching result and the scene type.

[0005] According to another aspect of the present disclosure, a text processing device is provided, comprising a matching result determination module, a scene type determination module, and an output result determination module. The matching result determination module is configured to determine a matching result between a to-be-processed text and a predetermined target text. The scene type determination module is configured to determine a scene type for the to-be-processed text. The output result determination module is configured to determine an output result for the to-be-processed text based on the matching result and the scene type.

[0006] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method provided by the present disclosure.

[0007] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause a computer to execute the method provided by the present disclosure.

[0008] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, which implements the method provided in the present disclosure when executed by a processor.

[0009] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] The accompanying drawings are provided to facilitate a better understanding of the present invention and do not constitute a limitation of the present disclosure.

[0011] Figure 1 is a schematic diagram of an application scenario of the text processing method and apparatus according to an embodiment of the present disclosure;

[0012] Figure 2 is a schematic flow chart of a text processing method according to an embodiment of the present disclosure;

[0013] Figure 3 is a schematic diagram of a WFST module according to an embodiment of the present disclosure;

[0014] Figure 4 is a schematic diagram of a classification model according to an embodiment of the present disclosure;

[0015] Figure 5 is a schematic diagram of a text processing method according to an embodiment of the present disclosure;

[0016] Figure 6 is a schematic structural block diagram of a text processing device according to an embodiment of the present disclosure; and

[0017] Figure 7 It is a structural block diagram of an electronic device used to implement the text processing method of an embodiment of the present disclosure. DETAILED DESCRIPTION

[0018] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0019] In some embodiments, a rule system may be used to convert the results of speech recognition or image recognition. For example, a rule may be pre-set such that, if it is determined that the text to be processed includes Chinese text representing numbers, the Chinese text representing numbers is converted into Arabic numerals.

[0020] However, whether the same Chinese text representing a number needs to be converted depends on the text's semantics. Some Chinese text representing numbers needs to be converted to Arabic numerals, for example, "the runway length is three thousand meters" needs to be converted to "the runway length is 3000." Other Chinese text representing numbers does not need to be converted to Arabic numerals, for example, "my white hair is three thousand feet long, and my sorrow is as long as it" does not need to be converted to "my white hair is three thousand feet long, and my sorrow is as long as it."

[0021] Therefore, when the above technical solution is used to convert the recognition results, conversion errors may occur.

[0022] Figure 1 Schematic diagram of an application scenario of the text processing method and apparatus according to an embodiment of the present disclosure.

[0023] It should be noted that Figure 1 The examples shown are merely examples of system architectures to which the embodiments of the present disclosure may be applied, to help those skilled in the art understand the technical content of the present disclosure, but do not mean that the embodiments of the present disclosure may not be used in other devices, systems, environments or scenarios.

[0024] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.

[0025] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Terminal devices 101, 102, and 103 can be various electronic devices with display screens and support web browsing, including but not limited to smartphones, tablet computers, laptop computers, and desktop computers, etc.

[0026] Server 105 may be a server that provides various services, such as a background management server (for example only) that supports websites browsed by users using terminal devices 101, 102, and 103. The background management server may analyze and process received data such as user requests, and feed back processing results (such as transcription results generated based on user speech) to the terminal device.

[0027] It should be noted that the text processing method provided by the embodiments of the present disclosure can generally be executed by the server 105. Correspondingly, the text processing device provided by the embodiments of the present disclosure can generally be set in the server 105. The text processing method provided by the embodiments of the present disclosure can also be executed by a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and / or the server 105. Correspondingly, the text processing device provided by the embodiments of the present disclosure can also be set in a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and / or the server 105.

[0028] It should be understood that Figure 1 the numbers of terminal devices, networks, and servers in

[0029] Figure 2 is a schematic flowchart of the text processing method according to the embodiments of the present disclosure.

[0030] As Figure 2 shown, the text processing method 200 may include operations S210 to S230.

[0031] In operation S210, determine the matching result between the text to be processed and the predetermined target text.

[0032] The predetermined target text may include Chinese texts representing numbers, such as "one one zero", "one two zero", etc.

[0033] Correspondingly, the matching result may include a number matching result, and the number matching result is divided into two cases: success and failure. For example, if the text to be processed includes a Chinese text representing a number, it is determined that the number matching result is a successful match. If the text to be processed does not include a Chinese text representing a number, it is determined that the number matching result is a failed match.

[0034] The predetermined target text may include a predetermined context for the Chinese text. The predetermined context may include at least one of a predetermined prefix in front of the Chinese text representing a number and a predetermined suffix behind the Chinese text representing a number. The predetermined prefix may include texts such as "call", "dial", "the length is", "the length is approximately", "the width is", "the area is approximately", etc. The predetermined suffix may include measurement units, such as "meter", "square meter", "year", "month", "day", "yuan", etc.

[0035] Accordingly, the matching result may include a context matching result, and the context matching result is divided into two cases: success and failure. The conditions for determining that the context matching result is a successful match may include at least one of the following: the prefix of the Chinese text representing the number is the same as at least one of the predetermined prefixes, the suffix of the Chinese text is the same as at least one of the predetermined suffixes, the similarity between the prefix of the Chinese text and the predetermined prefix is ​​greater than a first threshold, and the similarity between the suffix of the Chinese text and the predetermined suffix is ​​greater than a second threshold. The conditions for determining that the context matching result is a failed match may include: the prefix of the Chinese text is different from the predetermined prefix and the suffix of the Chinese text is different from the predetermined suffix.

[0036] It should be noted that, compared with the method of determining the context matching result by similarity, the method of comparing whether the prefix is ​​the same as the predetermined prefix and comparing whether the suffix is ​​the same as the predetermined suffix can more simply and accurately determine the matching result.

[0037] It should be noted that there can be no text between the predetermined prefix or suffix and the Chinese text, or there can be multiple texts. For example, if the text to be processed is "The length of the second runway is twice that of the previous runway, which is four hundred," in the recognition result, there are multiple texts between the predetermined prefix "Length is" and the Chinese text "four hundred," and the context matching result is a successful match.

[0038] In operation S220 , a scene type for the text to be processed is determined.

[0039] Scene types can include poetry, dates, currency, place names, personal names, etc. For example, the scene type of "My hair is three thousand feet long, and my sorrow is as long as it" is poetry, and the scene type of "January 1, 2022" is a date, and the scene type of "I have about twenty coins in my wallet" is currency.

[0040] In one example, recognition words and corresponding scene types can be pre-set. For example, the pre-set recognition words include "change," "transfer," and "remittance," and the scene type is currency. The text to be processed is then compared with the pre-set recognition words. If the text to be processed includes the pre-set recognition words, the scene type of the recognition words is determined to be the scene type for the text to be processed.

[0041] In another example, the similarity between the text to be processed and each of a plurality of predetermined scene texts can be determined to obtain multiple similarities, each of which corresponds to type information indicating the type of the actual scene. The type information corresponding to the maximum similarity is then determined as the scene type for the text to be processed. It should be understood that if a predetermined scene text a corresponds to type information b, and the similarity between the text to be processed and the predetermined scene text a is the maximum similarity, the type information b corresponds to the maximum similarity.

[0042] For example, some samples are collected in advance, which may include Chinese text representing numbers, and then labels are set for the samples with type information indicating the type of real scene. The samples can be cleaned, for example, by removing punctuation marks, rare characters, and stop words in the text. The classification model is then trained using the samples to obtain a trained classification model. The text to be processed can then be input into the classification model, and the classification model extracts the text vector of the text to be processed. The text vector can represent the sentence meaning of the text to be processed. The classification model can be implemented using, for example, BERT (Bidirectional Encoder Representations from Transformers).

[0043] The similarity between the text vector and the feature vectors of the pre-extracted sample can then be calculated. This similarity can represent the probability that the text to be processed belongs to each predetermined scene type. The predetermined scene type with the highest probability value is then selected from the multiple probabilities obtained as the scene type of the text to be processed.

[0044] In another example, if the maximum similarity among multiple similarities is determined to be greater than or equal to a similarity threshold, the type information corresponding to the maximum similarity may be determined as the scene type for the text to be processed. Because a similarity threshold is set, if the maximum similarity is less than the similarity threshold, it indicates that the scene type of the samples used to train the classification model does not cover the scene type of the text to be processed. In this case, the classification model cannot accurately determine the scene type of the text to be processed, and therefore, the text to be processed may not be converted.

[0045] In operation S230 , an output result for the text to be processed is determined according to the matching result and the scene type.

[0046] In one example, when the number matching result is a match failure, it means that the text to be processed does not include Chinese text representing a number, and the Chinese text may not be converted.

[0047] In another example, if the numeric matching result is a successful match and the context matching result is a successful match, the Chinese text can be converted into numeric text and the numeric text is determined as the output result. The numeric text includes Arabic characters.

[0048] In another example, if the numeric matching result is a successful match, the context matching result is a failed match, and the scene type is one of multiple predetermined scene types, the Chinese text is converted into numeric text and the numeric text is determined as the output result. Predefined scene types may include dates, currencies, etc. This example combines scene information to determine the transcription result of the text to be processed, thereby improving the accuracy of the transcription.

[0049] In another example, when the digital matching result is a successful match, the context matching result is a failed match, and the scenario type is not any one of multiple predetermined scenario types, the Chinese text is determined as the output result. For example, if the scenario type is any one of poetry, place names, and personal names, and the above scenario types do not belong to the predetermined scenario types, no conversion operation needs to be performed on the Chinese text. This example combines scenario information to determine the transcription result of the text to be processed, which can improve the accuracy of transcription.

[0050] According to the embodiments provided by the present disclosure, for the case where the context matching result is a successful match, it can be quickly determined that the text to be processed needs to be converted. For the case where the context matching result is a failed match, it means that the predetermined context cannot cover the context of the text to be processed. The text to be processed can be processed in combination with the scenario type, thereby improving the accuracy of the output result and avoiding transcribing text that does not need to be transcribed into digital text. For example, avoiding transcribing "White hair three thousand zhang" into "White hair 3000 zhang". In addition, when using a classification model to determine the scenario type, a large number of samples for training the classification model can be simply obtained. The classification task is simple, with low complexity and good universality.

[0051] It should be noted that the present disclosure embodiments do not limit the execution order of operation S210 and operation S220.

[0052] In one example, operation S210 and operation S220 can be executed in parallel.

[0053] In another example, operation S220 can be executed first, and then operation S210.

[0054] In another example, operation S210 can be executed first. Then, when the matching result indicates that the text to be processed includes Chinese text representing numbers and the context for the Chinese text fails to match the predetermined context, operation S220 is executed. When the matching result indicates that the text to be processed does not include Chinese text representing numbers, or the matching result indicates that the text to be processed includes Chinese text representing numbers and the context for the Chinese text successfully matches the predetermined context, the scenario information of the text to be processed does not need to be determined.

[0055] Adopting the technical solutions in the above examples, the text to be processed that does not need to determine the scenario type can be filtered in advance, thereby reducing the computing resources required to determine the scenario type. For example, reducing the computing resources required to calculate similarity and improving the processing efficiency.

[0056] According to another embodiment provided by the present disclosure, a rule system can be used to determine the matching result between the text to be processed and the predetermined target text.

[0057] In one example, the rule system can be implemented using a WFST (Weighted Finite State Transducer) module. The text to be processed is input into the WFST module, and the WFST module determines the matching result of the text to be processed. The WFST module can also convert the Chinese text representing numbers in the text to be processed into digital text and output the digital text.

[0058] Figure 3 It is a schematic diagram of the WFST module according to an embodiment of the present disclosure.

[0059] As Figure 3 shown, the figure shows a total of 8 nodes from "0" to "7". Two nodes are connected by an edge, and the text on the edge represents the input and output. For example, "one: 110" means the input is "one" and the output is "110". In the figure, " <eps>"It means the output result is empty.

[0060] Eight nodes form four paths. The first path passes through nodes 0, 1, 2, and 3 in sequence. Among them, nodes 1 and 2 are connected by edge 301. Therefore, when the text to be processed includes "one one zero", the text to be processed matches the first path, and the WFST module can transcribe "one one zero" into "110". The second path passes through nodes 0, 1, 2, and 3, and nodes 1 and 2 are connected by edge 302. Therefore, when the text to be processed includes "one two zero", the text to be processed matches the second path, and the WFST module can transcribe "one two zero" into "120". The third path passes through nodes 0, 4, 5, 6, and 7, and nodes 5 and 6 are connected by edge 303. Therefore, when the text to be processed includes "one hundred and ten", the text to be processed matches the third path, and the WFST module can transcribe "one hundred and ten" into "110". The fourth path passes through nodes 0, 4, 5, 6, and 7, and nodes 5 and 6 are connected by edge 304. Therefore, when the text to be processed includes "one hundred and twenty", the text to be processed matches the fourth path, and the WFST module can transcribe "one hundred and twenty" into "120".

[0061] In other examples, the rule system can also be implemented using several pre-written regular expressions.

[0062] Figure 4 It is a schematic diagram of the classification model according to an embodiment of the present disclosure.

[0063] In this embodiment 400, the classification model 401 can be trained in advance using samples to obtain the trained classification model 401. The feature vectors 440 of samples belonging to a predetermined scenario type can be extracted in advance using the classification model 401 and stored.

[0064] The text to be processed 410 can be cleaned, for example, by deleting punctuation marks, rare characters, stop words, etc. in the text to obtain the cleaned text 420. Then the cleaned text 420 can be input into the classification model 401, and the classification model 401 extracts the text vector 430 of the cleaned text 420. The feature vectors 440 of samples can be called, and the similarity between the feature vectors 440 of samples and the text vector 430 of the cleaned text 420 can be calculated to obtain multiple similarities 450. Then, when it is determined that the maximum similarity among the multiple similarities 450 is greater than or equal to the similarity threshold, the type information corresponding to the maximum similarity is determined as the scenario type 460 for the text to be processed 410. The similarity threshold can be set as needed. For example, the similarity threshold can be set to 0.75.

[0065] Figure 5 It is a schematic diagram of a text processing method according to an embodiment of the present disclosure.

[0066] In this embodiment 500, the rule system 501 can be used to determine the matching result of the to-be-processed text 510. The matching result can include the digital matching result and the context matching result described above. The rule system can output a weight value to represent the determined matching result.

[0067] For example, the weight value output by the rule system 501 is empty, indicating that the digital matching result is a matching failure. The text to be processed 510 may not be transcribed, and the original text 520a of the text to be processed 510 may be used as the output result.

[0068] For example, the weight value output by the rule system 501 is 1, indicating that the digital matching result is a successful match, and the context matching result is a successful match. The Chinese text included in the text to be processed 510 can be converted into digital text 520b, and the digital text 520b can be used as the output result.

[0069] For example, the rule system output weight value is 0, indicating that the digital matching result is a successful match, and the context matching result is a failed match. The Chinese text included in the text to be processed 510 can be converted into digital text 520c. In addition, the text to be processed 510 can be input into the classification model 502 to determine the scene type 530 of the text to be processed 510. When the scene type 530 is one of a plurality of predetermined scene types, the predetermined digital text 520c can be used as the output result. When the scene type 530 is not any one of the plurality of predetermined scene types, the text to be processed 510 can be not transcribed, and the original text 520d of the text to be processed 510 can be used as the output result.

[0070] In one example, the rule system may be implemented using the WFST module described above, but the embodiments of the present disclosure are not limited thereto.

[0071] Figure 6 4 is a schematic structural block diagram of a text processing device according to an embodiment of the present disclosure.

[0072] like Figure 6 As shown, the text processing apparatus 600 may include a matching result determination module 610 , a scene type determination module 620 , and an output result determination module 630 .

[0073] The matching result determination module 610 is used to determine the matching result between the text to be processed and the predetermined target text.

[0074] The scene type determination module 620 is used to determine the scene type of the text to be processed.

[0075] The output result determination module 630 is used to determine the output result for the text to be processed according to the matching result and the scene type.

[0076] According to another embodiment of the present disclosure, the output result determination module includes a conversion submodule and a first output result determination submodule. The conversion submodule is configured to convert the Chinese text into digital text when the matching result indicates that the to-be-processed text includes Chinese text representing a number, the context of the Chinese text fails to match a predetermined context, and the scene type is one of a plurality of predetermined scene types. The first output result determination submodule is configured to determine the digital text as the output result.

[0077] According to another embodiment of the present disclosure, the output result determination module includes a second output result determination submodule, which is used to determine the Chinese text as the output result when the matching result indicates that the text to be processed includes Chinese text representing numbers and the context of the Chinese text fails to match the predetermined context, and the scene type is not any one of multiple predetermined scene types.

[0078] According to another embodiment of the present disclosure, the scene type determination module includes a similarity determination submodule and a scene type determination submodule. The similarity determination submodule is configured to determine the similarity between the text to be processed and each of a plurality of predetermined scene texts, thereby obtaining a plurality of similarities; wherein each predetermined scene text corresponds to type information indicating a real scene type. The scene type determination submodule is configured to, if a maximum similarity among the plurality of similarities is determined to be greater than or equal to a similarity threshold, determine the type information corresponding to the maximum similarity as the scene type for the text to be processed.

[0079] According to another embodiment of the present disclosure, the scene type determination module is further configured to determine the scene type for the text to be processed when the matching result indicates that the text to be processed includes Chinese text representing numbers and the context of the Chinese text fails to match the predetermined context.

[0080] According to another embodiment of the present disclosure, the condition for determining whether the context of the Chinese text successfully matches the predetermined context includes at least one of the following: the prefix of the Chinese text is the same as the predetermined prefix; and the suffix of the Chinese text is the same as the predetermined suffix.

[0081] In the technical solutions disclosed herein, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0082] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0083] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0084] like Figure 7 As shown, the device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. Various programs and data required for the operation of the device 700 can also be stored in the RAM 703. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0085] Various components in device 700 are connected to I / O interface 705, including an input unit 706, such as a keyboard, mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a magnetic disk, optical disk, etc.; and a communication unit 709, such as a network card, modem, wireless communication transceiver, etc. The communication unit 709 allows device 700 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0086] The computing unit 701 can be a variety of general-purpose and / or specialized processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the various methods and processes described above, such as the text processing method. For example, in some embodiments, the text processing method can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as the storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the text processing method described above can be performed. Alternatively, in other embodiments, the computing unit 701 can be configured to perform the text processing method by any other suitable means (e.g., via firmware).

[0087] Various embodiments of the systems and techniques described above can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0088] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0089] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0090] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0091] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0092] Computer systems may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The client and server relationship arises through computer programs running on the respective computers and having a client-server relationship to each other.

[0093] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not a limitation herein.

[0094] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.< / eps>

Claims

1. A text processing method, comprising: Determine the matching result between the text to be processed and the predetermined target text; Determining a scenario type for the text to be processed; as well as Determine the output result for the text to be processed according to the matching result and the scene type, Wherein, determining the output result for the to-be-processed text according to the matching result and the scene type includes: In a case where the matching result indicates that the to-be-processed text includes Chinese text representing a number and the context of the Chinese text fails to match a predetermined context, and the scene type is one of a plurality of predetermined scene types, converting the Chinese text into a digital text, wherein the predetermined context includes at least one of a predetermined prefix located in front of the Chinese text and a predetermined suffix located after the Chinese text, and a condition for the context of the Chinese text failing to match the predetermined context includes: the prefix of the Chinese text is different from the predetermined prefix and the suffix of the Chinese text is different from the predetermined suffix; and determining the digital text as the output result, The step of determining the scene type for the text to be processed includes: Determining a similarity between the to-be-processed text and each predetermined scene text of a plurality of predetermined scene texts to obtain a plurality of similarities, wherein each predetermined scene text corresponds to type information indicating a real scene type; and In the case where it is determined that the maximum similarity among the multiple similarities is greater than or equal to the similarity threshold, the type information corresponding to the maximum similarity is determined as the scene type for the text to be processed.

2. The method according to claim 1, wherein Determining an output result for the text to be processed according to the matching result and the scene type includes: When the matching result indicates that the text to be processed includes Chinese text representing a number and the context of the Chinese text fails to match a predetermined context, and the scene type is not any one of multiple predetermined scene types, the Chinese text is determined as the output result.

3. The method according to claim 1 or 2, wherein The determining of the scene type for the text to be processed includes: When the matching result indicates that the text to be processed includes Chinese text representing a number and the context of the Chinese text fails to match a predetermined context, a scene type for the text to be processed is determined.

4. A text processing device comprising: A matching result determination module is used to determine the matching result between the text to be processed and the predetermined target text; A scene type determination module, configured to determine a scene type for the text to be processed; as well as An output result determination module is used to determine the output result for the text to be processed based on the matching result and the scene type. Wherein, the output result determination module includes: a conversion submodule, configured to, if the matching result indicates that the to-be-processed text includes Chinese text representing a number and the context of the Chinese text fails to match a predetermined context, and the scene type is one of a plurality of predetermined scene types, convert the Chinese text into digital text, wherein the predetermined context includes at least one of a predetermined prefix located in front of the Chinese text and a predetermined suffix located after the Chinese text, and a condition for the context of the Chinese text failing to match the predetermined context includes: the prefix of the Chinese text is different from the predetermined prefix and the suffix of the Chinese text is different from the predetermined suffix; and The first output result determination submodule is configured to determine the digital text as the output result. The scene type determination module includes: a similarity determination submodule, configured to determine a similarity between the text to be processed and each of a plurality of predetermined scene texts, to obtain a plurality of similarities; wherein each of the predetermined scene texts corresponds to type information indicating a real scene type; and The scene type determination submodule is configured to, when it is determined that the maximum similarity among the multiple similarities is greater than or equal to a similarity threshold, determine the type information corresponding to the maximum similarity as the scene type for the text to be processed.

5. The device according to claim 4, wherein The output result determination module includes: The second output result determination submodule is used to determine the Chinese text as the output result when the matching result indicates that the text to be processed includes Chinese text representing a number and the context of the Chinese text fails to match the predetermined context, and the scene type is not any one of multiple predetermined scene types.

6. The device according to claim 4 or 5, wherein: The scene type determination module is further configured to: When the matching result indicates that the text to be processed includes Chinese text representing a number and the context of the Chinese text fails to match a predetermined context, a scene type for the text to be processed is determined.

7. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 3.

8. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 3.

9. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Digital conversion method and system, text processing method and system, equipment and medium

    CN111931508A