Chinese text word segmentation method, device and storage medium

By processing Chinese text through a unified word segmentation model, using a multi-head attention mechanism and a deep neural network encoder, it solves the problem of differences in word segmentation results under different word segmentation standards, improves the efficiency and flexibility of word segmentation, and adapts to personalized needs.

CN112989819BActive Publication Date: 2024-10-15BEIJING XIAOMI MOBILE SOFTWARE CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110303001.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-22
Publication Date
2024-10-15
Estimated Expiration
2041-03-22

AI Technical Summary

Technical Problem

Existing Chinese word segmentation technology has multiple word segmentation standards, resulting in different word segmentation results for the same text under different standards, which increases the consumption of computing resources and lacks deployment flexibility, and cannot meet the needs of personalized word segmentation.

Method used

A unified word segmentation model is used to process multiple word segmentation standards. By obtaining the text to be segmented and the word segmentation standards, character feature information is extracted, and the corresponding label sequence is output. The multi-head attention mechanism and deep neural network encoder are used for word segmentation processing to reduce the need for specific standards. Manual annotation of corpus dependencies.

Benefits of technology

It achieves unified processing of multiple word segmentation standards, makes full use of shared word segmentation knowledge, reduces computing resource consumption, improves the efficiency and flexibility of word segmentation devices, and adapts to personalized word segmentation needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112989819B_ABST
    Figure CN112989819B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a Chinese text word segmentation method, device and storage medium. The Chinese text word segmentation method includes: obtaining a text to be segmented and a word segmentation standard of the text to be segmented; inputting the text to be segmented and the word segmentation standard of the text to be segmented into a unified word segmentation model, and when processing the text to be segmented through the unified word segmentation model, obtaining preset characters corresponding to the word segmentation standard of the text to be segmented; associating the preset characters with the text to be segmented to obtain a standard enhanced text to be segmented; extracting feature information of each character in the standard enhanced text to be segmented; based on the feature information of each character, outputting a label sequence of the text to be segmented corresponding to the word segmentation standard of the text to be segmented. Through the present disclosure, the shared word segmentation knowledge of different word segmentation standards can be fully utilized, reducing the dependence on manually annotated corpus of a specific standard, and reducing the consumption of computing resources of the word segmentation device, thereby improving the efficiency and flexibility of the deployment of the word segmentation device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0004] ,

[0008] , , ,

[0007] , ,

[0006] , ,

[0005] , , , , , ,

[0010] ,

[0009]

[0001] The present disclosure relates to the field of natural language processing, and particularly to a Chinese text word segmentation method, apparatus, and storage medium. Background Art

[0002] In natural language processing tasks, generally, words are the smallest dimension. In English texts, spaces are used as natural delimiters between words. However, in Chinese, only characters, sentences, and paragraphs can be simply divided by obvious delimiters, and there is no formal delimiter for words. Therefore, the word segmentation task for Chinese has become the basis of Chinese natural language processing tasks, that is, Chinese word segmentation.

[0003] Currently, the Chinese word segmentation task is generally abstracted into a sequence labeling task. Taking the word segmentation label system [B, M, E, S] composed of four common word segmentation labels as an example, for each character in a text sentence, it is considered to belong to one of the four labels [B, M, E, S]. Among them, B indicates that the current character is the starting character of a word, M indicates that the current character is the middle character of a word, E indicates that the current character is the last character of a word, and S indicates a single-word, that is, the current character forms a word alone.

[0004] In related technologies, there are multiple word segmentation standards for Chinese word segmentation. Based on different word segmentation standards, different word segmentation results will be generated for the same input text. For example, for the text sentence "Li Na enters the semi-final", the word segmentation result based on the CTB6 word segmentation standard is |Li Na| |enters| |semi-final|, the word segmentation result based on the PKU word segmentation standard is |Li| |Na| |enters| |semi| |final|, and the word segmentation result based on the MSRA word segmentation standard is |Li Na| |enters| |semi| |final|. Summary of the Invention

[0005] To overcome the problems in related technologies, the present disclosure provides a Chinese text word segmentation method, apparatus, and storage medium.

[0006] According to the first aspect of the embodiments of the present disclosure, a Chinese text word segmentation method is provided, including:

[0007] Obtain the text to be segmented and the word segmentation standard of the text to be segmented;

[0008] Input the text to be segmented and the word segmentation standard of the text to be segmented into a unified word segmentation model;

[0009] When processing the text to be segmented through the unified word segmentation model, obtain the preset characters corresponding to the word segmentation standard of the text to be segmented;

[0010] [[ID=​

[0011] Extracting feature information of each character in the standard enhanced text to be segmented;

[0012] Based on the feature information of each character, a label sequence of the text to be segmented corresponding to the segmentation standard of the text to be segmented is output.

[0013] Optionally, when the feature information includes text features, extracting text features of each character in the standard enhanced text to be segmented;

[0014] The step of outputting a label sequence of the text to be segmented corresponding to the segmentation standard of the text to be segmented based on the feature information of each character includes:

[0015] Encoding the text features of each character to obtain a text feature vector of each character;

[0016] According to the text feature vector of each character, the label probability of each character corresponding to the label is determined, and a label sequence of the text to be segmented corresponding to the word segmentation standard of the text to be segmented is output.

[0017] Optionally, when the feature information includes text features and bigram features, the text features of each character and the bigram features of each character are extracted;

[0018] Encoding the text feature of each character to obtain a text feature vector of each character, and performing an embedding operation on the binary grammar feature of each character based on the binary grammar feature and the binary grammar feature vector mapping table to obtain a binary grammar feature vector of each character;

[0019] For a first character in each of the characters, fusing the text feature vector of the first character and the binary grammar feature vector of the first character to obtain a fused feature vector of the first character, and encoding the fused feature vector of the first character based on a multi-head attention mechanism to obtain an output vector of the first character;

[0020] According to the output vector of the first character, a label probability of a label corresponding to the first character is determined, and a label sequence of the text to be segmented corresponding to the word segmentation standard of the text to be segmented is output.

[0021] Optionally, the text feature vector of the first character and the bi-gram feature vector of the first character are fused in the following manner to obtain a fused feature vector of the first character:

[0022] =tanh( ),

[0023] =tanh( ),

[0024] =σ( )

[0025] =

[0026] Where t represents the first character at position t in the text, is the text feature vector, is the binary grammar feature vector, For fusion gating, is the fusion feature vector, is the matrix weight of the text feature vector, is the matrix weight of the binary grammar feature vector, is the text feature vector matrix weight of the fused feature vector, is the matrix weight of the binary grammar feature vector of the fused feature vector, is the bias vector, σ is the sigmoid function, Represents a vector-matrix bitwise multiplication.

[0027] Optionally, the unified word segmentation model is trained in the following manner:

[0028] Determine multiple word segmentation standards, and obtain a word segmentation dataset corresponding to each of the multiple word segmentation standards, wherein the word segmentation dataset corresponding to each word segmentation standard includes a text, a word segmentation standard for the text, and a word segmentation label sequence corresponding to the word segmentation standard;

[0029] The set of word segmentation data sets corresponding to each word segmentation standard of the multiple word segmentation standards is determined as a training data set, and the unified word segmentation model is obtained by training based on the training data set.

[0030] According to a second aspect of an embodiment of the present disclosure, a Chinese text word segmentation device is provided, comprising:

[0031] An acquisition module is configured to acquire a text to be segmented and a segmentation standard for the text to be segmented;

[0032] The processing module is configured to input the text to be segmented and the segmentation standard of the text to be segmented into a unified segmentation model, obtain preset characters corresponding to the segmentation standard of the text to be segmented when processing the text to be segmented through the unified segmentation model, associate the preset characters with the text to be segmented to obtain a standard enhanced text to be segmented, extract feature information of each character in the standard enhanced text to be segmented, and output a label sequence of the text to be segmented corresponding to the segmentation standard of the text to be segmented based on the feature information of each character.

[0033] Optionally, when the feature information includes text features, the processing module extracts the text features of each character in the standard enhanced text to be segmented, the processing module encodes the text features of each character to obtain the text feature vector of each character, determines the label probability of the label corresponding to each character based on the text feature vector of each character, and outputs the label sequence of the text to be segmented corresponding to the segmentation standard of the text to be segmented.

[0034] Optionally, when the feature information includes text features and binary grammar features, the processing module extracts the text features of each character and the binary grammar features of each character, encodes the text features of each character to obtain the text feature vector of each character, and based on the binary grammar features and the binary grammar feature vector mapping table, performs an embedding operation on the binary grammar features of each character to obtain the binary grammar feature vector of each character, for the first character of each character, fuses the text feature vector of the first character and the binary grammar feature vector of the first character to obtain the fused feature vector of the first character, and encodes the fused feature vector of the first character based on the multi-head attention mechanism to obtain the output vector of the first character, determines the label probability of the label corresponding to the first character according to the output vector of the first character, and outputs the label sequence of the text to be segmented corresponding to the segmentation standard of the text to be segmented.

[0035] Optionally, the processing module fuses the text feature vector of the first character and the bi-gram feature vector of the first character in the following manner to obtain a fused feature vector of the first character:

[0036] =tanh( ),

[0037] =tanh( ),

[0038] =σ( )

[0039] =

[0040] Where t represents the first character at position t in the text, is the text feature vector, is the binary grammar feature vector, For fusion gating, is the fusion feature vector, is the matrix weight of the text feature vector, is the matrix weight of the binary grammar feature vector, is the text feature vector matrix weight of the fused feature vector, is the matrix weight of the binary grammar feature vector of the fused feature vector, is the bias vector, σ is the sigmoid function, Represents a vector-matrix bitwise multiplication.

[0041] Optionally, the processing module is further configured to train the unified word segmentation model in the following manner:

[0042] Determine multiple word segmentation standards, and obtain a word segmentation dataset corresponding to each of the multiple word segmentation standards, wherein the word segmentation dataset corresponding to each word segmentation standard includes a text, a word segmentation standard for the text, and a word segmentation label sequence corresponding to the word segmentation standard;

[0043] The set of word segmentation data sets corresponding to each word segmentation standard of the multiple word segmentation standards is determined as a training data set, and the unified word segmentation model is obtained by training based on the training data set.

[0044] According to the Xth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the program instructions are executed by a processor, the steps of the Chinese text word segmentation method provided in the first aspect of the present disclosure are implemented.

[0045] The technical solution provided by the embodiments of the present disclosure may include the following beneficial effects: In the exemplary embodiments of the present disclosure, the text to be segmented and the segmentation standard of the text to be segmented are input into a unified segmentation model. The text to be segmented is segmented by the unified segmentation model to obtain the label probability of each character in the text to be segmented, and the label sequence of the text to be segmented corresponding to the segmentation standard of the text to be segmented is output. Furthermore, in the present disclosure, by using a unified segmentation model, the input text can be segmented according to a variety of segmentation standards, making full use of the shared segmentation knowledge of different segmentation standards and reducing the dependence on manually annotated corpus for a specific standard. Moreover, by calculating the segmentation results of a variety of segmentation standards through a unified segmentation model, the consumption of computing resources of the segmentation device can be reduced, thereby improving the efficiency and flexibility of the deployment of the segmentation device.

[0046] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0048] Figure 1 The figure is a flowchart of a Chinese text word segmentation method according to an exemplary embodiment.

[0049] Figure 2 The figure is a flowchart of a Chinese text word segmentation method according to an exemplary embodiment.

[0050] Figure 3 The figure is a flowchart of a Chinese text word segmentation method according to an exemplary embodiment.

[0051] Figure 4 It is a schematic diagram of performing word segmentation on a text to be segmented by using a unified word segmentation model according to an exemplary embodiment.

[0052] Figure 5 The figure is a block diagram of a Chinese text word segmentation device according to an exemplary embodiment.

[0053] Figure 6 The figure is a block diagram showing a device for Chinese text word segmentation according to an exemplary embodiment. DETAILED DESCRIPTION

[0054] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all possible embodiments consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.

[0055] In related technologies, there are multiple segmentation standards for Chinese words. Inputting the same text into segmentation models corresponding to different segmentation standards will produce different segmentation results. While the segmentation results output by segmentation models using different segmentation standards may differ, they often share much of the same segmentation knowledge.

[0056] Currently, when training a word segmentation model corresponding to the word segmentation standard, a large amount of labeled word segmentation data is required. Since the word segmentation data corresponding to the word segmentation standard cannot share the same word segmentation knowledge, when training a word segmentation model corresponding to the word segmentation standard, a large amount of specific standard corpus needs to be manually and repeatedly labeled.

[0057] Furthermore, for different word segmentation standards, it is necessary to train multiple Chinese word segmentation models, which increases the consumption of computing resources of the word segmentation device. At the same time, the deployment of the word segmentation device lacks flexibility and cannot well meet personalized word segmentation needs.

[0058] In light of this, the present disclosure provides a Chinese text word segmentation method that uses a unified word segmentation model to process Chinese word segmentation based on multiple word segmentation standards. This method can fully leverage the shared word segmentation knowledge across different word segmentation standards and reduce reliance on manually annotated corpora for specific standards. Furthermore, by using a unified word segmentation model to calculate word segmentation results based on multiple word segmentation standards, the consumption of computing resources on the word segmentation device can be reduced, thereby improving the efficiency and flexibility of the word segmentation device deployment.

[0059] Figure 1 FIG. 1 is a flow chart showing a Chinese text word segmentation method according to an exemplary embodiment. Figure 1 As shown, the Chinese text word segmentation method includes the following steps.

[0060] In step S11, the text to be segmented and the segmentation standard of the text to be segmented are obtained.

[0061] In step S12, the text to be segmented and the segmentation standard of the text to be segmented are input into a unified segmentation model.

[0062] The unified word segmentation model in this disclosure is, for example, a model pre-trained in the following manner:

[0063] Multiple word segmentation standards are determined, and a word segmentation dataset corresponding to each of the multiple word segmentation standards is obtained. The word segmentation dataset corresponding to each word segmentation standard includes a text, a word segmentation standard for the text, and a word segmentation label sequence corresponding to the word segmentation standard. The set of word segmentation datasets corresponding to each of the multiple word segmentation standards is determined as a training dataset, and a unified word segmentation model is trained based on the training dataset.

[0064] Among them, the word segmentation standards may include, for example, the Microsoft Research Asia (MSRA) word segmentation standard, the Peking University (PKU) word segmentation standard, the Chinese TreeBank (CTB) word segmentation standard, the Chinese Knowledge and Information Processing (CKIP) word segmentation standard, the City University of Hong Kong (CITY University, CITYU) word segmentation standard, the normalized cross correlation (NCC) word segmentation standard, and the Shanxi University (SXU) word segmentation standard.

[0065] According to the above multiple word segmentation standards, a word segmentation dataset corresponding to the word segmentation standard is obtained, a set of word segmentation datasets corresponding to each word segmentation standard in the multiple word segmentation standards is determined as a training dataset, and a unified word segmentation model is obtained by training the training dataset.

[0066] Therefore, after the text to be segmented and the segmentation standard of the text to be segmented are input into the unified segmentation model, the unified segmentation model can segment the text to be segmented and output a label sequence of the text to be segmented corresponding to the segmentation standard of the text to be segmented.

[0067] In step S13, when the text to be segmented is processed by the unified segmentation model, preset characters corresponding to the segmentation standard of the text to be segmented are obtained, and the preset characters are associated with the text to be segmented to obtain the standard enhanced text to be segmented.

[0068] The preset characters may be, for example, pre-stored special characters corresponding to the word segmentation standard of the text to be segmented. For example, the pre-stored preset characters [PKU] may represent the PKU word segmentation standard.

[0069] For example, for the text to be segmented "make friends with users", the word segmentation standard of the text to be segmented is the PKU word segmentation standard. Obtain the preset character [PKU] corresponding to the PKU word segmentation standard, and associate [PKU] with the text to be segmented to obtain the standard-enhanced text to be segmented. For example, add [PKU] before "make friends with users" to obtain the standard-enhanced text to be segmented "[PKU] make friends with users".

[0070] For the obtained standard-enhanced text to be segmented, extract the feature information of each character in the standard-enhanced text to be segmented. Based on the feature information of each character, output the label sequence of the text to be segmented corresponding to the word segmentation standard of the text to be segmented.

[0071] In step S14, extract the feature information of each character in the standard-enhanced text to be segmented.

[0072] Among them, the feature information can include, for example, text features, or the feature information can include text features and bigram features.

[0073] When the extracted feature information includes text features: For example, extract the text features of each character in the standard-enhanced text to be segmented "[PKU] make friends with users" to obtain the text features of each character in the standard-enhanced text to be segmented: "[PKU] | | and | | use | | household | | make | | friends | | friend |".

[0074] When the extracted feature information includes text features and bigram features: For example, extract the bigram features of each character in the standard-enhanced text to be segmented "[PKU] make friends with users" to obtain the bigram features of each character in the standard-enhanced text to be segmented: "| <nil> | | <s>Make friends with users".

[0075] In step S15 , based on the feature information of each character, a label sequence of the text to be segmented corresponding to the segmentation standard of the text to be segmented is output.

[0076] In the present disclosure, the unified word segmentation model determines the label probability of each character corresponding to the label based on the extracted text features of each character or the extracted text features and bi-gram features of each character, and can output a label sequence of the text to be segmented that corresponds to the word segmentation standard of the text to be segmented.

[0077] Therefore, the Chinese text segmentation method disclosed in the present invention avoids the problem of multi-standard segmentation scenarios where different segmentation standards are required to be used for Chinese text segmentation. The problem arises that segmentation models corresponding to different segmentation standards need to be trained, thereby increasing the consumption of computing resources of the segmentation device, reducing the flexibility of deploying the segmentation device, and failing to meet personalized segmentation needs.

[0078] Furthermore, the present disclosure uses a unified word segmentation model to segment input text according to multiple word segmentation standards, leveraging the shared word segmentation knowledge across different word segmentation standards and reducing reliance on manually annotated corpora for specific standards. Furthermore, by using a single unified word segmentation model to calculate word segmentation results for multiple word segmentation standards, the consumption of computing resources on the word segmentation device can be reduced, improving the efficiency and flexibility of the device's deployment.

[0079] In an exemplary embodiment of the present disclosure, the text to be segmented and the segmentation standard of the text to be segmented are input into a unified segmentation model. The text to be segmented is segmented by the unified segmentation model to obtain the label probability of each character in the text to be segmented, and a label sequence of the text to be segmented corresponding to the segmentation standard of the text to be segmented is output. Furthermore, in the present disclosure, by using a unified segmentation model, the input text can be segmented according to a variety of segmentation standards, making full use of the shared segmentation knowledge of different segmentation standards and reducing the dependence on manually annotated corpus for a specific standard. Moreover, by calculating the segmentation results of a variety of segmentation standards through a unified segmentation model, the consumption of computing resources of the segmentation device can be reduced, thereby improving the efficiency and flexibility of the deployment of the segmentation device.

[0080] The present disclosure below takes the extracted feature information as text features, and the extracted feature information as feature text features and bi-gram features as examples, and explains the implementation methods of segmenting the text to be segmented by a unified segmentation model and outputting a label sequence of the text to be segmented corresponding to the segmentation standard of the text.

[0081] Figure 2 The flowchart of a Chinese text word segmentation method shown according to an exemplary embodiment is as follows Figure 2 as shown, and includes the following steps.

[0082] In step S21, the text to be segmented and the word segmentation standard of the text to be segmented are obtained.

[0083] In step S22, the text to be segmented and the word segmentation standard of the text to be segmented are input into the unified word segmentation model.

[0084] In step S23, when processing the text to be segmented through the unified word segmentation model, the preset characters corresponding to the word segmentation standard of the text to be segmented are obtained, and the preset characters are associated with the text to be segmented to obtain the standard-enhanced text to be segmented.

[0085] In step S24, the text features of each character in the standard-enhanced text to be segmented are extracted.

[0086] In step S25, the text features of each character are encoded to obtain the text feature vector of each character. According to the text feature vector of each character, the label probability of the label corresponding to each character is determined, and the label sequence of the text to be segmented corresponding to the word segmentation standard of the text to be segmented is output.

[0087] In one implementation, the unified word segmentation model can, for example, encode the text features of the standard-enhanced text to be segmented through the deep neural network encoder included in the unified word segmentation model to obtain the text feature vector of each character:

[0088] For example, the text features of each character in the standard-enhanced text to be segmented "[PKU] make friends with users" are extracted to obtain the text features of each character in the standard-enhanced text to be segmented: "[PKU] | | and | | use | | er | | make | | friends |".

[0089] Encode "[PKU] | | and | | use | | er | | make | | friends |" to obtain the feature vector of "[PKU] | | and | | use | | er | | make | | friends |".

[0090] Thus, according to the text vector that models the word segmentation standard and the text context semantic information, the label probability of each character can be determined, and the label sequence of the text to be segmented corresponding to the word segmentation standard of the text to be segmented is output.

[0091] In exemplary embodiments of the present disclosure, a unified word segmentation model is used to segment input text according to multiple word segmentation standards, fully leveraging the shared word segmentation knowledge across different word segmentation standards and reducing reliance on manually annotated corpora for specific standards. Furthermore, by using a single unified word segmentation model to calculate word segmentation results for multiple word segmentation standards, the consumption of computing resources in the word segmentation device is reduced, improving the efficiency and flexibility of the device's deployment.

[0092] Figure 3 FIG. 1 is a flow chart showing a Chinese text word segmentation method according to an exemplary embodiment. Figure 3 As shown, the following steps are included.

[0093] In step S31, the text to be segmented and the segmentation standard of the text to be segmented are obtained.

[0094] In step S32, the text to be segmented and the segmentation standard of the text to be segmented are input into a unified segmentation model.

[0095] In step S33, when the text to be segmented is processed by the unified segmentation model, preset characters corresponding to the segmentation standard of the text to be segmented are obtained, and the preset characters are associated with the text to be segmented to obtain the standard enhanced text to be segmented.

[0096] In step S34, the text features of each character and the bigram features of each character are extracted.

[0097] In step S35, the text features of each character are encoded to obtain the text feature vector of each character, and based on the binary grammar features and the binary grammar feature vector mapping table, the binary grammar features of each character are embedded to obtain the binary grammar feature vector of each character.

[0098] In the present disclosure, the binary grammar feature of each character may be embedded according to the stored binary grammar feature and binary grammar feature vector mapping table to obtain a binary grammar feature vector corresponding to the binary grammar feature of each character.

[0099] In step S36 , for the first character in each character, the text feature vector of the first character and the binary grammar feature vector of the first character are fused to obtain a fused feature vector of the first character.

[0100] In order to enable the unified word segmentation model to better learn the contextual information of word-level text and improve the word segmentation accuracy of the unified word segmentation model, in one embodiment, the present disclosure can, for example, fuse the text feature vector and the binary grammar feature vector of the character through a fusion module in the unified word segmentation model to obtain a fused feature vector of the character.

[0101] In one embodiment, for example, the text feature vector of the first character and the bi-gram feature vector of the first character may be fused in the following manner to obtain a fused feature vector of the first character:

[0102] =tanh( ),

[0103] =tanh( ),

[0104] =σ( )

[0105] =

[0106] Where t represents the first character at position t in the text, is the text feature vector, is the binary grammar feature vector, For fusion gating, is the fusion feature vector, is the matrix weight of the text feature vector, is the matrix weight of the binary grammar feature vector, is the text feature vector matrix weight of the fused feature vector, is the matrix weight of the binary grammar feature vector of the fused feature vector, is the bias vector, σ is the sigmoid function, Represents a vector-matrix bitwise multiplication.

[0107] Therefore, through the above process, we can know that Converted general In the same vector space, by determining the gate , can determine the dynamic fusion ratio of text feature vector and Bi-gram feature vector, and then by Determine the final fusion feature vector of the text feature vector and the bi-gram feature vector.

[0108] In step S37, based on the multi-head attention mechanism, the fused feature vector of the first character is encoded to obtain the output vector of the first character.

[0109] The fused feature vector obtained by the fusion module in the unified word segmentation model integrates the word-level Bi-gram feature vector and text feature vector of the first character at each position in the text, but does not perform context modeling on the word-level Bi-gram feature vector of the first character.

[0110] In order to obtain the contextual representation of the word-level Bi-gram feature vector and text feature vector of the first character at each position in the text, in one embodiment, the present disclosure introduces a multi-head attention mechanism, which encodes the fused feature vector of the first character through the multi-head attention mechanism to obtain an output vector that models the contextual information of the text features and Bi-gram features, thereby better semantically representing the input text and word segmentation standards, and improving the word segmentation accuracy of the unified word segmentation model.

[0111] In addition, to improve the stability of the unified word segmentation model, residual connection and layer normalization are used in the multi-head attention mechanism when encoding the fused feature vector of the first character.

[0112] In one embodiment, after using residual connections and layer normalization, the fused feature vector of the first character can be encoded using a multi-head attention mechanism, for example, in the following manner:

[0113] O=LayerNorm(MultiHead(F)+F)

[0114] Among them, F represents the fused feature vector and O represents the output vector of multi-head attention.

[0115] In the above formula, the vector encoding of the fused feature vector is obtained based on the multi-head attention mechanism, MultiHead(F), and then the fused feature vector is added using the residual connection, that is, MultiHead(F)+F. The (MultiHead(F)+F) obtained after the residual connection is normalized, that is, LayerNorm(MultiHead(F)+F), to obtain the output vector O.

[0116] In step S38, the label probability of the label corresponding to the first character is determined according to the output vector of the first character, and a label sequence of the text to be segmented corresponding to the segmentation standard of the text to be segmented is output.

[0117] After obtaining the output vector, the present disclosure can transform the output vector through a linear transformation and a softmax output layer, converting the output vector at each position into the probability of the four word segmentation labels of [BMES]. The maximum label probability of the character at each position is obtained through a greedy algorithm, and the word segmentation label result of the character at the corresponding position in the entire text to be segmented is obtained. Moreover, if it is necessary to obtain word segmentation labels of other word segmentation standards, it is only necessary to change the word segmentation standard of the unified word segmentation model input. After the unified word segmentation model is used, the word segmentation label result of the corresponding standard can be obtained.

[0118] In an exemplary embodiment of the present disclosure, a unified word segmentation model fuses the text feature vectors and bigram feature vectors of each character in the extracted standard-enhanced text to be segmented, and encodes the fused feature vectors based on a multi-head attention mechanism to obtain the output vector of the first character, enabling the unified word segmentation model to better learn the context information of word-level text and improving the word segmentation accuracy of the unified word segmentation model.

[0119] Figure 4 It is a schematic diagram of word segmentation of text to be segmented by a unified word segmentation model according to an exemplary embodiment.

[0120] In Figure 4 it, after the unified word segmentation model processes the input text to be segmented "make friends with users" and the word segmentation standard PKU word segmentation standard of the text to be segmented, the unified word segmentation model obtains the preset character [PKU] corresponding to the word segmentation standard of the text to be segmented, and associates the preset character with the text to be segmented to obtain the standard-enhanced text to be segmented "[PKU] make friends with users". For "[PKU] make friends with users", the text features of each character in "[PKU] make friends with users" are extracted to obtain "[PKU] | |make| |friends| |with| |users|". And the bigram features of each character in "[PKU] make friends with users" are extracted to obtain "| <nil> | | <s>"and" || "and use" || "user" || "user make" || "make friends".

[0121] Encode "[PKU] || and || use || user || user make || make friends" through the deep neural network encoder included in the unified word segmentation model to obtain the text feature vector of each character. Based on the bigram feature and the bigram feature vector mapping table, for "| <nil> | | <s>Perform embedding operations on "和| |和用| |用户| |户交| |交朋| |朋友", to obtain the bigram feature vectors of each character.

[0122] For each character in the standard enhanced text to be segmented, through the fusion module based on the fusion gating mechanism, fuse the text feature vector and the bigram feature vector of the character, to obtain the fusion feature vector of each character in the standard enhanced text to be segmented. Through the multi-head attention module based on the multi-head attention mechanism, encode the fusion feature vector of each character, to obtain the output vector that models the context information of the text features and the Bi-gram features. According to the output vector of each character, determine the label probability of the label corresponding to each character, and output the label corresponding to each character in the standard enhanced text to be segmented "[PKU]和用户交朋友", that is, [PKU]-S, 和-S, 用-B, 户-E, 交-B, 朋-M, 友-E.

[0123] Figure 5 It is a block diagram of a Chinese text segmentation device 500 shown according to an exemplary embodiment. Refer to Figure 5 This device includes an acquisition module 501 and a processing module 502. Among them,

[0124] The acquisition module 501 is configured to acquire the text to be segmented and the segmentation standard of the text to be segmented;

[0125] The processing module 502 is configured to input the text to be segmented and the segmentation standard of the text to be segmented into the unified segmentation model. When processing the text to be segmented through the unified segmentation model, acquire the preset characters corresponding to the segmentation standard of the text to be segmented, associate the preset characters with the text to be segmented, to obtain the standard enhanced text to be segmented, extract the feature information of each character in the standard enhanced text to be segmented, and based on the feature information of each character, output the label sequence of the text to be segmented corresponding to the segmentation standard of the text to be segmented.

[0126] Optionally, when the feature information includes text features, the processing module 502 extracts the text features of each character in the standard enhanced text to be segmented, encodes the text features of each character, to obtain the text feature vector of each character, and according to the text feature vector of each character, determines the label probability of the label corresponding to each character, and outputs the label sequence of the text to be segmented corresponding to the segmentation standard of the text to be segmented.

[0127] Optionally, when the feature information includes text features and binary grammar features, the processing module 502 extracts the text features of each character and the binary grammar features of each character, encodes the text features of each character to obtain the text feature vector of each character, and based on the binary grammar features and the binary grammar feature vector mapping table, performs an embedding operation on the binary grammar features of each character to obtain the binary grammar feature vector of each character, for the first character of each character, fuses the text feature vector of the first character and the binary grammar feature vector of the first character to obtain the fused feature vector of the first character, and encodes the fused feature vector of the first character based on the multi-head attention mechanism to obtain the output vector of the first character, determines the label probability of the label corresponding to the first character according to the output vector of the first character, and outputs the label sequence of the text to be segmented corresponding to the segmentation standard of the text to be segmented.

[0128] Optionally, the processing module 502 fuses the text feature vector of the first character and the bi-gram feature vector of the first character in the following manner to obtain a fused feature vector of the first character:

[0129] =tanh( ),

[0130] =tanh( ),

[0131] =σ( )

[0132] =

[0133] Where t represents the first character at position t in the text, is the text feature vector, is the binary grammar feature vector, For fusion gating, is the fusion feature vector, is the matrix weight of the text feature vector, is the matrix weight of the binary grammar feature vector, is the text feature vector matrix weight of the fused feature vector, is the matrix weight of the binary grammar feature vector of the fused feature vector, is the bias vector, σ is the sigmoid function, Represents vector-matrix bitwise multiplication.

[0134] Optionally, the processing module 502 is further configured to train the unified word segmentation model in the following manner:

[0135] Determine multiple word segmentation standards, and obtain a word segmentation dataset corresponding to each of the multiple word segmentation standards, wherein the word segmentation dataset corresponding to each word segmentation standard includes a text, a word segmentation standard for the text, and a word segmentation label sequence corresponding to the word segmentation standard;

[0136] The set of word segmentation data sets corresponding to each word segmentation standard of the multiple word segmentation standards is determined as a training data set, and the unified word segmentation model is obtained by training based on the training data set.

[0137] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0138] The present disclosure also provides a computer-readable storage medium having computer program instructions stored thereon. When the program instructions are executed by a processor, the steps of the Chinese text word segmentation method provided by the present disclosure are implemented.

[0139] Figure 6 6 is a block diagram illustrating an apparatus 600 for Chinese text word segmentation according to an exemplary embodiment. For example, the apparatus 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0140] Reference Figure 6 , apparatus 600 may include one or more of the following components: a processing component 602 , a memory 604 , a power component 606 , a multimedia component 608 , an audio component 610 , an input / output (I / O) interface 612 , a sensor component 614 , and a communication component 616 .

[0141] The processing component 602 generally controls the overall operation of the device 600, such as operations associated with display, phone calls, data communications, camera operation, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to complete all or part of the steps of the above-mentioned Chinese text segmentation method. In addition, the processing component 602 may include one or more modules to facilitate interaction between the processing component 602 and other components. For example, the processing component 602 may include a multimedia module to facilitate interaction between the multimedia component 608 and the processing component 602.

[0142] The memory 604 is configured to store various types of data to support operations on the device 600. Examples of such data include instructions for any application or method operating on the device 600, contact data, phone book data, messages, pictures, videos, etc. The memory 604 can be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.

[0143] The power component 606 provides power to the various components of the device 600. The power component 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device 600.

[0144] The multimedia component 608 includes a screen that provides an output interface between the device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensors can not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide action. In some embodiments, the multimedia component 608 includes a front-facing camera and / or a rear-facing camera. When the device 600 is in an operating mode, such as a capture mode or a video mode, the front-facing camera and / or the rear-facing camera can receive external multimedia data. Each front-facing camera and the rear-facing camera can have a fixed optical lens system or have focal length and optical zoom capabilities.

[0145] The audio component 610 is configured to output and / or input audio signals. For example, the audio component 610 includes a microphone (MIC) that is configured to receive external audio signals when the device 600 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in the memory 604 or transmitted via the communication component 616. In some embodiments, the audio component 610 also includes a speaker for outputting audio signals.

[0146] I / O interface 612 provides an interface between processing component 602 and peripheral interface modules, such as a keyboard, click wheel, buttons, etc. These buttons may include but are not limited to: a home button, volume buttons, a start button, and a lock button.

[0147] The sensor assembly 614 includes one or more sensors for providing various aspects of the status assessment of the device 600. For example, the sensor assembly 614 can detect the open / closed state of the device 600, the relative positioning of components, such as the display and keypad of the device 600. The sensor assembly 614 can also detect changes in the position of the device 600 or a component of the device 600, the presence or absence of user contact with the device 600, the orientation or acceleration / deceleration of the device 600, and temperature changes of the device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 614 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an accelerometer, a gyroscope, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0148] The communication component 616 is configured to facilitate wired or wireless communication between the apparatus 600 and other devices. The apparatus 600 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 616 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0149] In an exemplary embodiment, the apparatus 600 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the Chinese text segmentation method.

[0150] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions. The instructions can be executed by the processor 620 of the apparatus 600 to implement the Chinese text segmentation method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0151] In another exemplary embodiment, a computer program product is further provided. The computer program product includes a computer program that can be executed by a programmable device, and the computer program has a code portion for executing the above-mentioned method for Chinese text segmentation when executed by the programmable device.

[0152] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the present disclosure. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the following claims.

[0153] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.< / s> < / nil> < / s> < / nil> < / s> < / nil>

Claims

1. A Chinese text word segmentation method, characterized in that: include: Obtain the text to be segmented and the segmentation standard of the text to be segmented; Inputting the text to be segmented and the segmentation standard of the text to be segmented into a unified segmentation model; When processing the text to be segmented by the unified word segmentation model, obtaining a preset character corresponding to the word segmentation standard of the text to be segmented; Associating the preset characters with the text to be segmented to obtain a standard enhanced text to be segmented; Extracting feature information of each character in the standard enhanced text to be segmented; Based on the feature information of each character, output a label sequence of the text to be segmented corresponding to the segmentation standard of the text to be segmented; When the feature information includes text features, extract the text features of each character in the standard enhanced text to be segmented; encode the text features of each character to obtain a text feature vector of each character; determine the label probability of the label corresponding to each character according to the text feature vector of each character, and output the label sequence of the text to be segmented corresponding to the segmentation standard of the text to be segmented; Among them, when the feature information includes text features and binary grammar features, the text features of each character and the binary grammar features of each character are extracted; the text features of each character are encoded to obtain the text feature vector of each character, and based on the binary grammar features and the binary grammar feature vector mapping table, the binary grammar features of each character are embedded to obtain the binary grammar feature vector of each character; for the first character of each character, the text feature vector of the first character and the binary grammar feature vector of the first character are fused to obtain the fused feature vector of the first character, and based on the multi-head attention mechanism, the fused feature vector of the first character is encoded to obtain the output vector of the first character; according to the output vector of the first character, the label probability of the label corresponding to the first character is determined, and the label sequence of the text to be segmented corresponding to the segmentation standard of the text to be segmented is output.

2. The Chinese text word segmentation method according to claim 1, characterized in that: The text feature vector of the first character and the bi-gram feature vector of the first character are fused in the following manner to obtain a fused feature vector of the first character: =tanh( ) =tanh( ) = ) = Where t represents the first character at position t in the text, is the text feature vector, is the binary grammar feature vector, For fusion gating, is the fusion feature vector, is the matrix weight of the text feature vector, is the matrix weight of the bi-grammar feature vector, is the text feature vector matrix weight of the fused feature vector, is the matrix weight of the binary grammar feature vector of the fused feature vector, is the bias vector, is the sigmoid function, Represents vector-matrix bitwise multiplication.

3. The Chinese text word segmentation method according to any one of claims 1-2, characterized in that: The unified word segmentation model is trained in the following manner: Determine multiple word segmentation standards, and obtain a word segmentation data set corresponding to each of the multiple word segmentation standards, wherein the word segmentation data set corresponding to each word segmentation standard includes a text, a word segmentation standard of the text, and a word segmentation label sequence corresponding to the word segmentation standard; The set of word segmentation data sets corresponding to each word segmentation standard in the multiple word segmentation standards is determined as a training data set, and the unified word segmentation model is obtained by training based on the training data set.

4. A Chinese text word segmentation device, characterized in that: include: An acquisition module is configured to acquire the text to be segmented and the segmentation standard of the text to be segmented; A processing module is configured to input the text to be segmented and the segmentation standard of the text to be segmented into a unified segmentation model, obtain a preset character corresponding to the segmentation standard of the text to be segmented when processing the text to be segmented through the unified segmentation model, associate the preset character with the text to be segmented to obtain a standard enhanced text to be segmented, extract feature information of each character in the standard enhanced text to be segmented, and output a label sequence of the text to be segmented corresponding to the segmentation standard of the text to be segmented based on the feature information of each character; Wherein, when the feature information includes text features, the processing module extracts the text features of each character in the standard enhanced text to be segmented, encodes the text features of each character, obtains the text feature vector of each character, determines the label probability of the label corresponding to each character according to the text feature vector of each character, and outputs the label sequence of the text to be segmented corresponding to the segmentation standard of the text to be segmented; Among them, when the feature information includes text features and binary grammar features, the processing module extracts the text features of each character and the binary grammar features of each character, encodes the text features of each character to obtain the text feature vector of each character, and based on the binary grammar features and the binary grammar feature vector mapping table, embeds the binary grammar features of each character to obtain the binary grammar feature vector of each character, for the first character of each character, fuses the text feature vector of the first character and the binary grammar feature vector of the first character to obtain the fused feature vector of the first character, and based on the multi-head attention mechanism, encodes the fused feature vector of the first character to obtain the output vector of the first character, determines the label probability of the label corresponding to the first character according to the output vector of the first character, and outputs the label sequence of the text to be segmented corresponding to the segmentation standard of the text to be segmented.

5. A Chinese text word segmentation device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to: execute the Chinese text word segmentation method as described in any one of claims 1 to 3 by executing the instructions.

6. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the steps of the method described in any one of claims 1 to 3 are implemented.