A method, device and computer-readable storage medium for segmenting a sequence

By calculating the candidate slicing sequence score and selecting the highest scored sequence as the result, the problem of invalid combination in sequence slicing is solved, and the effectiveness and accuracy of sequence slicing is improved.

CN113569003BActive Publication Date: 2025-08-12TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110209883.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-24
Publication Date
2025-08-12
Estimated Expiration
2041-02-24

AI Technical Summary

Technical Problem

In the prior art, in the process of sequence slicing, the sequence labeling result combination of each fine-grained slicing unit in the sequence to be sliced is invalid, resulting in low validity of sequence slicing.

Method used

By obtaining the slicing sequence to be sliced including n slicing units, the candidate slicing sequence score set is calculated, and the highest candidate slicing sequence score is selected as the sequence slicing result to ensure the validity of the slicing result.

Benefits of technology

The integrated sequence slicing with the sequence to be sliced is realized, which improves the effectiveness of sequence slicing and ensures the accuracy and effectiveness of slicing results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113569003B_ABST
    Figure CN113569003B_ABST
Patent Text Reader

Abstract

The present application provides a sequence segmentation method, device, and computer-readable storage medium; the method includes: obtaining a sequence to be segmented including n segmentation units, wherein n is an integer greater than 1; performing sequence segmentation on the n segmentation units to obtain a candidate segmentation sequence score set corresponding to the sequence to be segmented; wherein the candidate segmentation sequence score set is a set consisting of candidate segmentation sequence scores corresponding to each candidate segmentation sequence, each slice in each candidate segmentation sequence constitutes the sequence to be segmented, and the candidate segmentation sequence score is a combination of the scores of each slice corresponding to each slice; obtaining the highest candidate segmentation sequence score in the candidate segmentation sequence score set; and determining the candidate segmentation sequence corresponding to the highest candidate segmentation sequence score as the sequence segmentation result of the sequence to be segmented. Through the present application, the effectiveness of sequence segmentation in natural language processing can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to natural language processing technology in the field of artificial intelligence, and in particular to a sequence segmentation method, device, and computer-readable storage medium. Background Art

[0002] Sequence segmentation is the process of combining fine-grained segments in a sequence into coarse-grained segments. It is a fundamental task in natural language processing. Sequence segmentation improves the efficiency of information processing and also assists in information processing.

[0003] Generally speaking, to achieve sequence segmentation of a sequence to be segmented, sequence annotation is typically performed on each fine-grained segmentation unit in the sequence to be segmented. The segmentation sequence of the sequence to be segmented is then determined based on the sequence annotation results for each fine-grained segmentation unit. However, this sequence segmentation process can result in invalid combinations of sequence annotation results for each fine-grained segmentation unit in the sequence to be segmented, such as "O, I-tag, I-tag," resulting in low sequence segmentation effectiveness. Summary of the Invention

[0004] The embodiments of the present application provide a sequence segmentation method, apparatus, device, and computer-readable storage medium, which can improve the effectiveness of sequence segmentation.

[0005] The technical solution of the embodiment of the present application is implemented as follows:

[0006] The present invention provides a sequence segmentation method, including:

[0007] Obtain a sequence to be segmented comprising n segmentation units, where n is an integer greater than 1;

[0008] Performing sequence segmentation on the n segmentation units to obtain a candidate segmentation sequence score set corresponding to the sequence to be segmented;

[0009] The candidate segmentation sequence score set is a set of candidate segmentation sequence scores corresponding to each candidate segmentation sequence, each slice in each candidate segmentation sequence constitutes the sequence to be segmented, and the candidate segmentation sequence score is a combination of the scores of each slice corresponding to each slice;

[0010] Obtaining the highest candidate segmentation sequence score in the candidate segmentation sequence score set;

[0011] The candidate segmentation sequence corresponding to the highest candidate segmentation sequence score is determined as the sequence segmentation result of the sequence to be segmented.

[0012] The present invention provides a sequence segmentation device, including:

[0013] A sequence acquisition module, configured to acquire a sequence to be segmented, comprising n segmentation units, where n is an integer greater than 1;

[0014] a sequence segmentation module, configured to segment the n segmentation units to obtain a set of candidate segmentation sequence scores corresponding to the sequence to be segmented; wherein the set of candidate segmentation sequence scores is a set of candidate segmentation sequence scores corresponding to each candidate segmentation sequence, each slice in each candidate segmentation sequence constitutes the sequence to be segmented, and the candidate segmentation sequence score is a combination of the scores of each slice corresponding to each slice;

[0015] A score acquisition module, configured to acquire the highest candidate segmentation sequence score in the candidate segmentation sequence score set;

[0016] The result acquisition module is configured to determine the candidate segmentation sequence corresponding to the highest candidate segmentation sequence score as the sequence segmentation result of the sequence to be segmented.

[0017] In an embodiment of the present application, the sequence segmentation module is further configured to traverse the n segmentation units, and based on the first segmentation sequence score set to the i-1th segmentation sequence score set, perform sequence segmentation on the first i segmentation units traversed to obtain the i-th segmentation sequence score set, wherein i is an integer greater than 1 and less than or equal to n, and the i-th segmentation sequence score set is the score of each segmentation sequence corresponding to the first i segmentation units; based on the first segmentation sequence score set to the i-th segmentation sequence score set, continue to perform sequence segmentation on the first i+1 segmentation units traversed until the n segmentation units are traversed, thereby obtaining the n-th segmentation sequence score set, wherein the n-th segmentation sequence score set is the candidate segmentation sequence score set corresponding to the sequence to be segmented.

[0018] In an embodiment of the present application, the sequence segmentation module is further configured to traverse the first i segmentation units that have been traversed again, and obtain the corresponding j-th segmentation prefix and j-th last slice for the last j segmentation units that have been traversed, where j is an integer greater than 0 and less than i-1, the j-th segmentation prefix is the segmentation sequence corresponding to the first ij segmentation units, and the j-th last slice is a slice composed of the last j segmentation units; determine the i-th segmentation sequence score corresponding to the j-th segmentation prefix and the j-th last slice based on the first segmentation sequence score set to the i-1-th segmentation sequence score set; and continue traversing the next j+1 segmentation units until the last i-1 segmentation units of the first i segmentation units are traversed, thereby obtaining the i-1-th i-th segmentation sequence score corresponding to the first i segmentation units, wherein the i-th segmentation sequence score set includes the i-1-th i-th segmentation sequence score.

[0019] In an embodiment of the present application, the sequence segmentation module is further configured to obtain the jth last slice score corresponding to the jth last slice; obtain the jth highest segmentation sequence score corresponding to the jth segmentation prefix from the first segmentation sequence score set to the i-1th segmentation sequence score set, wherein the jth highest segmentation sequence score is the highest segmentation sequence score corresponding to the jth segmentation prefix; and combine the jth highest segmentation sequence score and the jth last slice score to obtain the i-th segmentation sequence score.

[0020] In an embodiment of the present application, the sequence segmentation module is further used to obtain the j-th last slice feature corresponding to the j-th last slice; based on the j-th last slice feature, predict the feasibility of at least one segmentation unit in the j-th last slice as a slice, and obtain the j-th slice merge score; based on the j-th slice merge score, obtain the j-th last slice score.

[0021] In an embodiment of the present application, the sequence segmentation module is further used to predict the j-th slice label values corresponding to each label of the j-th last slice based on the j-th last slice feature; and obtain the j-th highest slice label value from the j-th slice label values.

[0022] In an embodiment of the present application, the sequence segmentation module is further configured to combine the j-th slice merge score and the j-th highest slice label value to obtain the j-th final slice score.

[0023] In an embodiment of the present application, the sequence segmentation module is further used to obtain n segmentation unit features corresponding to the n segmentation units; obtain the first segmentation unit feature and the last segmentation unit feature corresponding to the j-th last slice from the n segmentation unit features; and determine the j-th last slice feature by combining the first segmentation unit feature and the last segmentation unit feature.

[0024] In an embodiment of the present application, the sequence segmentation module is further used to obtain a target slice label corresponding to the j-th highest slice label value, wherein the j-th last slice and the target slice label are an element in the sequence segmentation result; obtain a label dependency value between each label and the target slice label; obtain the highest segmentation sequence score of each label corresponding to the ij-th last slice from the 1st segmentation sequence score set to the i-1th segmentation sequence score set, wherein the ij-th last slice is the last slice corresponding to the first ij segmentation units; combine the highest segmentation sequence score of each label corresponding to the ij-th last slice with the label dependency value to obtain the ij-th segmentation sequence score set; and obtain the j-th highest segmentation sequence score from the ij-th segmentation sequence score set.

[0025] In the embodiment of the present application, the sequence segmentation module is further configured to obtain a segmentation sequence score corresponding to the first segmentation unit among the n segmentation units, to obtain a first segmentation sequence score set.

[0026] In an embodiment of the present application, the sequence segmentation module is further configured to adopt a sequence segmentation model to traverse the n segmentation units, wherein the sequence segmentation model is configured to obtain the sequence segmentation results corresponding to the n segmentation units.

[0027] In an embodiment of the present application, the sequence segmentation module is further used to obtain sequence samples, wherein the sequence samples include a sequence to be predicted and sequence labeling information; using a sequence segmentation model to be trained to predict the sequence to be predicted and obtain a highest-scoring predicted segmentation sequence, wherein the sequence segmentation model to be trained is a model to be trained for obtaining the sequence segmentation results corresponding to the n segmentation units; based on the difference between the highest-scoring predicted segmentation sequence and the sequence labeling information, iteratively training the sequence segmentation model to be trained; and terminating the training until a training end condition is met to obtain the sequence segmentation model.

[0028] In an embodiment of the present application, the sequence segmentation module is further configured to obtain a new sequence sample, wherein the new sequence sample is a sample obtained after the sequence sample; and optimize the sequence segmentation model based on the new sequence sample.

[0029] In the embodiment of the present application, the sequence segmentation module is further configured to adopt an optimized sequence segmentation model to traverse the n segmentation units.

[0030] In an embodiment of the present application, the sequence acquisition module is further used to obtain the text to be segmented in response to a sequence segmentation request; traverse each sentence to be segmented in the text to be segmented, and determine the traversed sentence to be segmented as the sequence to be segmented including the n segmentation units.

[0031] In an embodiment of the present application, the result acquisition module is further configured to obtain a text segmentation sequence consisting of the sequence segmentation results corresponding to each sentence to be segmented after traversing the text to be segmented.

[0032] The present invention provides a sequence segmentation device, including:

[0033] a memory for storing executable instructions;

[0034] The processor is configured to implement the sequence segmentation method provided in the embodiment of the present application when executing the executable instructions stored in the memory.

[0035] An embodiment of the present application provides a computer-readable storage medium storing executable instructions for causing a processor to execute instructions to implement the sequence segmentation method provided in the embodiment of the present application.

[0036] The embodiments of the present application have at least the following beneficial effects: by obtaining a candidate segmentation sequence score corresponding to each candidate segmentation sequence corresponding to n segmentation units, and determining the candidate segmentation sequence corresponding to the highest candidate segmentation sequence score as the sequence segmentation result; an integrated sequence segmentation based on the sequence to be segmented is achieved, and the validity of the obtained sequence segmentation result can be guaranteed; thereby, the validity of the sequence segmentation can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 is a schematic diagram of an exemplary sequence segmentation method;

[0038] Figure 2 is another exemplary sequence segmentation method schematic diagram;

[0039] Figure 3 This is an optional architectural diagram of the sequence segmentation system provided in an embodiment of the present application;

[0040] Figure 4 This embodiment of the present application provides a Figure 3 Schematic diagram of the composition structure of the server in;

[0041] Figure 5 This is an optional flowchart of the sequence segmentation method provided in the embodiment of the present application;

[0042] Figure 6 This is another optional flow chart of the sequence segmentation method provided in the embodiment of the present application;

[0043] Figure 7 This is another optional flow chart of the sequence segmentation method provided in the embodiment of the present application;

[0044] Figure 8 This is a flow chart of an exemplary sequence segmentation method provided in an embodiment of the present application;

[0045] Figure 9 1 is a flow chart of another exemplary sequence segmentation method provided in an embodiment of the present application;

[0046] Figure 10 This is a flow chart of another exemplary sequence segmentation method provided in the embodiments of the present application;

[0047] Figure 11 This is a schematic diagram of an exemplary sequence segmentation process provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solutions and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limiting this application. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0049] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.

[0051] Before further explaining the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0052] 1) Artificial Intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.

[0053] 2) Machine Learning (ML) is a multidisciplinary field that encompasses probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specifically studies how computers can simulate or implement human learning behaviors to acquire new knowledge or skills, and reorganize existing knowledge structures to continuously improve their performance. Machine learning is at the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications span all areas of AI. Machine learning typically includes techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, and inductive learning.

[0054] 3) Natural Language Processing (NLP) is an important field in computer science and artificial intelligence. It aims to study various theories and methods that can enable effective communication between humans and computers using natural language. Natural Language Processing is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language, that is, the language people use in daily life, and is closely related to the study of linguistics. Natural Language Processing technologies generally include text processing, semantic understanding, machine translation, robot question answering, knowledge graphs, and other technologies.

[0055] 4) Neural Networks (NN) are mathematical models that mimic the structure and function of biological neural networks. Exemplary structures of artificial neural networks in this article include Deep Neural Networks (DNN), Convolutional Neural Networks (CNN), and Recurrent Neural Networks (RNN).

[0056] 5) Dynamic Programming (DP) is an optimization method for finding extreme values. Its core concept is to recursively decompose a complex problem into several simple subproblems. It is applicable to multi-stage decision-making problems. Here, a problem is considered a multi-stage process with a chain-like structure. This is called a multi-stage decision-making process, and this type of problem is called a multi-stage decision-making problem. In multi-stage decision-making problems, the decisions taken at each stage are generally time-dependent. Decisions depend on the current state and subsequently cause state transitions. A decision sequence is generated in this changing state. In dynamic programming, a table is used to record the answers to all solved subproblems. Regardless of whether the subproblem is used later, as long as it has been calculated, its results are entered into the table.

[0057] 6) LUA (Lexical Unit Analysis), a general framework proposed in the embodiment of the present application for sequence segmentation tasks, is used to implement the sequence segmentation method provided in the embodiment of the present application; in the embodiment of the present application, the sequence segmentation tasks include part-of-speech tagging, syntactic chunking, named entity recognition, word segmentation, and slot extraction.

[0058] 7) Named Entity Recognition (NER) is used to identify entity phrases in a given unstructured text, such as IP (Intellectual Property) types (including names of movies, TV series, novels, animation, games, events, songs, and apps), personal names, place names, and institutional names. It is an NLP task that identifies the type and location of entity names in the input text.

[0059] 8) Part-of-speech tagging (POS) is a text data processing technology in corpus linguistics that marks the part of speech of strings in a corpus according to their meaning and context.

[0060] 9) Syntactic chunking, the process of obtaining syntactic structure from a string.

[0061] 10) Word segmentation (CWS) is the process of recombining continuous character sequences into string sequences according to certain specifications.

[0062] 11) Slot extraction refers to performing lexical and grammatical analysis on a sentence in a certain domain, and combining the context to determine whether a certain segment of the specified sentence string is a slot with certain meaning and in line with the context.

[0063] 12) F1-Measure is the harmonic mean of precision and recall. Typically, F1 = precision * recall * 2 / (precision + recall). F1 values range from 0 to 1, with larger F1 values indicating better results.

[0064] 13) LSTM (Long Short Term Memory Networks) is a modified recurrent neural network that significantly enhances its ability to model long-term dependencies through a gating mechanism.

[0065] 14) CRF (Conditional Random Fields) is a discriminant probability model and a type of random field, commonly used to analyze sequence data; for example, natural language and biological DNA (deoxyribonucleic acid).

[0066] 15) A dataset, also known as a data set, data set, or data collection, is a collection of data. In the embodiments of this application, a dataset is used to evaluate network models. For example, the CTB (Chinese Treebank) dataset is a large Chinese dataset with annotated syntactic trees, and is often used to evaluate Chinese word segmentation, Chinese part-of-speech tagging, and syntactic analysis.

[0067] 16) Loss function, also known as cost function, is a function that maps the value of a random event or its related random variables into a non-negative real number to represent the "risk" or "loss" of the random event.

[0068] 17) In dynamic programming, a state transition equation is an equation that uses functions to represent the relationship between previous and next stages. In dynamic programming, the state of a stage is usually the result of the state and decisions of the previous stage.

[0069] 18) Activation function: A process used to increase the nonlinearity of neural network models. Since data distribution is mostly nonlinear, while neural network computation is generally linear, activation functions can be used to introduce nonlinearity into neural networks, enhancing their learning capabilities and allowing them to approximate any nonlinear function. This allows neural networks to be applied to a wide range of nonlinear models. For example, the "Tanh" activation function, also known as the hyperbolic tangent activation function, is used.

[0070] It's important to note that artificial intelligence (AI) is a comprehensive technology within computer science that seeks to understand the essence of intelligence and create new intelligent machines that can respond in a manner similar to human intelligence. AI also studies the design principles and implementation methods of various intelligent machines, enabling them to perceive, reason, and make decisions.

[0071] Furthermore, artificial intelligence (AI) technology is a comprehensive discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning.

[0072] With the research and advancement of artificial intelligence technology, it has been studied and applied in many fields, such as smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, autonomous driving, drones, robots, smart healthcare, and smart customer service. As technology develops, artificial intelligence technology will be applied in more fields and play an increasingly important role. For example, artificial intelligence can also be applied in the field of text processing. The application of artificial intelligence in the field of natural language processing involved in the embodiments of the present invention will be explained later.

[0073] Generally speaking, to achieve sequence segmentation of a sequence to be segmented, a sequence labeling-based model can be used; that is, sequence labeling is performed on each fine-grained segmentation unit in the sequence to be segmented, and then the segmentation sequence of the sequence to be segmented is determined based on the sequence labeling results of each fine-grained segmentation unit. However, during the above sequence segmentation process, there are cases where the combination of sequence labeling results of each fine-grained segmentation unit in the sequence to be segmented is invalid. For example, "O, I-tag, I-tag" is a sequence labeling result without a starting position. However, in actual applications, there is no case of a sequence labeling result without a starting position. Therefore, "O, I-tag, I-tag" is an invalid sequence labeling result; thus, the effectiveness of sequence segmentation is low.

[0074] See also Figure 1 , Figure 1 is an exemplary sequence segmentation method diagram; Figure 1 As shown in the figure, for the to-be-segmented sequence 1-1: "Word Cup Standings", the sequence labeling model 1-2 performs sequence labeling on each fine-grained segmentation unit "Word", "Cup", and "Standings". Finally, the output of the sequence labeling model 1-2 is filtered to obtain the sequence labeling result 1-3: "[Word]O[Cup]I[Standings]I". Here, in the sequence labeling result of each fine-grained segmentation unit: B-tag indicates that the unit is at the starting position of a segmentation; I-tag indicates that the unit is in a slice but not the starting position; O indicates that this segmentation unit does not correspond to any slice; "MISC" indicates miscellaneous. Therefore, "[Word]O[Cup]I[Standings]I" is also an invalid segmentation sequence.

[0075] In addition, in order to achieve sequence segmentation of the sequence to be segmented, a slice-based model can also be used; that is, all candidate slices in the sequence to be segmented are predicted separately; however, when the above-mentioned slice-based model is used to achieve sequence segmentation, there are cases of slice boundary conflicts, and thus, the obtained segmented sequence may also be invalid.

[0076] See also Figure 2 , Figure 2 is another exemplary sequence segmentation method schematic diagram; Figure 2 As shown, for the to-be-segmented sequence 2-1: "Word Cup Standings", the slicing model 2-2 predicts all candidate slices (coarse-grained segmentation units) "Word Cup", "Cup Standings", "Cup", and so on, "Standings". Finally, the output of the slicing model 2-2 is filtered based on the rules to obtain the segmentation sequence 2-3: "[World Cup]MISC[Cup]MISC[Standings]O". In this segmentation sequence, the slices [World Cup] and [Cup] overlap, resulting in a slice boundary conflict.

[0077] Based on this, the embodiments of the present application provide a sequence segmentation method, apparatus, device, and computer-readable storage medium that can improve the effectiveness of sequence segmentation. The following describes an exemplary application of the sequence segmentation device provided in the embodiments of the present application. The sequence segmentation device provided in the embodiments of the present application can be implemented as various types of user terminals such as laptop computers, tablet computers, desktop computers, set-top boxes, mobile devices (e.g., mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices), and can also be implemented as a server. Below, an exemplary application when the device is implemented as a server will be described.

[0078] See also Figure 3 , Figure 3 This is an optional architectural diagram of the sequence segmentation system provided in the embodiment of the present application; Figure 3 As shown, to support a sequence segmentation application, in a sequence segmentation system 100, terminals 200 (terminal 200-1 and terminal 200-2 are shown as examples) are connected to a server 400 via a network 300. Network 300 can be a wide area network (WAN), a local area network (LAN), or a combination of the two. Sequence segmentation system 100 also includes a database 500 for providing data support to server 400 when server 400 provides sequence segmentation services to the terminals via network 300.

[0079] The terminal 200 is configured to send a sequence segmentation request to the server 400 via the network 300 in response to a sequence segmentation operation performed on the sequence segmentation control.

[0080] Server 400 is configured to respond to a sequence segmentation request sent by terminal 200 via network 300, obtain a sequence to be segmented comprising n segmentation units, where n is an integer greater than 1; perform sequence segmentation on the n segmentation units to obtain a set of candidate segmentation sequence scores corresponding to the sequence to be segmented; wherein the candidate segmentation sequence score set is a set of candidate segmentation sequence scores corresponding to each candidate segmentation sequence, wherein each slice in each candidate segmentation sequence constitutes the sequence to be segmented, and the candidate segmentation sequence score is a combination of the scores of each slice corresponding to each slice; obtain the highest candidate segmentation sequence score in the candidate segmentation sequence score set; and determine the candidate segmentation sequence corresponding to the highest candidate segmentation sequence score as the sequence segmentation result of the sequence to be segmented. Server 400 is further configured to send a sequence segmentation result sequence to terminal 200 via network 300.

[0081] In some embodiments, the server 400 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The terminal 200 can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present invention.

[0082] See also Figure 4 , Figure 4 This embodiment of the present application provides a Figure 3 Schematic diagram of the composition structure of the server in; Figure 4 The server 400 shown includes: at least one processor 410, a memory 450, at least one network interface 420, and a user interface 430. The various components in the server 400 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to including a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 440 is not described in detail. Figure 4 Various buses are labeled as bus system 440 .

[0083] The processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0084] The user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0085] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.

[0086] The memory 450 includes volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.

[0087] In some embodiments, the memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplified below.

[0088] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, and driver layer, which are used to implement various basic services and process hardware-based tasks;

[0089] A network communication module 452 for reaching other computing devices via one or more (wired or wireless) network interfaces 420 , exemplary network interfaces 420 including Bluetooth, Wi-Fi, and Universal Serial Bus (USB);

[0090] a presentation module 453 for enabling presentation of information via one or more output devices 431 (e.g., a display screen, a speaker, etc.) associated with the user interface 430 (e.g., a user interface for operating peripheral devices and displaying content and information);

[0091] The input processing module 454 is configured to detect one or more user inputs or interactions from one of the one or more input devices 432 and to translate the detected inputs or interactions.

[0092] In some embodiments, the sequence segmentation device provided in the embodiments of the present application can be implemented in software. Figure 4 A sequence segmentation device 455 stored in memory 450 is shown. This device can be software in the form of a program or plug-in, and includes the following software modules: a sequence acquisition module 4551, a sequence segmentation module 4552, a score acquisition module 4553, and a result acquisition module 4554. These modules are logical and can be arbitrarily combined or further separated according to the functions they implement. The functions of each module will be described below.

[0093] In other embodiments, the sequence segmentation device provided in the embodiments of the present application can be implemented in hardware. As an example, the sequence segmentation device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the sequence segmentation method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.

[0094] Below, the sequence segmentation method provided in the embodiment of the present application will be described in combination with the exemplary application and implementation of the server provided in the embodiment of the present application.

[0095] See also Figure 5 , Figure 5 This is an optional flow chart of the sequence segmentation method provided in the embodiment of the present application, which will be combined with Figure 5 The steps shown are explained.

[0096] S501: Obtain a to-be-segmented sequence including n segmentation units.

[0097] In the embodiment of the present application, when the sequence segmentation device performs a sequence segmentation task, the corresponding sequence segmentation object is the sequence to be segmented, such as a sentence in a text, an article title, etc.

[0098] It should be noted that the sequence to be segmented includes n segmentation units, each segmentation unit is the smallest unit for sequence segmentation and is a fine-grained segmentation unit; for example, a Chinese character, an English word, etc.; wherein n is an integer greater than 1.

[0099] S502: Perform sequence segmentation on the n segmentation units to obtain a candidate segmentation sequence score set corresponding to the sequence to be segmented.

[0100] In an embodiment of the present application, after the sequence segmentation device obtains n segmentation units, it performs sequence segmentation on the n segmentation units at the level of the sequence to be segmented. Each sequence segmentation can obtain a segmentation sequence corresponding to the n segmentation units, which is referred to as a candidate segmentation sequence; and obtains the score corresponding to the candidate segmentation sequence. When multiple sequence segmentations of the n segmentation units are completed, a set of candidate segmentation sequence scores corresponding to the sequence to be segmented is obtained. Here, the sequence segmentation method can be an enumeration method, a recursive method, etc., which is not specifically limited in the embodiment of the present application.

[0101] It should be noted that the candidate segmentation sequence score set is a set of candidate segmentation sequence scores corresponding to each candidate segmentation sequence; the slices in each candidate segmentation sequence constitute the sequence to be segmented, that is, the slices in each candidate segmentation sequence do not overlap and just cover the sequence to be segmented; the candidate segmentation sequence score is a combination of the slice scores corresponding to each slice, and each slice score can be determined based on the combination of the slice's own segmentation units, or based on its association with other slices, etc., which is not specifically limited in this embodiment of the present application. In addition, each candidate segmentation sequence is a valid segmentation sequence of the sequence to be segmented.

[0102] It should also be noted that each candidate segmentation sequence includes processing of each slice and may also include prediction information corresponding to each slice, such as entity type, syntactic structure, part of speech, etc.

[0103] S503: Obtain the highest candidate segmentation sequence score in the candidate segmentation sequence score set.

[0104] In the embodiments of the present application, since each candidate segmentation sequence score is determined by comprehensively considering the scores of each slice corresponding to each slice, each candidate segmentation sequence score represents the sequence segmentation effect of each candidate segmentation sequence. It is readily apparent that when a candidate segmentation sequence score is high, the corresponding candidate segmentation sequence has a better segmentation effect, such as a higher precision and recall rate; whereas when a candidate segmentation sequence score is low, the corresponding candidate segmentation sequence has a poorer segmentation effect, such as a lower precision and recall rate. Here, the highest candidate segmentation sequence score is the highest score in the set of candidate segmentation sequence scores.

[0105] S504: Determine the candidate segmentation sequence corresponding to the highest candidate segmentation sequence score as the sequence segmentation result of the sequence to be segmented.

[0106] It should be noted that the candidate segmentation sequence corresponding to the highest candidate segmentation sequence score is the sequence segmentation result of the sequence to be segmented.

[0107] In the embodiment of the present application, the sequence segmentation device obtains the candidate segmentation sequence corresponding to each candidate segmentation sequence score, which can be formalized as formula (1). Formula (1) is:

[0108]

[0109] in, is the candidate segmentation sequence corresponding to the highest candidate segmentation sequence score, f(y) is the candidate segmentation sequence score, Y is all candidate segmentation sequences, y is any candidate segmentation sequence in Y, max y∈Y f(y) is the highest candidate segmentation sequence score.

[0110] It can be understood that by obtaining the candidate segmentation sequence score corresponding to each candidate segmentation sequence corresponding to the n segmentation units, and determining the candidate segmentation sequence corresponding to the highest candidate segmentation sequence score as the sequence segmentation result, an integrated sequence segmentation based on the sequence to be segmented is achieved, which can ensure the validity of the obtained sequence segmentation result; thereby, the validity of the sequence segmentation can be improved.

[0111] See also Figure 6 , Figure 6 This is another optional flow chart of the sequence segmentation method provided in the embodiment of the present application; Figure 6 As shown, in the embodiment of the present application, S502 can be implemented through S5021 and S5022; that is, the sequence segmentation device performs sequence segmentation on n segmentation units to obtain a set of candidate segmentation sequence scores corresponding to the sequence to be segmented, including S5021 and S5022. Each step is described below.

[0112] S5021: traverse n segmentation units, and based on the 1st segmentation sequence score set to the (i-1)th segmentation sequence score set, perform sequence segmentation on the first i segmentation units traversed to obtain the i-th segmentation sequence score set.

[0113] In an embodiment of the present application, when the sequence segmentation device recursively obtains a candidate segmentation sequence score set, the process of performing sequence segmentation on the first i segmentation units is determined as each sequence segmentation stage. Here, the sequence segmentation device traverses n segmentation units. When it traverses to the first i segmentation units, it has completed the sequence segmentation of the first i-1 segmentation units. Therefore, at this time, the score sets of the segmentation sequences corresponding to the sequence segmentation of the first segmentation unit (the first segmentation unit), the first two segmentation units, ..., and the first i-1 segmentation units are obtained, that is, the score sets of the first segmentation sequence to the i-1th segmentation sequence. Furthermore, when the sequence segmentation device performs sequence segmentation on the first i segmentation units, since the scores of the segmentation sequences corresponding to the first segmentation unit to the first i-1 segmentation units may be used in the score calculation process of the sequence segmentation of the first i segmentation units, the sequence segmentation device determines the score of each i-th segmentation sequence corresponding to the first i segmentation units based on the score set of the first segmentation sequence to the score set of the i-1 segmentation sequence. The set composed of the scores of each i-th segmentation sequence is the i-th segmentation sequence score set.

[0114] It should be noted that the first segmentation sequence score set is the score for the segmentation sequence corresponding to the first segmentation unit; the i-1th segmentation sequence score set is the total score corresponding to all segmentation sequences obtained by segmenting the first i-1 segmentation units; and the i-th segmentation sequence score set is the total score corresponding to each segmentation sequence corresponding to the first i segmentation units. Here, i is an integer greater than 1 and less than or equal to n.

[0115] S5022. Based on the first segmentation sequence score set to the i-th segmentation sequence score set, continue to segment the first i+1 segmentation units that have been traversed until n segmentation units are traversed, thereby obtaining the n-th segmentation sequence score set, wherein the n-th segmentation sequence score set is a candidate segmentation sequence score set corresponding to the sequence to be segmented.

[0116] In this embodiment of the present application, after the sequence segmentation device traverses the first i segmentation units and obtains the i-th segmentation sequence score set, it continues to segment the first i+1 segmentation units it has traversed based on the first segmentation sequence score set to the i-th segmentation sequence score set. The corresponding process is similar to S5021 and will not be further described in this embodiment of the present application. In this way, the sequence segmentation device continues to traverse n segmentation units. When the n segmentation units are traversed, the n-th segmentation sequence score set corresponding to the first n segmentation units is obtained.

[0117] It should be noted that the nth segmentation sequence score set is the scores corresponding to the segmentation sequences corresponding to the first n segmentation units (i.e., n segmentation units); that is, the nth segmentation sequence score set is the candidate segmentation sequence score set corresponding to the sequence to be segmented.

[0118] It can be understood that by recursively performing sequence segmentation on the first two segmentation units, the first three segmentation units, ..., the first n segmentation units among the n segmentation units, scores of each candidate segmentation sequence corresponding to the n segmentation units are obtained; the feasibility and efficiency of sequence segmentation are improved.

[0119] In an embodiment of the present application, the sequence segmentation unit in S5021 performs sequence segmentation on the first i segmentation units traversed based on the 1st segmentation sequence score set to the i-1th segmentation sequence score set to obtain the i-th segmentation sequence score set, including S50211-S50213. Each step is described below.

[0120] S50211. Traverse the first i segmentation units traversed again, and obtain the corresponding j-th segmentation prefix and j-th last slice for the last j segmentation units traversed.

[0121] It should be noted that when the sequence segmentation device determines the i-th segmentation sequence score set corresponding to the first i segmentation units, it uses the segmentation sequence corresponding to the first i segmentation units as the concatenation of the last slice of the first i segmentation units and the prefix corresponding to the last slice of the first i segmentation units. The number of segmentation units contained in the last slice is determined by traversing the first i segmentation units. When the sequence segmentation device traverses to the last j segmentation units of the first i segmentation units, it uses the last j segmentation units of the first i segmentation units as the last slice of the first i segmentation units, referred to as the j-th last slice. The prefix corresponding to the last slice of the first i segmentation units is the segmentation sequence corresponding to the first ij segmentation units of the first i segmentation units, referred to as the j-th segmentation prefix. Here, j is an integer greater than 0 and less than i-1. In other words, the j-th segmentation prefix is the segmentation sequence corresponding to the first ij segmentation units, and the j-th last slice is the slice consisting of the last j segmentation units.

[0122] S50212. Determine the i-th segmentation sequence score corresponding to the j-th segmentation prefix and the j-th last slice based on the 1st segmentation sequence score set to the i-1th segmentation sequence score set.

[0123] In the embodiment of the present application, each i-th segmentation sequence score in the i-th segmentation sequence score set obtained by the sequence segmentation device is calculated based on the j-th segmentation prefix and the j-th last slice. Specifically, the j-th segmentation prefix is calculated by the sequence segmentation device based on the first segmentation sequence score set to the (i-1)-th segmentation sequence score set; and the j-th last slice is calculated by the sequence segmentation device based on the combination of slices and / or slice label information.

[0124] S50213. Continue traversing the next j+1 segmentation units until the next i-1 segmentation units of the first i segmentation units are traversed, and obtain the i-1th i-th segmentation sequence score corresponding to the first i segmentation units.

[0125] In the embodiment of the present application, when the sequence segmentation device completes the traversal of the last j segmentation units and obtains an i-th segmentation sequence score corresponding to the last j segmentation units, the last j+1 segmentation units of the first i segmentation units are again used as the last slice of the first i segmentation units to calculate another i-th segmentation sequence score; the first i segmentation sequences are traversed in this way until an i-th segmentation sequence score corresponding to the last slice composed of the last i-1 segmentation units of the first i segmentation units is calculated, and the last 1 segmentation sequence is combined. The i-th segmentation sequence score obtained when the segmentation unit is the last slice of the first i segmentation units, ..., the i-th segmentation sequence score obtained when the next j segmentation units are the last slice of the first i segmentation units, the i-th segmentation sequence score obtained when the next j+1 segmentation units are the last slice of the first i segmentation units, ..., the i-th segmentation sequence score obtained when the next i-1 segmentation units are the last slice of the first i segmentation units, thus obtaining the i-1th i-th segmentation sequence score corresponding to the first i segmentation units. Here, the i-th segmentation sequence score set includes i-1 i-th segmentation sequence scores.

[0126] It should be noted that the sequence segmentation device recursively obtains a set of candidate segmentation sequence scores corresponding to the sequence to be segmented by adopting dynamic programming.

[0127] In an embodiment of the present application, S50212 can be implemented through S502121-S502123; that is, the sequence segmentation device determines the i-th segmentation sequence score corresponding to the j-th segmentation prefix and the j-th last slice based on the 1st segmentation sequence score set to the i-1th segmentation sequence score set, including S502121-S502123. Each step is explained below.

[0128] S502121. Obtain the j-th last slice score corresponding to the j-th last slice.

[0129] It should be noted that the sequence segmentation device scores the jth last slice in the first i segmentation units, thereby obtaining the jth last slice score. Here, the scoring can be based on the combination of the next j segmentation units and / or the label information of the jth last slice, which is not specifically limited in this embodiment of the application.

[0130] S502122. Obtain the jth highest segmentation sequence score corresponding to the jth segmentation prefix from the 1st segmentation sequence score set to the (i-1)th segmentation sequence score set.

[0131] It should be noted that, since the scores of each segmentation sequence corresponding to the jth segmentation prefix are included in the 1st segmentation sequence score set to the i-1th segmentation sequence score set, the sequence segmentation device can obtain the jth highest segmentation sequence score corresponding to the jth segmentation prefix from the 1st segmentation sequence score set to the i-1th segmentation sequence score set.

[0132] Here, the jth highest segmentation sequence score is the segmentation sequence with the highest score corresponding to the first ij segmentation units, that is, the highest segmentation sequence score corresponding to the jth segmentation prefix.

[0133] S502123. Combine the j-th highest segmentation sequence score and the j-th last slice score to obtain the i-th segmentation sequence score.

[0134] It should be noted that the i-th segmentation sequence score is the combined result of the j-th highest segmentation sequence score and the j-th last slice score; here, the combined result can be the sum of the j-th highest segmentation sequence score and the j-th last slice score, or the product of the j-th highest segmentation sequence score and the j-th last slice score, or the normalized result of the sum of the j-th highest segmentation sequence score and the j-th last slice score, etc., and the embodiments of the present application do not make specific limitations on this.

[0135] In the embodiment of the present application, the sequence segmentation device in S502121 obtains the j-th last slice score corresponding to the j-th last slice, including S5021211-S5021213, and each step is described below.

[0136] S5021211. Obtain the j-th last slice feature corresponding to the j-th last slice.

[0137] It should be noted that the sequence segmentation device extracts the features of the j-th last slice, thereby obtaining the j-th last slice features.

[0138] S5021212. Based on the j-th last slice feature, predict the feasibility of at least one segmentation unit in the j-th last slice being a slice, and obtain the j-th slice merging score.

[0139] It should be noted that the j-th last slice includes at least one segmentation unit; the j-th slice merge score is predicted based on the j-th last slice feature, and the j-th last slice merge score is obtained by scoring the j-th last slice based on the possibility that the j-th last slice is a slice.

[0140] For example, the j-th slice merging score can be realized by formula (2), which is:

[0141]

[0142] Among them, v c and W c is the training parameter, is the jth last slice feature, Merge the scores for the j-th slice.

[0143] S5021213. Based on the j-th slice merging score, obtain the j-th final slice score.

[0144] In an embodiment of the present application, the sequence segmentation device can determine the j-th slice merge score as the j-th last slice score, or it can combine the j-th slice merge score and the label information corresponding to the j-th last slice to obtain the j-th last slice score. The embodiment of the present application does not make specific limitations on this.

[0145] It should be noted that when the sequence segmentation device determines the j-th slice merge score as the j-th last slice score, it is applied in unlabeled sequence segmentation scenarios, such as Chinese word segmentation; when the j-th slice merge score and the label information corresponding to the j-th last slice are combined to obtain the j-th last slice score, it is applied in labeled sequence segmentation scenarios, such as NER or part-of-speech tagging.

[0146] In the embodiment of the present application, after S5021211 and before S5021213, S5021214 and S5021215 are also included; that is, after the sequence segmentation device obtains the j-th last slice feature corresponding to the j-th last slice, and before the sequence segmentation device obtains the j-th last slice score based on the j-th slice merge score, the sequence segmentation method also includes S5021214 and S5021215. Each step is explained below.

[0147] S5021214. Based on the j-th last slice feature, predict the j-th slice label values corresponding to the j-th last slice.

[0148] It should be noted that the sequence segmentation device can also predict the probability values of the labels corresponding to the last j slices based on the j-th last slice feature when they are each label, thereby obtaining the label values of each j-th slice. Here, each label corresponding to the last j slice corresponds to a label value for the next j slices.

[0149] For example, the last j slice label values can be realized by formula (3), which is:

[0150]

[0151] in, and W l is the training parameter, is the label value of the last j slices.

[0152] S5021215. Obtain the jth highest slice label value from each jth slice label value.

[0153] It should be noted that the j-th highest slice label value is the one with the highest probability value among all j-th slice label values.

[0154] Accordingly, in the embodiment of the present application, S5021213 can be implemented through S50212131; that is, the sequence segmentation device obtains the jth last slice score based on the jth slice merging score, including S50212131, and this step is explained below.

[0155] S50212131. Combine the j-th slice merge score and the j-th highest slice label value to obtain the j-th final slice score.

[0156] It should be noted that the sequence segmentation device can use the sum of the j-th slice merge score and the j-th highest slice label value as the j-th final slice score, or it can use other methods to combine the j-th slice merge score and the j-th highest slice label value. The embodiments of the present application do not make specific limitations on this.

[0157] In an embodiment of the present application, S5021211 can be implemented through S50212111-S50212113; that is, the sequence segmentation device obtains the j-th last slice feature corresponding to the j-th last slice, including S50212111-S50212113, and each step is described below.

[0158] S50212111. Obtain n segmentation unit features corresponding to the n segmentation units.

[0159] In the embodiment of the present application, the feature of each segmentation unit in the sequence to be segmented is a segmentation unit feature, and thus, n segmentation units in the sequence to be segmented correspond to n segmentation unit features.

[0160] It should be noted that the n segmentation unit features can be acquired in advance, acquired in real time, or directly used in a subsequent traversal process after being acquired once, etc., and this embodiment of the application does not specifically limit this. In addition, the method for acquiring each segmentation unit feature can be a network model, such as a BERT model.

[0161] For example, n segmentation unit features can be obtained by formula (4), which is:

[0162]

[0163] Among them, x is the sequence to be segmented; n segmentation unit features corresponding to n segmentation units; is the segmentation unit feature corresponding to the first segmentation unit, is the segmentation unit feature corresponding to the first segmentation unit, is the segmentation unit feature corresponding to the first segmentation unit.

[0164] S50212112. Obtain the first segmentation unit feature and the last segmentation unit feature corresponding to the j-th last slice from the n segmentation unit features.

[0165] In an embodiment of the present application, when the j-th last slice includes one segmentation unit, the j-th last slice feature is the segmentation unit feature corresponding to the j-th last slice among the n segmentation unit features; when the j-th last slice includes multiple segmentation units, the sequence segmentation device obtains the segmentation unit feature corresponding to the first segmentation unit in the j-th last slice from the n segmentation unit features, and thus obtains the first segmentation unit feature; the sequence segmentation device obtains the segmentation unit feature corresponding to the last segmentation unit in the j-th last slice from the n segmentation unit features, and thus obtains the last segmentation unit feature.

[0166] S50212113. Determine the j-th last slice feature by combining the first slice unit feature and the last slice unit feature.

[0167] It should be noted that the sequence segmentation device fuses the first segmentation unit feature and the last segmentation unit feature to obtain the jth last slice feature.

[0168] For example, the first segmentation unit feature and the last segmentation unit feature can be combined by formula (5), which is:

[0169]

[0170] in, is the first segmentation unit feature, is the tail segmentation unit feature, is the column vector concatenation, and ⊙ is the element-wise vector product.

[0171] In the embodiment of the present application, S502122 can be implemented through S5021221-S5021225; that is, the sequence segmentation device obtains the jth highest segmentation sequence score corresponding to the jth segmentation prefix from the 1st segmentation sequence score set to the i-1th segmentation sequence score set, including S5021221-S5021225. Each step is described below.

[0172] S5021221. Obtain the target slice label corresponding to the j-th highest slice label value.

[0173] It should be noted that after the sequence segmentation device obtains the jth highest slice label value, the label corresponding to the jth highest slice label value, i.e., the target slice label, is also the predicted label of the jth last slice. Here, the jth last slice and the target slice label are one element in the sequence segmentation result.

[0174] S5021222. Obtain the label dependency value between each label and the target slice label.

[0175] It should be noted that the dependencies between various labels can be represented by a |v|*|v| matrix. Thus, after the sequence segmentation device obtains the target slice label, it can also obtain the label dependency values between each label and the target slice label; at this time, the label dependency value includes |v| elements (dependency values).

[0176] In an embodiment of the present application, the sequence segmentation device may also adopt label dependency between q consecutive slices, where q is greater than or equal to 2. Here, an example is given when q is 2.

[0177] S5021223. From the 1st segmentation sequence score set to the i-1th segmentation sequence score set, obtain the highest segmentation sequence score of each tag in the ijth last slice corresponding to each tag.

[0178] In the embodiment of the present application, the last slice corresponding to the jth segmentation prefix, i.e., the first ij segmentation units, is the ijth last slice. In other words, the ijth last slice is the last slice corresponding to the first ij segmentation units and is also the last slice corresponding to the jth segmentation prefix.

[0179] S5021224. Combine the highest segmentation sequence score of each tag corresponding to the ijth last slice with the tag dependency value to obtain the ijth segmentation sequence score set.

[0180] It should be noted that the sequence segmentation device combines the highest segmentation sequence score corresponding to each tag in the ijth last slice with the corresponding dependency value in the tag dependency value to obtain the ijth segmentation sequence score set. Here, the dependency value corresponding to the tag dependency value is based on the tag correspondence.

[0181] S5021225. Obtain the jth highest segmentation sequence score from the ijth segmentation sequence score set.

[0182] It should be noted that the jth highest segmentation sequence score is the highest score among the first ij segmentation sequence scores.

[0183] In the embodiment of the present application, before S5021, S5023 is also included; that is, before the sequence segmentation device traverses the n segmentation units, the sequence segmentation method further includes S5023, which is described below.

[0184] S5023. Obtain the segmentation sequence score corresponding to the first segmentation unit among the n segmentation units to obtain the first segmentation sequence score set.

[0185] It should be noted that the first segmentation unit among the n segmentation units cannot be used as the final slice and the corresponding prefix to implement sequence segmentation; here, the sequence segmentation device initializes the segmentation sequence score corresponding to the first segmentation unit, and thus obtains the first segmentation sequence score set.

[0186] In the embodiment of the present application, S5021 can be implemented through S50214; that is, the sequence segmentation device traverses n segmentation units, including S50214, and this step is described below.

[0187] S50214. Use the sequence segmentation model to traverse n segmentation units.

[0188] It should be noted that the sequence segmentation model is used to obtain sequence segmentation results corresponding to n segmentation units, such as LUA.

[0189] It is understandable that by adopting a network model to implement sequence segmentation of n segmentation units, the efficiency of sequence segmentation can be improved.

[0190] In the embodiment of the present application, S50215-S50218 are also included before S50214; that is, the sequence segmentation device adopts a sequence segmentation model, and before traversing n segmentation units, the sequence segmentation method also includes S50215-S50218, and each part is explained below.

[0191] S50215. Obtain sequence samples, where the sequence samples include a sequence to be predicted and sequence annotation information.

[0192] It should be noted that the sequence sample is a data set used to train the network model to obtain a sequence segmentation model; here, the sequence to be predicted is the sample sequence to be segmented, and the sequence annotation information is the segmentation sequence of the sequence to be predicted.

[0193] S50216. Use the to-be-trained sequence segmentation model to predict the to-be-predicted sequence and obtain the highest-scoring predicted segmentation sequence.

[0194] It should be noted that the sequence segmentation device uses the constructed network model, namely the sequence segmentation model to be trained, to perform sequence segmentation on the sequence to be predicted, and the obtained segmentation sequence is the highest-scoring predicted segmentation sequence; the sequence segmentation model to be trained is a model to be trained for obtaining sequence segmentation results corresponding to n segmentation units.

[0195] S50217. Iteratively train the sequence segmentation model to be trained based on the difference between the highest-scoring predicted segmentation sequence and the sequence annotation information.

[0196] It should be noted that the highest-scoring predicted segmentation sequence is the one predicted by the training sequence segmentation model, and the sequence annotation information is the label of the segmentation sequence of the training sequence. Therefore, to determine the prediction performance of the training sequence segmentation model, the difference between the highest-scoring predicted segmentation sequence and the sequence annotation information can be measured. When the difference is greater than the difference threshold, the training sequence segmentation model is iteratively trained.

[0197] In an embodiment of the present application, the difference between the highest score predicted segmentation sequence and the sequence annotation information can be obtained through a loss function; for example, the difference between the highest score predicted segmentation sequence and the sequence annotation information can be obtained through a hinge loss function.

[0198] For example, as shown in formula (6):

[0199]

[0200] Among them, ζ is the difference between the highest score predicted segmentation sequence and the sequence annotation information; f(y * ) is the sequence annotation information; The highest-scoring predicted segmentation sequence.

[0201] S50218. When the training end condition is met, the training is terminated to obtain a sequence segmentation model.

[0202] It should be noted that the training end condition may be that the difference obtained is lower than the difference threshold, or that the training number threshold is reached, etc., which is not specifically limited in the present embodiment. Here, the sequence segmentation model is a trained sequence segmentation model to be trained.

[0203] In the embodiment of the present application, S50218 also includes S50219 and S502110; that is, after the sequence segmentation device obtains the sequence segmentation model, the sequence segmentation method also includes S50219 and S502110. Each step is described below.

[0204] S50219. Obtain a new sequence sample.

[0205] It should be noted that the new sequence samples are samples obtained after the sequence samples; the new sequence samples are the data sets used to optimize the sequence segmentation model.

[0206] S502110. Optimize the sequence segmentation model based on new sequence samples.

[0207] In the embodiment of the present application, the process of the sequence segmentation device optimizing the sequence segmentation model using new sequence samples is similar to the process of training the sequence segmentation model to be trained using sequence samples, and the embodiment of the present application does not specifically limit this.

[0208] Accordingly, in the embodiment of the present application, the sequence segmentation device in S50214 adopts a sequence segmentation model to traverse n segmentation units, including: adopting an optimized sequence segmentation model to traverse n segmentation units.

[0209] It can be understood that after obtaining the sequence segmentation model, obtaining new sequence samples again to train the sequence segmentation model can achieve the effect of optimizing the sequence segmentation model, which can improve the generalization ability of the optimized sequence segmentation model and thus improve the accuracy of the determined segmentation sequence results.

[0210] See also Figure 7 , Figure 7 This is another optional flow chart of the sequence segmentation method provided in the embodiment of the present application; Figure 7 As shown, in the embodiment of the present application, S501 can be implemented through S5011 and S5012; that is, the sequence segmentation device obtains a sequence to be segmented including n segmentation units, including S5011 and S5012, and each step is described below.

[0211] S5011. In response to the sequence segmentation request, obtain the text to be segmented.

[0212] It should be noted that the sequence segmentation request is generated by the sequence segmentation device in response to a received sequence segmentation operation on the text to be segmented.

[0213] S5012: traverse each sentence to be segmented in the text to be segmented, and determine the traversed sentence to be segmented as a sequence to be segmented including n segmentation units.

[0214] In the embodiment of the present application, the sequence segmentation device traverses the text to be segmented, and for each sentence to be segmented that is traversed, that is, the sequence to be segmented includes n segmentation units in the embodiment of the present application.

[0215] Continue to see Figure 7 Accordingly, in the embodiment of the present application, S504 is followed by S505; that is, after the sequence segmentation device determines the candidate segmentation sequence corresponding to the highest candidate segmentation sequence score as the sequence segmentation result of the sequence to be segmented, the sequence segmentation method further includes S505, which is described below.

[0216] S505 : When the text to be segmented is traversed, a text segmentation sequence consisting of sequence segmentation results corresponding to each sentence to be segmented is obtained.

[0217] It should be noted that the sequence segmentation device executes the sequence segmentation method of the embodiment of the present application for each sentence to be segmented that is traversed, and obtains a corresponding sequence segmentation result. Thus, when the traversal of the text to be segmented is completed, since the text to be segmented includes at least one sentence to be segmented, at least one sequence segmentation result corresponding to the text to be segmented can be obtained. Here, the at least one sequence segmentation result is a text segmentation sequence. The text segmentation sequence can also be displayed.

[0218] In the embodiment of the present application, S502 can also be implemented through S5024-S5026; that is, the sequence segmentation device performs sequence segmentation on n segmentation units to obtain a candidate segmentation sequence score set corresponding to the sequence to be segmented, including S5024-S5026. Each step is described below.

[0219] S5024. Perform various sequence segmentations on the n segmentation units to obtain various candidate segmentation sequences.

[0220] It should be noted that the sequence segmentation device uses an exhaustive method to perform sequence segmentation on n segmentation units, thereby obtaining various candidate segmentation sequences.

[0221] S5025: For each candidate segmentation sequence in the set of various candidate segmentation sequences, obtain each slice score corresponding to each slice.

[0222] It should be noted that each candidate segmentation sequence includes various slices, and the sequence segmentation device scores each slice, thereby obtaining a slice score corresponding to each slice.

[0223] S5026: Combine the scores of each slice to obtain a score corresponding to each candidate segmentation sequence, thereby obtaining a candidate segmentation sequence score set.

[0224] In an embodiment of the present application, when the sequence segmentation device calculates the score of each candidate segmentation sequence, it combines the scores of each slice, for example, accumulates the scores of each slice, and obtains the score corresponding to each candidate segmentation sequence, thereby obtaining a candidate segmentation sequence score set.

[0225] It should be noted that the sequence segmentation method provided in the embodiment of the present application can be used as a callable application interface to provide services.

[0226] The following describes an exemplary application of the embodiments of the present application in a practical application scenario.

[0227] See also Figure 8 , Figure 8 : is a flow chart of an exemplary sequence segmentation method provided in the embodiments of the present application; Figure 8 As shown, the sequence segmentation task corresponding to this exemplary sequence segmentation method is Chinese word segmentation, including:

[0228] S801: Obtain an input fine-grained lexical unit sequence (sequence to be segmented).

[0229] Here, the fine-grained lexical unit sequence is recorded as x = [x1, x2, ..., x n ](n segmentation units).

[0230] S802: Obtain the initial state score of the fine-grained lexical unit sequence (the segmentation sequence score corresponding to the first segmentation unit).

[0231] Here, the initial state score is recorded as in, The possibility of taking the first element (the first segmentation unit) in the fine-grained token sequence x as a slice.

[0232] S803 : sequentially obtain the highest Chinese word segmentation scores corresponding to the first two elements, ..., and the first n elements in the fine-grained lexical unit sequence.

[0233] It should be noted that by sequentially performing Chinese word segmentation on the first i elements (first i segmentation units) in the fine-grained lexical unit sequence; when i is n, the highest Chinese word segmentation score obtained is the highest Chinese word segmentation score (highest candidate segmentation sequence score) of the fine-grained lexical unit sequence x. In addition, when obtaining the highest Chinese word segmentation score corresponding to the first i elements, the segmentation sequence corresponding to the first i elements is used as the prefix x. 1,i-j (jth segmentation prefix) and the last slice (i-j+1,i) (jth last slice), so the highest Chinese word segmentation score corresponding to the first i elements can be achieved by formula (7), which is:

[0234]

[0235] Among them, g i is the highest Chinese word segmentation score corresponding to the first i elements; g i-j is the highest Chinese word segmentation score corresponding to the first ij elements; is the probability that the last j elements in the first i elements are a slice (the j-th slice merge score).

[0236] Here, the score of a Chinese word segmentation sequence corresponding to a Chinese word segmentation can be achieved through formula (8), which is:

[0237]

[0238] Where u is the starting element number of a slice in the fine-grained lexical unit sequence x; v is the ending element number of a slice in the fine-grained lexical unit sequence x; is the score of the slice consisting of the uth element to the vth element in the fine-grained lexical unit sequence x; y is the output segmentation sequence, called the coarse-grained lexical unit sequence, denoted as y = [y1, y2, ..., y m ], where m is the length of the sequence and each item in y is represented as a two-tuple (i k ,j k ), (i k ,j k ) is a phrase range, k∈m.

[0239] S804: Based on the highest Chinese word segmentation scores corresponding to the first n elements, obtain the corresponding Chinese word segmentation sequence (segmentation sequence result). This can be achieved using formula (1).

[0240] See also Figure 9 , Figure 9 FIG. 1 is a flow chart of another exemplary sequence segmentation method provided in an embodiment of the present application; Figure 9As shown, the sequence segmentation task corresponding to this exemplary sequence segmentation method is named entity recognition, including:

[0241] S901: Obtain an input fine-grained lexical unit sequence.

[0242] Here, the implementation process of S901 is consistent with that of S801, and will not be repeated in detail in the embodiment of the present application.

[0243] S902: Obtain the initial state score of the fine-grained lexical unit sequence (the segmentation sequence score corresponding to the first segmentation unit).

[0244] Here, the initial state score is recorded as in, The highest score of the corresponding tag when the first element in the fine-grained token sequence x is used as a slice.

[0245] S903 , sequentially obtaining the highest named entity recognition scores corresponding to the first two elements, ..., and the first n elements in the fine-grained lexical unit sequence.

[0246] It should be noted that by sequentially performing named entity recognition on the first i elements (first i segmentation units) in the fine-grained lexical unit sequence; when i is n, the highest named entity recognition score obtained is the highest named entity recognition score (highest candidate segmentation sequence score) of the fine-grained lexical unit sequence X. In addition, when obtaining the highest named entity recognition score corresponding to the first i elements, the segmentation sequence corresponding to the first i elements is used as the prefix x 1,i-j (jth segmentation prefix) and the last slice (i-j+1,i,t) (jth last slice), so the highest Chinese word segmentation score corresponding to the first i elements can be achieved by formula (9), which is:

[0247]

[0248] Among them, g i is the highest named entity recognition score corresponding to the first i elements; g i-j is the highest named entity recognition score corresponding to the first ij elements; is the probability that the last j elements in the first i elements are a slice (the j-th slice merge score). The maximum probability value of the label corresponding to the slice composed of the last j elements in the first i elements (the jth highest slice label value) can be achieved by formula (10), which is:

[0249]

[0250] Where L is all labels (each label); It is the possibility or probability value when the label corresponding to phrase (i-j+1,i) is t.

[0251] It should be noted that, by calculating in advance through formula (10) It can reduce the time complexity of formula (9).

[0252] At this time, the score corresponding to each candidate segmentation sequence can be achieved by formula (11), which is:

[0253]

[0254] Among them, f(y) is the score corresponding to the candidate segmentation sequence; The highest score when the label corresponding to the slice consisting of the u-th element to the v-th element in the fine-grained lexical unit sequence x is t.

[0255] S904. Based on the highest entity recognition scores corresponding to the first n elements, obtain the corresponding entity recognition sequence (segmentation sequence result).

[0256] Here, S901-S904 can be implemented by pseudo code:

[0257] Input: Merged score for each slice (u,v,t) and label scores

[0258] Output: The highest scoring segmentation sequence and the highest score of the segmentation sequence

[0259] 1. Initialization

[0260] 2. Traverse the first i elements in x (the first i partition units), i∈[2,3,…,n]

[0261] 3. Calculate g i (Can be calculated by formula (9))

[0262] 4. Get g i The corresponding segmentation sequence (which can be achieved through formula (1))

[0263] 5. When i is n, the obtained g n The highest score of the segmented sequence So as to obtain the highest score segmentation sequence

[0264] It should be noted that the process of slot extraction is similar to that of named entity recognition, and will not be repeated here in the embodiments of this application.

[0265] See also Figure 10 , Figure 10 This is a flow chart of another exemplary sequence segmentation method provided in the embodiments of the present application; Figure 10 As shown, the sequence segmentation corresponding to this exemplary sequence segmentation method is part-of-speech tagging, including:

[0266] S1001. Obtain an input fine-grained lexical unit sequence.

[0267] Here, the implementation process of S1001 is consistent with that of S801, and will not be repeated in detail in the embodiment of the present application.

[0268] S1002: Obtain the initial state score of the fine-grained lexical unit sequence (the segmentation sequence score corresponding to the first segmentation unit).

[0269] Here, the implementation process of S1002 is consistent with that of S902, and will not be repeated in detail in the embodiment of the present application.

[0270] S1003 , sequentially obtaining the highest part-of-speech tagging scores corresponding to the first two elements, ..., and the first n elements in the fine-grained lexical unit sequence.

[0271] It should be noted that, by sequentially performing part-of-speech tagging on the first i elements (first i segmentation units) in the fine-grained lexical unit sequence, when i is n, the highest part-of-speech tagging score obtained is the highest part-of-speech tagging score (highest candidate segmentation sequence score) of the fine-grained lexical unit sequence x. In addition, when obtaining the highest part-of-speech tagging score corresponding to the first i elements, the segmentation sequence corresponding to the first i elements is also used as the prefix x. 1,i-j (jth segmentation prefix) and the last slice (i-j+1,i,t) (jth last slice), so the highest part-of-speech tagging score corresponding to the first i elements can be achieved by formula (12), which is:

[0272]

[0273] Among them, g i,t is the highest part-of-speech tagging score when the label of the last slice corresponding to the first i elements is t; g i-j,t‘ is the highest part-of-speech tagging score when the label of the last slice corresponding to the first ij elements is t'; is the probability that the last j elements in the first i elements are a slice (the j-th slice merge score); is the dependency value between label t' and label t; is the ijth segmentation sequence score set in the embodiment of the present application, is the jth highest segmentation sequence score in the embodiment of this application.

[0274] Here, the score corresponding to each candidate segmentation sequence can be realized by formula (13), which is:

[0275]

[0276] in, For the phrase (u k ,v k ) as a possibility of a slice; The label for the slice is t k The probability value when ; is the label dependency between q consecutive labels, which is the value trained by the model.

[0277] S1004. Based on the highest part-of-speech tagging scores corresponding to the first n elements, obtain the corresponding part-of-speech tagging sequence (segmentation sequence result).

[0278] It should be noted that the combined score ( and ) and label scores ( and ) can be realized based on equations (2)-(5).

[0279] The following describes an exemplary application of the sequence segmentation method provided in the embodiments of the present application. Figure 11 , Figure 11 is a schematic diagram of an exemplary sequence segmentation process provided in the embodiments of the present application; Figure 11 As shown, for the sequence to be segmented 11-1: "Word Cup Standings", in the LUA model 11-2, each candidate segmentation sequence "[WorldCup]MISC[Standings]O", "[World]O[Cup Standings]LOC", "[World Cup]PER[Standings]O", ..., "[World]O[Cup]MUSC[Standings]O" is scored respectively, and finally the candidate segmentation sequence with the highest score is selected from the output of the LUA model 11-2 to obtain the sequence segmentation result 11-3: "[Word Cup]MISC[Standings]O".

[0280] It is understood that the sequence segmentation method provided in the embodiments of this application directly searches for the optimal segmentation sequence from all possible segmentation sequences, achieving sequence segmentation at the level of the sequence to be segmented, thereby improving the effectiveness and efficiency of sequence segmentation. The following describes the evaluation results of various sequence segmentation tasks performed on datasets using the sequence segmentation method provided in the embodiments of this application.

[0281] See Table 1, which shows the F1 values of the LUA model corresponding to the sequence segmentation method provided in the embodiment of the present application for datasets 1-1 to 1-5, baseline models 1-1 to 1-5, and Chinese word segmentation for datasets 1-1 to 1-5:

[0282] Table 1

[0283]

[0284]

[0285] Datasets 1-1 through 1-5 are, in order, "AS," "MSR," "CITYU," "PKU," and "CTB 6." Baseline models 1-1 through 1-5 are, in order, "Rich Pretraining," "Bi-LSTM," "Multi-CriteriaLearning+BERT," "BERT," and "Glyce+BERT." Table 1 shows that the LUA model achieves the highest F1 scores on Datasets 1-1 and 1-3 through 1-4, achieving improvements of 0.25% on AS, 0.32% on CITYU, 0.19% on PKU, and 0.54% on CTB6. The F1 score on Dataset 2 is also high.

[0286] See Table 2, which shows the F1 values of the baseline models 2-1 to 2-6, and the sequence segmentation method provided in the embodiment of the present application corresponding to the LUA model 2-7 and LUA model 2-8 in Chinese word segmentation for datasets 2-1 to 2-4:

[0287] Table 2

[0288] Dataset 2-1 Dataset 2-2 Datasets 2-3 Datasets 2-4 Baseline Model 2-1 94.07 90.81 91.89 89.41 Baseline Model 2-2 94.38 - 92.34 89.75 Baseline Model 2-3 95.14 91.43 92.13 90.09 Baseline Models 2-4 95.61 91.92 92.38 90.87 Baseline Models 2-5 96.06 94.77 92.29 94.79 Baseline Models 2-6 96.61 95.41 93.15 96.14 LUA Models 2-7 96.79 95.39 93.22 96.01 LUA Models 2-8 97.96 96.63 93.95 97.08

[0289] Datasets 2-1 through 2-4 are, respectively, CTB 5, CTB 6, CTB 9, and UD 1. Baseline models 2-1 and 2-2 use different Bi-RNN+CRF implementations, while baseline models 2-3 through 2-6 use Lattice-LSTM, Glyce+Lattice-LSTM, BERT, and Glyce+BERT. LUA model 2-7 does not incorporate label dependency, while LUA model 2-8 incorporates label dependency. As shown in Table 2, LUA model 2-8 achieves improvements of 1.35% on CTB 5, 1.22% on CTB 6, 0.8% on CTB 9, and 0.94% on UD 1. In addition, LUA models 2-7 exceed “Glyce+BERT” by 0.18% and 0.07% on “CTB 5” and “CTB 9”, respectively.

[0290] Referring to Table 3, the F1 values of baseline models 3-1 to 3-6, and LUA models 3-7 and 3-8 corresponding to the sequence segmentation method provided in the embodiment of the present application, when performing syntactic segmentation on the data set 3-1 are shown; the F1 values of baseline models 3-1 to 3-6, and LUA models 3-7 and 3-8 corresponding to the sequence segmentation method provided in the embodiment of the present application, when performing named entity recognition NER on the data sets 3-2 and 3-3 are also shown.

[0291] Table 3

[0292]

[0293] Among them, dataset 3-1 is "CoNLL-2000", which contains 11 syntactic block types ("NP", "VP", "PP", etc.); dataset 3-2 is "CoNLL-2003", which contains 22,137 sentences, of which the training set, development set and test set contain 14,987, 3,466 and 3,684 sentences respectively, including four entity types: "PER", "LOC", "ORG" and "MISC"; dataset 3-3 is "OntoNotes 5.0", which contains 76,714 sentences and 18 entity types; baseline models 3-1 to baseline models 3-6 are "Bi-LSTM+CRF", "Flair Embeddings", "GCDT w / BERT", "BERT-MRC", "HCR w / BERT" and "BERT-Biaffine Model" respectively; LUA model 3-7 is a model without label dependency, and LUA model 3-8 is a model with label dependency. As Table 3 shows, LUA models 3-7 surpass BERT-BiaffineModel by 0.79% on Onto Notes 5.0, achieving the current state-of-the-art performance. On the syntactic chunking task, LUA models 3-7 outperform GCDT w / BERT, with LUA model 3-8 improving the performance gap by 0.42 percentage points.

[0294] See Table 4, which shows the F1 values of the LUA models 4-5 and 4-6 corresponding to the sequence segmentation method provided in the embodiment of the present application for data sets 4-1 to 4-3, baseline models 4-1 to 4-4, and the slot extraction for the LUA models 4-5 and 4-6:

[0295] Table 4

[0296] Dataset 4-1 Dataset 4-2 Dataset 4-3 Baseline Model 4-1 95.20 88.30 95.12 Baseline Model 4-2 95.42 93.90 - Baseline Model 4-3 96.10 97.00 96.48 Baseline Model 4-4 96.20 97.15 - LUA Models 4-6 96.15 97.10 97.53 LUA Models 4-7 96.27 97.20 97.55

[0297] Datasets 4-1 through 4-3 are "ATIS," "SNIPS," and "MTOD," respectively. The ATIS dataset contains a large amount of voice text recorded during airline ticket reservations, with a training set and test set containing 4,478 and 893 data points, respectively. The SNIPS dataset consists of voice data collected by in-car voice assistants, with a training set and test set containing 13,084 and 700 data points, respectively. The "MTOD" dataset covers three domains: "Alarm," "Reminder," and "Weather," with a training set of 30,521 samples, a development set of 4,181 samples, and a test set of 8,621 samples. Baseline models 4-1 through 4-4 are "Slot-gated SLU," "Bi-LSTM+EMLo," "Joint BERT," and "CM-Net," respectively. LUA model 4-5 is a model without intent recognition, and LUA model 4-6 is a model with intent recognition (a LUA based on multi-task learning). It can be seen from Table 4 that LUA models 4-6 improve by 0.07% on “ATIS”, 0.05% on “SNIPS”, and 1.11% on “MTOD”.

[0298] It is understandable that the sequence segmentation method provided in the embodiment of the present application ensures the validity of the segmentation sequence by searching for the best partition from all possible segmentation candidates. In addition, by using DP to search for the best partition, the effect and feasibility of determining the best partition are improved. And through parallel computing, the segmentation time is optimized. In addition, the sequence segmentation of the present application is applicable to unlabeled sequence segmentation scenarios, labeled sequence segmentation scenarios, and sequence segmentation scenarios with strong label dependence, and has a wide range of applications.

[0299] The following continues to describe the exemplary structure of the sequence segmentation device 455 provided in the embodiment of the present application as a software module. In some embodiments, such as Figure 4 As shown, the software modules stored in the sequence segmentation device 455 of the memory 450 may include:

[0300] The sequence acquisition module 4551 is used to acquire a sequence to be segmented, which includes n segmentation units, where n is an integer greater than 1;

[0301] Sequence segmentation module 4552 is configured to segment the n segmentation units to obtain a set of candidate segmentation sequence scores corresponding to the sequence to be segmented; wherein the set of candidate segmentation sequence scores is a set of candidate segmentation sequence scores corresponding to each candidate segmentation sequence, each slice in each candidate segmentation sequence constitutes the sequence to be segmented, and the candidate segmentation sequence score is a combination of the scores of each slice corresponding to each slice;

[0302] The score acquisition module 4553 is used to obtain the highest candidate segmentation sequence score in the candidate segmentation sequence score set;

[0303] The result acquisition module 4554 is configured to determine the candidate segmentation sequence corresponding to the highest candidate segmentation sequence score as the sequence segmentation result of the sequence to be segmented.

[0304] In an embodiment of the present application, the sequence segmentation module 4552 is further configured to traverse the n segmentation units, and based on the first segmentation sequence score set to the i-1th segmentation sequence score set, perform sequence segmentation on the first i segmentation units traversed to obtain the i-th segmentation sequence score set, where i is an integer greater than 1 and less than or equal to n, and the i-th segmentation sequence score set is the score of each segmentation sequence corresponding to the first i segmentation units; based on the first segmentation sequence score set to the i-th segmentation sequence score set, continue to perform sequence segmentation on the first i+1 segmentation units traversed until the n segmentation units are traversed, thereby obtaining the n-th segmentation sequence score set, where the n-th segmentation sequence score set is the candidate segmentation sequence score set corresponding to the sequence to be segmented.

[0305] In an embodiment of the present application, the sequence segmentation module 4552 is further configured to traverse the first i segmentation units again, and obtain the corresponding j-th segmentation prefix and j-th last slice for the last j segmentation units traversed, where j is an integer greater than 0 and less than i-1, the j-th segmentation prefix is the segmentation sequence corresponding to the first ij segmentation units, and the j-th last slice is the slice composed of the last j segmentation units; determine the i-th segmentation sequence score corresponding to the j-th segmentation prefix and the j-th last slice based on the first segmentation sequence score set to the i-1-th segmentation sequence score set; and continue traversing the next j+1 segmentation units until the last i-1 segmentation units of the first i segmentation units are traversed, thereby obtaining the i-1-th i-th segmentation sequence score corresponding to the first i segmentation units, wherein the i-th segmentation sequence score set includes the i-1-th i-th segmentation sequence score.

[0306] In an embodiment of the present application, the sequence segmentation module 4552 is further configured to obtain the jth last slice score corresponding to the jth last slice; obtain the jth highest segmentation sequence score corresponding to the jth segmentation prefix from the first segmentation sequence score set to the i-1th segmentation sequence score set, wherein the jth highest segmentation sequence score is the highest segmentation sequence score corresponding to the jth segmentation prefix; and combine the jth highest segmentation sequence score and the jth last slice score to obtain the i-th segmentation sequence score.

[0307] In an embodiment of the present application, the sequence segmentation module 4552 is further used to obtain the j-th last slice feature corresponding to the j-th last slice; based on the j-th last slice feature, predict the feasibility of at least one segmentation unit in the j-th last slice as a slice, and obtain the j-th slice merge score; based on the j-th slice merge score, obtain the j-th last slice score.

[0308] In an embodiment of the present application, the sequence segmentation module 4552 is further used to predict the j-th slice label values corresponding to each label of the j-th last slice based on the j-th last slice feature; and obtain the j-th highest slice label value from the j-th slice label values.

[0309] In the embodiment of the present application, the sequence segmentation module 4552 is further configured to combine the j-th slice merge score and the j-th highest slice label value to obtain the j-th final slice score.

[0310] In an embodiment of the present application, the sequence segmentation module 4552 is further used to obtain n segmentation unit features corresponding to the n segmentation units; obtain the first segmentation unit feature and the last segmentation unit feature corresponding to the j-th last slice from the n segmentation unit features; and determine the j-th last slice feature by combining the first segmentation unit feature and the last segmentation unit feature.

[0311] In an embodiment of the present application, the sequence segmentation module 4552 is further used to obtain the target slice label corresponding to the j-th highest slice label value, wherein the j-th last slice and the target slice label are an element in the sequence segmentation result; obtain the label dependency value between each label and the target slice label; obtain the highest segmentation sequence score of each label corresponding to the ij-th last slice from the 1st segmentation sequence score set to the i-1th segmentation sequence score set, wherein the ij-th last slice is the last slice corresponding to the first ij segmentation units; combine the highest segmentation sequence score of each label corresponding to the ij-th last slice with the label dependency value to obtain the ij-th segmentation sequence score set; and obtain the j-th highest segmentation sequence score from the ij-th segmentation sequence score set.

[0312] In the embodiment of the present application, the sequence segmentation module 4552 is further configured to obtain a segmentation sequence score corresponding to the first segmentation unit among the n segmentation units, and obtain a first segmentation sequence score set.

[0313] In the embodiment of the present application, the sequence segmentation module 4552 is further configured to adopt a sequence segmentation model to traverse the n segmentation units, wherein the sequence segmentation model is configured to obtain the sequence segmentation results corresponding to the n segmentation units.

[0314] In an embodiment of the present application, the sequence segmentation module 4552 is further used to obtain sequence samples, wherein the sequence samples include a sequence to be predicted and sequence labeling information; use a sequence segmentation model to be trained to predict the sequence to be predicted and obtain a highest-scoring predicted segmentation sequence, wherein the sequence segmentation model to be trained is a model to be trained for obtaining the sequence segmentation results corresponding to the n segmentation units; iteratively train the sequence segmentation model to be trained based on the difference between the highest-scoring predicted segmentation sequence and the sequence labeling information; and terminate the training until a training end condition is met to obtain the sequence segmentation model.

[0315] In the embodiment of the present application, the sequence segmentation module 4552 is further configured to obtain a new sequence sample, wherein the new sequence sample is a sample obtained after the sequence sample; and optimize the sequence segmentation model based on the new sequence sample.

[0316] In the embodiment of the present application, the sequence segmentation module 4552 is further configured to adopt the optimized sequence segmentation model to traverse the n segmentation units.

[0317] In an embodiment of the present application, the sequence acquisition module 4551 is further used to obtain the text to be segmented in response to a sequence segmentation request; traverse each sentence to be segmented in the text to be segmented, and determine the traversed sentence to be segmented as the sequence to be segmented including the n segmentation units.

[0318] In the embodiment of the present application, the result acquisition module 4554 is further configured to obtain a text segmentation sequence consisting of the sequence segmentation results corresponding to each sentence to be segmented after traversing the text to be segmented.

[0319] The present invention provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the sequence segmentation method described in the present invention.

[0320] The embodiment of the present application provides a computer-readable storage medium storing executable instructions, wherein the executable instructions are stored. When the executable instructions are executed by a processor, the processor will execute the sequence segmentation method provided in the embodiment of the present application, for example, Figure 5The sequence segmentation method shown.

[0321] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or various devices including one or any combination of the above memories.

[0322] In some embodiments, executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.

[0323] As an example, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinating files (e.g., files storing one or more modules, subroutines, or code portions).

[0324] By way of example, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices at one site, or on multiple computing devices distributed across multiple sites and interconnected by a communication network.

[0325] In summary, the present embodiment obtains a candidate segmentation sequence score for each candidate segmentation sequence corresponding to n segmentation units and determines the candidate segmentation sequence corresponding to the highest candidate segmentation sequence score as the sequence segmentation result. This achieves holistic sequence segmentation based on the sequence to be segmented, ensuring the validity of the obtained sequence segmentation results. This improves the effectiveness of sequence segmentation. Furthermore, it improves the accuracy and efficiency of sequence segmentation. Furthermore, the sequence segmentation method provided by the present embodiment has a wide range of applicability and strong generalization capabilities.

[0326] The above description is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the scope of protection of the present application.

Claims

1. A sequence segmentation method, characterized in that: include: Traversing each sentence to be segmented in the text to be segmented, and determining the traversed sentence to be segmented as a sequence to be segmented including n segmentation units, where n is an integer greater than 1; Traverse the n segmentation units, traverse the first i segmentation units traversed again, and obtain the corresponding j-th segmentation prefix and j-th last slice for the last j segmentation units traversed, where i is an integer greater than 1 and less than or equal to n, j is an integer greater than 0 and less than i-1, the j-th segmentation prefix is the segmentation sequence corresponding to the first ij segmentation units, and the j-th last slice is the slice composed of the last j segmentation units; Determine, based on the first segmentation sequence score set to the (i-1)th segmentation sequence score set, the i-th segmentation sequence score corresponding to the j-th segmentation prefix and the j-th last slice; Continue traversing the next j+1 segmentation units until the next i-1 segmentation units of the first i segmentation units are traversed, and obtain the i-1th i-th segmentation sequence scores corresponding to the first i segmentation units, wherein the i-th segmentation sequence score set includes the i-1th i-th segmentation sequence scores, and the i-th segmentation sequence score set is the segmentation sequence scores corresponding to the first i segmentation units; Based on the first segmentation sequence score set to the i-th segmentation sequence score set, continue to perform sequence segmentation on the first i+1 segmentation units that have been traversed until the n segmentation units are traversed, thereby obtaining the n-th segmentation sequence score set, wherein the n-th segmentation sequence score set is a candidate segmentation sequence score set corresponding to the sequence to be segmented, the candidate segmentation sequence score set is a set consisting of candidate segmentation sequence scores corresponding to each candidate segmentation sequence, each slice in each candidate segmentation sequence constitutes the sequence to be segmented, and the candidate segmentation sequence score is a combination of the scores of each slice corresponding to each slice; Obtaining the highest candidate segmentation sequence score in the candidate segmentation sequence score set; Determining the candidate segmentation sequence corresponding to the highest candidate segmentation sequence score as the sequence segmentation result of the sequence to be segmented; When the text to be segmented is traversed, a text segmentation sequence consisting of the sequence segmentation results corresponding to each sentence to be segmented is obtained.

2. The method according to claim 1, characterized in that The determining, based on the first segmentation sequence score set to the (i-1)th segmentation sequence score set, the i-th segmentation sequence score corresponding to the j-th segmentation prefix and the j-th last slice comprises: Obtaining the j-th last slice score corresponding to the j-th last slice; Obtaining the jth highest segmentation sequence score corresponding to the jth segmentation prefix from the first segmentation sequence score set to the (i-1)th segmentation sequence score set, wherein the jth highest segmentation sequence score is the highest segmentation sequence score corresponding to the jth segmentation prefix; The j-th highest segmentation sequence score and the j-th last slice score are combined to obtain the i-th segmentation sequence score.

3. The method according to claim 2, characterized in that The obtaining the j-th last slice score corresponding to the j-th last slice includes: Obtaining the j-th last slice feature corresponding to the j-th last slice; Based on the j-th last slice feature, predicting the feasibility of at least one segmentation unit in the j-th last slice being a slice, and obtaining a j-th slice merging score; Based on the j-th slice merge score, the j-th final slice score is obtained.

4. The method according to claim 3, characterized in that After obtaining the j-th last slice feature corresponding to the j-th last slice and before obtaining the j-th last slice score based on the j-th slice merging score, the method further includes: Based on the j-th last slice feature, predict each j-th slice label value corresponding to each label of the j-th last slice; Obtaining the j-th highest slice label value from the j-th slice label values; The obtaining the j-th final slice score based on the j-th slice merging score includes: The j-th slice merge score and the j-th highest slice label value are combined to obtain the j-th final slice score.

5. The method according to claim 3 or 4, characterized in that The obtaining of the j-th last slice feature corresponding to the j-th last slice includes: Obtaining n segmentation unit features corresponding to the n segmentation units; Obtaining, from the n segmentation unit features, a first segmentation unit feature and a last segmentation unit feature corresponding to the j-th last slice; The j-th last slice feature is determined by combining the first slice unit feature and the last slice unit feature.

6. The method according to claim 4, characterized in that The obtaining, from the first segmentation sequence score set to the (i-1)th segmentation sequence score set, the jth highest segmentation sequence score corresponding to the jth segmentation prefix includes: Obtaining a target slice label corresponding to the j-th highest slice label value, wherein the j-th last slice and the target slice label are an element in the sequence segmentation result; Obtaining label dependency values between each of the labels and the target slice label; From the first segmentation sequence score set to the (i-1)th segmentation sequence score set, obtaining the highest segmentation sequence score corresponding to each of the labels for the ijth last slice, wherein the ijth last slice is the last slice corresponding to the first ij segmentation units; Combine the highest segmentation sequence score of each tag corresponding to the ijth last slice with the tag dependency value to obtain the ijth segmentation sequence score set; From the ijth segmentation sequence score set, the jth highest segmentation sequence score is obtained.

7. The method according to any one of claims 1 to 4 and 6, characterized in that Before traversing the n segmentation units, the method further includes: Obtain a segmentation sequence score corresponding to the first segmentation unit among the n segmentation units to obtain a first segmentation sequence score set.

8. The method according to any one of claims 1 to 4 and 6, characterized in that The traversing the n segmentation units includes: A sequence segmentation model is adopted to traverse the n segmentation units, wherein the sequence segmentation model is used to obtain the sequence segmentation results corresponding to the n segmentation units.

9. The method according to claim 8, characterized in that Before traversing the n segmentation units using the sequence segmentation model, the method further includes: Acquiring a sequence sample, wherein the sequence sample includes a sequence to be predicted and sequence annotation information; Using a sequence segmentation model to be trained, predicting the sequence to be predicted, and obtaining a predicted segmentation sequence with the highest score, wherein the sequence segmentation model to be trained is a model to be trained for obtaining the sequence segmentation results corresponding to the n segmentation units; Iteratively training the sequence segmentation model to be trained based on the difference between the highest-scoring predicted segmentation sequence and the sequence annotation information; When the training end condition is met, the training is terminated to obtain the sequence segmentation model.

10. The method according to claim 9, characterized in that After obtaining the sequence segmentation model, the method further includes: Acquire a new sequence sample, wherein the new sequence sample is a sample obtained after the sequence sample; Optimizing the sequence segmentation model based on the new sequence sample; The sequential segmentation model is adopted to traverse the n segmentation units, including: The optimized sequence segmentation model is used to traverse the n segmentation units.

11. A sequence segmentation device, characterized in that: The device comprises: A sequence acquisition module is used to traverse each sentence to be segmented in the text to be segmented, and determine the traversed sentence to be segmented as a sequence to be segmented including n segmentation units, where n is an integer greater than 1; A sequence segmentation module is configured to traverse the n segmentation units, traverse the first i segmentation units traversed again, and obtain the corresponding j-th segmentation prefix and j-th last slice for the last j segmentation units traversed, wherein i is an integer greater than 1 and less than or equal to n, j is an integer greater than 0 and less than i-1, the j-th segmentation prefix is the segmentation sequence corresponding to the first ij segmentation units, and the j-th last slice is a slice composed of the last j segmentation units; based on the first segmentation sequence score set to the i-1 segmentation sequence score set, determine the i-th segmentation sequence score corresponding to the j-th segmentation prefix and the j-th last slice; continue to traverse the next j+1 segmentation units until the last i-1 segmentation units of the first i segmentation units are traversed, and obtain the i-1th i-th segmentation sequence corresponding to the first i segmentation units. Column scores, wherein the i-th segmentation sequence score set includes the i-1 i-th segmentation sequence scores, and the i-th segmentation sequence score set is the scores of each segmentation sequence corresponding to the first i segmentation units; based on the first segmentation sequence score set to the i-th segmentation sequence score set, the first i+1 segmentation units traversed are continued to be sequence segmented until the n segmentation units are traversed, and the n-th segmentation sequence score set is obtained, wherein the n-th segmentation sequence score set is the candidate segmentation sequence score set corresponding to the sequence to be segmented, and the candidate segmentation sequence score set is a set consisting of candidate segmentation sequence scores corresponding to each candidate segmentation sequence, and each slice in each candidate segmentation sequence constitutes the sequence to be segmented, and the candidate segmentation sequence score is a combination of the scores of each slice corresponding to each slice; A score acquisition module, configured to acquire the highest candidate segmentation sequence score in the candidate segmentation sequence score set; The result acquisition module is used to determine the candidate segmentation sequence corresponding to the highest candidate segmentation sequence score as the sequence segmentation result of the sequence to be segmented; when the text to be segmented is traversed, a text segmentation sequence consisting of the sequence segmentation results corresponding to each sentence to be segmented is obtained.

12. The device according to claim 11, characterized in that The sequence segmentation module is further configured to obtain a j-th last slice score corresponding to the j-th last slice; obtain the j-th highest segmentation sequence score corresponding to the j-th segmentation prefix from the first segmentation sequence score set to the i-1-th segmentation sequence score set, wherein the j-th highest segmentation sequence score is the highest segmentation sequence score corresponding to the j-th segmentation prefix; and combine the j-th highest segmentation sequence score and the j-th last slice score to obtain the i-th segmentation sequence score.

13. The device according to claim 12, characterized in that The sequence segmentation module is further configured to obtain a j-th last slice feature corresponding to the j-th last slice; based on the j-th last slice feature, predict the feasibility of at least one segmentation unit in the j-th last slice being a slice, and obtain a j-th slice merging score; Based on the j-th slice merge score, the j-th final slice score is obtained.

14. The device according to claim 13, characterized in that The sequence segmentation module is further configured to predict, based on the j-th last slice feature, each j-th slice label value corresponding to each label of the j-th last slice; and obtain the j-th highest slice label value from the each j-th slice label value; The sequence segmentation module is further configured to combine the j-th slice merge score and the j-th highest slice label value to obtain the j-th final slice score.

15. The device according to claim 13 or 14, characterized in that The sequence segmentation module is further used to obtain n segmentation unit features corresponding to the n segmentation units; obtain the first segmentation unit feature and the last segmentation unit feature corresponding to the j-th last slice from the n segmentation unit features; and determine the j-th last slice feature by combining the first segmentation unit feature and the last segmentation unit feature.

16. The device according to claim 14, characterized in that The sequence segmentation module is further configured to obtain a target slice label corresponding to the j-th highest slice label value, wherein the j-th last slice and the target slice label are an element of the sequence segmentation result; obtain label dependency values between each label and the target slice label; obtain the highest segmentation sequence score of each label corresponding to the ij-th last slice from the first segmentation sequence score set to the i-1-th segmentation sequence score set, wherein the ij-th last slice is the last slice corresponding to the first ij segmentation units; combine the highest segmentation sequence score of each label corresponding to the ij-th last slice with the label dependency value to obtain the ij-th segmentation sequence score set; and obtain the j-th highest segmentation sequence score from the ij-th segmentation sequence score set.

17. The device according to any one of claims 11 to 14 and 16, characterized in that The sequence segmentation module is further configured to obtain a segmentation sequence score corresponding to the first segmentation unit among the n segmentation units, and obtain a first segmentation sequence score set.

18. The device according to any one of claims 11 to 14 and 16, characterized in that The sequence segmentation module is further configured to adopt a sequence segmentation model to traverse the n segmentation units, wherein the sequence segmentation model is configured to obtain the sequence segmentation results corresponding to the n segmentation units.

19. The device according to claim 18, characterized in that The sequence segmentation module is further configured to obtain sequence samples, wherein the sequence samples include a sequence to be predicted and sequence labeling information; predict the sequence to be predicted using a sequence segmentation model to be trained to obtain a predicted segmentation sequence with the highest score, wherein the sequence segmentation model to be trained is a model to be trained for obtaining the sequence segmentation results corresponding to the n segmentation units; iteratively train the sequence segmentation model to be trained based on the difference between the predicted segmentation sequence with the highest score and the sequence labeling information; and terminate the training until a training termination condition is met, thereby obtaining the sequence segmentation model.

20. The device according to claim 19, characterized in that The sequence segmentation module is further configured to obtain a new sequence sample, wherein the new sequence sample is a sample obtained after the sequence sample; and optimize the sequence segmentation model based on the new sequence sample; The sequence segmentation module is further configured to adopt the optimized sequence segmentation model to traverse the n segmentation units.

21. A sequence segmentation device, characterized in that: include: a memory for storing executable instructions; A processor, configured to implement the method according to any one of claims 1 to 10 when executing the executable instructions stored in the memory.

22. A computer-readable storage medium, characterized in that Executable instructions are stored, and when executed by a processor, they are used to implement the method according to any one of claims 1 to 10.

23. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the method according to any one of claims 1 to 10 is implemented.

Citation Information

Patent Citations

  • Reminding control method and device for terminal equipment and electronic equipment

    CN108093121A

  • Data real-time storage method and device, computer equipment and storage medium

    CN111400361A