Natural language processing method, apparatus, device, storage medium, and program product

By detecting the word order rationality and language fluency of natural language string data, a language completeness index is determined, which solves the problem of insufficient fluency and completeness in natural language processing and achieves more efficient language processing.

CN119578402BActive Publication Date: 2026-07-10CHINA MOBILE INTERNET CO LTD +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA MOBILE INTERNET CO LTD
Filing Date
2024-10-28
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

Existing natural language processing methods ignore the contextual information of words or phrases in sentences or texts, resulting in a lack of fluency and completeness in the generated language, which affects processing efficiency.

Method used

By detecting the word order rationality and language fluency of natural language string data, calculating the word order rationality coefficient and language fluency coefficient, determining the language integrity index, and adjusting the natural language according to the index.

Benefits of technology

It improves the integrity and processing efficiency of natural language, making the output language more in line with system usage standards.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119578402B_ABST
    Figure CN119578402B_ABST
Patent Text Reader

Abstract

This application discloses a natural language processing method, apparatus, device, storage medium, and program product, belonging to the field of natural language processing technology. The method includes: in response to natural language input into a target application, acquiring string data corresponding to the natural language; performing a word order rationality test on the string data to obtain a word order rationality coefficient; performing a language fluency test on the string data to obtain a language fluency coefficient; determining a language completeness index based on the language rationality coefficient and the language fluency coefficient; and adjusting the natural language based on the language completeness index to obtain the output language. This method ensures that the final output language has good completeness, thereby meeting system usage standards and improving the efficiency of natural language processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of natural language processing technology, and in particular to a natural language processing method, apparatus, device, storage medium, and program product. Background Technology

[0002] Natural Language Processing (NLP), as an important branch of artificial intelligence, has made significant progress. Through technologies such as deep learning and machine learning, NLP systems are now capable of handling complex natural language tasks, such as text classification, sentiment analysis, entity recognition, and machine translation. However, related NLP methods often focus only on information from individual words or phrases, neglecting their contextual information within sentences or discourse. This results in generated language lacking fluency and completeness, impacting the efficiency of natural language processing. Summary of the Invention

[0003] This application provides a natural language processing method, apparatus, device, storage medium, and program product to at least solve the problems of lack of fluency and completeness in the natural language generated in the prior art, and the low efficiency of natural language processing.

[0004] To solve the above-mentioned technical problems, this application is implemented as follows:

[0005] In a first aspect, embodiments of this application provide a natural language processing method, comprising: in response to natural language input in a target application, acquiring string data corresponding to the natural language; performing a word order rationality detection on the string data to obtain a word order rationality coefficient; performing a language fluency detection on the string data to obtain a language fluency coefficient; wherein the word order rationality coefficient is used to indicate the rationality of the word order among the strings in the string data; the language fluency coefficient is used to indicate the language fluency of the strings in the string data; determining a language completeness index based on the language rationality coefficient and the language fluency coefficient; and adjusting the natural language based on the language completeness index to obtain an output language.

[0006] Secondly, embodiments of this application provide a natural language processing apparatus, comprising: an acquisition module, configured to acquire string data corresponding to natural language input in a target application; a detection module, configured to perform word order rationality detection on the string data to obtain a word order rationality coefficient; and perform language fluency detection on the string data to obtain a language fluency coefficient; wherein the word order rationality coefficient is used to indicate the rationality of word order among the strings in the string data; and the language fluency coefficient is used to indicate the fluency of language among the strings in the string data; a determination module, configured to determine a language completeness index based on the language rationality coefficient and the language fluency coefficient; and an adjustment module, configured to adjust the natural language based on the language completeness index to obtain an output language.

[0007] Thirdly, embodiments of this application provide an electronic device, including a processor and a memory, wherein the memory stores a program or instructions that can run on the processor, and when the program or instructions are executed by the processor, they implement the steps of the method described in the first aspect above.

[0008] Fourthly, embodiments of this application provide a computer-readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect above.

[0009] Fifthly, embodiments of this application provide a computer program product, the computer program product including a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, which, when executed by a computer, cause the computer to perform the steps of the method described in the first aspect above.

[0010] In this embodiment, in response to natural language input in the target application, string data corresponding to the natural language is obtained; the string data is subjected to word order rationality detection to obtain a word order rationality coefficient; the string data is subjected to language fluency detection to obtain a language fluency coefficient; based on the language rationality coefficient and the language fluency coefficient, a language completeness index is determined; based on the language completeness index, the natural language is adjusted to obtain the output language. Thus, by performing word order rationality and language fluency detection on the string data corresponding to the natural language, a language completeness index is determined. This language completeness index reflects the degree of word order rationality and language fluency among the strings in the string data, allowing for a more comprehensive measurement of the completeness of the natural language. Furthermore, by adjusting the natural language based on the language completeness index, the final output language has better completeness, thereby meeting system usage standards and improving the processing efficiency of natural language.

[0011] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0012] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0013] Figure 1 A flowchart illustrating the natural language processing method provided in an embodiment of this application is shown;

[0014] Figure 2 A flowchart illustrating the natural language preprocessing method provided in an embodiment of this application is shown;

[0015] Figure 3 A flowchart illustrating the method for determining the rationality coefficient of word order provided in an embodiment of this application is shown.

[0016] Figure 4 A flowchart illustrating the method for determining the fluency coefficient provided in an embodiment of this application is shown.

[0017] Figure 5 A schematic diagram of the structure of the natural language processing device provided in an embodiment of this application is shown;

[0018] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation

[0019] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0020] Figure 1This illustration shows a flowchart of a natural language processing method provided in an embodiment of this application. The execution subject of this method can be a terminal device or a server. The terminal device can be a personal computer, a mobile terminal device such as a mobile phone or tablet, or a user-used terminal device. The server can be a standalone server or a server cluster composed of multiple servers. Furthermore, the server can be a backend server for a specific business function, or a backend server for a platform or application (e.g., a machine translation platform, a text editing application, a chatbot, an intelligent customer service system, etc.). This embodiment uses a terminal device as the execution subject for illustration. For the server case, the following related content can be used, and it will not be repeated here. As shown in the figure, the natural language processing method 100 may include the following steps:

[0021] Step 101: In response to the natural language input in the target application, obtain the string data corresponding to the natural language.

[0022] In practice, natural language is input into the target application installed on the target terminal. This target application can be a text editing application, a machine translation application, a chatbot, etc. The natural language is preprocessed to obtain the corresponding string data.

[0023] Step 102: Perform a word order rationality test on the string data to obtain a word order rationality coefficient; perform a language fluency test on the string data to obtain a language fluency coefficient.

[0024] The word order rationality coefficient is used to indicate the rationality of the word order among the strings in the string data; the language fluency coefficient is used to indicate the language fluency of the strings in the string data.

[0025] In practice, string data can be input into a pre-built mathematical model for word order arrangement. This model then performs a word order rationality test on the string data to obtain a word order rationality coefficient, which indicates the degree of rationality of the word order among the strings in the string data. Alternatively, string data can be input into a pre-built mathematical model for language arrangement. This model then performs a language fluency test on the string data to obtain a language fluency coefficient, which indicates the degree of fluency of the language among the strings in the string data.

[0026] In this way, by using the word order rationality coefficient to measure the rationality of the word order among the strings in the string data, and the language fluency coefficient to measure the language fluency of the strings in the string data, the integrity of natural language can be quantified, providing a basis for subsequent natural language adjustments.

[0027] Step 103: Determine the language completeness index based on the language rationality coefficient and language fluency coefficient.

[0028] In practice, the language rationality coefficient and language fluency coefficient can be calculated to obtain the language completeness index. For example, the sum of the language rationality coefficient and the language fluency coefficient can be determined as the language completeness index. Alternatively, the language rationality coefficient and the language fluency coefficient can be normalized, and the language completeness index can be determined based on the normalized language rationality coefficient and language fluency coefficient.

[0029] In this way, by combining word order rationality and language fluency to measure the integrity of natural language, we can provide a clear direction for subsequent modification and optimization of natural language, so that the final output language has better integrity.

[0030] Step 104: Adjust the natural language according to the language completeness index to obtain the output language.

[0031] In practice, the natural language can be adjusted in terms of word order and optimized based on the language completeness index to obtain the output language. The output language is then transmitted to the terminal device, which can then perform recognition, analysis, and translation, thereby improving the efficiency of natural language processing.

[0032] In this way, by performing word order rationality and language fluency tests on the string data corresponding to natural language, a language completeness index is determined. This language completeness index can reflect the degree of word order rationality and language fluency among the strings in the string data, and can more comprehensively measure the completeness of natural language. Then, the natural language can be adjusted according to the language completeness index so that the final output language has better completeness, thereby meeting the system usage standards and improving the processing efficiency of natural language.

[0033] In one possible implementation, step 101 above, obtaining the string data corresponding to the natural language, includes:

[0034] The natural language is preprocessed to obtain preprocessed natural language; the preprocessed natural language is converted into a vector representation to obtain a target vector; the target vector is decoded to obtain the string data corresponding to the natural language.

[0035] In this embodiment of the application, preprocessing operations such as text cleaning and data standardization are performed on the natural language to obtain preprocessed natural language; the preprocessed natural language is converted into executable string data through an encoder and a decoder, wherein the encoder is used to encode the natural language input into a target vector of fixed length, and the decoder is used to decode the target vector into string data of the target programming language, which includes multiple strings.

[0036] Optionally, the above-described preprocessing operations on the natural language to obtain preprocessed natural language include:

[0037] The natural language is preprocessed to obtain secondary natural language; the precision and recall are determined based on the number of first sentences extracted from the natural language and the number of second sentences extracted from the secondary natural language.

[0038] If the precision and recall meet the preset conditions, the secondary natural language is determined as preprocessed natural language;

[0039] If the precision and recall fail to meet the preset conditions, the secondary natural language is reprocessed until the precision and recall meet the preset conditions. The reprocessed secondary natural language is then identified as the preprocessed natural language.

[0040] In one exemplary embodiment, such as Figure 2 As shown, the above-mentioned natural language preprocessing method includes the following steps:

[0041] Step 1011: Perform preprocessing operations such as text cleaning and data standardization on the natural language to obtain secondary natural language;

[0042] Step 1012: Randomly select the number of sentences in the first natural language, denoted as T; randomly select the number of sentences in the second natural language, denoted as S.

[0043] Step 1013: Calculate precision P and recall R based on the number of sentences in the first sentence and the number of sentences in the second sentence; the calculation formula is as follows: , ;

[0044] Step 1014: Determine whether the precision and recall meet the preset conditions, for example, whether both P and R are greater than 0.5. If the preset conditions are met, the preprocessing is complete, and the secondary natural language is identified as the preprocessed natural language; otherwise, the preprocessing is not complete, and the preprocessing operation continues until the precision and recall meet the preset conditions, and the secondary natural language after the reprocessing operation is identified as the preprocessed natural language.

[0045] In one possible implementation, step 102 above, which involves performing a word order rationality test on the string data to obtain a word order rationality coefficient, includes:

[0046] Based on the length of each string in the string data, determine the hash value corresponding to each string; for each string, determine the word order rationality corresponding to the string based on the first length of the string, the first hash value corresponding to the string, and the second length of the first string adjacent to the string; determine the word order rationality coefficient based on the word order rationality corresponding to each string in the string data.

[0047] In one exemplary embodiment, such as Figure 3 As shown, the method for determining the word order rationality coefficient includes the following steps:

[0048] Step 10211: Extract the string data i There are strings, and the length of each string is represented as . L i ,in, i =1, 2, 3, ... i ..., n, where n is the total number of strings;

[0049] Step 10212: Input the length of the string using a string decoding tool. L i Automatically output the hash value corresponding to the string T ( L i );

[0050] Step 10213: Based on the length of each string and its corresponding hash value, calculate the word order rationality coefficient. Specifically, this can be done for each string. i According to the string i First length L i String i The corresponding first hash value T ( L i ), and strings i The first adjacent string ( i +1 or i The second length (+2) L i+1 or L i+2 ), determine the string iThe corresponding word order rationality is determined based on the word order rationality of each string in the string data. This rationality coefficient can be determined by summing the word order rationality of the first n-1 strings and the first n-2 strings. For example, the word order rationality coefficient can be calculated using the following formula:

[0051] ;

[0052] Where Y1 is the word order rationality coefficient; L i For the first i The length of the string; T ( L i ) is the first i The hash value corresponding to the length of each string; L i+1 For the first i +1 is the length of the string; L i+2 For the first i +2 is the length of the string.

[0053] In one possible implementation, step 102 above, which involves performing a language fluency test on the string data to obtain a language fluency coefficient, includes:

[0054] Obtain the target character from the string data; determine the fluency coefficient based on the probability of the target character appearing in each string of the string data.

[0055] In one exemplary embodiment, such as Figure 4 The method for determining the fluency coefficient, as shown, includes the following steps:

[0056] Step 10221: Extract the string data i There are strings, among which... i =1, 2, 3, ... i ..., n, where n is the total number of strings;

[0057] Step 10222: Determine the probability of the target character appearing in each string of the string data; for example, ,in, H n For the first n The target character in the string. From 1 to n The probability of the target character appearing in a string, here. ;

[0058] Step 10223: Determine the fluency coefficient based on the probability of the target character appearing in each string of the string data; for example, the fluency coefficient can be determined by the following formula:

[0059] ;

[0060] in, Yr For fluency, From 1 to n The probability of the target character appearing in a string.

[0061] In one possible implementation, step 103 above, determining the language completeness index based on the language rationality coefficient and the language fluency coefficient, includes:

[0062] Obtain the first weight of the language rationality coefficient and the second weight of the language fluency coefficient; based on the first weight and the second weight, perform a weighted summation of the language rationality coefficient and the language fluency coefficient to obtain the language completeness index.

[0063] In one exemplary embodiment, the language integrity index can be calculated using the following formula:

[0064] ;

[0065] in, Dy As a language completeness index; Y l represents the word order rationality coefficient; Yr This represents the fluency coefficient; 1- k 1 is the first weight; k 2 is the second weight; k 1 and k 2 is a constant and can be selected based on empirical values.

[0066] In one possible implementation, step 104 above, adjusting the natural language according to the language completeness index to obtain the output language, includes:

[0067] If the language completeness index is greater than or equal to a preset language completeness threshold, the natural language is determined as the output language; if the language completeness index is less than the language completeness threshold, the natural language is adjusted to obtain the output language.

[0068] In this embodiment of the application, the calculated language completeness index Dy Compared with the preset language completeness threshold For comparison, if the language completeness index Dy Greater than or equal to the language completeness threshold If the language completeness index is within a certain range, the input natural language is determined to meet the system's usage standards, i.e., the language is fluent and the word order is reasonable, and the natural language is identified as the output language; if ... Dy Less than the language completeness threshold If the input natural language does not meet the system's usage standards, the word order of the natural language will be adjusted and the language optimized to obtain the output language.

[0069] In one possible implementation, step 104 above, after adjusting the natural language according to the language completeness index to obtain the output language, further includes:

[0070] The output language is transmitted to the target terminal corresponding to the target application, and the output language is output through the target terminal in a predefined output format.

[0071] In this embodiment, the output language conforming to the system usage standard is transmitted to the target terminal corresponding to the target application. The target terminal outputs the output language in output formats such as text format, data format, visual display, and audio format to further improve the processing efficiency of natural language.

[0072] In one possible implementation, the natural language processing method 100 described above further includes:

[0073] Based on the business functions from obtaining the string data corresponding to the natural language to obtaining the output language, the target application is divided into multiple microservices; the multiple microservices interact with each other through a preset communication protocol.

[0074] The application interfaces of the multiple microservices and the application container resources allocated to the multiple microservices are stored in the service registry center so that mutual calls between the multiple microservices can be realized through the service registry center.

[0075] In this embodiment of the application, a microservice architecture can be used to decompose the target application and a lightweight communication protocol can be used for communication. Specifically, it may include the following steps:

[0076] Step 1051: Identify microservices: Based on the business functions from acquiring the string data corresponding to the natural language to obtaining the output language, the target application is broken down into multiple small, independent microservices, such as natural language input module, natural language conversion module, language data acquisition module, word order rationality detection module, language fluency detection module, language detection model building module, language adjustment output module, etc.

[0077] Step 1052: Design service interfaces: Define an interface for each microservice, including input and output parameters, error handling mechanisms, and define the interface using a lightweight communication protocol;

[0078] Step 1053: Implement the service: Based on the designed interface, implement each microservice using programming languages ​​and frameworks; specifically, the target application can be packaged into a container image, and the container can be deployed and run in a container runtime environment. Container orchestration tools are used to automate the deployment, scaling and management of containers, and container resources can be automatically scheduled and allocated according to the needs and constraints of the target application.

[0079] Step 1054: Service Registration and Discovery: Using the service registration and discovery mechanism, each microservice automatically registers its application interface, application container resources, and other information to the service registry when it starts up. Other services find the service instances they need to call through the service discovery mechanism.

[0080] Step 1055: Service Communication: Services communicate with each other through a lightweight communication protocol. When one service needs to call another service, it sends a request using the defined interface and waits for a response.

[0081] In this way, the microservice architecture allows each service to be developed, deployed, and scaled independently, making it easy to quickly adapt to changes in business needs; each microservice is responsible for a specific function, and certain microservices can be scaled individually as needed, rather than scaling the entire application as a whole, thus improving resource utilization efficiency; at the same time, microservices can run in containers, which can improve resource utilization and management flexibility.

[0082] Figure 5 This illustration shows a schematic diagram of the structure of a natural language processing device provided in an embodiment of this application. This natural language processing device can achieve, for example... Figure 1 The natural language processing device 500, comprising all or part of the contents shown in the embodiments, includes:

[0083] The acquisition module 510 is used to acquire string data corresponding to the natural language input in the target application.

[0084] The detection module 520 is used to perform word order rationality detection on the string data to obtain a word order rationality coefficient; and to perform language fluency detection on the string data to obtain a language fluency coefficient; wherein, the word order rationality coefficient is used to indicate the rationality of the word order among the strings in the string data; and the language fluency coefficient is used to indicate the language fluency of the strings in the string data.

[0085] The determining module 530 is used to determine the language completeness index based on the language rationality coefficient and the language fluency coefficient;

[0086] The adjustment module 540 is used to adjust the natural language according to the language completeness index to obtain the output language.

[0087] In one possible implementation, the acquisition module 510, when acquiring the string data corresponding to the natural language, is specifically used for:

[0088] The natural language is preprocessed to obtain preprocessed natural language;

[0089] The preprocessed natural language is converted into a vector representation to obtain the target vector;

[0090] The target vector is decoded to obtain the string data corresponding to the natural language.

[0091] Specifically, the acquisition module 510, when performing preprocessing operations on the natural language to obtain preprocessed natural language, is used for:

[0092] The natural language is preprocessed to obtain secondary natural language;

[0093] Precision and recall are determined based on the number of first sentences extracted from the natural language and the number of second sentences extracted from the secondary natural language.

[0094] If the precision and recall meet the preset conditions, the secondary natural language is determined as preprocessed natural language;

[0095] If the precision and recall fail to meet the preset conditions, the secondary natural language is reprocessed until the precision and recall meet the preset conditions. The reprocessed secondary natural language is then identified as the preprocessed natural language.

[0096] In one possible implementation, the detection module 520, when performing word order rationality detection on the string data to obtain a word order rationality coefficient, is specifically used for:

[0097] Based on the length of each string in the string data, determine the hash value corresponding to each string;

[0098] For each string, the word order rationality of the string is determined based on the first length of the string, the first hash value corresponding to the string, and the second length of the first string adjacent to the string.

[0099] The word order rationality coefficient is determined based on the word order rationality of each string in the string data.

[0100] The detection module 520 is used to determine the word order rationality coefficient in the following manner:

[0101] ;

[0102] Where Y1 is the word order rationality coefficient; L i For the first i The length of the string; T ( L i ) is the first i The hash value corresponding to the length of each string; L i+1 For the first i +1 is the length of the string; L i+2 For the first i +2 is the length of the string.

[0103] In one possible implementation, the detection module 520, when performing language fluency detection on the string data to obtain a language fluency coefficient, is specifically used for:

[0104] Obtain the target character from the string data;

[0105] The fluency coefficient is determined based on the probability of the target character appearing in each string of the string data.

[0106] In one possible implementation, the determining module 530, when determining the language completeness index based on the language rationality coefficient and the language fluency coefficient, is specifically used for:

[0107] Obtain the first weight of the language reasonableness coefficient and the second weight of the language fluency coefficient;

[0108] Based on the first weight and the second weight, the language rationality coefficient and the language fluency coefficient are weighted and summed to obtain the language completeness index.

[0109] In one possible implementation, the adjustment module 540, when adjusting the natural language according to the language completeness index to obtain the output language, is specifically used for:

[0110] If the language completeness index is greater than or equal to a preset language completeness threshold, the natural language is determined as the output language.

[0111] If the language completeness index is less than the language completeness threshold, the natural language is adjusted to obtain the output language.

[0112] In one possible implementation, adjustment module 540 is also used for:

[0113] The output language is transmitted to the target terminal corresponding to the target application, and the output language is output through the target terminal in a predefined output format.

[0114] In one possible implementation, the natural language processing device 500 further includes:

[0115] A cloud-native architecture building module is used to split the target application into multiple microservices based on the business functions between obtaining the string data corresponding to the natural language and obtaining the output language; the multiple microservices interact with each other through a preset communication protocol;

[0116] The containerized deployment module is used to store the application interfaces of the multiple microservices and the application container resources allocated to the multiple microservices in the service registry center, so as to realize mutual calls between the multiple microservices through the service registry center.

[0117] This application provides a natural language processing device, including an acquisition module, a detection module, a determination module, and an adjustment module. The acquisition module, in response to natural language input in a target application, acquires string data corresponding to the natural language. The detection module performs a word order rationality test on the string data to obtain a word order rationality coefficient; it also performs a language fluency test on the string data to obtain a language fluency coefficient. The determination module determines a language completeness index based on the language rationality coefficient and the language fluency coefficient. The adjustment module adjusts the natural language based on the language completeness index to obtain the output language. This method ensures that the final output language has good completeness, thereby meeting system usage standards and improving the efficiency of natural language processing.

[0118] Furthermore, it includes a cloud-native architecture building module and a containerized deployment module. The cloud-native architecture building module breaks down the target application into multiple microservices based on the business functions between obtaining the string data corresponding to the natural language and obtaining the output language. The multiple microservices interact with each other through a preset communication protocol. The containerized deployment module stores the application interfaces of the multiple microservices and the application container resources allocated to the multiple microservices in a service registry center, so as to realize mutual calls between the multiple microservices through the service registry center. In this way, resource utilization efficiency and management flexibility can be improved.

[0119] Figure 6This diagram illustrates the hardware structure of an electronic device implementing the embodiments of this application. Referring to the diagram, at the hardware level, the electronic device 600 includes a processor 610, and optionally includes an internal bus 620, a network interface 630, and a memory 640. The memory 640 may include main memory 641, such as high-speed random-access memory (RAM), and may also include non-volatile memory 642, such as at least one disk storage device. Of course, the electronic device 600 may also include other hardware required for other services.

[0120] The processor 610, network interface 630, and memory can be interconnected via an internal bus 620. This internal bus 620 can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be categorized as an address bus, data bus, control bus, etc. For ease of illustration, only a single bidirectional arrow is used in this diagram, but this does not imply that there is only one bus or one type of bus.

[0121] Memory 640 stores programs. Specifically, the program may include program code, which includes computer operation instructions. Memory 640 may include main memory 641 and non-volatile memory 642, and provides instructions and data to processor 610.

[0122] The processor 610 reads the corresponding computer program from the non-volatile memory 642 into memory and then runs it, forming a device for locating the target user at the logical level. The processor 610 executes the program stored in memory and specifically performs the following: Figure 1 , Figure 2 , Figure 3 or Figure 4 The methods disclosed in the embodiments shown achieve the functions and beneficial effects of the methods described in the preceding method embodiments, and will not be repeated here.

[0123] The above is as stated in this application. Figure 1 , Figure 2 , Figure 3 or Figure 4The methods disclosed in the illustrated embodiments can be applied to or implemented by processor 610. Processor 610 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above methods can be completed by integrated logic circuits in the hardware or by instructions in software form within processor 610. Processor 610 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.

[0124] The computer device can also execute the methods described in the preceding method embodiments and achieve the functions and beneficial effects of the methods described in the preceding method embodiments, which will not be repeated here.

[0125] Of course, in addition to software implementation, the electronic device 600 of this application does not exclude other implementation methods, such as logic devices or a combination of hardware and software, etc. In other words, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0126] This application also proposes a computer-readable storage medium that stores one or more programs, which, when executed by an electronic device including multiple applications, cause the electronic device to perform... Figure 1 , Figure 2 , Figure 3 or Figure 4 The methods disclosed in the embodiments shown achieve the functions and beneficial effects of the methods described in the preceding method embodiments, and will not be repeated here.

[0127] The computer-readable storage medium mentioned above includes read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, etc.

[0128] Furthermore, embodiments of this application also provide a computer program product, the computer program product including a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, which, when executed by a computer, implement the following process: Figure 1 , Figure 2 , Figure 3 or Figure 4 The methods disclosed in the embodiments shown achieve the functions and beneficial effects of the methods described in the preceding method embodiments, and will not be repeated here.

[0129] The embodiments of this application can be applied to various scenarios of electronic device collaboration or interconnection, including: collaboration and interconnection between mobile phones and laptops / tablets; collaboration and interconnection between mobile terminals and smart TVs / monitors; collaboration and interconnection between mobile phones or tablets and in-vehicle entertainment systems; collaboration and interconnection between mobile terminals and smart conferencing systems, etc. This satisfies users' diverse needs in smart home, smart office, and smart travel scenarios.

[0130] In summary, the above description is merely a preferred embodiment of this application and does not limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

[0131] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.

[0132] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can store information accessible to a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0133] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0134] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

Claims

1. A natural language processing method, characterized in that, include: In response to natural language input in the target application, obtain the string data corresponding to the natural language; The string data is subjected to a word order rationality test to obtain a word order rationality coefficient; The string data is subjected to a language fluency test to obtain a language fluency coefficient; wherein, the word order rationality coefficient is used to indicate the rationality of the word order among the strings in the string data; the language fluency coefficient is used to indicate the language fluency of each string in the string data. The language completeness index is determined based on the word order rationality coefficient and the language fluency coefficient. The natural language is adjusted based on the language completeness index to obtain the output language; The word order rationality coefficient is determined in the following way: ; Where Y1 is the word order rationality coefficient; L i For the first i The length of the string; T ( L i ) is the first i The hash value corresponding to the length of each string; L i+1 For the first i +1 is the length of the string; L i+2 For the first i +2 the length of the string; The step of performing language fluency detection on the string data to obtain a language fluency coefficient includes: Obtain the target character from the string data; The fluency coefficient is determined based on the probability of the target character appearing in each string of the string data.

2. The method according to claim 1, characterized in that, The step of obtaining the string data corresponding to the natural language includes: The natural language is preprocessed to obtain preprocessed natural language; The preprocessed natural language is converted into a vector representation to obtain the target vector; The target vector is decoded to obtain the string data corresponding to the natural language.

3. The method according to claim 2, characterized in that, The preprocessing operation on the natural language to obtain preprocessed natural language includes: The natural language is preprocessed to obtain secondary natural language; Precision and recall are determined based on the number of first sentences extracted from the natural language and the number of second sentences extracted from the secondary natural language. If the precision and recall meet the preset conditions, the secondary natural language is determined as preprocessed natural language; If the precision and recall fail to meet the preset conditions, the secondary natural language is reprocessed until the precision and recall meet the preset conditions. The reprocessed secondary natural language is then identified as the preprocessed natural language.

4. The method according to claim 1, characterized in that, The step of performing a word order rationality test on the string data to obtain a word order rationality coefficient includes: Based on the length of each string in the string data, determine the hash value corresponding to each string; For each string, the word order rationality of the string is determined based on the first length of the string, the first hash value corresponding to the string, and the second length of the first string adjacent to the string. The word order rationality coefficient is determined based on the word order rationality of each string in the string data.

5. The method according to claim 1, characterized in that, The determination of the language completeness index based on the word order rationality coefficient and the language fluency coefficient includes: Obtain the first weight of the word order rationality coefficient and the second weight of the language fluency coefficient; Based on the first weight and the second weight, the word order rationality coefficient and the language fluency coefficient are weighted and summed to obtain the language completeness index.

6. The method according to claim 1, characterized in that, The step of adjusting the natural language according to the language completeness index to obtain the output language includes: If the language completeness index is greater than or equal to a preset language completeness threshold, the natural language is determined as the output language. If the language completeness index is less than the language completeness threshold, the natural language is adjusted to obtain the output language.

7. The method according to claim 1, characterized in that, After adjusting the natural language according to the language completeness index to obtain the output language, the method further includes: The output language is transmitted to the target terminal corresponding to the target application, and the output language is output through the target terminal in a predefined output format.

8. The method according to any one of claims 1 to 7, characterized in that, Also includes: Based on the business functions between obtaining the string data corresponding to the natural language and obtaining the output language, the target application is split into multiple microservices; The multiple microservices interact with each other through a preset communication protocol; The application interfaces of the multiple microservices and the application container resources allocated to the multiple microservices are stored in the service registry center so that mutual calls between the multiple microservices can be realized through the service registry center.

9. A natural language processing device, characterized in that, include: The acquisition module is used to acquire string data corresponding to the natural language input in the target application. The detection module is used to detect the word order rationality of the string data and obtain the word order rationality coefficient; The string data is subjected to a language fluency test to obtain a language fluency coefficient; wherein, the word order rationality coefficient is used to indicate the rationality of the word order among the strings in the string data; the language fluency coefficient is used to indicate the language fluency of each string in the string data. The determining module is used to determine the language completeness index based on the word order rationality coefficient and the language fluency coefficient; An adjustment module is used to adjust the natural language according to the language completeness index to obtain the output language; The detection module is used to determine the word order rationality coefficient in the following manner: ; Where Y1 is the word order rationality coefficient; L i For the first i The length of the string; T ( L i ) is the first i The hash value corresponding to the length of each string; L i+1 For the first i +1 is the length of the string; L i+2 For the first i +2 the length of the string; The detection module, when performing language fluency detection on the string data to obtain a language fluency coefficient, is specifically used for: Obtain the target character from the string data; The fluency coefficient is determined based on the probability of the target character appearing in each string of the string data.

10. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions being executed by the processor to implement the steps of the method as described in any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the method as described in any one of claims 1 to 8.

12. A computer program product, characterized in that, The computer program product includes a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions that, when executed by a computer, cause the computer to perform the steps of the method as described in any one of claims 1 to 8.