[go: up one dir, main page]

CN112966506A - Text processing method, device, equipment and storage medium - Google Patents

Text processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN112966506A
CN112966506A CN202110309988.XA CN202110309988A CN112966506A CN 112966506 A CN112966506 A CN 112966506A CN 202110309988 A CN202110309988 A CN 202110309988A CN 112966506 A CN112966506 A CN 112966506A
Authority
CN
China
Prior art keywords
target
sample
label
participle
result
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110309988.XA
Other languages
Chinese (zh)
Inventor
林雨
吴培昊
马泽君
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Youzhuju Network Technology Co Ltd
Original Assignee
Beijing Youzhuju Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Youzhuju Network Technology Co Ltd filed Critical Beijing Youzhuju Network Technology Co Ltd
Priority to CN202110309988.XA priority Critical patent/CN112966506A/en
Publication of CN112966506A publication Critical patent/CN112966506A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/232Orthographic correction, e.g. spell checking or vowelisation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Machine Translation (AREA)

Abstract

The embodiment of the disclosure discloses a text processing method, a text processing device, text processing equipment and a storage medium. The method comprises the following steps: determining a target label and a target modification result of each target word in a text to be detected, wherein the target word is a word obtained by segmenting the text to be detected, and the target label is used for indicating a modification mode of the target word; determining a target result of each target word segmentation according to the target label and the target modification result of each target word segmentation; and splicing the target results of the target word segmentation to obtain a target text corresponding to the text to be detected. According to the scheme, the target label and the target modification result of each target word segmentation in the text to be detected are determined, and the corresponding target result is determined based on the target label and the target modification result, so that the information according to the target label and the target modification result is more comprehensive when the target result of each target word segmentation is determined, and the accuracy of the text processing result is improved.

Description

Text processing method, device, equipment and storage medium
Technical Field
The disclosed embodiments relate to the field of natural language processing technologies, and in particular, to a text processing method, device, apparatus, and storage medium.
Background
Error detection and modification of text is critical in language learning and applications. Specifically, for an input text, it is necessary to find out which part of the text has an error, and to appropriately modify the erroneous part to obtain a correct text.
In the traditional method, when error detection and modification are carried out, the accuracy of the obtained text is low.
BRIEF SUMMARY OF THE PRESENT DISCLOSURE
The embodiment of the disclosure provides a text processing method, a text processing device, a text processing apparatus and a storage medium, which can improve the accuracy of a text processing result.
In a first aspect, an embodiment of the present disclosure provides a text processing method, including:
determining a target label and a target modification result of each target word in a text to be detected, wherein the target word is a word obtained by segmenting the text to be detected, and the target label is used for indicating a modification mode of the target word;
determining a target result of each target word segmentation according to the target label and the target modification result of each target word segmentation;
and splicing the target results of the target word segmentation to obtain a target text corresponding to the text to be detected.
In a second aspect, an embodiment of the present disclosure further provides a text processing apparatus, including:
the first determining module is used for determining a target label and a target modification result of each target word in a text to be detected, wherein the target word is a word obtained by segmenting the text to be detected, and the target label is used for indicating a modification mode of the target word;
the second determining module is used for determining the target result of each target word segmentation according to the target label and the target modification result of each target word segmentation;
and the splicing module is used for splicing the target results of the target word segmentation to obtain the target text corresponding to the text to be detected.
In a third aspect, an embodiment of the present disclosure further provides an electronic device, including:
one or more processors;
a memory for storing one or more programs;
the one or more programs, when executed by the one or more processors, implement a text processing method as described in the first aspect.
In a fourth aspect, the disclosed embodiments also provide a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the text processing method according to the first aspect.
The embodiment of the disclosure provides a text processing method, a text processing device, a text processing apparatus and a storage medium, wherein a target label and a target modification result of each target word in a text to be detected are determined, the target word is a word obtained by segmenting the text to be detected, and the target label is used for representing a modification mode of the target word; determining a target result of each target word segmentation according to the target label and the target modification result of each target word segmentation; and splicing the target results of the target word segmentation to obtain a target text corresponding to the text to be detected. According to the scheme, the target label and the target modification result of each target word segmentation in the text to be detected are determined, and the corresponding target result is determined based on the target label and the target modification result, so that the information according to the target label and the target modification result is more comprehensive when the target result of each target word segmentation is determined, and the accuracy of the text processing result is improved.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale.
Fig. 1 is a flowchart of a text processing method according to an embodiment of the present disclosure;
fig. 2 is a flowchart of a text processing method according to a second embodiment of the disclosure;
fig. 3 is a structural diagram of a text processing apparatus according to a third embodiment of the disclosure;
fig. 4 is a structural diagram of an electronic device according to a fourth embodiment of the disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
Example one
Fig. 1 is a flowchart of a text processing method according to an embodiment of the present disclosure, which is applicable to the case of performing error recognition and error correction on an input text. The method can be executed by a text reduction apparatus, which can be implemented in software and/or hardware and can be configured in an electronic device with data processing function. As shown in fig. 1, the method may include the steps of:
s110, determining target labels and target modification results of all target word segments in the text to be detected.
The target word segmentation is a word segmentation obtained by segmenting the text to be detected, and the target label is used for indicating a modification mode of the target word segmentation. The text to be detected can be text with certain meaning composed of a plurality of words, and the existing form of the text can include but is not limited to sentences, paragraphs and articles. The embodiment does not limit the specific content of the text to be detected and the language used by the text to be detected, for example, the text to be detected may only use one language, such as chinese or english, or may use multiple languages simultaneously, such as chinese and english, and the like. In practical application, the text to be detected can be directly input by a user, can be acquired locally or online through a webpage, and can be acquired by recognizing voice information.
Considering that the text to be detected is a text composed of a plurality of words, when the text to be detected is detected, each word contained in the text to be detected can be detected. In an example, the text to be detected may be segmented to obtain each participle included in the text to be detected, and in the embodiment, each participle obtained by segmenting the text to be detected is marked as a target participle of the text to be detected. For example, the text to be detected is: and splitting the I wan go home on yesterday to obtain I, wan, go, home, on and yesterday, and respectively marking the I, wan, go, home, on and yesterday as target word segmentation of the text to be detected. The detection result based on the target word segmentation can add corresponding labels to the target word segmentation so as to represent the modification mode of the target word segmentation, wherein the modification mode can include whether the target word segmentation needs to be modified or not and how the target word segmentation needs to be modified, namely, the target word segmentation can be simultaneously identified and corrected for errors occurring in the text to be detected. For example, after detecting the target word "want", a VB _ VBZ tag and a True tag may be added to the target word "want", where the VB _ VBZ tag is used to indicate that a verb is generally changed from time to time in the past, and the True tag indicates that a word needs to be inserted into a position where the target word "want" is located. It should be noted that, when detecting each target word segmentation, the context of the text to be detected may be combined to improve the accuracy of the detection result, for example, when the context corresponding to the text to be detected is past, the context may be used as a detection basis when detecting the target word segmentation "wan".
The target tag usually reflects a rough detection result, for example, the VB _ VBZ tag and the True tag described above can only indicate the modification result of the target participle to some extent, but do not give a specific modification result. The method is suitable for users with strong language understanding ability, and specific modification results can be obtained based on the target tags. For users with weak language understanding ability, specific modification results can be provided for the users for the convenience of understanding and learning, and the embodiment refers to the specific modification results as target modification results. For example, for the target word "wan", the target modification result may be "wan" provided to the user with weak language understanding capability. Compared with the label method, the method can meet the requirements of some primary language learners, but certain problems can exist in the aspect of accuracy. In view of this, the present embodiment determines the target word segmentation and the target modification result corresponding to the target word segmentation at the same time, and detects the target word segmentation from different layers, so that the detection result is richer, and when the target result is subsequently determined, the accuracy of the target result can be improved.
Optionally, the target label and the target modification result of each target word in the text to be detected may be determined manually, for example, each target word included in the text to be detected may be manually verified in combination with the context of the text to be detected, and the target label and the target modification result corresponding to the target word are determined, so that the accuracy is high. The text to be detected can be input into the text processing model, the target label and the target modification result of each target word are obtained by combining the text processing model, and especially when the content and the number of the text to be detected are large, the detection efficiency can be improved, the waiting time of a user is reduced, and the user experience is improved. The type of the text processing model is not limited by the embodiment, and for example, BERT (Bidirectional Encoder representation from pre-training models for Bidirectional conversion), RoBERTa (Robustly Optimized BERT prediction Approach), XLNET (Generalized Autoregressive model for Language Understanding), etc. may be used, and RoBERTa and XLNET are two modified forms of BERT.
And S120, determining a target result of each target word segmentation according to the target label and the target modification result of each target word segmentation.
Optionally, in a case that the target tag and the target modification result are not contradictory, the target modification result may be directly used as the target result of the target word segmentation, and in a case that the target tag and the target modification result are contradictory, a result with a higher probability may be used as the target result thereof, for example, when the probability corresponding to the target tag is greater than the probability corresponding to the target modification result, a result may be determined as the target result based on the target tag, and when the probability corresponding to the target modification result is greater than the probability corresponding to the target tag, the target modification result may be used as the target result thereof. The contradiction between the target tag and the target modification result indicates that the modification mode reflected by the target tag is different from the modification mode reflected by the target modification result, for example, the target tag is VB _ VBZ, which indicates that when the verb is generally changed from the current time to the general past, the target modification result is "wait" - "wented", which indicates that the target tag and the target modification result are not contradictory; if the target label is VB _ VBZ and the target modification result is 'wait' - 'wards', the contradiction between the target label and the target modification result is indicated. The target result is determined by combining the target label and the target modification result, the information is more comprehensive, and the result accuracy is higher.
And S130, splicing the target results of the target word segmentation to obtain a target text corresponding to the text to be detected.
Optionally, the target result of each target word segmentation may be spliced according to the sequence of the target word segmentation in the text to be detected to obtain the detected text, and the text is referred to as the target text in the embodiment. On one hand, the embodiment can identify the error of the text to be detected, and plays a role in reminding the user, so that the user can emphatically check the part with the error, and the error correction capability of the user is improved; on the other hand, the embodiment can also modify the error of the text to be detected, provide a more reasonable language expression suggestion for the user, and improve the language expression ability of the user.
The first embodiment of the disclosure provides a text processing method, which includes determining a target label and a target modification result of each target word segmentation in a text to be detected, where the target word segmentation is a word segmentation obtained by segmenting the text to be detected, and the target label is used for indicating a modification mode of the target word segmentation; determining a target result of each target word segmentation according to the target label and the target modification result of each target word segmentation; and splicing the target results of the target word segmentation to obtain a target text corresponding to the text to be detected. According to the scheme, the target label and the target modification result of each target word segmentation in the text to be detected are determined, and the corresponding target result is determined based on the target label and the target modification result, so that the information according to the target label and the target modification result is more comprehensive when the target result of each target word segmentation is determined, and the accuracy of the text processing result is improved.
Example two
Fig. 2 is a flowchart of a text processing method provided in the second embodiment of the present disclosure, in this embodiment, a determination process of a target tag and a target modification result is optimized on the basis of the above embodiments, and referring to fig. 2, the method may include the following steps:
s210, inputting the text to be detected into a target text processing model to obtain target labels and target modification results of target word segments in the text to be detected.
And the target text processing model is obtained by training an initial text processing model through sample word segmentation contained in a training sample. In the embodiment, the target label and the target modification result of the target word segmentation are determined in an intelligent manner, so that the labor can be saved, and the detection efficiency can be improved. Alternatively, the target label and the target modification result of each target word can be determined by means of a text processing model. For example, a training sample can be obtained in advance, an initial text processing model is trained by using the training sample to obtain a target text processing model, and a target label and a target modification result of each target word segmentation in the text to be detected are obtained based on the target text processing model. The structure of the initial text processing model may be set as required, for example, the initial text processing model may include a deep network structure and a shallow network structure, the deep network structure is used to determine the parameter vector corresponding to the target tag and the target modification result, and the shallow network structure is used to convert the parameter vector output by the deep network structure into the target tag and the target modification result. The deep network structure may adopt a deep bidirectional Transformer model structure, and of course, other structures may also be adopted, and the embodiment is not particularly limited. The shallow network structure may adopt a full connection layer, an Attention attachment layer, CNN (Convolutional Neural Networks), or the like. It should be noted that, when outputting the target tag and the target modification result, a shallow network with the same structure may be used, for example, a full connection layer, an Attention authorization layer, or a CNN may be used when outputting the target tag and the target modification result, or a shallow network with a different structure may be used, for example, a full connection layer may be used when outputting the target tag, and a CNN may be used when outputting the target modification result.
In one example, the initial text processing model may be trained in the following manner, resulting in a target text processing model:
s2101, inputting the first sample into the initial text processing model to obtain a sample label and a sample modification result corresponding to the first word segmentation in the first sample.
The first sample is a training sample, and the first participle is obtained by segmenting the first sample. The obtaining manner of the first sample may refer to the text to be detected in the above embodiment, and details are not described here. Optionally, the sample tags may include a first sample tag and a second sample tag, the first sample tag may include a part of speech conversion tag, a deletion tag, or an unmodified tag, and the second sample tag may include an insertion tag or a non-insertion tag. The part-of-speech transformation tag is used to represent part-of-speech transformation of the first participle, wherein the part-of-speech transformation may include, but is not limited to, verb transformation, noun transformation, adjective transformation, or adverb transformation. The delete tag is used to indicate that the first segmentation requires deletion. No modification tag is used to indicate that the first word does not need to be modified. The insertion label is used for indicating that the position of the first segmentation is required to be inserted. No inserted tag is used to indicate that no segmentation needs to be inserted at the location where the first segmentation is located. The sample modification result may include a first sample modification result and a second sample modification result. The first sample modification result may include a part-of-speech modification result of the first participle or a deletion result of the first participle, and the part-of-speech modification result may include an original word or a modified word, where the original word indicates that the first participle is kept unchanged, and the modified word is a participle obtained after the part-of-speech modification of the first participle. The deletion result indicates that the first participle is deleted. The second sample modification result may include an insertion word result of the first participle, the insertion word result may include a specific insertion word or no other participle, and when the position of the first participle does not need to be inserted into other participles, a specific character, such as an EMPTY, may be added to the first participle, indicating that the position of the participle does not need to be inserted into other participles.
In one example, a word insertion result of the first segmentation may be determined as a second modification result of the first segmentation, and a binary label of the first segmentation may be determined as a second sample label of the first segmentation, wherein the binary label is used to indicate whether the position of the first segmentation requires insertion of other segmentation. The inserted word result and the binary label of the first word segmentation can be obtained by the initial text processing model, that is, the first word segmentation is input into the initial text processing model, that is, the initial text processing model outputs the result of whether other word segmentation needs to be inserted at the position where the first word segmentation is located, and the inserted word result and the binary label, that is, the second modification result and the second sample label, can be obtained according to the result. In addition, the initial text processing model may determine whether the first segmentation requires modification, and output a result, the modification being used to modify a part of speech of the first segmentation or delete the first segmentation. The first sample modification result and the first sample label of the first word can be determined according to the result whether the first word output by the initial text processing model needs to be modified.
The mode for determining whether the first word segmentation needs to be modified by the initial text processing model can be selected according to actual needs. For example, a probability that the first term does not need to be modified may be determined by the initial text processing model, which is noted by the embodiment as the first probability, and if the first probability is greater than or equal to the first set threshold, it may be determined that the first term does not need to be modified, otherwise, it is determined that the first term needs to be modified. For example, the probability that the label of the first word is the first preset label may also be determined by the initial text processing model, and the embodiment records the probability as the second probability, where the first preset label is used to indicate that the first word does not need to be modified, that is, if the initial text processing model determines that the probability that the label of the first word does not need to be modified is greater than or equal to the second set threshold, it may be determined that the first word does not need to be modified, otherwise, it is determined that the first word needs to be modified. For example, the initial text processing model may determine the probability that the first word segmentation needs to be modified, and the embodiment records the probability as a third probability, and if the difference between the first probability and the third probability is greater than or equal to a third set threshold, it may be determined that the first word segmentation needs to be modified, otherwise, it is determined that the first word segmentation does not need to be modified. The sizes of the first set threshold, the second set threshold and the third set threshold can be set according to actual conditions.
Optionally, a word segmentation list may be preset, where the word segmentation list includes multiple modification results and tags corresponding to each word segmentation, the modification results may include part-of-speech modification results, deletion results, insertion results, and the like, and the tags may include part-of-speech conversion tags, deletion tags, non-modification tags, insertion tags, and the like. For each modified result and label in the word segmentation list, the corresponding probability can be determined by the initial text processing model, and then the first probability, the second probability or the third probability is obtained.
When it is determined by the initial text processing model that the first segmentation requires modification, in one example, a first sample modification result and a first sample tag of the first segmentation may be determined according to a modification result of the first segmentation output by the initial text processing model. For example, the modification result of the first word segmentation output by the initial text processing model may be recorded as a first sample modification result of the first word segmentation, and then the first sample label of the first word segmentation is determined according to the association relationship between the first word segmentation and the first sample modification result. For example, if the first word is word and the first sample modification result is words, it may be determined that the correlation between the first word and the first sample modification result is a noun complex change, and thus it may be determined that the first sample tag of the first word is a noun complex change; and if the first word is word and the first sample modification result is word, determining that the correlation between the first word and the first sample modification result is that the original word is kept unchanged, and thus determining that the first sample label of the first word does not need to be modified. In one example, the first sample modification result and the first sample label of the first participle can also be determined according to the label of the first participle output by the initial text processing model. For example, a label of a first word segmentation output by the initial text processing model may be denoted as a first sample label of the first word segmentation, and a first sample modification result of the first word segmentation may be determined according to the first sample label. For example, if the first word is word and the first sample tag output by the initial text processing model is a noun complex change, it may be determined that the first sample modification result of the first word is words. In one example, when the initial text processing model may output the modification result of the first segmentation and the tag at the same time, the first sample modification result and the first sample tag of the first segmentation may also be determined according to the modification result and the tag output by the initial text processing model. For example, when the modification result of the first segmentation output by the initial text processing model is inconsistent with the tag, the first sample modification result of the first segmentation and the first sample tag may be determined according to a party with a higher probability, for example, the probability of the modification result of the first segmentation output by the initial text processing model is 0.4, and the probability of the tag of the first segmentation output is 0.3, then the modification result of the first segmentation output by the initial text processing model may be recorded as the first sample modification result, and then the first sample tag of the first segmentation is determined based on the association relationship between the first segmentation and the first sample modification result. When the modification result and the label of the first word segmentation output by the initial text processing model are not contradictory, the modification result and the label of the first word segmentation output by the initial text processing model can be respectively marked as a first sample modification result and a first sample label. Of course, other ways of determining the first sample modification result and the first sample label of the first participle are also possible.
When it is determined by the initial text processing model that the first word does not need to be modified, a first sample modification result and a first sample tag for the first word may be determined according to a non-modification indication result output by the initial text processing model, the non-modification indication result being used to indicate that the first word does not need to be modified. Specifically, when the initial text processing model outputs the non-modification indication result, it may be determined that the first sample modification result of the first word is to KEEP the first word unchanged, for example, the first word is "I", and the first sample modification result is still "I", and accordingly, the first sample tag may be set to be KEEP, which indicates that no modification is needed. It should be noted that, the embodiment does not limit the determination order of the first sample modification result and the second sample modification result, for example, a sequence may be set for the first sample modification result and the second sample modification result, or the first sample modification result and the second sample modification result may be determined at the same time, and the first sample label is similar to the second sample label. Therefore, a sample label and a sample modification result corresponding to the first word segmentation in the first sample can be obtained.
S2102, determining a first loss value of the sample label and the expected label and a second loss value of the sample modification result and the expected modification result.
The expected label and the expected modification result of the first segmentation may be determined based on a first sample, which may also be referred to as the original text, and a second sample, which is a modified text of the original text, accordingly. Optionally, the first sample and the second sample may be preprocessed to eliminate form problems in the first sample and the second sample, for example, redundant punctuation marks, spaces, and the like in the first sample and the second sample may be deleted. And then performing word-level alignment on the preprocessed first sample and the preprocessed second sample, namely that two words at the same position after alignment are the same word or different forms of the same word. Illustratively, the first sample is I wait go home on yesterday and the second sample is I wait to go home yesterday, referring to Table 1, Table 1 is the alignment result of the first sample and the second sample. Wherein, DELETE represents deleting the word, which can be used as the deletion result or as the deletion tag; false is no inserted label, which means that the position of the word segmentation does not need to be inserted; true is an insertion tag, which indicates that the position of the participle needs to be inserted.
TABLE 1 alignment results of first and second samples
Figure BDA0002989306190000131
Table 1 shows the result of the modification of the first sample and the result of the insertion of the word by splitting the second sample based on the first sample. In other words, the second sample may be derived based on the first sample modification result and the second sample modification result. For a first sample and a second sample, the alignment results as described in table 1 can be obtained, wherein the expected modification results are the first sample modification result and the second sample modification result in table 1, and the expected labels are the first sample label and the second sample label in table 1. Table 1 may be predetermined manually, or the first sample and the second sample may be analyzed by a model, and the results shown in table 1 may be obtained. The embodiment does not limit the specific structure of the model.
The table can be used as a training basis of the initial text processing model. For example, after determining a exemplar label and an exemplar modification result for the first participle based on the initial text processing model, a first loss value for the exemplar label and the expected label and a second loss value for the exemplar modification result and the expected modification result, respectively, may be determined. Considering that the sample modification result includes a first sample modification result and a second sample modification result, and the sample label includes a first sample label and a second sample label, when in actual application, the first loss value includes a loss value corresponding to the first sample modification result and a loss value corresponding to the second sample modification result, and the second loss value is similar. The embodiment does not specifically limit the determination process of the loss value, and takes the first sample modification result as an example, for example, the similarity between the first sample modification result and the corresponding expected modification result may be determined, the loss value between the first sample modification result and the expected modification result may be determined based on the similarity, or the loss value between the first sample modification result and the expected modification result may be determined based on the loss function.
S2103, training the initial text processing model according to the first loss value and the second loss value to obtain a target text processing model.
Specifically, the initial text processing model is trained based on the first loss value and the second loss value until the initial text processing model meets a training termination condition, and a target text processing model is obtained. The training termination condition may be that both the first loss value and the second loss value are smaller than the corresponding set threshold or converge, or that the number of times of training corresponding to the first loss value and the second loss value reaches a preset number of times. And obtaining a target label and a target modification result of the first word segmentation based on the target text processing model.
S220, determining a target result of each target word segmentation according to the target label and the target modification result of each target word segmentation.
And S230, splicing the target results of the target word segmentation to obtain a target text corresponding to the text to be detected.
The second embodiment of the disclosure provides a text processing method, which can modify errors existing in a text, provide a more reasonable and smooth language expression suggestion for a user, and identify the errors existing in the text, and can provide a reliable grammar error reminding function for scenes such as language learning, auditing, job correction and the like, so as to remind the user, and enrich the use scenes of the user. Secondly, detecting the participles contained in the sample from different layers to obtain two detection results, and then obtaining a target result based on the two detection results, so that the accuracy of the text processing result is improved.
EXAMPLE III
Fig. 3 is a structural diagram of a text processing apparatus according to a third embodiment of the present disclosure, where the apparatus may execute the text processing method according to the foregoing embodiment, and with reference to fig. 3, the apparatus may include:
the first determining module 31 is configured to determine a target label and a target modification result of each target word in a to-be-detected text, where the target word is a word obtained by segmenting the to-be-detected text, and the target label is used to indicate a modification mode of the target word;
a second determining module 32, configured to determine a target result of each target word segmentation according to the target tag and the target modification result of each target word segmentation;
and the splicing module 33 is configured to splice the target results of the target word segments to obtain a target text corresponding to the text to be detected.
The third embodiment of the present disclosure provides a text processing apparatus, where a target label and a target modification result of each target word in a text to be detected are determined, where the target word is a word obtained by segmenting the text to be detected, and the target label is used to indicate a modification mode of the target word; determining a target result of each target word segmentation according to the target label and the target modification result of each target word segmentation; and splicing the target results of the target word segmentation to obtain a target text corresponding to the text to be detected. According to the scheme, the target label and the target modification result of each target word segmentation in the text to be detected are determined, and the corresponding target result is determined based on the target label and the target modification result, so that the information according to the target label and the target modification result is more comprehensive when the target result of each target word segmentation is determined, and the accuracy of the text processing result is improved.
On the basis of the foregoing embodiment, the first determining module 31 is specifically configured to:
and inputting the text to be detected into a target text processing model to obtain target labels and target modification results of all target word segments in the text to be detected, wherein the target text processing model is obtained by training an initial text processing model by sample word segments contained in a training sample.
On the basis of the above embodiment, the training process of the target text processing model is as follows:
inputting a first sample into the initial text processing model to obtain a sample label and a sample modification result corresponding to a first word segmentation in the first sample, wherein the first sample is a training sample, and the first word segmentation is a word segmentation obtained by segmenting the first sample;
determining a first loss value for the exemplar label and the expected label and a second loss value for the exemplar modification result and the expected modification result;
and training the initial text processing model according to the first loss value and the second loss value to obtain a target text processing model.
On the basis of the above embodiment, the sample label includes a first sample label and a second sample label, the first sample label includes a part-of-speech conversion label, a deletion label or an unmodified label, and the second sample label includes an insertion label or a non-insertion label;
the sample modification result comprises a first sample modification result and a second sample modification result, the first sample modification result comprises a part-of-speech modification result of the first participle or a deletion result of the first participle, and the second modification result comprises an insertion word result of the first participle.
On the basis of the above embodiment, the inputting the first sample into the initial text processing model to obtain a sample label and a sample modification result corresponding to the first participle in the first sample includes:
determining an insertion word result of the first segmentation as a second modification result of the first segmentation, and determining a binary label of the first segmentation as a second sample label of the first segmentation, wherein the binary label is used for indicating whether other segmentation is required to be inserted into the position of the first segmentation;
determining whether the first segmentation needs to be modified, wherein the modification is used for modifying the part of speech of the first segmentation or deleting the first segmentation;
when the first word segmentation is determined to need to be modified, determining a first sample modification result and a first sample label of the first word segmentation according to a modification result of the first word segmentation and/or a label of the first word segmentation output by the initial text processing model; otherwise, determining a first sample modification result and a first sample label of the first word segmentation according to a non-modification indication result output by the initial text processing model, wherein the non-modification indication result is used for indicating that the first word segmentation does not need to be modified.
On the basis of the above embodiment, the determining whether the first word needs to be modified includes:
determining a first probability that the first word segmentation does not require modification;
determining that the first word segmentation does not require modification if the first probability is greater than or equal to a first set threshold; otherwise, it is determined that the first word segmentation requires modification.
On the basis of the above embodiment, the determining whether the first word needs to be modified includes:
determining a second probability that a label of the first word segmentation is a first preset label, wherein the first preset label is used for indicating that the first word segmentation does not need to be modified;
determining that the first segmentation does not need to be modified if the second probability is greater than or equal to a second set threshold; otherwise, it is determined that the first word segmentation requires modification.
On the basis of the above embodiment, the determining whether the first word needs to be modified includes:
determining a first probability that the first term does not require modification and a third probability that the first term requires modification;
if the difference value of the third probability and the first probability is larger than or equal to a third set threshold value, determining that the first word segmentation needs to be modified; otherwise, it is determined that the first word does not need to be modified.
On the basis of the above embodiment, determining a first sample modification result and a first sample label of the first participle according to the modification result of the first participle output by the initial text processing model includes:
recording the modification result of the first word segmentation output by the initial text processing model as a first sample modification result of the first word segmentation;
and determining a first sample label of the first word segmentation according to the incidence relation between the first word segmentation and the first sample modification result.
On the basis of the above embodiment, determining a first sample modification result and a first sample label of the first participle according to the label of the first participle output by the initial text processing model includes:
recording the label of the first word segmentation output by the initial text processing model as a first sample label of the first word segmentation;
determining a first sample modification result of the first participle according to the first sample label.
On the basis of the above embodiment, determining a first sample modification result and a first sample label of the first participle according to the modification result of the first participle output by the initial text processing model and the label of the first participle includes:
if the modification result of the first word segmentation is inconsistent with the label of the first word segmentation, determining a first sample modification result and a first sample label of the first word segmentation according to the probability of the modification result of the first word segmentation output by the initial text processing model and the probability of the label of the first word segmentation output by the initial text processing model; otherwise, the modification result and the label of the first word segmentation output by the initial text processing model are respectively recorded as the first sample modification result and the first sample label of the first word segmentation.
The text processing apparatus provided by the embodiment of the disclosure and the text processing method provided by the embodiment belong to the same concept, and technical details which are not described in detail in the embodiment can be referred to the embodiment, and the embodiment has the same beneficial effects as the text processing method.
Example four
Referring now to FIG. 4, a block diagram of an electronic device 400 suitable for use in implementing embodiments of the present disclosure is shown. The electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., car navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 4, electronic device 400 may include a processing device (e.g., central processing unit, graphics processor, etc.) 401 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)402 or a program loaded from a storage device 408 into a Random Access Memory (RAM) 403. In the RAM 403, various programs and data necessary for the operation of the electronic apparatus 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
Generally, the following devices may be connected to the I/O interface 405: input devices 406 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 407 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 408 including, for example, tape, hard disk, etc.; and a communication device 409. The communication means 409 may allow the electronic device 400 to communicate wirelessly or by wire with other devices to exchange data. While fig. 4 illustrates an electronic device 400 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication device 409, or from the storage device 408, or from the ROM 402. The computer program performs the above-described functions defined in the methods of the embodiments of the present disclosure when executed by the processing device 401.
EXAMPLE five
The computer readable medium described above in this disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (Hyper Text Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: determining a target label and a target modification result of each target word in a text to be detected, wherein the target word is a word obtained by segmenting the text to be detected, and the target label is used for indicating a modification mode of the target word; determining a target result of each target word segmentation according to the target label and the target modification result of each target word segmentation; and splicing the target results of the target word segmentation to obtain a target text corresponding to the text to be detected.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present disclosure may be implemented by software or hardware. The name of the module does not constitute a limitation to the module itself in some cases, for example, the first determining module may also be described as a "module that determines the target label and the target modification result of each target word in the text to be detected".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, there is provided a text processing method including:
determining a target label and a target modification result of each target word in a text to be detected, wherein the target word is a word obtained by segmenting the text to be detected, and the target label is used for indicating a modification mode of the target word;
determining a target result of each target word segmentation according to the target label and the target modification result of each target word segmentation;
and splicing the target results of the target word segmentation to obtain a target text corresponding to the text to be detected.
According to one or more embodiments of the present disclosure, in the text processing method provided by the present disclosure, the determining the target label and the target modification result of each target word segmentation in the text to be detected includes:
and inputting the text to be detected into a target text processing model to obtain target labels and target modification results of all target word segments in the text to be detected, wherein the target text processing model is obtained by training an initial text processing model by sample word segments contained in a training sample.
According to one or more embodiments of the present disclosure, in a text processing method provided by the present disclosure, a training process of the target text processing model is as follows:
inputting a first sample into the initial text processing model to obtain a sample label and a sample modification result corresponding to a first word segmentation in the first sample, wherein the first sample is a training sample, and the first word segmentation is a word segmentation obtained by segmenting the first sample;
determining a first loss value for the exemplar label and the expected label and a second loss value for the exemplar modification result and the expected modification result;
and training the initial text processing model according to the first loss value and the second loss value to obtain a target text processing model.
According to one or more embodiments of the present disclosure, in a text processing method provided by the present disclosure, the sample tag includes a first sample tag and a second sample tag, the first sample tag includes a part-of-speech conversion tag, a deletion tag, or an unmodified tag, and the second sample tag includes an insertion tag or a non-insertion tag;
the sample modification result comprises a first sample modification result and a second sample modification result, the first sample modification result comprises a part-of-speech modification result of the first participle or a deletion result of the first participle, and the second modification result comprises an insertion word result of the first participle.
According to one or more embodiments of the present disclosure, in a text processing method provided by the present disclosure, the inputting a first sample into the initial text processing model to obtain a sample label and a sample modification result corresponding to a first word segmentation in the first sample includes:
determining an insertion word result of the first segmentation as a second modification result of the first segmentation, and determining a binary label of the first segmentation as a second sample label of the first segmentation, wherein the binary label is used for indicating whether other segmentation is required to be inserted into the position of the first segmentation;
determining whether the first segmentation needs to be modified, wherein the modification is used for modifying the part of speech of the first segmentation or deleting the first segmentation;
when the first word segmentation is determined to need to be modified, determining a first sample modification result and a first sample label of the first word segmentation according to a modification result of the first word segmentation and/or a label of the first word segmentation output by the initial text processing model; otherwise, determining a first sample modification result and a first sample label of the first word segmentation according to a non-modification indication result output by the initial text processing model, wherein the non-modification indication result is used for indicating that the first word segmentation does not need to be modified.
According to one or more embodiments of the present disclosure, in a text processing method provided by the present disclosure, the determining whether the first word segmentation needs to be modified includes:
determining a first probability that the first word segmentation does not require modification;
determining that the first word segmentation does not require modification if the first probability is greater than or equal to a first set threshold; otherwise, it is determined that the first word segmentation requires modification.
According to one or more embodiments of the present disclosure, in a text processing method provided by the present disclosure, the determining whether the first word segmentation needs to be modified includes:
determining a second probability that a label of the first word segmentation is a first preset label, wherein the first preset label is used for indicating that the first word segmentation does not need to be modified;
determining that the first segmentation does not need to be modified if the second probability is greater than or equal to a second set threshold; otherwise, it is determined that the first word segmentation requires modification.
According to one or more embodiments of the present disclosure, in a text processing method provided by the present disclosure, the determining whether the first word segmentation needs to be modified includes:
determining a first probability that the first term does not require modification and a third probability that the first term requires modification;
if the difference value of the third probability and the first probability is larger than or equal to a third set threshold value, determining that the first word segmentation needs to be modified; otherwise, it is determined that the first word does not need to be modified.
According to one or more embodiments of the present disclosure, in a text processing method provided by the present disclosure, determining a first sample modification result and a first sample tag of the first participle according to a modification result of the first participle output by the initial text processing model includes:
recording the modification result of the first word segmentation output by the initial text processing model as a first sample modification result of the first word segmentation;
and determining a first sample label of the first word segmentation according to the incidence relation between the first word segmentation and the first sample modification result.
According to one or more embodiments of the present disclosure, in a text processing method provided by the present disclosure, determining a first sample modification result and a first sample tag of the first participle according to the tag of the first participle output by the initial text processing model includes:
recording the label of the first word segmentation output by the initial text processing model as a first sample label of the first word segmentation;
determining a first sample modification result of the first participle according to the first sample label.
According to one or more embodiments of the present disclosure, in a text processing method provided by the present disclosure, determining a first sample modification result and a first sample tag of the first participle according to the modification result of the first participle output by the initial text processing model and the tag of the first participle includes:
if the modification result of the first word segmentation is inconsistent with the label of the first word segmentation, determining a first sample modification result and a first sample label of the first word segmentation according to the probability of the modification result of the first word segmentation output by the initial text processing model and the probability of the label of the first word segmentation output by the initial text processing model; otherwise, the modification result and the label of the first word segmentation output by the initial text processing model are respectively recorded as the first sample modification result and the first sample label of the first word segmentation.
According to one or more embodiments of the present disclosure, there is provided a text processing apparatus including:
the first determining module is used for determining a target label and a target modification result of each target word in a text to be detected, wherein the target word is a word obtained by segmenting the text to be detected, and the target label is used for indicating a modification mode of the target word;
the second determining module is used for determining the target result of each target word segmentation according to the target label and the target modification result of each target word segmentation;
and the splicing module is used for splicing the target results of the target word segmentation to obtain the target text corresponding to the text to be detected.
In accordance with one or more embodiments of the present disclosure, there is provided an electronic device including:
one or more processors;
a memory for storing one or more programs;
the one or more programs, when executed by the one or more processors, implement a text processing method according to any of the present disclosure.
According to one or more embodiments of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a text processing method according to any one of the present disclosure.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (14)

1.一种文本处理方法,其特征在于,包括:1. a text processing method, is characterized in that, comprises: 确定待检测文本中各目标分词的目标标签和目标修改结果,所述目标分词为切分所述待检测文本得到的分词,所述目标标签用于表示所述目标分词的修改方式;Determine the target label and target modification result of each target word segmentation in the text to be detected, the target word segmentation is a word segmentation obtained by dividing the to-be-detected text, and the target label is used to indicate the modification method of the target word segmentation; 根据各所述目标分词的目标标签和目标修改结果,确定各所述目标分词的目标结果;Determine the target result of each target word segmentation according to the target label and target modification result of each target word segmentation; 拼接各所述目标分词的目标结果,得到所述待检测文本对应的目标文本。The target results of each of the target word segmentations are spliced to obtain the target text corresponding to the text to be detected. 2.根据权利要求1所述的方法,其特征在于,所述确定待检测文本中各目标分词的目标标签和目标修改结果,包括:2. The method according to claim 1, wherein the determining the target label and target modification result of each target word segmentation in the text to be detected comprises: 将所述待检测文本输入目标文本处理模型,得到所述待检测文本中各目标分词的目标标签和目标修改结果,所述目标文本处理模型由训练样本包含的样本分词训练初始文本处理模型得到。Input the text to be detected into a target text processing model, and obtain target labels and target modification results of each target word segmentation in the text to be detected. The target text processing model is obtained by training an initial text processing model for sample word segmentation included in the training samples. 3.根据权利要求2所述的方法,其特征在于,所述目标文本处理模型的训练过程如下:3. The method according to claim 2, wherein the training process of the target text processing model is as follows: 将第一样本输入所述初始文本处理模型,得到所述第一样本中第一分词对应的样本标签和样本修改结果,所述第一样本为训练样本,所述第一分词为切分所述第一样本得到的分词;Input the first sample into the initial text processing model, and obtain the sample label and sample modification result corresponding to the first participle in the first sample, the first sample is a training sample, and the first participle is a cut the word segmentation obtained by dividing the first sample; 确定所述样本标签和期望标签的第一损失值以及所述样本修改结果和期望修改结果的第二损失值;determining a first loss value of the sample label and the expected label and a second loss value of the sample modification result and the expected modification result; 根据所述第一损失值和第二损失值,对所述初始文本处理模型进行训练,得到目标文本处理模型。According to the first loss value and the second loss value, the initial text processing model is trained to obtain a target text processing model. 4.根据权利要求3所述的方法,其特征在于,所述样本标签包括第一样本标签和第二样本标签,所述第一样本标签包括词性变换标签、删除标签或不修改标签,所述第二样本标签包括插入标签或不插入标签;4. The method according to claim 3, wherein the sample label comprises a first sample label and a second sample label, and the first sample label comprises a part-of-speech conversion label, a deletion label or a non-modified label, The second sample label includes an insert label or no insert label; 所述样本修改结果包括第一样本修改结果和第二样本修改结果,所述第一样本修改结果包括所述第一分词的词性修改结果或所述第一分词的删除结果,所述第二样本修改结果包括所述第一分词的插入词结果。The sample modification result includes a first sample modification result and a second sample modification result, and the first sample modification result includes a part-of-speech modification result of the first participle or a deletion result of the first participle. The two-sample modification result includes the inserted word result of the first participle. 5.根据权利要求4所述的方法,其特征在于,所述将第一样本输入所述初始文本处理模型,得到所述第一样本中第一分词对应的样本标签和样本修改结果,包括:5. The method according to claim 4, wherein the inputting the first sample into the initial text processing model to obtain the sample label and the sample modification result corresponding to the first participle in the first sample, include: 确定所述第一分词的插入词结果,作为所述第一分词的第二修改结果,以及确定所述第一分词的二元标签,作为所述第一分词的第二样本标签,所述二元标签用于表示所述第一分词所在的位置是否需要插入其他分词;Determine the inserted word result of the first participle as the second modification result of the first participle, and determine the binary label of the first participle as the second sample label of the first participle, the two The meta tag is used to indicate whether the location of the first participle needs to insert other participles; 确定所述第一分词是否需要修改,所述修改用于修改所述第一分词的词性或删除所述第一分词;Determine whether the first participle needs to be modified, and the modification is used to modify the part of speech of the first participle or delete the first participle; 当确定所述第一分词需要修改时,根据所述初始文本处理模型输出的所述第一分词的修改结果和/或所述第一分词的标签确定所述第一分词的第一样本修改结果和第一样本标签;否则,根据所述初始文本处理模型输出的不修改指示结果确定所述第一分词的第一样本修改结果和第一样本标签,所述不修改指示结果用于表示所述第一分词不需要修改。When it is determined that the first participle needs to be modified, the modification of the first sample of the first participle is determined according to the modification result of the first participle output by the initial text processing model and/or the label of the first participle The result and the first sample label; otherwise, the first sample modification result and the first sample label of the first word segmentation are determined according to the non-modification instruction result output by the initial text processing model, and the non-modification instruction result uses Yu indicates that the first participle does not need to be modified. 6.根据权利要求5所述的方法,其特征在于,所述确定所述第一分词是否需要修改,包括:6. The method according to claim 5, wherein the determining whether the first participle needs to be modified comprises: 确定所述第一分词不需要修改的第一概率;determining a first probability that the first participle does not need to be modified; 如果所述第一概率大于或等于第一设定阈值,则确定所述第一分词不需要修改;否则,确定所述第一分词需要修改。If the first probability is greater than or equal to a first set threshold, it is determined that the first word segmentation does not need to be modified; otherwise, it is determined that the first segmentation needs to be modified. 7.根据权利要求5所述的方法,其特征在于,所述确定所述第一分词是否需要修改,包括:7. The method according to claim 5, wherein the determining whether the first participle needs to be modified comprises: 确定所述第一分词的标签为第一预设标签的第二概率,所述第一预设标签用于表示所述第一分词不需要修改;determining that the label of the first segment is a second probability of a first preset label, and the first preset label is used to indicate that the first segment does not need to be modified; 如果所述第二概率大于或等于第二设定阈值,则确定所述第一分词不需要修改;否则,确定所述第一分词需要修改。If the second probability is greater than or equal to a second set threshold, it is determined that the first participle does not need to be modified; otherwise, it is determined that the first participle needs to be modified. 8.根据权利要求5所述的方法,其特征在于,所述确定所述第一分词是否需要修改,包括:8. The method according to claim 5, wherein the determining whether the first participle needs to be modified comprises: 确定所述第一分词不需要修改的第一概率以及所述第一分词需要修改的第三概率;determining a first probability that the first participle does not need to be modified and a third probability that the first participle needs to be modified; 如果所述第三概率与第一概率的差值大于或等于第三设定阈值,则确定所述第一分词需要修改;否则,确定所述第一分词不需要修改。If the difference between the third probability and the first probability is greater than or equal to a third set threshold, it is determined that the first participle needs to be modified; otherwise, it is determined that the first participle does not need to be modified. 9.根据权利要求5所述的方法,其特征在于,根据所述初始文本处理模型输出的所述第一分词的修改结果确定所述第一分词的第一样本修改结果和第一样本标签,包括:9 . The method according to claim 5 , wherein a first sample modification result and a first sample of the first word segmentation are determined according to a modification result of the first word segmentation output by the initial text processing model. 10 . Labels, including: 将所述初始文本处理模型输出的所述第一分词的修改结果,记为所述第一分词的第一样本修改结果;Denote the modification result of the first participle output by the initial text processing model as the modification result of the first sample of the first participle; 根据所述第一分词和第一样本修改结果的关联关系,确定所述第一分词的第一样本标签。According to the association relationship between the first word segmentation and the first sample modification result, the first sample label of the first word segmentation is determined. 10.根据权利要求5所述的方法,其特征在于,根据所述初始文本处理模型输出的所述第一分词的标签确定所述第一分词的第一样本修改结果和第一样本标签,包括:10 . The method according to claim 5 , wherein the first sample modification result and the first sample label of the first word segmentation are determined according to the label of the first word segmentation output by the initial text processing model. 11 . ,include: 将所述初始文本处理模型输出的所述第一分词的标签,记为所述第一分词的第一样本标签;Denote the label of the first segmented word output by the initial text processing model as the first sample label of the first segmented word; 根据所述第一样本标签,确定所述第一分词的第一样本修改结果。According to the first sample label, a first sample modification result of the first word segmentation is determined. 11.根据权利要求5所述的方法,其特征在于,根据所述初始文本处理模型输出的所述第一分词的修改结果和所述第一分词的标签确定所述第一分词的第一样本修改结果和第一样本标签,包括:11. The method according to claim 5, characterized in that determining the first identity of the first participle according to the modification result of the first participle output by the initial text processing model and the label of the first participle The revised results and first sample labels include: 如果所述第一分词的修改结果和所述第一分词的标签矛盾,则根据所述初始文本处理模型输出的所述第一分词的修改结果的概率与所述初始文本处理模型输出的所述第一分词的标签的概率,确定所述第一分词的第一样本修改结果和第一样本标签;否则,将所述初始文本处理模型输出的所述第一分词的修改结果和标签分别记为所述第一分词的第一样本修改结果和第一样本标签。If the modification result of the first word segmentation contradicts the label of the first word segmentation, the probability of the modification result of the first word segmentation output according to the initial text processing model and the output of the initial text processing model The probability of the label of the first participle is to determine the first sample modification result and the first sample label of the first participle; otherwise, the modification result and the label of the first participle output by the initial text processing model are respectively It is recorded as the first sample modification result and the first sample label of the first participle. 12.一种文本处理装置,其特征在于,包括:12. A text processing device, comprising: 第一确定模块,用于确定待检测文本中各目标分词的目标标签和目标修改结果,所述目标分词为切分所述待检测文本得到的分词,所述目标标签用于表示所述目标分词的修改方式;The first determination module is used to determine the target label and target modification result of each target word segmentation in the text to be detected, the target word segmentation is the word segmentation obtained by dividing the to-be-detected text, and the target label is used to indicate the target word segmentation the way of modification; 第二确定模块,用于根据各所述目标分词的目标标签和目标修改结果,确定各所述目标分词的目标结果;The second determination module is used to determine the target result of each target word segmentation according to the target label and target modification result of each target word segmentation; 拼接模块,用于拼接各所述目标分词的目标结果,得到所述待检测文本对应的目标文本。The splicing module is used for splicing the target results of each target word segmentation to obtain the target text corresponding to the text to be detected. 13.一种电子设备,其特征在于,包括:13. An electronic device, characterized in that, comprising: 一个或多个处理器;one or more processors; 存储器,用于存储一个或多个程序;memory for storing one or more programs; 当所述一个或多个程序被所述一个或多个处理器执行时实现如权利要求1-11任一项所述的文本处理方法。The text processing method of any one of claims 1-11 is implemented when the one or more programs are executed by the one or more processors. 14.一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现如权利要求1-11任一项所述的文本处理方法。14. A computer-readable storage medium on which a computer program is stored, characterized in that, when the program is executed by a processor, the text processing method according to any one of claims 1-11 is implemented.
CN202110309988.XA 2021-03-23 2021-03-23 Text processing method, device, equipment and storage medium Pending CN112966506A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110309988.XA CN112966506A (en) 2021-03-23 2021-03-23 Text processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110309988.XA CN112966506A (en) 2021-03-23 2021-03-23 Text processing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112966506A true CN112966506A (en) 2021-06-15

Family

ID=76278256

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110309988.XA Pending CN112966506A (en) 2021-03-23 2021-03-23 Text processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112966506A (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103154936A (en) * 2010-09-24 2013-06-12 新加坡国立大学 Methods and systems for automated text correction
CN109213998A (en) * 2018-08-17 2019-01-15 汇智容大(北京)信息技术有限公司 Chinese wrongly written character detection method and system
CN110489760A (en) * 2019-09-17 2019-11-22 达而观信息科技(上海)有限公司 Based on deep neural network text auto-collation and device
CN110750959A (en) * 2019-10-28 2020-02-04 腾讯科技(深圳)有限公司 Text information processing method, model training method and related device
CN111368548A (en) * 2018-12-07 2020-07-03 北京京东尚科信息技术有限公司 Semantic recognition method and device, electronic equipment and computer-readable storage medium
CN112084301A (en) * 2020-08-11 2020-12-15 网易有道信息技术(北京)有限公司 Training method and device of text correction model and text correction method and device
CN112417902A (en) * 2020-12-04 2021-02-26 北京有竹居网络技术有限公司 Text translation method, device, equipment and storage medium
CN112509562A (en) * 2020-11-09 2021-03-16 北京有竹居网络技术有限公司 Method, apparatus, electronic device and medium for text post-processing

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103154936A (en) * 2010-09-24 2013-06-12 新加坡国立大学 Methods and systems for automated text correction
CN109213998A (en) * 2018-08-17 2019-01-15 汇智容大(北京)信息技术有限公司 Chinese wrongly written character detection method and system
CN111368548A (en) * 2018-12-07 2020-07-03 北京京东尚科信息技术有限公司 Semantic recognition method and device, electronic equipment and computer-readable storage medium
CN110489760A (en) * 2019-09-17 2019-11-22 达而观信息科技(上海)有限公司 Based on deep neural network text auto-collation and device
CN110750959A (en) * 2019-10-28 2020-02-04 腾讯科技(深圳)有限公司 Text information processing method, model training method and related device
CN112084301A (en) * 2020-08-11 2020-12-15 网易有道信息技术(北京)有限公司 Training method and device of text correction model and text correction method and device
CN112509562A (en) * 2020-11-09 2021-03-16 北京有竹居网络技术有限公司 Method, apparatus, electronic device and medium for text post-processing
CN112417902A (en) * 2020-12-04 2021-02-26 北京有竹居网络技术有限公司 Text translation method, device, equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
KOSTIANTYN OMELIANCHUK 等: "GECToR – Grammatical Error Correction: Tag, Not Rewrite", 《PROCEEDINGS OF THE 15TH WORKSHOP ON INNOVATIVE USE OF NLP FOR BUILDING EDUCATIONAL APPLICATIONS》, pages 163 *
黄浩洋: "基于深度学习的自动句法纠错研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》, pages 1 - 23 *

Similar Documents

Publication Publication Date Title
CN111274815B (en) Method and device for mining entity focus point in text
CN108985358B (en) Emotion recognition method, device, equipment and storage medium
CN110276023B (en) POI transition event discovery method, device, computing equipment and medium
US11669679B2 (en) Text sequence generating method and apparatus, device and medium
CN112633947A (en) Text generation model generation method, text generation method, device and equipment
CN110969012A (en) Text error correction method and device, storage medium and electronic equipment
CN113378586A (en) Speech translation method, translation model training method, device, medium, and apparatus
US20250118338A1 (en) Methods, devices, readable media and electronic devices for video processing
JP7676561B2 (en) Minutes processing method, device, equipment and media
CN111341308A (en) Method and apparatus for outputting information
CN112883968A (en) Image character recognition method, device, medium and electronic equipment
CN111815274A (en) Information processing method and device and electronic equipment
CN114461795A (en) Document abstract processing method, device, equipment and medium
CN111555960A (en) Method for generating information
CN114995691B (en) Document processing method, device, equipment and medium
CN112509581B (en) Error correction method and device for text after voice recognition, readable medium and electronic equipment
CN112069786A (en) Text information processing method and device, electronic equipment and medium
CN111488450A (en) Method and device for generating keyword library and electronic equipment
CN112966506A (en) Text processing method, device, equipment and storage medium
CN115129845A (en) Text information processing method, device and electronic device
CN110276001B (en) Checking page identification method and device, computing equipment and medium
CN112699687A (en) Content cataloging method and device and electronic equipment
CN114239578A (en) Named entity identification method, device, device and storage medium
CN114429629A (en) Image processing method, device, readable storage medium and electronic device
CN111339776A (en) Resume parsing method and device, electronic equipment and computer-readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210615