WO2021208460A1 - Sentence completion method and device, and readable storage medium - Google Patents

Sentence completion method and device, and readable storage medium Download PDF

Info

Publication number
WO2021208460A1
WO2021208460A1 PCT/CN2020/134320 CN2020134320W WO2021208460A1 WO 2021208460 A1 WO2021208460 A1 WO 2021208460A1 CN 2020134320 W CN2020134320 W CN 2020134320W WO 2021208460 A1 WO2021208460 A1 WO 2021208460A1
Authority
WO
WIPO (PCT)
Prior art keywords
sentence
completion
completed
analysis result
result
Prior art date
Application number
PCT/CN2020/134320
Other languages
French (fr)
Chinese (zh)
Inventor
李松
汤耀华
周楠楠
徐倩
Original Assignee
深圳前海微众银行股份有限公司
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 深圳前海微众银行股份有限公司 filed Critical 深圳前海微众银行股份有限公司
Publication of WO2021208460A1 publication Critical patent/WO2021208460A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • G06F40/211Syntactic parsing, e.g. based on context-free grammar [CFG] or unification grammars
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • 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/30Semantic analysis

Definitions

  • This application relates to the field of artificial intelligence of financial technology (Fintech), and in particular to a sentence completion method, device, and readable storage medium.
  • the intelligent question answering system In the intelligent question answering system related to artificial intelligence, the intelligent question answering system often receives sentences with missing components, which causes the intelligent question answering system to fail to recognize At present, the semantics of the sentence is usually analyzed by first analyzing the sentence type of the sentence, and then according to the sentence type, different models are used to determine the antecedent of the sentence, and the antecedent word is replaced to complete the sentence with missing components.
  • the determination of the sentence type and the antecedent is usually carried out in series, which will cause errors to accumulate, which will result in low accuracy of sentence completion. Therefore, there is a technical problem of low accuracy of sentence completion in related technologies.
  • the main purpose of this application is to provide a sentence completion method, device and readable storage medium, aiming to solve the technical problem of low sentence completion accuracy in the prior art.
  • the present application provides a sentence completion method, which is applied to a sentence completion device, and the sentence completion method includes:
  • the first analysis result and the second analysis result are input into a preset sentence completion model, and based on the first analysis result and the second analysis result, the sentence to be completed is complemented to obtain Preliminary completion results;
  • the preliminary completion result is post-processed to obtain the target completion result.
  • the present application also provides a sentence completion device, the sentence completion device is a virtual device, and the sentence completion device is applied to a sentence completion device, and the sentence completion device includes:
  • the dependency syntax analysis module is used to obtain the sentence to be completed and the related sentence corresponding to the sentence to be completed, and perform dependency syntax analysis on the sentence to be completed and the related sentence, respectively, to obtain the corresponding sentence of the related sentence.
  • the sentence completion module is used to input the first analysis result and the second analysis result into a preset sentence completion model, and based on the first analysis result and the second analysis result, perform the completion The sentence is completed and processed, and the preliminary completion result is obtained;
  • the post-processing module is used to perform post-processing on the preliminary completion result to obtain the target completion result.
  • the present application also provides a sentence completion device.
  • the sentence completion device is a physical device.
  • the sentence completion device includes a memory, a processor, and a device that is stored in the memory and can run on the processor.
  • the program of the sentence completion method when the program of the sentence completion method is executed by a processor, can realize the steps of the sentence completion method described above.
  • the present application also provides a readable storage medium, the readable storage medium stores a program for implementing the sentence completion method, and when the program of the sentence completion method is executed by a processor, the method for implementing the sentence completion method as described above is stored. step.
  • the present application obtains the sentence to be completed and the related sentence corresponding to the sentence to be completed, and performs dependency syntactic analysis on the sentence to be completed and the related sentence, respectively, to obtain the first analysis result and the related sentence corresponding to the related sentence.
  • the second analysis result corresponding to the sentence to be completed, and then the first analysis result and the second analysis result are input into a preset sentence completion model, based on the first analysis result and the second analysis result , Perform completion processing on the sentence to be completed to obtain a preliminary completion result, and then perform post-processing on the preliminary completion result to obtain a target completion result.
  • this application first performs dependency syntactic analysis on the sentence to be completed and the associated sentence corresponding to the sentence to be completed to obtain the first analysis result and the second analysis result, and then based on the first analysis result and the second analysis result, through
  • the preset sentence completion model performs completion processing on the sentence to be completed to obtain an initial completion result, and further, performs post-processing on the preliminary completion result to obtain a target completion result.
  • this application provides a method for completing sentences to be completed based on dependency syntax analysis and related sentences corresponding to sentences to be completed, thereby avoiding completion of sentences to be completed based on sentence types and antecedents. This avoids the accumulation of errors due to the determination of sentence types and antecedents in series, which leads to lower accuracy of sentence completion, thereby improving the accuracy of sentence completion, so it solves the problem of accuracy of sentence completion. Low rate of technical problems.
  • FIG. 1 is a schematic flowchart of a first embodiment of a sentence completion method of the application
  • FIG. 2 is a schematic flowchart of a second embodiment of a sentence completion method for the application
  • FIG. 3 is a schematic diagram of the device structure of the hardware operating environment involved in the solution of the embodiment of the application.
  • the embodiment of the present application provides a sentence completion method.
  • the sentence completion method includes:
  • Step S10 Obtain the sentence to be completed and the related sentence corresponding to the sentence to be completed, and perform dependency syntactic analysis on the sentence to be completed and the related sentence, respectively, to obtain the first analysis result corresponding to the related sentence The second analysis result corresponding to the sentence to be completed;
  • the sentence completion method is applied to a question and answer system, the sentence to be completed is semantically completed and it is confirmed that the sentence needs to be completed, and the related sentence is the sentence to be completed.
  • the context-related sentences of the whole sentence for example, suppose a piece of dialogue information in the question and answer system is "A: Is the repayment date the same? B: Is the same", then if sentence B is the sentence to be completed, then the sentence A is the associated sentence.
  • the second analysis result corresponding to the sentence to be completed specifically, extracts the sentence to be completed and the associated sentence corresponding to the sentence to be completed from the database of the question answering system, and compares the sentence to be completed and the sentence to be completed respectively.
  • Dependent syntax analysis is performed on the related sentence to perform grammatical analysis on the sentence to be completed and the related sentence respectively to obtain a first analysis result corresponding to the related sentence and a second analysis result corresponding to the sentence to be completed ,
  • the first analysis result is the result of grammatical analysis of the sentence to be completed
  • the second analysis result is the result of the grammatical analysis of the associated sentence
  • the first analysis result and the The second analysis result can be expressed in the form of a vector.
  • the grammatical analysis result obtained is "('Yes','v', 0,'HED') ), ('Follow','v',1,'VOB'),('particle loan','nz',4,'ATT'), ('public account','nz',2,'VOB' )”, where v is the identifier of the verb, HED is the identifier of the core relationship, VOB is the identifier of the verb-object relationship, nz is the identifier of the noun, ATT is the identifier of the definite middle relationship, and 0, 1, 4, and 2 are each analysis The encoding of the word that comes out, and then the vector corresponding to the grammatical interpretation result is (0, 1, 4, 2).
  • the step of obtaining the sentence to be completed and the associated sentence corresponding to the sentence to be completed includes:
  • Step S11 obtaining an initial sentence to be completed and an initial associated sentence corresponding to the initial sentence to be completed;
  • the initial sentence to be completed is a sentence that has not been processed for de-speaking and it has been determined that it needs to be completed
  • the initial associated sentence is a sentence that has not been processed for de-speaking.
  • Step S12 De-verbalize the initial sentence to be completed and the initial related sentence to obtain the sentence to be completed corresponding to the initial sentence to be completed and the initial related sentence Associated statement.
  • the initial to-be-completed sentence and the initial associated sentence are respectively subjected to de-spoken processing to obtain the to-be-completed sentence corresponding to the initial to-be-completed sentence and the corresponding initial associated sentence
  • the related sentences specifically, the initial to-be-completed sentences and the initial related sentences are compared with a preset spoken language set, and if the initial to-be-completed sentences exist and are in the preset spoken language set If the same first word to be removed is the same, the first word to be removed is removed from the initial sentence to be completed to obtain the sentence to be completed. If the same second word to be removed in the spoken language set, the second word to be removed is removed from the initial associated sentence to obtain the associated sentence.
  • the preset spoken language set includes um, ok, may I ask , That, that, please, etc. spoken language.
  • Step S20 input the first analysis result and the second analysis result into a preset sentence completion model, and perform the completion of the sentence to be completed based on the first analysis result and the second analysis result Processing and obtaining preliminary completion results;
  • the preset sentence completion model is a preset rule model for performing sentence completion processing, and the preset sentence completion model includes one or more sentences. Completion rules.
  • the first analysis result and the second analysis result are input into a preset sentence completion model, and based on the first analysis result and the second analysis result, the sentence to be completed is complemented to obtain
  • the preliminary completion result specifically, the first analysis result and the second analysis result are input into a preset sentence completion model, and the to-be-supplement is determined based on the first analysis result and the second analysis result
  • each of the sentence completion rules can be combined according to the application scenario of the question answering system to form the preset sentence completion model.
  • each of the sentence completion rules includes rule A. , Rule B and Rule C.
  • the preset sentence completion model can be combined based on the Rule A and the rule B, and then the
  • the first analysis result and the second analysis result are input into the preset sentence completion model, it is determined whether the sentence to be completed is applicable to rule A, and if the sentence to be completed is applicable to rule A , The sentence to be completed is completed based on the rule A, and if the sentence to be completed is not applicable to the rule A, the sentence to be completed is completed based on the rule B.
  • the steps to obtain preliminary completion results include:
  • Step S21 inputting the first analysis result and the second analysis result into the preset sentence completion model, and matching sentence completion rules corresponding to the first analysis result and the second analysis result;
  • the first analysis result and the second analysis result are input into the preset sentence completion model, and the sentence completion corresponding to the first analysis result and the second analysis result is matched
  • the rule specifically, the first analysis result and the second analysis result are input into the preset sentence completion model, and it is determined whether the first analysis result and the second analysis result match the customized rule.
  • the sentence completion rule is a default rule, wherein the customized rule is a sentence completion rule customized based on the characteristics of the first analysis result and the second analysis result, wherein the customized rule includes keywords Rules and repeated word rules, etc., the default rules are general sentence completion rules.
  • sentence completion rules include keyword rules, repeated word rules and default rules
  • the step of matching the sentence completion rule corresponding to the first analysis result and the second analysis result includes:
  • Step S211 Determine whether a preset keyword exists in the first analysis result and the second analysis result, and if the preset keyword exists in the first analysis result and the second analysis result, then determine The sentence completion rule is the keyword rule;
  • the keyword rules are rules for sentence completion based on preset keywords
  • the preset keywords are pre-set keywords, for example, "Is there", "Whether” and so on.
  • the completion rule is the keyword rule. Specifically, the first analysis result and the second analysis result are respectively compared with a preset keyword set, and if the first analysis result is compared with the preset keyword set, Assuming that the same word exists in the keyword set, it is determined that the preset keyword exists in the first analysis result.
  • the preset keyword exists in the second analysis result, and if the preset keyword exists in the first analysis result, or the preset keyword exists in the second analysis result, Or if the preset keyword exists in both the first analysis result and the second analysis result, it is determined that the preset keyword exists in the first analysis result and the second analysis result, and It is determined that the sentence completion rule is the keyword rule.
  • Step S212 if the preset keyword does not exist in the first analysis result and the second analysis result, determine whether there are repeated words between the first analysis result and the second analysis result;
  • the repeated words are the same words in the sentence to be completed and in the associated sentence.
  • Step S213 If the repeated word exists between the first analysis result and the second analysis result, determine that the sentence completion rule is the repeated word rule;
  • the repeated word rule is a rule for sentence completion based on the repeated word.
  • step S214 if the repeated word does not exist between the first analysis result and the second analysis result, it is determined that the sentence completion rule is the default rule.
  • the default rule is a general sentence completion rule, that is, the default rule is that both the first analysis result and the second analysis result are specific
  • the sentence completion rules required by the feature requirements, where the feature requirements include having preset keywords, having repeated words, and so on.
  • Step S22 Perform completion processing on the sentence to be completed based on the sentence completion rule to obtain the preliminary completion result.
  • the sentence to be completed is complemented to obtain the preliminary completion result, specifically, based on the sentence completion rule and the first analysis
  • the result and the second analysis result determine the sentence completion operation corresponding to the sentence to be completed, perform the sentence completion operation on the sentence to be completed, and obtain the preliminary completion result.
  • sentence completion rules include keyword rules, repeated word rules and default rules
  • the step of performing completion processing on the sentence to be completed based on the sentence completion rule, and obtaining the preliminary completion result includes:
  • Step S221 based on the keyword rules, perform completion processing on the sentence to be completed to obtain the preliminary completion result;
  • the keyword rules include a first keyword rule and a second keyword rule, wherein the first keyword rule is that the preset keyword is in the to-be-filled keyword rule.
  • the keyword rule corresponding to when in the full sentence the second keyword rule is the keyword rule corresponding to when the preset keyword is in the associated sentence, for example, when there is in the first analysis result
  • pronouns obtain the set of nouns that constitute the second analysis result, and based on a preset antecedent matching model, determine the antecedents corresponding to the pronouns in the set of constituted nouns, and use them in the to-be-completed In the sentence, replace the pronouns with the antecedents to obtain the preliminary completion result, where the pronouns include him, she, and it, etc.
  • the preset keyword is "yes or not”, if If "yes” is in the related sentence, and there are negative words such as “no”, “no”, and “no” in the sentence to be completed, replace “yes” with "in the sentence to be completed” No, similarly, assuming the preset keyword is “whether”, if “whether” exists in the related sentence, and there are negative words such as “no”, “no”, and “no” in the sentence to be completed, then Replace "whether” with "no” in the sentence to be completed.
  • the preset keyword is replaced with the antecedent word to obtain the preliminary completion result, for example, when the pronouns such as "she, he, it" appear in the sentence to be completed
  • the candidate set of nouns is determined in the associated sentence
  • the antecedent words corresponding to the preset keywords are matched in the candidate set of nouns, and then in the sentence to be completed
  • the preset keywords are replaced with the antecedent words in, where it should be noted that the noun construction candidate set is a set of all nouns in the related sentence, and further, if the second analysis result If the preset keyword exists in the, the second keyword rule corresponding to the preset keyword and the dependency syntax corresponding to the preset keyword are determined, and according to the dependency syntax and the second keyword rule , Determine the replacement word corresponding to the
  • the step of performing completion processing on the sentence to be completed based on the keyword rule, and obtaining the preliminary completion result includes:
  • Step C10 based on the keyword rules, determine a target phrase in the sentence to be completed
  • the target phrase is determined in the sentence to be completed. Specifically, if the preset keyword is a selective word, for example, "still", etc., and the If the preset keyword is in the related sentence, the target phrase set with the same part of speech on the left and right sides of the selective word is determined in the related sentence, and the longest phrase in the target phrase set is acquired as the The target phrase, for example, suppose that the related sentence is "Do you want to repay tomorrow or the day after tomorrow", the sentence to be completed is "tomorrow”, the preset keyword is "or”, and then the preset The longest part-of-speech phrases on the left and right sides of the keywords are "repayment tomorrow" and "repayment the day after tomorrow".
  • the related sentence is "Do you want to repay tomorrow or the day after tomorrow”
  • the sentence to be completed is "tomorrow”
  • the preset keyword is "or”
  • the preset The longest part-of-speech phrases on the left and right sides of the keywords are "repayment tomorrow" and "repayment the day after tomorrow”.
  • Step C20 segment the related sentence based on the target phrase to obtain each segmented sentence corresponding to the related sentence;
  • each of the segmented sentences includes a first segmented sentence, a second segmented sentence, and a third segmented sentence
  • the target phrase includes the left side of the preset keyword The first target phrase and the second target phrase to the right of the preset keyword.
  • the related sentence is segmented to obtain each segmented sentence corresponding to the related sentence, specifically, based on the target phrase and the preset keyword, the related sentence is divided into Three paragraphs, to obtain the first paragraph sentence, the second paragraph sentence, and the third paragraph sentence.
  • the first target phrase is "repayment tomorrow”
  • the second target phrase is "repayment the day after tomorrow”
  • the preset keyword is "still”
  • the first segment sentence is "you want”
  • the second sub-sentence is "repayment tomorrow”
  • the third sub-sentence is "repayment the day after tomorrow”.
  • Step C30 Perform completion processing on the sentence to be completed based on each of the segmented sentences to obtain the preliminary completion result.
  • the sentence to be completed is complemented to obtain the preliminary completion result, specifically, the sentence to be completed and the second score are determined.
  • the length of the first coincidence of the coincident words of the paragraph sentence and determine the length of the second coincidence of the coincidence words of the sentence to be completed and the third segment sentence, and then if the length of the first coincidence is greater than the preset Coincident word length threshold, the first segmented sentence and the second segmented sentence are spliced to obtain a first splicing result, and the first splicing result is corrected to obtain the preliminary completion
  • the length of the second coincidence word is greater than the preset coincidence word length threshold
  • the first segmented sentence and the third segmented sentence are spliced to obtain a second splicing result
  • the second splicing result is obtained.
  • the preliminary completion processing result is obtained as "I want to repay tomorrow".
  • Step S222 Perform completion processing on the sentence to be completed based on the repeated word rule to obtain the preliminary completion result
  • the sentence to be completed is complemented to obtain the preliminary completion result, specifically, based on the repeated word rule, the second analysis result Connect each word segmentation information in to obtain the preliminary completion result. For example, suppose the associated sentence is "Is the amount the same as the original?" and the sentence to be completed is "the same", then the repeat If the word is "same”, connect n, v, HED, VOB, SBV, ATT in the second analysis result corresponding to the related sentence, and obtain the preliminary completion result "the quota is the same as the original", where n Is the identification of nouns, v is the identification of verbs, HED is the identification of core relationship, VOB is the identification of verb-object relationship, SBV is the identification of main-predicate relationship, and ATT is the identification of definite middle relationship.
  • the default rule is a general sentence completion rule.
  • the word segmentation information is determined in the result, and the word segmentation information is connected in a preset grammatical order to obtain the preliminary completion result. For example, the word segmentation information is replaced with "n”, "v”, "s", and "f".
  • T is the identifier of the location word
  • f is the identifier of the location word
  • t is The identification of time words
  • m is the identification of numerals
  • ADV is the identification of adverbial structure.
  • the step of performing completion processing on the sentence to be completed based on the default rule to obtain the preliminary completion result includes:
  • Step D10 acquiring each word segmentation information in the first analysis result and the second analysis result
  • the word segmentation information includes the word segmentation relationship between the word segmentation and the word segmentation.
  • the word segmentation includes verbs, nouns, time words, etc.
  • the word segmentation relationship includes subject-predicate relationship, The verb-object relationship, etc.
  • Step D20 based on the preset grammatical sequence, sequentially connect the word segmentation information to obtain the preliminary completion result.
  • the word segmentation information is sequentially connected to obtain the preliminary completion result, specifically, based on the preset grammatical sequence and the word segmentation association relationship in the word segmentation information, The word segmentation is sequentially connected to obtain the preliminary completion result.
  • Step S30 post-processing the preliminary completion result to obtain the target completion result.
  • the post-processing may be error correction processing, such as disordered word order correction processing, semantic incomplete correction processing, and the like.
  • Perform post-processing on the preliminary completion result to obtain a target completion result specifically, based on a preset post-processing model, perform error correction processing on sentence errors in the preliminary completion result to obtain the target completion result
  • a target completion result specifically, based on a preset post-processing model, perform error correction processing on sentence errors in the preliminary completion result to obtain the target completion result
  • "adjustment” is often associated with the quota, so when performing post-processing, replace all "adjustments” that appear separately with “adjustment quota”, where, It should be noted that the preset post-processing model can be supplemented and improved based on the actual business in the question and answer system.
  • a sentence to be completed and a related sentence corresponding to the sentence to be completed are obtained, and a dependency syntax analysis is performed on the sentence to be completed and the related sentence, respectively, to obtain the first analysis result corresponding to the related sentence
  • the second analysis result corresponding to the sentence to be completed, and then the first analysis result and the second analysis result are input into a preset sentence completion model, based on the first analysis result and the second analysis result
  • completion processing is performed on the sentence to be completed to obtain a preliminary completion result, and then the preliminary completion result is post-processed to obtain a target completion result.
  • this embodiment first performs dependency syntax analysis on the sentence to be completed and the associated sentence corresponding to the sentence to be completed to obtain the first analysis result and the second analysis result, and then based on the first analysis result and the second analysis result, The completion of the sentence to be completed is performed through the preset sentence completion model to obtain the initial completion result, and further, the preliminary completion result is post-processed to obtain the target completion result. That is, this embodiment provides a method for completing the sentence to be completed based on the dependency syntax analysis and the associated sentence corresponding to the sentence to be completed, thereby avoiding the completion of the sentence to be completed based on the sentence type and the antecedent. , Thereby avoiding the accumulation of errors due to the determination of sentence types and antecedents in series, which will lead to lower accuracy of sentence completion, thereby improving the accuracy of sentence completion, so it solves the problem of sentence completion. Technical problems with low accuracy.
  • the step of obtaining the sentence to be completed includes:
  • Step A10 Obtain the sentence to be predicted, and input the sentence to be predicted into a preset sentence completion prediction model to determine whether the sentence to be predicted needs to be completed;
  • the sentence to be predicted is a sentence received by the question answering system
  • the preset sentence completion prediction model is a pre-trained machine learning model
  • the question answering system is When the number of sentences to be predicted is large, it is suitable for the machine learning model to predict whether the model to be predicted needs to be complemented.
  • the sentence to be predicted and input the sentence to be predicted into a preset sentence completion prediction model to determine whether the sentence to be predicted needs to be completed.
  • the sentence to be predicted is obtained, and the sentence to be predicted is combined
  • Input the preset sentence completion prediction model to segment the sentence to be completed to obtain the word segmentation result, and based on the word segmentation result and the preset first encoding method, encode the sentence to be completed to obtain the first A coding vector, and based on a preset second coding mode, coding the sentence to be completed to obtain a second coding vector, and then concatenating the first coding vector and the second coding vector to obtain the
  • the feature representation vector corresponding to the sentence to be completed and further, based on the data processing layer in the preset sentence completion prediction model, data processing is performed on the feature representation vector, wherein the data processing layer includes a convolutional layer , Pooling layer, fully connected layer, etc., and then obtain the completion prediction result, and based on the completion prediction result, determine whether the sentence to be completed
  • the sentence completion method further includes:
  • Step B10 Obtain each training sentence to be completed and a basic prediction model, and perform word segmentation on each training sentence to be completed, to obtain a word segmentation result corresponding to each training sentence to be completed;
  • the training sentence to be completed is a sentence that has been determined to be completed.
  • each training sentence to be completed and the basic prediction model, and segment each training sentence to be completed, and obtain the word segmentation result corresponding to each training sentence to be completed specifically, from a preset training data repository Extract each to-be-completed training sentence and the basic prediction model, and split each to-be-completed sentence into its corresponding words to obtain the word segmentation result corresponding to each of the to-be-completed training sentences, for example, suppose the If the training sentence to be completed is "the same", the word segmentation result is (yes, the same).
  • Step B20 based on each of the word segmentation results, respectively encode each of the training sentences to be completed to obtain a first coding result corresponding to each of the training sentences to be completed;
  • each of the training sentences to be complemented is coded to obtain the first coding result corresponding to each of the training sentences to be complemented, specifically, based on the word segmentation result , Encode the training sentence to be completed in a preset first coding manner, obtain a first training sentence vector, and use the first training sentence vector as the first encoding result, for example, suppose the training sentence to be completed If the sentence is "the same", the word segmentation result is (yes, the same), and the first encoding result is (a, b), where the code a is the symbol of "yes”, and the frequency of occurrence is 1, the code b is the "same” mark, and the frequency of occurrence is 1.
  • Step B30 performing dependent syntax analysis on the training sentences to be completed respectively, to obtain the syntax analysis results corresponding to each training sentence to be completed;
  • Step B40 encoding each of the training sentences to be complemented based on the results of each of the syntactic analysis, to obtain a second coding result corresponding to each of the training sentences to be complemented;
  • the dependency syntax analysis is performed on the training sentences to be complemented respectively to obtain the syntactic analysis results corresponding to each training sentence to be complemented, and then the to-be-completing training sentences are processed by the preset second coding method.
  • the second training sentence vector is (0, 1), where 0 indicates that no noun exists in the training sentence to be completed, and 1 indicates that there is a verb in the training sentence to be completed.
  • Step B50 based on each of the first encoding results and each of the second encoding results, generating a target encoding result corresponding to each of the training sentences to be completed;
  • the target encoding result corresponding to the training sentence to be completed is generated, specifically, the first training result corresponding to the first encoding result is generated
  • the sentence vector and the second training sentence vector corresponding to the second coding result are spliced to obtain a target coding vector, and the target coding vector is used as the target coding result. For example, suppose the first training sentence vector is ( a, b, c), the second training sentence vector is (0, 1, 0, 1), and the target coding vector is (a, b, c, 0, 1, 0, 1).
  • Step B60 Perform iterative training on the basic prediction model based on each of the target encoding results until the basic prediction model reaches a preset iteration end condition, and obtain the preset sentence completion prediction model.
  • the basic prediction model is iteratively trained until the basic prediction model reaches a preset iterative end condition, and the preset sentence completion prediction model is obtained, specifically , Extract the first target encoding result from each target encoding result, and input the first target encoding result into the basic prediction model, train and update the basic prediction model, obtain the initial training model, and determine Whether the initial training model satisfies the preset iteration end condition, if the initial training model satisfies the preset iteration end condition, the initial training model is used as the preset sentence completion prediction model, if the initial training model If the preset iteration end condition is not met, extract a second target encoding result from each target encoding result, and re-train and update the initial training model based on the second target encoding result, until the initial training The model satisfies the preset iteration end condition to obtain the preset sentence completion prediction model, where the preset iteration end condition
  • Step A20 if the sentence to be predicted needs to be completed, use the sentence to be predicted as the sentence to be completed;
  • the sentence to be predicted if the sentence to be predicted needs to be completed, the sentence to be predicted is used as the sentence to be completed. Specifically, if it is determined that the sentence to be predicted needs to be completed, then Assign a preset sentence identifier to be predicted to the sentence to be predicted to obtain the sentence to be completed, and if it is determined that the sentence to be predicted does not need to be completed, then assign a clear semantic identifier to the sentence to be predicted.
  • Step A30 Obtain the sentence to be predicted, and perform dependency syntactic analysis on the sentence to be predicted to determine whether the sentence to be predicted lacks a preset sentence component;
  • the predetermined sentence component includes a subject-predicate-object component, wherein the subject-predicate-object component is a subject component, a predicate component, and an object component.
  • step A40 if the sentence to be predicted lacks the preset sentence component, the sentence to be predicted is used as the sentence to be completed.
  • the sentence to be predicted if the sentence to be predicted lacks the preset sentence component, the sentence to be predicted is used as the sentence to be completed, specifically, if the sentence to be predicted lacks the preset sentence Component, the preset sentence to be completed identifier is assigned to the sentence to be predicted, and the sentence to be completed is obtained. If the sentence to be predicted does not lack the preset sentence component, then the preset semantic clear identifier is assigned to the sentence to be predicted. State the sentence to be predicted.
  • the sentence to be predicted by obtaining the sentence to be predicted, and inputting the sentence to be predicted into the preset sentence completion prediction model, it is determined whether the sentence to be predicted needs to be completed, and then if the sentence to be predicted needs to be completed.
  • the sentence to be predicted is used as the sentence to be completed; or the sentence to be predicted is obtained, and the dependency syntax analysis is performed on the sentence to be predicted to determine whether the sentence to be predicted lacks preset sentence components, and then if If the sentence to be predicted lacks the preset sentence component, the sentence to be predicted is used as the sentence to be completed.
  • this embodiment provides a method for determining whether the sentence to be predicted needs to be completed, that is, when the number of samples is small, the sentence to be predicted can be determined by performing dependency syntax analysis on the sentence to be predicted. Whether the predicted sentence lacks a preset sentence component, and then when the sentence to be predicted lacks the preset sentence component, it is determined that the sentence to be predicted needs to be complemented. When the number of samples is large, it is determined based on the machine learning model.
  • the sentence to be completed can be completed based on the dependency syntax analysis and the related sentence corresponding to the sentence to be completed ,
  • the accuracy of sentence completion is improved, so it lays a foundation for solving the technical problem of low accuracy of sentence completion.
  • FIG. 3 is a schematic diagram of the device structure of the hardware operating environment involved in the solution of the embodiment of the present application.
  • the sentence completion device may include: a processor 1001, such as a CPU, a memory 1005, and a communication bus 1002.
  • the communication bus 1002 is used to implement connection and communication between the processor 1001 and the memory 1005.
  • the memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a magnetic disk memory.
  • the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
  • the sentence completion device may also include a rectangular user interface, a network interface, a camera, and RF (Radio Frequency (radio frequency) circuits, sensors, audio circuits, WiFi modules, etc.
  • the rectangular user interface may include a display screen (Display) and an input sub-module such as a keyboard (Keyboard), and the optional rectangular user interface may also include a standard wired interface and a wireless interface.
  • the optional network interface can include standard wired interface and wireless interface (such as WI-FI interface).
  • the structure of the sentence completion device shown in FIG. 3 does not constitute a limitation on the sentence completion device, and may include more or less components than shown in the figure, or a combination of certain components, or different components.
  • the layout of the components does not constitute a limitation on the sentence completion device, and may include more or less components than shown in the figure, or a combination of certain components, or different components. The layout of the components.
  • the memory 1005 as a computer storage medium may include an operating system, a network communication module, and a sentence completion program.
  • the operating system is a program that manages and controls the hardware and software resources of the sentence completion device, and supports the operation of the sentence completion program and other software and/or programs.
  • the network communication module is used to realize the communication between the components in the memory 1005 and the communication with other hardware and software in the sentence completion system.
  • the processor 1001 is used to execute the sentence completion program stored in the memory 1005 to implement the steps of the sentence completion method described in any one of the above.
  • An embodiment of the present application also provides a sentence completion device, the sentence completion device is applied to a sentence completion device, and the sentence completion device includes:
  • the dependency syntax analysis module is used to obtain the sentence to be completed and the related sentence corresponding to the sentence to be completed, and perform dependency syntax analysis on the sentence to be completed and the related sentence, respectively, to obtain the corresponding sentence of the related sentence.
  • the sentence completion module is used to input the first analysis result and the second analysis result into a preset sentence completion model, and based on the first analysis result and the second analysis result, perform the completion The sentence is completed and processed, and the preliminary completion result is obtained;
  • the post-processing module is used to perform post-processing on the preliminary completion result to obtain the target completion result.
  • the sentence completion module includes:
  • the matching sub-module is configured to input the first analysis result and the second analysis result into the preset sentence completion model, and match the sentence completion corresponding to the first analysis result and the second analysis result rule;
  • the completion processing sub-module is used to perform completion processing on the sentence to be completed based on the sentence completion rule to obtain the preliminary completion result.
  • the matching submodule includes:
  • the first determining unit is configured to determine whether a preset keyword exists in the first analysis result and the second analysis result, if the preset key exists in the first analysis result and the second analysis result Words, it is determined that the sentence completion rule is the keyword rule;
  • the second determining unit is configured to determine whether there is a gap between the first analysis result and the second analysis result if the preset keyword does not exist in the first analysis result and the second analysis result Repeated words
  • a third determining unit configured to determine that the sentence completion rule is the repeated word rule if the repeated word exists between the first analysis result and the second analysis result;
  • the fourth determining unit is configured to determine that the sentence completion rule is the default rule if the repeated word does not exist between the first analysis result and the second analysis result.
  • the completion processing sub-module includes:
  • the first completion processing unit is configured to perform completion processing on the sentence to be completed based on the keyword rule to obtain the preliminary completion result;
  • the second completion processing unit is configured to perform completion processing on the sentence to be completed based on the repeated word rule to obtain the preliminary completion result;
  • the third completion processing unit is configured to perform completion processing on the sentence to be completed based on the default rule to obtain the preliminary completion result.
  • the first completion processing unit includes:
  • the determining subunit is used to determine a target phrase in the sentence to be completed based on the keyword rule
  • the segmentation subunit is used to segment the related sentence based on the target phrase to obtain each segmented sentence corresponding to the related sentence;
  • the completion processing subunit is configured to perform completion processing on the sentence to be completed based on each of the segmented sentences to obtain the preliminary completion result.
  • the third completion processing unit includes:
  • An obtaining subunit for obtaining each word segmentation information in the first analysis result and the second analysis result An obtaining subunit for obtaining each word segmentation information in the first analysis result and the second analysis result
  • connection subunit is used to sequentially connect the word segmentation information based on a preset grammatical sequence to obtain the preliminary completion result.
  • the dependency syntax analysis module includes:
  • the prediction sub-module is used to obtain the sentence to be predicted, and input the sentence to be predicted into a preset sentence completion prediction model to determine whether the sentence to be predicted needs to be completed;
  • the first determining sub-module is configured to use the sentence to be predicted as the sentence to be completed if the sentence to be predicted needs to be completed;
  • the syntactic analysis sub-module is used to obtain the sentence to be predicted, and perform dependency syntactic analysis on the sentence to be predicted to determine whether the sentence to be predicted lacks a preset sentence component;
  • the second determining sub-module is configured to use the sentence to be predicted as the sentence to be completed if the sentence to be predicted lacks the preset sentence component.
  • the sentence completion device further includes:
  • the word segmentation module is used to obtain each training sentence to be completed and a basic prediction model, and to segment each training sentence to be completed to obtain the word segmentation result corresponding to each training sentence to be completed;
  • the first encoding module is configured to respectively encode each of the training sentences to be completed based on each of the word segmentation results to obtain the first encoding result corresponding to each of the training sentences to be completed;
  • the syntactic analysis module is used to perform dependent syntactic analysis on the training sentences to be completed to obtain the syntactic analysis results corresponding to the training sentences to be completed;
  • the second encoding module is configured to respectively encode each of the training sentences to be completed based on each of the syntactic analysis results to obtain the second encoding result corresponding to each of the training sentences to be completed;
  • a generating module configured to generate a target encoding result corresponding to each of the training sentences to be completed based on each of the first encoding results and each of the second encoding results;
  • the iterative training module is configured to perform iterative training on the basic prediction model based on each of the target encoding results until the basic prediction model reaches a preset iterative end condition to obtain the preset sentence completion prediction model.
  • the dependency syntax analysis module further includes:
  • the de-verbalization processing sub-module is used to de-verbally process the initial sentence to be completed and the initial associated sentence to obtain the sentence to be completed and the initial sentence to be completed corresponding to the initial sentence to be completed.
  • the related sentence corresponding to the related sentence.
  • the embodiments of the present application provide a readable storage medium, and the readable storage medium stores one or more programs, and the one or more programs may also be executed by one or more processors for implementation The steps of the sentence completion method described in any one of the above.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Mathematical Physics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Machine Translation (AREA)

Abstract

A sentence completion method and device, and a readable storage medium. The sentence completion method comprises: obtaining a sentence to be completed and an associated sentence corresponding to said sentence, and respectively performing dependency syntactic analysis on said sentence and the associated sentence to obtain a first analysis result corresponding to the associated sentence and a second analysis result corresponding to said sentence (S10); inputting the first analysis result and the second analysis result into a preset sentence completion model, and performing completion processing on said sentence on the basis of the first analysis result and the second analysis result to obtain a preliminary completion result (S20); and performing post-processing on the preliminary completion result to obtain a target completion result (S30).

Description

语句补全方法、设备及可读存储介质Sentence completion method, equipment and readable storage medium
本申请要求2020年4月15日申请的,申请号为202010302609.X,名称为“语句补全方法、设备及可读存储介质”的中国专利申请的优先权,在此将其全文引入作为参考。This application claims the priority of the Chinese patent application filed on April 15, 2020 with the application number 202010302609.X and the name "Sentence Completion Method, Device and Readable Storage Medium", the full text of which is hereby incorporated by reference .
技术领域Technical field
本申请涉及金融科技(Fintech)的人工智能领域,尤其涉及一种语句补全方法、设备及可读存储介质。This application relates to the field of artificial intelligence of financial technology (Fintech), and in particular to a sentence completion method, device, and readable storage medium.
背景技术Background technique
随着金融科技,尤其是互联网科技金融的不断发展,越来越多的技术(如分布式、区块链Blockchain、人工智能等)应用在金融领域,但金融业也对技术提出了更高的要求,如对金融业对应待办事项的分发也有更高的要求。With the continuous development of financial technology, especially Internet technology and finance, more and more technologies (such as distributed, blockchain, artificial intelligence, etc.) are applied in the financial field, but the financial industry has also proposed higher technology Requirements, such as the distribution of to-do items in the financial industry, also have higher requirements.
随着计算机软件和人工智能的不断发展,人工智能的应用领域也越来越广泛,在人工智能相关的智能问答***中,智能问答***常常会接收成分缺失的语句,进而导致智能问答***无法识别语句中的语义,目前,通常通过先分析语句的语句类型,进而根据语句类型,使用不同的模型确定语句的先行词,并对先行词进行替换,以对成分缺失的语句进行补全,但是,该方法中确定句子类型和先行词通常是串联进行的,进而会造成错误累积,进而导致语句补全的准确率低,所以,相关技术中存在语句补全准确率低的技术问题。With the continuous development of computer software and artificial intelligence, the application field of artificial intelligence has become more and more extensive. In the intelligent question answering system related to artificial intelligence, the intelligent question answering system often receives sentences with missing components, which causes the intelligent question answering system to fail to recognize At present, the semantics of the sentence is usually analyzed by first analyzing the sentence type of the sentence, and then according to the sentence type, different models are used to determine the antecedent of the sentence, and the antecedent word is replaced to complete the sentence with missing components. However, In this method, the determination of the sentence type and the antecedent is usually carried out in series, which will cause errors to accumulate, which will result in low accuracy of sentence completion. Therefore, there is a technical problem of low accuracy of sentence completion in related technologies.
技术解决方案Technical solutions
本申请的主要目的在于提供一种语句补全方法、设备及可读存储介质,旨在解决现有技术中语句补全准确率低的技术问题。The main purpose of this application is to provide a sentence completion method, device and readable storage medium, aiming to solve the technical problem of low sentence completion accuracy in the prior art.
为实现上述目的,本申请提供一种语句补全方法,所述语句补全方法应用于语句补全设备,所述语句补全方法包括:To achieve the above objective, the present application provides a sentence completion method, which is applied to a sentence completion device, and the sentence completion method includes:
获取待补全语句和所述待补全语句对应的关联语句,并分别对所述待补全语句和所述关联语句进行依存句法分析,获得所述关联语句对应的第一分析结果和所述待补全语句对应的第二分析结果;Acquire the sentence to be completed and the related sentence corresponding to the sentence to be completed, and perform dependency syntactic analysis on the sentence to be completed and the related sentence, respectively, to obtain the first analysis result and the related sentence corresponding to the related sentence The second analysis result corresponding to the sentence to be completed;
将所述第一分析结果和所述第二分析结果输入预设语句补全模型,基于所述第一分析结果和所述第二分析结果,对所述待补全语句进行补全处理,获得初步补全结果;The first analysis result and the second analysis result are input into a preset sentence completion model, and based on the first analysis result and the second analysis result, the sentence to be completed is complemented to obtain Preliminary completion results;
对所述初步补全结果进行后处理,获得目标补全结果。The preliminary completion result is post-processed to obtain the target completion result.
本申请还提供一种语句补全装置,所述语句补全装置为虚拟装置,且所述语句补全装置应用于语句补全设备,所述语句补全装置包括:The present application also provides a sentence completion device, the sentence completion device is a virtual device, and the sentence completion device is applied to a sentence completion device, and the sentence completion device includes:
依存句法分析模块,用于获取待补全语句和所述待补全语句对应的关联语句,并分别对所述待补全语句和所述关联语句进行依存句法分析,获得所述关联语句对应的第一分析结果和所述待补全语句对应的第二分析结果;The dependency syntax analysis module is used to obtain the sentence to be completed and the related sentence corresponding to the sentence to be completed, and perform dependency syntax analysis on the sentence to be completed and the related sentence, respectively, to obtain the corresponding sentence of the related sentence The first analysis result and the second analysis result corresponding to the sentence to be completed;
语句补全模块,用于将所述第一分析结果和所述第二分析结果输入预设语句补全模型,基于所述第一分析结果和所述第二分析结果,对所述待补全语句进行补全处理,获得初步补全结果;The sentence completion module is used to input the first analysis result and the second analysis result into a preset sentence completion model, and based on the first analysis result and the second analysis result, perform the completion The sentence is completed and processed, and the preliminary completion result is obtained;
后处理模块,用于对所述初步补全结果进行后处理,获得目标补全结果。The post-processing module is used to perform post-processing on the preliminary completion result to obtain the target completion result.
本申请还提供一种语句补全设备,所述语句补全设备为实体设备,所述语句补全设备包括:存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的所述语句补全方法的程序,所述语句补全方法的程序被处理器执行时可实现如上述的语句补全方法的步骤。The present application also provides a sentence completion device. The sentence completion device is a physical device. The sentence completion device includes a memory, a processor, and a device that is stored in the memory and can run on the processor. The program of the sentence completion method, when the program of the sentence completion method is executed by a processor, can realize the steps of the sentence completion method described above.
本申请还提供一种可读存储介质,所述可读存储介质上存储有实现语句补全方法的程序,所述语句补全方法的程序被处理器执行时实现如上述的语句补全方法的步骤。The present application also provides a readable storage medium, the readable storage medium stores a program for implementing the sentence completion method, and when the program of the sentence completion method is executed by a processor, the method for implementing the sentence completion method as described above is stored. step.
本申请获取待补全语句和所述待补全语句对应的关联语句,并分别对所述待补全语句和所述关联语句进行依存句法分析,获得所述关联语句对应的第一分析结果和所述待补全语句对应的第二分析结果,进而将所述第一分析结果和所述第二分析结果输入预设语句补全模型,基于所述第一分析结果和所述第二分析结果,对所述待补全语句进行补全处理,获得初步补全结果,进而对所述初步补全结果进行后处理,获得目标补全结果。也即,本申请首先对待补全语句和所述待补全语句对应的关联语句进行依存句法分析,获得第一分析结果和第二分析结果,进而基于第一分析结果和第二分析结果,通过预设语句补全模型对所述待补全语句进行补全处理,获得初始补全结果,进一步地,对初步补全结果进行后处理,获得目标补全结果。也即,本申请提供了一种基于依存句法分析和待补全语句对应的关联语句,对待补全语句进行补全的方法,进而避免了基于句子类型和先行词对待补全语句进行补全,进而避免了由于串联进行句子类型和先行词的确定,而导致错误累积,进而导致语句补全准确率变低的情况发生,进而提高了语句补全的准确率,所以,解决了语句补全准确率低的技术问题。The present application obtains the sentence to be completed and the related sentence corresponding to the sentence to be completed, and performs dependency syntactic analysis on the sentence to be completed and the related sentence, respectively, to obtain the first analysis result and the related sentence corresponding to the related sentence. The second analysis result corresponding to the sentence to be completed, and then the first analysis result and the second analysis result are input into a preset sentence completion model, based on the first analysis result and the second analysis result , Perform completion processing on the sentence to be completed to obtain a preliminary completion result, and then perform post-processing on the preliminary completion result to obtain a target completion result. That is, this application first performs dependency syntactic analysis on the sentence to be completed and the associated sentence corresponding to the sentence to be completed to obtain the first analysis result and the second analysis result, and then based on the first analysis result and the second analysis result, through The preset sentence completion model performs completion processing on the sentence to be completed to obtain an initial completion result, and further, performs post-processing on the preliminary completion result to obtain a target completion result. That is, this application provides a method for completing sentences to be completed based on dependency syntax analysis and related sentences corresponding to sentences to be completed, thereby avoiding completion of sentences to be completed based on sentence types and antecedents. This avoids the accumulation of errors due to the determination of sentence types and antecedents in series, which leads to lower accuracy of sentence completion, thereby improving the accuracy of sentence completion, so it solves the problem of accuracy of sentence completion. Low rate of technical problems.
附图说明Description of the drawings
图1为本申请语句补全方法第一实施例的流程示意图;FIG. 1 is a schematic flowchart of a first embodiment of a sentence completion method of the application;
图2为本申请语句补全方法第二实施例的流程示意图;2 is a schematic flowchart of a second embodiment of a sentence completion method for the application;
图3为本申请实施例方案涉及的硬件运行环境的设备结构示意图。FIG. 3 is a schematic diagram of the device structure of the hardware operating environment involved in the solution of the embodiment of the application.
本发明的实施方式Embodiments of the present invention
应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。It should be understood that the specific embodiments described here are only used to explain the application, and are not used to limit the application.
本申请实施例提供一种语句补全方法,在本申请语句补全方法的第一实施例中,参照图1,所述语句补全方法包括:The embodiment of the present application provides a sentence completion method. In the first embodiment of the sentence completion method of the present application, referring to FIG. 1, the sentence completion method includes:
步骤S10,获取待补全语句和所述待补全语句对应的关联语句,并分别对所述待补全语句和所述关联语句进行依存句法分析,获得所述关联语句对应的第一分析结果和所述待补全语句对应的第二分析结果;Step S10: Obtain the sentence to be completed and the related sentence corresponding to the sentence to be completed, and perform dependency syntactic analysis on the sentence to be completed and the related sentence, respectively, to obtain the first analysis result corresponding to the related sentence The second analysis result corresponding to the sentence to be completed;
在本实施例中,需要说明的是,所述语句补全方法应用于问答***,所述待补全语句为语义补全且确认需要进行补全的语句,所述关联语句为所述待补全语句的上下文关联语句,例如,假设问答***中的一段对话信息为“A:还款日期是一样的么?B:是一样的”,则若语句B为所述待补全语句,则语句A为所述关联语句。In this embodiment, it should be noted that the sentence completion method is applied to a question and answer system, the sentence to be completed is semantically completed and it is confirmed that the sentence needs to be completed, and the related sentence is the sentence to be completed. The context-related sentences of the whole sentence, for example, suppose a piece of dialogue information in the question and answer system is "A: Is the repayment date the same? B: Is the same", then if sentence B is the sentence to be completed, then the sentence A is the associated sentence.
获取待补全语句和所述待补全语句对应的关联语句,并分别对所述待补全语句和所述关联语句进行依存句法分析,获得所述关联语句对应的第一分析结果和所述待补全语句对应的第二分析结果,具体地,从所述问答***的数据库中提取待补全语句和所述待补全语句对应的关联语句,并分别对所述待补全语句和所述关联语句进行依存句法分析,以分别对所述待补全语句和所述关联语句进行语法解析,获得所述关联语句对应的第一分析结果和所述待补全语句对应的第二分析结果,其中,所述第一分析结果为对所述待补全语句进行语法解析的结果,所述第二分析结果为对所述关联语句进行语法解析的结果,且所述第一分析结果和所述第二分析结果均可以向量的形式进行表示,例如,语句“有关注微粒贷公众号”进行语法解析后,获得的语法解析结果为“(‘有’,‘v’, 0,‘HED’),(‘关注’,‘v’,1,‘VOB’),(‘微粒贷’,‘nz’,4,‘ATT’), (‘公众号’,‘nz’,2,‘VOB’)”,其中,v为动词的标识,HED为核心关系的标识,VOB为动宾关系的标识,nz为名词的标识,ATT为定中关系的标识,0、1、4、2为各个解析出来的词的编码,进而获得语法解释结果对应的向量为(0,1,4,2)。Acquire the sentence to be completed and the related sentence corresponding to the sentence to be completed, and perform dependency syntactic analysis on the sentence to be completed and the related sentence, respectively, to obtain the first analysis result and the related sentence corresponding to the related sentence The second analysis result corresponding to the sentence to be completed, specifically, extracts the sentence to be completed and the associated sentence corresponding to the sentence to be completed from the database of the question answering system, and compares the sentence to be completed and the sentence to be completed respectively. Dependent syntax analysis is performed on the related sentence to perform grammatical analysis on the sentence to be completed and the related sentence respectively to obtain a first analysis result corresponding to the related sentence and a second analysis result corresponding to the sentence to be completed , Wherein the first analysis result is the result of grammatical analysis of the sentence to be completed, the second analysis result is the result of the grammatical analysis of the associated sentence, and the first analysis result and the The second analysis result can be expressed in the form of a vector. For example, after the sentence "You Follow the WeChat Official Account" is parsed, the grammatical analysis result obtained is "('Yes','v', 0,'HED') ), ('Follow','v',1,'VOB'),('particle loan','nz',4,'ATT'), ('public account','nz',2,'VOB' )”, where v is the identifier of the verb, HED is the identifier of the core relationship, VOB is the identifier of the verb-object relationship, nz is the identifier of the noun, ATT is the identifier of the definite middle relationship, and 0, 1, 4, and 2 are each analysis The encoding of the word that comes out, and then the vector corresponding to the grammatical interpretation result is (0, 1, 4, 2).
其中,所述获取待补全语句和所述待补全语句对应的关联语句的步骤包括:Wherein, the step of obtaining the sentence to be completed and the associated sentence corresponding to the sentence to be completed includes:
步骤S11,获取初始待补全语句和所述初始待补全语句对应的初始关联语句;Step S11, obtaining an initial sentence to be completed and an initial associated sentence corresponding to the initial sentence to be completed;
在本实施例中,需要说明的是,所述初始待补全语句为未进行去口语化处理之前的且已经确定需要进行补全处理的语句,所述初始关联语句为未进行去口语化处理之前的所述初始待补全语句的关联语句。In this embodiment, it should be noted that the initial sentence to be completed is a sentence that has not been processed for de-speaking and it has been determined that it needs to be completed, and the initial associated sentence is a sentence that has not been processed for de-speaking. The related sentence of the previous initial sentence to be completed.
步骤S12,分别对所述初始待补全语句和所述初始关联语句进行去口语化处理,获得所述初始待补全语句对应的所述待补全语句和所述初始关联语句对应的所述关联语句。Step S12: De-verbalize the initial sentence to be completed and the initial related sentence to obtain the sentence to be completed corresponding to the initial sentence to be completed and the initial related sentence Associated statement.
在本实施例中,分别对所述初始待补全语句和所述初始关联语句进行去口语化处理,获得所述初始待补全语句对应的所述待补全语句和所述初始关联语句对应的所述关联语句,具体地,分别对所述初始待补全语句和所述初始关联语句与预设口语集合进行对比,若所述初始待补全语句中存在与所述预设口语集合中相同的第一待去除词语,则在所述初始待补全语句中去除所述第一待去除词语,获得所述待补全语句,相同地,若所述关联语句中存在与所述预设口语集合中相同的第二待去除词语,则在所述初始关联语句中去除所述第二待去除词语,获得所述关联语句,例如,所述预设口语集合包括嗯、好的、请问一下、那个、那请问等口语。In this embodiment, the initial to-be-completed sentence and the initial associated sentence are respectively subjected to de-spoken processing to obtain the to-be-completed sentence corresponding to the initial to-be-completed sentence and the corresponding initial associated sentence The related sentences, specifically, the initial to-be-completed sentences and the initial related sentences are compared with a preset spoken language set, and if the initial to-be-completed sentences exist and are in the preset spoken language set If the same first word to be removed is the same, the first word to be removed is removed from the initial sentence to be completed to obtain the sentence to be completed. If the same second word to be removed in the spoken language set, the second word to be removed is removed from the initial associated sentence to obtain the associated sentence. For example, the preset spoken language set includes um, ok, may I ask , That, that, please, etc. spoken language.
步骤S20,将所述第一分析结果和所述第二分析结果输入预设语句补全模型,基于所述第一分析结果和所述第二分析结果,对所述待补全语句进行补全处理,获得初步补全结果;Step S20, input the first analysis result and the second analysis result into a preset sentence completion model, and perform the completion of the sentence to be completed based on the first analysis result and the second analysis result Processing and obtaining preliminary completion results;
在本实施例中,需要说明的是,所述预设语句补全模型为预先设置好的用于进行语句的补全处理的规则模型,所述预设语句补全模型包括一条或者多条语句补全规则。In this embodiment, it should be noted that the preset sentence completion model is a preset rule model for performing sentence completion processing, and the preset sentence completion model includes one or more sentences. Completion rules.
将所述第一分析结果和所述第二分析结果输入预设语句补全模型,基于所述第一分析结果和所述第二分析结果,对所述待补全语句进行补全处理,获得初步补全结果,具体地,将所述第一分析结果和所述第二分析结果输入预设语句补全模型,基于所述第一分析结果和所述第二分析结果,确定所述待补全语句对应的语句补全规则,并基于所述语句补全规则对应的语句补全操作,对所述待补全语句进行补全处理,获得初步补全结果。The first analysis result and the second analysis result are input into a preset sentence completion model, and based on the first analysis result and the second analysis result, the sentence to be completed is complemented to obtain The preliminary completion result, specifically, the first analysis result and the second analysis result are input into a preset sentence completion model, and the to-be-supplement is determined based on the first analysis result and the second analysis result A sentence completion rule corresponding to a full sentence, and based on a sentence completion operation corresponding to the sentence completion rule, a completion process is performed on the sentence to be completed to obtain a preliminary completion result.
另外地,需要说明的是,各所述语句补全规则可根据问答***的应用场景进行组合,形成所述预设语句补全模型,例如,假设所述各所述语句补全规则包括规则A、规则B和规则C,在所述问答***的应用场景中,涉及到规则A和规则B,则可基于所述规则A和所述规则B组合所述预设语句补全模型,进而当将所述第一分析结果和所述第二分析结果输入所述预设语句补全模型中时,则判断所述待补全语句是否适用于规则A,若所述待补全语句适用于规则A,则基于所述规则A对所述待补全语句进行补全,若所述待补全语句不适用于规则A,则基于所述规则B对所述待补全语句进行补全。In addition, it should be noted that each of the sentence completion rules can be combined according to the application scenario of the question answering system to form the preset sentence completion model. For example, assume that each of the sentence completion rules includes rule A. , Rule B and Rule C. In the application scenario of the question answering system, when Rule A and Rule B are involved, the preset sentence completion model can be combined based on the Rule A and the rule B, and then the When the first analysis result and the second analysis result are input into the preset sentence completion model, it is determined whether the sentence to be completed is applicable to rule A, and if the sentence to be completed is applicable to rule A , The sentence to be completed is completed based on the rule A, and if the sentence to be completed is not applicable to the rule A, the sentence to be completed is completed based on the rule B.
其中,所述将所述第一分析结果和所述第二分析结果输入预设语句补全模型,基于所述第一分析结果和所述第二分析结果,对所述待补全语句进行补全处理,获得初步补全结果的步骤包括:Wherein, said inputting said first analysis result and said second analysis result into a preset sentence completion model, and supplementing said sentence to be completed based on said first analysis result and said second analysis result Full processing, the steps to obtain preliminary completion results include:
步骤S21,将所述第一分析结果和所述第二分析结果输入所述预设语句补全模型,匹配所述第一分析结果和所述第二分析结果共同对应的语句补全规则;Step S21, inputting the first analysis result and the second analysis result into the preset sentence completion model, and matching sentence completion rules corresponding to the first analysis result and the second analysis result;
在本实施例中,将所述第一分析结果和所述第二分析结果输入所述预设语句补全模型,匹配所述第一分析结果和所述第二分析结果共同对应的语句补全规则,具体地,将所述第一分析结果和所述第二分析结果输入所述预设语句补全模型,确定所述第一分析结果和所述第二分析结果是否命中定制规则,若所述第一分析结果和所述第二分析结果命中定制规则,则确定所述语句补全规则为定制规则,若所述第一分析结果和所述第二分析结果未命中定制规则,则确定所述语句补全规则为缺省规则,其中,所述定制规则为基于所述第一分析结果和所述第二分析结果的特性而定制的语句补全规则,其中,所述定制规则包括关键词规则和重复词规则等,所述缺省规则为通用的语句补全规则。In this embodiment, the first analysis result and the second analysis result are input into the preset sentence completion model, and the sentence completion corresponding to the first analysis result and the second analysis result is matched The rule, specifically, the first analysis result and the second analysis result are input into the preset sentence completion model, and it is determined whether the first analysis result and the second analysis result match the customized rule. If the first analysis result and the second analysis result match the custom rule, it is determined that the sentence completion rule is a custom rule, and if the first analysis result and the second analysis result do not match the custom rule, it is determined that all The sentence completion rule is a default rule, wherein the customized rule is a sentence completion rule customized based on the characteristics of the first analysis result and the second analysis result, wherein the customized rule includes keywords Rules and repeated word rules, etc., the default rules are general sentence completion rules.
其中,所述语句补全规则包括关键词规则、重复词规则和缺省规则,Wherein, the sentence completion rules include keyword rules, repeated word rules and default rules,
所述匹配所述第一分析结果和所述第二分析结果共同对应的语句补全规则的步骤包括:The step of matching the sentence completion rule corresponding to the first analysis result and the second analysis result includes:
步骤S211,确定所述第一分析结果和所述第二分析结果中是否存在预设关键词,若所述第一分析结果和所述第二分析结果中存在所述预设关键词,则确定所述语句补全规则为所述关键词规则;Step S211: Determine whether a preset keyword exists in the first analysis result and the second analysis result, and if the preset keyword exists in the first analysis result and the second analysis result, then determine The sentence completion rule is the keyword rule;
在本实施例中,需要说明的是,所述关键词规则为基于预设关键词进行语句补全的规则,所述预设关键词为预先设置好的关键词,例如,“有没有”、“是否”等。In this embodiment, it should be noted that the keyword rules are rules for sentence completion based on preset keywords, and the preset keywords are pre-set keywords, for example, "Is there", "Whether" and so on.
确定所述第一分析结果和所述第二分析结果中是否存在预设关键词,若所述第一分析结果和所述第二分析结果中存在所述预设关键词,则确定所述语句补全规则为所述关键词规则,具体地,分别将所述第一分析结果和所述第二分析结果与预设关键词集合进行比对,若所述第一分析结果中与所述预设关键词集合中存在相同词语,则判定所述第一分析结果中存在所述预设关键词,相同地,若所述第二分析结果中与所述预设关键词集合中存在相同词语,则判定所述第二分析结果中存在所述预设关键词,进而若所述第一分析结果中存在所述预设关键词,或者所述第二分析结果中存在所述预设关键词,或者所述第一分析结果中和所述第二分析结果中均存在所述预设关键词,则判定所述第一分析结果和所述第二分析结果中存在所述预设关键词,并确定所述语句补全规则为所述关键词规则。Determine whether a preset keyword exists in the first analysis result and the second analysis result, and if the preset keyword exists in the first analysis result and the second analysis result, determine the sentence The completion rule is the keyword rule. Specifically, the first analysis result and the second analysis result are respectively compared with a preset keyword set, and if the first analysis result is compared with the preset keyword set, Assuming that the same word exists in the keyword set, it is determined that the preset keyword exists in the first analysis result. Similarly, if the same word exists in the second analysis result as in the preset keyword set, It is determined that the preset keyword exists in the second analysis result, and if the preset keyword exists in the first analysis result, or the preset keyword exists in the second analysis result, Or if the preset keyword exists in both the first analysis result and the second analysis result, it is determined that the preset keyword exists in the first analysis result and the second analysis result, and It is determined that the sentence completion rule is the keyword rule.
步骤S212,若所述第一分析结果和所述第二分析结果中不存在所述预设关键词,则确定所述第一分析结果和所述第二分析结果之间是否存在重复词;Step S212, if the preset keyword does not exist in the first analysis result and the second analysis result, determine whether there are repeated words between the first analysis result and the second analysis result;
在本实施例中,需要说明的是,所述重复词为所述待补全语句中和所述关联语句中相同的词语。In this embodiment, it should be noted that the repeated words are the same words in the sentence to be completed and in the associated sentence.
步骤S213,若所述第一分析结果和所述第二分析结果之间存在所述重复词,则确定所述语句补全规则为所述重复词规则;Step S213: If the repeated word exists between the first analysis result and the second analysis result, determine that the sentence completion rule is the repeated word rule;
在本实施例中,需要说明的是,所述重复词规则为基于所述重复词进行语句补全的规则。In this embodiment, it should be noted that the repeated word rule is a rule for sentence completion based on the repeated word.
步骤S214,若所述第一分析结果和所述第二分析结果之间不存在所述重复词,则确定所述语句补全规则为所述缺省规则。In step S214, if the repeated word does not exist between the first analysis result and the second analysis result, it is determined that the sentence completion rule is the default rule.
在本实施例中,需要说明的是,所述缺省规则为通用的语句补全规则,也即,所述缺省规则为对所述第一分析结果和所述第二分析结果均为特定的特性要求的语句补全规则,其中,所述特性要求包括具有预设关键词、具有重复词等。In this embodiment, it should be noted that the default rule is a general sentence completion rule, that is, the default rule is that both the first analysis result and the second analysis result are specific The sentence completion rules required by the feature requirements, where the feature requirements include having preset keywords, having repeated words, and so on.
步骤S22,基于所述语句补全规则,对所述待补全语句进行补全处理,获得所述初步补全结果。Step S22: Perform completion processing on the sentence to be completed based on the sentence completion rule to obtain the preliminary completion result.
在本实施例中,基于所述语句补全规则,对所述待补全语句进行补全处理,获得所述初步补全结果,具体地,基于所述语句补全规则、所述第一分析结果和所述第二分析结果,确定所述待补全语句对应的语句补全操作,对所述待补全语句执行所述语句补全操作,获得所述初步补全结果。In this embodiment, based on the sentence completion rule, the sentence to be completed is complemented to obtain the preliminary completion result, specifically, based on the sentence completion rule and the first analysis The result and the second analysis result determine the sentence completion operation corresponding to the sentence to be completed, perform the sentence completion operation on the sentence to be completed, and obtain the preliminary completion result.
其中,所述语句补全规则包括关键词规则、重复词规则和缺省规则,Wherein, the sentence completion rules include keyword rules, repeated word rules and default rules,
所述基于所述语句补全规则,对所述待补全语句进行补全处理,获得所述初步补全结果的步骤包括:The step of performing completion processing on the sentence to be completed based on the sentence completion rule, and obtaining the preliminary completion result includes:
步骤S221,基于所述关键词规则,对所述待补全语句进行补全处理,获得所述初步补全结果;Step S221, based on the keyword rules, perform completion processing on the sentence to be completed to obtain the preliminary completion result;
在本实施例中,需要说明的是,所述关键词规则包括第一关键词规则和第二关键词规则,其中,所述第一关键词规则为所述预设关键词在所述待补全语句中时所对应的关键词规则,所述第二关键词规则为所述预设关键词在所述关联语句中时所对应的关键词规则,例如,当所述第一分析结果中存在指代词时,则获取所述第二分析结果中构成名词集合,并基于预设先行词匹配模型,在所述构成名词集合中确定所述指代词对应的先行词,并在所述待补全语句中,将指代词替换为先行词,获得所述初步补全结果,其中,所述指代词包括他、她和它等,进一步地,假设所述预设关键词为“有没有”,如果“有没有”在所述关联语句中,且所述待补全语句中存在“没”“不”“否”等否定词,则在所述待补全语句中将“有没有”替换成“没有”,相同地,假设所述预设关键词为“是否”,若“是否”存在所述关联语句中,且待补全语句中存在“没”“不”“否”等否定词,则在所述待补全语句中把“是否”替换成“不”。In this embodiment, it should be noted that the keyword rules include a first keyword rule and a second keyword rule, wherein the first keyword rule is that the preset keyword is in the to-be-filled keyword rule. The keyword rule corresponding to when in the full sentence, the second keyword rule is the keyword rule corresponding to when the preset keyword is in the associated sentence, for example, when there is in the first analysis result When referring to pronouns, obtain the set of nouns that constitute the second analysis result, and based on a preset antecedent matching model, determine the antecedents corresponding to the pronouns in the set of constituted nouns, and use them in the to-be-completed In the sentence, replace the pronouns with the antecedents to obtain the preliminary completion result, where the pronouns include him, she, and it, etc. Further, suppose the preset keyword is "yes or not", if If "yes" is in the related sentence, and there are negative words such as "no", "no", and "no" in the sentence to be completed, replace "yes" with "in the sentence to be completed" No, similarly, assuming the preset keyword is “whether”, if “whether” exists in the related sentence, and there are negative words such as “no”, “no”, and “no” in the sentence to be completed, then Replace "whether" with "no" in the sentence to be completed.
基于所述关键词规则,对所述待补全语句进行补全处理,获得所述初步补全结果,具体地,在所述关联语句中匹配所述预设关键词对应的先行词,并在所述待补全语句中将所述预设关键词替换为所述先行词,获得所述初步补全结果,例如,当所述待补全语句中出现“她、他、它”等指代词时,则在所述关联语句中确定名词构建候选集,并基于所述关键词规则,在所述名词构建候选集中匹配所述预设关键词对应的先行词,进而在所述待补全语句中将所述预设关键词替换为所述先行词,其中,需要说明的是,所述名词构建候选集为所述关联语句中所有名词组成的集合,进一步地,若所述第二分析结果中存在所述预设关键词,则确定所述预设关键词对应的第二关键词规则和所述预设关键词对应的依存句法,并依据所述依存句法和所述第二关键词规则,确定所述预设关键词对应的替换词,并将所述关联语句中的所述预设关键词替换为所述替换词,获得所述初步补全结果,例如,当所述预设关键词为“什么”“哪”“谁”等,且所述预设关键词在所述关联语句中,则若所述预设关键词是“VOB”,则所述待补全语句中选取一个动词对所述关联语句中的所述预设关键词进行替换,获得所述初步补全结果。Based on the keyword rules, perform completion processing on the sentence to be completed to obtain the preliminary completion result, specifically, match the antecedent corresponding to the preset keyword in the associated sentence, and In the sentence to be completed, the preset keyword is replaced with the antecedent word to obtain the preliminary completion result, for example, when the pronouns such as "she, he, it" appear in the sentence to be completed When, the candidate set of nouns is determined in the associated sentence, and based on the keyword rules, the antecedent words corresponding to the preset keywords are matched in the candidate set of nouns, and then in the sentence to be completed The preset keywords are replaced with the antecedent words in, where it should be noted that the noun construction candidate set is a set of all nouns in the related sentence, and further, if the second analysis result If the preset keyword exists in the, the second keyword rule corresponding to the preset keyword and the dependency syntax corresponding to the preset keyword are determined, and according to the dependency syntax and the second keyword rule , Determine the replacement word corresponding to the preset key word, and replace the preset key word in the associated sentence with the replacement word to obtain the preliminary completion result, for example, when the preset key word The words are "what", "where", "who", etc., and the preset keyword is in the related sentence, then if the preset keyword is "VOB", then one of the sentences to be completed is selected The verb replaces the preset keyword in the related sentence to obtain the preliminary completion result.
其中,所述基于所述关键词规则,对所述待补全语句进行补全处理,获得所述初步补全结果的步骤包括:Wherein, the step of performing completion processing on the sentence to be completed based on the keyword rule, and obtaining the preliminary completion result includes:
步骤C10,基于所述关键词规则,在所述待补全语句中确定目标短语;Step C10, based on the keyword rules, determine a target phrase in the sentence to be completed;
在本实施例中,基于所述关键词规则,在所述待补全语句中确定目标短语,具体地,若所述预设关键词为选择性词语,例如,“还是”等,且所述预设关键词在所述关联语句中,则在所述关联语句中确定所述选择性词语左右两边的具有相同词性的目标短语集合,且获取所述目标短语集合中最长的短语作为所述目标短语,例如,假设所述关联语句为“你要明天还款还是后天还款”,所述待补全语句为“明天”,所述预设关键词为“还是”,进而所述预设关键词左右两边的最长的相同词性短语分别为“明天还款”和“后天还款”。In this embodiment, based on the keyword rules, the target phrase is determined in the sentence to be completed. Specifically, if the preset keyword is a selective word, for example, "still", etc., and the If the preset keyword is in the related sentence, the target phrase set with the same part of speech on the left and right sides of the selective word is determined in the related sentence, and the longest phrase in the target phrase set is acquired as the The target phrase, for example, suppose that the related sentence is "Do you want to repay tomorrow or the day after tomorrow", the sentence to be completed is "tomorrow", the preset keyword is "or", and then the preset The longest part-of-speech phrases on the left and right sides of the keywords are "repayment tomorrow" and "repayment the day after tomorrow".
步骤C20,基于所述目标短语,对所述关联语句进行分段,获得所述关联语句对应的各分段语句;Step C20, segment the related sentence based on the target phrase to obtain each segmented sentence corresponding to the related sentence;
在本实施例中,需要说明的是,各所述分段语句包括第一分段语句、第二分段语句和第三分段语句,所述目标短语包括在所述预设关键词左边的第一目标短语和在所述预设关键词右边的第二目标短语。In this embodiment, it should be noted that each of the segmented sentences includes a first segmented sentence, a second segmented sentence, and a third segmented sentence, and the target phrase includes the left side of the preset keyword The first target phrase and the second target phrase to the right of the preset keyword.
基于所述目标短语,对所述关联语句进行分段,获得所述关联语句对应的各分段语句,具体地,基于所述目标短语和所述预设关键词,将所述关联语句分为三段,获得所述第一分段语句、所述第二分段语句和所述第三分段语句,例如,假设所述关联语句为“你要明天还款还是后天还款”,所述第一目标短语为“明天还款”,所述第二目标短语为“后天还款”,所述预设关键词为“还是”,则所述第一分段语句为“你要”,所述第二分段语句为“明天还款”,所述第三分段语句为“后天还款”。Based on the target phrase, the related sentence is segmented to obtain each segmented sentence corresponding to the related sentence, specifically, based on the target phrase and the preset keyword, the related sentence is divided into Three paragraphs, to obtain the first paragraph sentence, the second paragraph sentence, and the third paragraph sentence. The first target phrase is "repayment tomorrow", the second target phrase is "repayment the day after tomorrow", and the preset keyword is "still", then the first segment sentence is "you want", so The second sub-sentence is "repayment tomorrow", and the third sub-sentence is "repayment the day after tomorrow".
步骤C30,基于各所述分段语句,对所述待补全语句进行补全处理,获得所述初步补全结果。Step C30: Perform completion processing on the sentence to be completed based on each of the segmented sentences to obtain the preliminary completion result.
在本实施例中,基于各所述分段语句,对所述待补全语句进行补全处理,获得所述初步补全结果,具体地,确定所述待补全语句与所述第二分段语句的重合词的第一重合词长度,并确定所述待补全语句与所述第三分段语句的重合词的第二重合词长度,进而若所述第一重合词长度大于预设重合词长度阀值,则将所述第一分段语句和所述第二分段语句进行拼接,获得第一拼接结果,并对所述第一拼接结果进行修正处理,获得所述初步补全结果,若所述第二重合词长度大于预设重合词长度阀值,则将所述第一分段语句和所述第三分段语句进行拼接,获得第二拼接结果,并对所述第二拼接结果进行修正处理,获得所述初步补全结果,例如,假设,所述预设重合词长度阀值,所述第一分段语句为“你要”,所述第二分段语句为“明天还款”,所述第三分段语句为“后天还款”,所述待补全语句为“明天”,则所述第一重合词长度为2,所述第二重合词长度为1,则将所述第一分段语句和所述第二分段语句进行拼接且进行修正处理后,获得初步补全处理结果为“我要明天还款”。In this embodiment, based on each of the segmented sentences, the sentence to be completed is complemented to obtain the preliminary completion result, specifically, the sentence to be completed and the second score are determined The length of the first coincidence of the coincident words of the paragraph sentence, and determine the length of the second coincidence of the coincidence words of the sentence to be completed and the third segment sentence, and then if the length of the first coincidence is greater than the preset Coincident word length threshold, the first segmented sentence and the second segmented sentence are spliced to obtain a first splicing result, and the first splicing result is corrected to obtain the preliminary completion As a result, if the length of the second coincidence word is greater than the preset coincidence word length threshold, the first segmented sentence and the third segmented sentence are spliced to obtain a second splicing result, and the second splicing result is obtained. Perform correction processing on the second splicing result to obtain the preliminary completion result, for example, suppose that the preset coincident word length threshold, the first segmented sentence is "you want", and the second segmented sentence is "Repayment tomorrow", the third sub-sentence is "repayment the day after tomorrow", and the sentence to be completed is "tomorrow", then the length of the first overlapping word is 2, and the length of the second overlapping word is 1. After the first segmented sentence and the second segmented sentence are spliced and corrected, the preliminary completion processing result is obtained as "I want to repay tomorrow".
步骤S222,基于所述重复词规则,对所述待补全语句进行补全处理,获得所述初步补全结果;Step S222: Perform completion processing on the sentence to be completed based on the repeated word rule to obtain the preliminary completion result;
在本实施例中,基于所述重复词规则,对所述待补全语句进行补全处理,获得所述初步补全结果,具体地,基于所述重复词规则,将所述第二分析结果中的各分词信息进行连接,获得所述初步补全结果,例如,假设所述关联语句为“额度和原先是一样的么”,所述待补全语句为“一样的”,则所述重复词为“一样”,则将所述关联语句对应的第二分析结果中的n,v,HED, VOB, SBV, ATT进行连接,获得初步补全结果“额度和原先是一样”,其中,n为名词的标识,v为动词的标识,HED为核心关系的标识,VOB为动宾关系的标识,SBV为主谓关系的标识,ATT为定中关系的标识。In this embodiment, based on the repeated word rule, the sentence to be completed is complemented to obtain the preliminary completion result, specifically, based on the repeated word rule, the second analysis result Connect each word segmentation information in to obtain the preliminary completion result. For example, suppose the associated sentence is "Is the amount the same as the original?" and the sentence to be completed is "the same", then the repeat If the word is "same", connect n, v, HED, VOB, SBV, ATT in the second analysis result corresponding to the related sentence, and obtain the preliminary completion result "the quota is the same as the original", where n Is the identification of nouns, v is the identification of verbs, HED is the identification of core relationship, VOB is the identification of verb-object relationship, SBV is the identification of main-predicate relationship, and ATT is the identification of definite middle relationship.
步骤S223,基于所述缺省规则,对所述待补全语句进行补全处理,获得所述初步补全结果。Step S223, based on the default rule, perform completion processing on the sentence to be completed to obtain the preliminary completion result.
在本实施例中,需要说明的是,所述缺省规则为通用语句补全规则。In this embodiment, it should be noted that the default rule is a general sentence completion rule.
基于所述缺省规则,对所述待补全语句进行补全处理,获得所述初步补全结果,具体地,基于所述缺省规则,在所述第一分析结果和所述第二分析结果中确定各分词信息,并将各所述分词信息以预设语法顺序进行连接,获得所述初步补全结果,例如,将各所述分词信息以“n”“v”“s”“f”“t”“m”“HED”“SBV”“VOB”“ADV”的顺序进行连接,获得所述初步补全结果,其中,s为处所词的标识,f为方位词的标识,t为时间词的标识,m为数词的标识,ADV为状中结构的标识。Based on the default rule, perform the completion processing on the sentence to be completed to obtain the preliminary completion result, specifically, based on the default rule, in the first analysis result and the second analysis result The word segmentation information is determined in the result, and the word segmentation information is connected in a preset grammatical order to obtain the preliminary completion result. For example, the word segmentation information is replaced with "n", "v", "s", and "f". “T”, “m”, “HED”, “SBV”, “VOB”, and “ADV” are connected in order to obtain the preliminary completion result, where s is the identifier of the location word, f is the identifier of the location word, and t is The identification of time words, m is the identification of numerals, and ADV is the identification of adverbial structure.
其中,所述基于所述缺省规则,对所述待补全语句进行补全处理,获得所述初步补全结果的步骤包括:Wherein, the step of performing completion processing on the sentence to be completed based on the default rule to obtain the preliminary completion result includes:
步骤D10,获取所述第一分析结果和所述第二分析结果中的各分词信息;Step D10, acquiring each word segmentation information in the first analysis result and the second analysis result;
在本实施例中,需要说明的是,所述分词信息包括分词和分词之间的分词关联关系,例如,所述分词包括动词、名词、时间词等,所述分词关联关系包括主谓关系、动宾关系等。In this embodiment, it should be noted that the word segmentation information includes the word segmentation relationship between the word segmentation and the word segmentation. For example, the word segmentation includes verbs, nouns, time words, etc., and the word segmentation relationship includes subject-predicate relationship, The verb-object relationship, etc.
步骤D20,基于预设语法顺序,将各所述分词信息进行顺序连接,获得所述初步补全结果。Step D20, based on the preset grammatical sequence, sequentially connect the word segmentation information to obtain the preliminary completion result.
在本实施例中,基于预设语法顺序,将各所述分词信息进行顺序连接,获得所述初步补全结果,具体地,基于预设语法顺序和所述分词信息中的分词关联关系,对各所述分词进行顺序连接,获得所述初步补全结果。In this embodiment, based on a preset grammatical sequence, the word segmentation information is sequentially connected to obtain the preliminary completion result, specifically, based on the preset grammatical sequence and the word segmentation association relationship in the word segmentation information, The word segmentation is sequentially connected to obtain the preliminary completion result.
步骤S30,对所述初步补全结果进行后处理,获得目标补全结果。Step S30, post-processing the preliminary completion result to obtain the target completion result.
在本实施例中,需要说明的是,所述后处理可以为错误修正处理,如错乱语序修正处理、语义残缺修正处理等。In this embodiment, it should be noted that the post-processing may be error correction processing, such as disordered word order correction processing, semantic incomplete correction processing, and the like.
对所述初步补全结果进行后处理,获得目标补全结果,具体地,基于预设后处理模型,对所述初步补全结果中的语句错误进行错误修正处理,获得所述目标补全结果,例如,在所述问答***中的实际业务中,“调整”往往是和额度关联在一起的,则在进行后处理时,将所有单独出现的“调整”替换成“调整额度”,其中,需要说明的是,预设后处理模型可基于所述问答***中的实际业务进行补充完善。Perform post-processing on the preliminary completion result to obtain a target completion result, specifically, based on a preset post-processing model, perform error correction processing on sentence errors in the preliminary completion result to obtain the target completion result For example, in the actual business of the question-and-answer system, "adjustment" is often associated with the quota, so when performing post-processing, replace all "adjustments" that appear separately with "adjustment quota", where, It should be noted that the preset post-processing model can be supplemented and improved based on the actual business in the question and answer system.
本实施例获取待补全语句和所述待补全语句对应的关联语句,并分别对所述待补全语句和所述关联语句进行依存句法分析,获得所述关联语句对应的第一分析结果和所述待补全语句对应的第二分析结果,进而将所述第一分析结果和所述第二分析结果输入预设语句补全模型,基于所述第一分析结果和所述第二分析结果,对所述待补全语句进行补全处理,获得初步补全结果,进而对所述初步补全结果进行后处理,获得目标补全结果。也即,本实施例首先对待补全语句和所述待补全语句对应的关联语句进行依存句法分析,获得第一分析结果和第二分析结果,进而基于第一分析结果和第二分析结果,通过预设语句补全模型对所述待补全语句进行补全处理,获得初始补全结果,进一步地,对初步补全结果进行后处理,获得目标补全结果。也即,本实施例提供了一种基于依存句法分析和待补全语句对应的关联语句,对待补全语句进行补全的方法,进而避免了基于句子类型和先行词对待补全语句进行补全,进而避免了由于串联进行句子类型和先行词的确定,而导致错误累积,进而导致语句补全准确率变低的情况发生,进而提高了语句补全的准确率,所以,解决了语句补全准确率低的技术问题。In this embodiment, a sentence to be completed and a related sentence corresponding to the sentence to be completed are obtained, and a dependency syntax analysis is performed on the sentence to be completed and the related sentence, respectively, to obtain the first analysis result corresponding to the related sentence The second analysis result corresponding to the sentence to be completed, and then the first analysis result and the second analysis result are input into a preset sentence completion model, based on the first analysis result and the second analysis result As a result, completion processing is performed on the sentence to be completed to obtain a preliminary completion result, and then the preliminary completion result is post-processed to obtain a target completion result. That is, this embodiment first performs dependency syntax analysis on the sentence to be completed and the associated sentence corresponding to the sentence to be completed to obtain the first analysis result and the second analysis result, and then based on the first analysis result and the second analysis result, The completion of the sentence to be completed is performed through the preset sentence completion model to obtain the initial completion result, and further, the preliminary completion result is post-processed to obtain the target completion result. That is, this embodiment provides a method for completing the sentence to be completed based on the dependency syntax analysis and the associated sentence corresponding to the sentence to be completed, thereby avoiding the completion of the sentence to be completed based on the sentence type and the antecedent. , Thereby avoiding the accumulation of errors due to the determination of sentence types and antecedents in series, which will lead to lower accuracy of sentence completion, thereby improving the accuracy of sentence completion, so it solves the problem of sentence completion. Technical problems with low accuracy.
进一步地,参照图2,基于本申请中第一实施例,在本申请的另一实施例中,所述获取待补全语句的步骤包括:Further, referring to FIG. 2, based on the first embodiment of the present application, in another embodiment of the present application, the step of obtaining the sentence to be completed includes:
步骤A10,获取待预测语句,并将所述待预测语句输入预设语句补全预测模型,以确定所述待预测语句是否需要进行补全处理;Step A10: Obtain the sentence to be predicted, and input the sentence to be predicted into a preset sentence completion prediction model to determine whether the sentence to be predicted needs to be completed;
在本实施例中,需要说明的是,所述待预测语句为所述问答***接收的语句,所述预设语句补全预测模型为预先训练好的机器学习模型,且当所述问答***中的待预测语句的数量较多时,则适用于机器学习模型预测所述待预测模型是否需要进行补全。In this embodiment, it should be noted that the sentence to be predicted is a sentence received by the question answering system, the preset sentence completion prediction model is a pre-trained machine learning model, and when the question answering system is When the number of sentences to be predicted is large, it is suitable for the machine learning model to predict whether the model to be predicted needs to be complemented.
获取待预测语句,并将所述待预测语句输入预设语句补全预测模型,以确定所述待预测语句是否需要进行补全处理,具体地,获取待预测语句,并将所述待预测语句输入预设语句补全预测模型,以对所述待补全语句进行分词,获得分词结果,并基于所述分词结果和预设第一编码方式,对所述待补全语句进行编码,获得第一编码向量,并基于预设第二编码方式,对所述待补全语句进行编码,获得第二编码向量,进而将所述第一编码向量和所述第二编码向量进行拼接,获得所述待补全语句对应的特征表示向量,进一步地,基于所述预设语句补全预测模型中的数据处理层,对所述特征表示向量进行数据处理,其中,所述数据处理层包括卷积层、池化层、全连接层等,进而获得补全预测结果,并基于所述补全预测结果,确定所述待补全语句是否需要进行补全处理,其中,需要说明的是,所述预设第一编码方式包括TF-IDF(term frequency-inverse document frequency,词频-逆文本频率指数)算法等,所述预设第二编码方式包括独热编码等。Obtain the sentence to be predicted, and input the sentence to be predicted into a preset sentence completion prediction model to determine whether the sentence to be predicted needs to be completed. Specifically, the sentence to be predicted is obtained, and the sentence to be predicted is combined Input the preset sentence completion prediction model to segment the sentence to be completed to obtain the word segmentation result, and based on the word segmentation result and the preset first encoding method, encode the sentence to be completed to obtain the first A coding vector, and based on a preset second coding mode, coding the sentence to be completed to obtain a second coding vector, and then concatenating the first coding vector and the second coding vector to obtain the The feature representation vector corresponding to the sentence to be completed, and further, based on the data processing layer in the preset sentence completion prediction model, data processing is performed on the feature representation vector, wherein the data processing layer includes a convolutional layer , Pooling layer, fully connected layer, etc., and then obtain the completion prediction result, and based on the completion prediction result, determine whether the sentence to be completed needs to be completed. It should be noted that the prediction Suppose the first encoding method includes TF-IDF (term Frequency-inverse document frequency, word frequency-inverse document frequency index) algorithm, etc., the preset second encoding method includes one-hot encoding and the like.
其中,所述将所述待补全语句输入预设语句补全预测模型,以确定所述待补全语句是否需要进行补全处理的步骤之前,所述语句补全方法还包括:Wherein, before the step of inputting the sentence to be completed into a preset sentence completion prediction model to determine whether the sentence to be completed needs to be completed, the sentence completion method further includes:
步骤B10,获取各待补全训练语句和基础预测模型,并分别对各所述待补全训练语句进行分词,获得各所述待补全训练语句对应的分词结果;Step B10: Obtain each training sentence to be completed and a basic prediction model, and perform word segmentation on each training sentence to be completed, to obtain a word segmentation result corresponding to each training sentence to be completed;
在本实施例中,需要说明的是,所述待补全训练语句为已经确定好需要进行补全处理的语句。In this embodiment, it should be noted that the training sentence to be completed is a sentence that has been determined to be completed.
获取各待补全训练语句和基础预测模型,并分别对各所述待补全训练语句进行分词,获得各所述待补全训练语句对应的分词结果,具体地,从预设训练数据存储库中提取各待补全训练语句和基础预测模型,并分别将各所述待补全语句拆分为各自对应的词语,获得各所述待补全训练语句对应的分词结果,例如,假设所述待补全训练语句为“是一样的”,则分词结果为(是,一样的)。Obtain each training sentence to be completed and the basic prediction model, and segment each training sentence to be completed, and obtain the word segmentation result corresponding to each training sentence to be completed, specifically, from a preset training data repository Extract each to-be-completed training sentence and the basic prediction model, and split each to-be-completed sentence into its corresponding words to obtain the word segmentation result corresponding to each of the to-be-completed training sentences, for example, suppose the If the training sentence to be completed is "the same", the word segmentation result is (yes, the same).
步骤B20,基于各所述分词结果,分别对各所述待补全训练语句进行编码,获得各所述待补全训练语句对应的第一编码结果;Step B20, based on each of the word segmentation results, respectively encode each of the training sentences to be completed to obtain a first coding result corresponding to each of the training sentences to be completed;
在本实施例中,基于各所述分词结果,分别对各所述待补全训练语句进行编码,获得各所述待补全训练语句对应的第一编码结果,具体地,基于所述分词结果,以预设第一编码方式对所述待补全训练语句进行编码,获得第一训练语句向量,并将第一训练语句向量作为所述第一编码结果,例如,假设所述待补全训练语句为“是一样的”,则分词结果为(是,一样的),所述第一编码结果为(a,b),其中,编码a为“是”的标识,且出现频率为1,编码b为“一样的”的标识,且出现频率为1。In this embodiment, based on each of the word segmentation results, each of the training sentences to be complemented is coded to obtain the first coding result corresponding to each of the training sentences to be complemented, specifically, based on the word segmentation result , Encode the training sentence to be completed in a preset first coding manner, obtain a first training sentence vector, and use the first training sentence vector as the first encoding result, for example, suppose the training sentence to be completed If the sentence is "the same", the word segmentation result is (yes, the same), and the first encoding result is (a, b), where the code a is the symbol of "yes", and the frequency of occurrence is 1, the code b is the "same" mark, and the frequency of occurrence is 1.
步骤B30,分别对所述待补全训练语句进行依存句法分析,获得各所述待补全训练语句对应的句法分析结果;Step B30, performing dependent syntax analysis on the training sentences to be completed respectively, to obtain the syntax analysis results corresponding to each training sentence to be completed;
步骤B40,基于各所述句法分析结果,分别对各所述待补全训练语句进行编码,获得各所述待补全训练语句对应的第二编码结果;Step B40, encoding each of the training sentences to be complemented based on the results of each of the syntactic analysis, to obtain a second coding result corresponding to each of the training sentences to be complemented;
在本实施例中,具体地,分别对所述待补全训练语句进行依存句法分析,获得各所述待补全训练语句对应的句法分析结果,进而以预设第二编码方式对所述待补全训练语句进行独热编码,获得第二训练语句向量,并将所述第二训练语句向量作为所述第二编码结果,其中,所述第二训练语句向量为由0和1组成的向量,例如,假设所述第二训练语句向量为(0,1),其中,0表示所述待补全训练语句中不存在名词,1表示所述待补全训练语句中存在动词。In this embodiment, specifically, the dependency syntax analysis is performed on the training sentences to be complemented respectively to obtain the syntactic analysis results corresponding to each training sentence to be complemented, and then the to-be-completing training sentences are processed by the preset second coding method. Perform one-hot encoding of the complementary training sentence to obtain a second training sentence vector, and use the second training sentence vector as the second encoding result, wherein the second training sentence vector is a vector composed of 0 and 1 For example, suppose that the second training sentence vector is (0, 1), where 0 indicates that no noun exists in the training sentence to be completed, and 1 indicates that there is a verb in the training sentence to be completed.
步骤B50,基于各所述第一编码结果和各所述第二编码结果,生成各所述待补全训练语句对应的目标编码结果;Step B50, based on each of the first encoding results and each of the second encoding results, generating a target encoding result corresponding to each of the training sentences to be completed;
在本实施例中,基于所述第一编码结果和所述第二编码结果,生成所述待补全训练语句对应的目标编码结果,具体地,将所述第一编码结果对应的第一训练语句向量和所述第二编码结果对应的第二训练语句向量进行拼接,获得目标编码向量,并将所述目标编码向量作为所述目标编码结果,例如,假设所述第一训练语句向量为(a,b,c),所述第二训练语句向量为(0,1,0,1),则所述目标编码向量为(a,b,c,0,1,0,1)。In this embodiment, based on the first encoding result and the second encoding result, the target encoding result corresponding to the training sentence to be completed is generated, specifically, the first training result corresponding to the first encoding result is generated The sentence vector and the second training sentence vector corresponding to the second coding result are spliced to obtain a target coding vector, and the target coding vector is used as the target coding result. For example, suppose the first training sentence vector is ( a, b, c), the second training sentence vector is (0, 1, 0, 1), and the target coding vector is (a, b, c, 0, 1, 0, 1).
步骤B60,基于各所述目标编码结果,对所述基础预测模型进行迭代训练,直至所述基础预测模型达到预设迭代结束条件,获得所述预设语句补全预测模型。Step B60: Perform iterative training on the basic prediction model based on each of the target encoding results until the basic prediction model reaches a preset iteration end condition, and obtain the preset sentence completion prediction model.
在本实施例中,基于各所述目标编码结果,对所述基础预测模型进行迭代训练,直至所述基础预测模型达到预设迭代结束条件,获得所述预设语句补全预测模型,具体地,则在各所述目标编码结果中提取第一目标编码结果,并将所述第一目标编码结果输入所述基础预测模型,对所述基础预测模型进行训练更新,获得初始训练模型,并确定所述初始训练模型是否满足预设迭代结束条件,若所述初始训练模型满足预设迭代结束条件,则将所述初始训练模型作为所述预设语句补全预测模型,若所述初始训练模型不满足预设迭代结束条件,则在各所述目标编码结果中提取第二目标编码结果,并基于所述第二目标编码结果,重新对所述初始训练模型进行训练更新,直至所述初始训练模型满足所述预设迭代结束条件,获得所述预设语句补全预测模型,其中,所述预设迭代结束条件包括达到最大迭代次数、模型对应的损失函数收敛等。In this embodiment, based on each of the target encoding results, the basic prediction model is iteratively trained until the basic prediction model reaches a preset iterative end condition, and the preset sentence completion prediction model is obtained, specifically , Extract the first target encoding result from each target encoding result, and input the first target encoding result into the basic prediction model, train and update the basic prediction model, obtain the initial training model, and determine Whether the initial training model satisfies the preset iteration end condition, if the initial training model satisfies the preset iteration end condition, the initial training model is used as the preset sentence completion prediction model, if the initial training model If the preset iteration end condition is not met, extract a second target encoding result from each target encoding result, and re-train and update the initial training model based on the second target encoding result, until the initial training The model satisfies the preset iteration end condition to obtain the preset sentence completion prediction model, where the preset iteration end condition includes reaching the maximum number of iterations, convergence of the loss function corresponding to the model, and the like.
步骤A20,若所述待预测语句需要进行补全处理,则将所述待预测语句作为所述待补全语句;Step A20, if the sentence to be predicted needs to be completed, use the sentence to be predicted as the sentence to be completed;
在本实施例中,若所述待预测语句需要进行补全处理,则将所述待预测语句作为所述待补全语句,具体地,若确定所述待预测语句需要进行补全处理,则将预设待补全语句标识赋予所述待预测语句,获得所述待补全语句,若确定所述待预测语句不需要进行补全,则将预设语义明确标识赋予所述待预测语句。In this embodiment, if the sentence to be predicted needs to be completed, the sentence to be predicted is used as the sentence to be completed. Specifically, if it is determined that the sentence to be predicted needs to be completed, then Assign a preset sentence identifier to be predicted to the sentence to be predicted to obtain the sentence to be completed, and if it is determined that the sentence to be predicted does not need to be completed, then assign a clear semantic identifier to the sentence to be predicted.
步骤A30,获取待预测语句,并对所述待预测语句进行依存句法分析,确定所述待预测语句是否缺少预设语句成分;Step A30: Obtain the sentence to be predicted, and perform dependency syntactic analysis on the sentence to be predicted to determine whether the sentence to be predicted lacks a preset sentence component;
在本实施例中,需要说明的是,所述预设语句成分包括主谓宾成分,其中,所述主谓宾成分为主语成分、谓语成分和宾语成分。In this embodiment, it should be noted that the predetermined sentence component includes a subject-predicate-object component, wherein the subject-predicate-object component is a subject component, a predicate component, and an object component.
获取待预测语句,并对所述待预测语句进行依存句法分析,确定所述待预测语句是否缺少预设语句成分,具体地,获取待预测语句,并对所述待预测语句进行依存句法分析,获得语句解析结果,并基于所述语句解析结果,确定所述待补全语句是否存在主谓宾成分。Obtain the sentence to be predicted, and perform dependency syntactic analysis on the sentence to be predicted, determine whether the sentence to be predicted lacks preset sentence components, specifically, obtain the sentence to be predicted, and perform dependency syntax analysis on the sentence to be predicted, The sentence parsing result is obtained, and based on the sentence parsing result, it is determined whether the sentence to be completed has subject, predicate, and object components.
步骤A40,若所述待预测语句缺少所述预设语句成分,则将所述待预测语句作为所述待补全语句。In step A40, if the sentence to be predicted lacks the preset sentence component, the sentence to be predicted is used as the sentence to be completed.
在本实施例中,若所述待预测语句缺少所述预设语句成分,则将所述待预测语句作为所述待补全语句,具体地,若所述待预测语句缺少所述预设语句成分,则将预设待补全语句标识赋予所述待预测语句,获得所述待补全语句,若所述待预测语句不缺少所述预设语句成分,则将预设语义明确标识赋予所述待预测语句。In this embodiment, if the sentence to be predicted lacks the preset sentence component, the sentence to be predicted is used as the sentence to be completed, specifically, if the sentence to be predicted lacks the preset sentence Component, the preset sentence to be completed identifier is assigned to the sentence to be predicted, and the sentence to be completed is obtained. If the sentence to be predicted does not lack the preset sentence component, then the preset semantic clear identifier is assigned to the sentence to be predicted. State the sentence to be predicted.
本实施通过获取待预测语句,并将所述待预测语句输入预设语句补全预测模型,以确定所述待预测语句是否需要进行补全处理,进而若所述待预测语句需要进行补全处理,则将所述待预测语句作为所述待补全语句;或者获取待预测语句,并对所述待预测语句进行依存句法分析,确定所述待预测语句是否缺少预设语句成分,进而若所述待预测语句缺少所述预设语句成分,则将所述待预测语句作为所述待补全语句。也即,本实施例提供了一种确定待预测语句是否需要进行补全处理的方法,也即,当样本数量较少时,可通过对所述待预测语句进行依存句法分析,确定所述待预测语句是否缺少预设语句成分,进而当所述待预测语句缺少所述预设语句成分时,则判定所述待预测语句需要进行补全处理,当样本数量较多时,基于机器学习模型确定所述待补全语句是否需要进行补全处理,进而在确定所述待补全语句需要进行补全后,即可基于依存句法分析和待补全语句对应的关联语句,对待补全语句进行补全,进而避免了基于句子类型和先行词对待补全语句进行补全,进而避免了由于串联进行句子类型和先行词的确定,而导致错误累积,进而导致语句补全准确率变低的情况发生,进而提高了语句补全的准确率,所以,为解决语句补全准确率低的技术问题奠定了基础。In this implementation, by obtaining the sentence to be predicted, and inputting the sentence to be predicted into the preset sentence completion prediction model, it is determined whether the sentence to be predicted needs to be completed, and then if the sentence to be predicted needs to be completed. , The sentence to be predicted is used as the sentence to be completed; or the sentence to be predicted is obtained, and the dependency syntax analysis is performed on the sentence to be predicted to determine whether the sentence to be predicted lacks preset sentence components, and then if If the sentence to be predicted lacks the preset sentence component, the sentence to be predicted is used as the sentence to be completed. That is, this embodiment provides a method for determining whether the sentence to be predicted needs to be completed, that is, when the number of samples is small, the sentence to be predicted can be determined by performing dependency syntax analysis on the sentence to be predicted. Whether the predicted sentence lacks a preset sentence component, and then when the sentence to be predicted lacks the preset sentence component, it is determined that the sentence to be predicted needs to be complemented. When the number of samples is large, it is determined based on the machine learning model. State whether the sentence to be completed needs to be completed, and then after it is determined that the sentence to be completed needs to be completed, the sentence to be completed can be completed based on the dependency syntax analysis and the related sentence corresponding to the sentence to be completed , Thus avoiding the completion of the sentence to be completed based on the sentence type and antecedent, and thus avoiding the accumulation of errors due to the concatenation of the sentence type and the antecedent, which will lead to the lower accuracy of sentence completion. In turn, the accuracy of sentence completion is improved, so it lays a foundation for solving the technical problem of low accuracy of sentence completion.
参照图3,图3是本申请实施例方案涉及的硬件运行环境的设备结构示意图。Referring to FIG. 3, FIG. 3 is a schematic diagram of the device structure of the hardware operating environment involved in the solution of the embodiment of the present application.
如图3所示,该语句补全设备可以包括:处理器1001,例如CPU,存储器1005,通信总线1002。其中,通信总线1002用于实现处理器1001和存储器1005之间的连接通信。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储设备。As shown in FIG. 3, the sentence completion device may include: a processor 1001, such as a CPU, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to implement connection and communication between the processor 1001 and the memory 1005. The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a magnetic disk memory. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
在一实施例中,该语句补全设备还可以包括矩形用户接口、网络接口、摄像头、RF(Radio Frequency,射频)电路,传感器、音频电路、WiFi模块等等。矩形用户接口可以包括显示屏(Display)、输入子模块比如键盘(Keyboard),可选矩形用户接口还可以包括标准的有线接口、无线接口。网络接口可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。In an embodiment, the sentence completion device may also include a rectangular user interface, a network interface, a camera, and RF (Radio Frequency (radio frequency) circuits, sensors, audio circuits, WiFi modules, etc. The rectangular user interface may include a display screen (Display) and an input sub-module such as a keyboard (Keyboard), and the optional rectangular user interface may also include a standard wired interface and a wireless interface. The optional network interface can include standard wired interface and wireless interface (such as WI-FI interface).
本领域技术人员可以理解,图3中示出的语句补全设备结构并不构成对语句补全设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。Those skilled in the art can understand that the structure of the sentence completion device shown in FIG. 3 does not constitute a limitation on the sentence completion device, and may include more or less components than shown in the figure, or a combination of certain components, or different components. The layout of the components.
如图3所示,作为一种计算机存储介质的存储器1005中可以包括操作***、网络通信模块以及语句补全程序。操作***是管理和控制语句补全设备硬件和软件资源的程序,支持语句补全程序以及其它软件和/或程序的运行。网络通信模块用于实现存储器1005内部各组件之间的通信,以及与语句补全***中其它硬件和软件之间通信。As shown in FIG. 3, the memory 1005 as a computer storage medium may include an operating system, a network communication module, and a sentence completion program. The operating system is a program that manages and controls the hardware and software resources of the sentence completion device, and supports the operation of the sentence completion program and other software and/or programs. The network communication module is used to realize the communication between the components in the memory 1005 and the communication with other hardware and software in the sentence completion system.
在图3所示的语句补全设备中,处理器1001用于执行存储器1005中存储的语句补全程序,实现上述任一项所述的语句补全方法的步骤。In the sentence completion device shown in FIG. 3, the processor 1001 is used to execute the sentence completion program stored in the memory 1005 to implement the steps of the sentence completion method described in any one of the above.
本申请语句补全设备具体实施方式与上述语句补全方法各实施例基本相同,在此不再赘述。The specific implementation of the sentence completion device of the present application is basically the same as the embodiments of the sentence completion method described above, and will not be repeated here.
本申请实施例还提供一种语句补全装置,所述语句补全装置应用于语句补全设备,所述语句补全装置包括:An embodiment of the present application also provides a sentence completion device, the sentence completion device is applied to a sentence completion device, and the sentence completion device includes:
依存句法分析模块,用于获取待补全语句和所述待补全语句对应的关联语句,并分别对所述待补全语句和所述关联语句进行依存句法分析,获得所述关联语句对应的第一分析结果和所述待补全语句对应的第二分析结果;The dependency syntax analysis module is used to obtain the sentence to be completed and the related sentence corresponding to the sentence to be completed, and perform dependency syntax analysis on the sentence to be completed and the related sentence, respectively, to obtain the corresponding sentence of the related sentence The first analysis result and the second analysis result corresponding to the sentence to be completed;
语句补全模块,用于将所述第一分析结果和所述第二分析结果输入预设语句补全模型,基于所述第一分析结果和所述第二分析结果,对所述待补全语句进行补全处理,获得初步补全结果;The sentence completion module is used to input the first analysis result and the second analysis result into a preset sentence completion model, and based on the first analysis result and the second analysis result, perform the completion The sentence is completed and processed, and the preliminary completion result is obtained;
后处理模块,用于对所述初步补全结果进行后处理,获得目标补全结果。The post-processing module is used to perform post-processing on the preliminary completion result to obtain the target completion result.
在一实施例中,所述语句补全模块包括:In an embodiment, the sentence completion module includes:
匹配子模块,用于将所述第一分析结果和所述第二分析结果输入所述预设语句补全模型,匹配所述第一分析结果和所述第二分析结果共同对应的语句补全规则;The matching sub-module is configured to input the first analysis result and the second analysis result into the preset sentence completion model, and match the sentence completion corresponding to the first analysis result and the second analysis result rule;
补全处理子模块,用于基于所述语句补全规则,对所述待补全语句进行补全处理,获得所述初步补全结果。The completion processing sub-module is used to perform completion processing on the sentence to be completed based on the sentence completion rule to obtain the preliminary completion result.
在一实施例中,所述匹配子模块包括:In an embodiment, the matching submodule includes:
第一判定单元,用于确定所述第一分析结果和所述第二分析结果中是否存在预设关键词,若所述第一分析结果和所述第二分析结果中存在所述预设关键词,则确定所述语句补全规则为所述关键词规则;The first determining unit is configured to determine whether a preset keyword exists in the first analysis result and the second analysis result, if the preset key exists in the first analysis result and the second analysis result Words, it is determined that the sentence completion rule is the keyword rule;
第二判定单元,用于若所述第一分析结果和所述第二分析结果中不存在所述预设关键词,则确定所述第一分析结果和所述第二分析结果之间是否存在重复词;The second determining unit is configured to determine whether there is a gap between the first analysis result and the second analysis result if the preset keyword does not exist in the first analysis result and the second analysis result Repeated words
第三判定单元,用于若所述第一分析结果和所述第二分析结果之间存在所述重复词,则确定所述语句补全规则为所述重复词规则;A third determining unit, configured to determine that the sentence completion rule is the repeated word rule if the repeated word exists between the first analysis result and the second analysis result;
第四判定单元,用于若所述第一分析结果和所述第二分析结果之间不存在所述重复词,则确定所述语句补全规则为所述缺省规则。The fourth determining unit is configured to determine that the sentence completion rule is the default rule if the repeated word does not exist between the first analysis result and the second analysis result.
在一实施例中,所述补全处理子模块包括:In an embodiment, the completion processing sub-module includes:
第一补全处理单元,用于基于所述关键词规则,对所述待补全语句进行补全处理,获得所述初步补全结果;或者The first completion processing unit is configured to perform completion processing on the sentence to be completed based on the keyword rule to obtain the preliminary completion result; or
第二补全处理单元,用于基于所述重复词规则,对所述待补全语句进行补全处理,获得所述初步补全结果;或者The second completion processing unit is configured to perform completion processing on the sentence to be completed based on the repeated word rule to obtain the preliminary completion result; or
第三补全处理单元,用于基于所述缺省规则,对所述待补全语句进行补全处理,获得所述初步补全结果。The third completion processing unit is configured to perform completion processing on the sentence to be completed based on the default rule to obtain the preliminary completion result.
在一实施例中,所述第一补全处理单元包括:In an embodiment, the first completion processing unit includes:
确定子单元,用于基于所述关键词规则,在所述待补全语句中确定目标短语;The determining subunit is used to determine a target phrase in the sentence to be completed based on the keyword rule;
分段子单元,用于基于所述目标短语,对所述关联语句进行分段,获得所述关联语句对应的各分段语句;The segmentation subunit is used to segment the related sentence based on the target phrase to obtain each segmented sentence corresponding to the related sentence;
补全处理子单元,用于基于各所述分段语句,对所述待补全语句进行补全处理,获得所述初步补全结果。The completion processing subunit is configured to perform completion processing on the sentence to be completed based on each of the segmented sentences to obtain the preliminary completion result.
在一实施例中,所述第三补全处理单元包括:In an embodiment, the third completion processing unit includes:
获取子单元,用于获取所述第一分析结果和所述第二分析结果中的各分词信息;An obtaining subunit for obtaining each word segmentation information in the first analysis result and the second analysis result;
连接子单元,用于基于预设语法顺序,将各所述分词信息进行顺序连接,获得所述初步补全结果。The connection subunit is used to sequentially connect the word segmentation information based on a preset grammatical sequence to obtain the preliminary completion result.
在一实施例中,所述依存句法分析模块包括:In an embodiment, the dependency syntax analysis module includes:
预测子模块,用于获取待预测语句,并将所述待预测语句输入预设语句补全预测模型,以确定所述待预测语句是否需要进行补全处理;The prediction sub-module is used to obtain the sentence to be predicted, and input the sentence to be predicted into a preset sentence completion prediction model to determine whether the sentence to be predicted needs to be completed;
第一确定子模块,用于若所述待预测语句需要进行补全处理,则将所述待预测语句作为所述待补全语句;或者The first determining sub-module is configured to use the sentence to be predicted as the sentence to be completed if the sentence to be predicted needs to be completed; or
句法分析子模块,用于获取待预测语句,并对所述待预测语句进行依存句法分析,确定所述待预测语句是否缺少预设语句成分;The syntactic analysis sub-module is used to obtain the sentence to be predicted, and perform dependency syntactic analysis on the sentence to be predicted to determine whether the sentence to be predicted lacks a preset sentence component;
第二确定子模块,用于若所述待预测语句缺少所述预设语句成分,则将所述待预测语句作为所述待补全语句。The second determining sub-module is configured to use the sentence to be predicted as the sentence to be completed if the sentence to be predicted lacks the preset sentence component.
在一实施例中,所述语句补全装置还包括:In an embodiment, the sentence completion device further includes:
分词模块,用于获取各待补全训练语句和基础预测模型,并分别对各所述待补全训练语句进行分词,获得各所述待补全训练语句对应的分词结果;The word segmentation module is used to obtain each training sentence to be completed and a basic prediction model, and to segment each training sentence to be completed to obtain the word segmentation result corresponding to each training sentence to be completed;
第一编码模块,用于基于各所述分词结果,分别对各所述待补全训练语句进行编码,获得各所述待补全训练语句对应的第一编码结果;The first encoding module is configured to respectively encode each of the training sentences to be completed based on each of the word segmentation results to obtain the first encoding result corresponding to each of the training sentences to be completed;
句法分析模块,用于分别对所述待补全训练语句进行依存句法分析,获得各所述待补全训练语句对应的句法分析结果;The syntactic analysis module is used to perform dependent syntactic analysis on the training sentences to be completed to obtain the syntactic analysis results corresponding to the training sentences to be completed;
第二编码模块,用于基于各所述句法分析结果,分别对各所述待补全训练语句进行编码,获得各所述待补全训练语句对应的第二编码结果;The second encoding module is configured to respectively encode each of the training sentences to be completed based on each of the syntactic analysis results to obtain the second encoding result corresponding to each of the training sentences to be completed;
生成模块,用于基于各所述第一编码结果和各所述第二编码结果,生成各所述待补全训练语句对应的目标编码结果;A generating module, configured to generate a target encoding result corresponding to each of the training sentences to be completed based on each of the first encoding results and each of the second encoding results;
迭代训练模块,用于基于各所述目标编码结果,对所述基础预测模型进行迭代训练,直至所述基础预测模型达到预设迭代结束条件,获得所述预设语句补全预测模型。The iterative training module is configured to perform iterative training on the basic prediction model based on each of the target encoding results until the basic prediction model reaches a preset iterative end condition to obtain the preset sentence completion prediction model.
在一实施例中,所述依存句法分析模块还包括:In an embodiment, the dependency syntax analysis module further includes:
获取子模块,用于获取初始待补全语句和所述初始待补全语句对应的初始关联语句;An obtaining sub-module for obtaining the initial sentence to be completed and the initial associated sentence corresponding to the initial sentence to be completed;
去口语化处理子模块,用于分别对所述初始待补全语句和所述初始关联语句进行去口语化处理,获得所述初始待补全语句对应的所述待补全语句和所述初始关联语句对应的所述关联语句。The de-verbalization processing sub-module is used to de-verbally process the initial sentence to be completed and the initial associated sentence to obtain the sentence to be completed and the initial sentence to be completed corresponding to the initial sentence to be completed. The related sentence corresponding to the related sentence.
本申请语句补全装置的具体实施方式与上述语句补全方法各实施例基本相同,在此不再赘述。The specific implementation of the sentence completion device of the present application is basically the same as each embodiment of the sentence completion method described above, and will not be repeated here.
本申请实施例提供了一种可读存储介质,且所述可读存储介质存储有一个或者一个以上程序,所述一个或者一个以上程序还可被一个或者一个以上的处理器执行以用于实现上述任一项所述的语句补全方法的步骤。The embodiments of the present application provide a readable storage medium, and the readable storage medium stores one or more programs, and the one or more programs may also be executed by one or more processors for implementation The steps of the sentence completion method described in any one of the above.
本申请可读存储介质具体实施方式与上述语句补全方法各实施例基本相同,在此不再赘述。The specific implementation manner of the readable storage medium of the present application is basically the same as each embodiment of the sentence completion method described above, and will not be repeated here.
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利处理范围内。The above are only preferred embodiments of this application, and do not limit the scope of this application. Any equivalent structure or equivalent process transformation made using the content of the description and drawings of this application, or directly or indirectly used in other related technical fields , The same reason is included in the scope of patent processing of this application.

Claims (20)

  1. 一种语句补全方法,其中,所述语句补全方法包括:A sentence completion method, wherein the sentence completion method includes:
    获取待补全语句和所述待补全语句对应的关联语句,并分别对所述待补全语句和所述关联语句进行依存句法分析,获得所述关联语句对应的第一分析结果和所述待补全语句对应的第二分析结果;Acquire the sentence to be completed and the related sentence corresponding to the sentence to be completed, and perform dependency syntactic analysis on the sentence to be completed and the related sentence, respectively, to obtain the first analysis result and the related sentence corresponding to the related sentence The second analysis result corresponding to the sentence to be completed;
    将所述第一分析结果和所述第二分析结果输入预设语句补全模型,基于所述第一分析结果和所述第二分析结果,对所述待补全语句进行补全处理,获得初步补全结果;以及The first analysis result and the second analysis result are input into a preset sentence completion model, and based on the first analysis result and the second analysis result, the sentence to be completed is complemented to obtain Preliminary completion results; and
    对所述初步补全结果进行后处理,获得目标补全结果。The preliminary completion result is post-processed to obtain the target completion result.
  2. 如权利要求1所述语句补全方法,其中,所述将所述第一分析结果和所述第二分析结果输入预设语句补全模型,基于所述第一分析结果和所述第二分析结果,对所述待补全语句进行补全处理,获得初步补全结果的步骤包括:2. The sentence completion method of claim 1, wherein said inputting said first analysis result and said second analysis result into a preset sentence completion model is based on said first analysis result and said second analysis As a result, the steps of performing completion processing on the sentence to be completed to obtain preliminary completion results include:
    将所述第一分析结果和所述第二分析结果输入所述预设语句补全模型,匹配所述第一分析结果和所述第二分析结果共同对应的语句补全规则;以及Inputting the first analysis result and the second analysis result into the preset sentence completion model, and matching sentence completion rules corresponding to the first analysis result and the second analysis result; and
    基于所述语句补全规则,对所述待补全语句进行补全处理,获得所述初步补全结果。Based on the sentence completion rule, perform completion processing on the sentence to be completed to obtain the preliminary completion result.
  3. 如权利要求2所述语句补全方法,其中,所述语句补全规则包括关键词规则、重复词规则和缺省规则,3. The sentence completion method of claim 2, wherein the sentence completion rules include keyword rules, repeated word rules, and default rules,
    所述匹配所述第一分析结果和所述第二分析结果共同对应的语句补全规则的步骤包括:The step of matching the sentence completion rule corresponding to the first analysis result and the second analysis result includes:
    确定所述第一分析结果和所述第二分析结果中是否存在预设关键词,若所述第一分析结果和所述第二分析结果中存在所述预设关键词,则确定所述语句补全规则为所述关键词规则;Determine whether a preset keyword exists in the first analysis result and the second analysis result, and if the preset keyword exists in the first analysis result and the second analysis result, determine the sentence The completion rule is the keyword rule;
    若所述第一分析结果和所述第二分析结果中不存在所述预设关键词,则确定所述第一分析结果和所述第二分析结果之间是否存在重复词;If the preset keyword does not exist in the first analysis result and the second analysis result, determining whether there are duplicate words between the first analysis result and the second analysis result;
    若所述第一分析结果和所述第二分析结果之间存在所述重复词,则确定所述语句补全规则为所述重复词规则;以及If the repeated word exists between the first analysis result and the second analysis result, determining that the sentence completion rule is the repeated word rule; and
    若所述第一分析结果和所述第二分析结果之间不存在所述重复词,则确定所述语句补全规则为所述缺省规则。If the repeated word does not exist between the first analysis result and the second analysis result, it is determined that the sentence completion rule is the default rule.
  4. 如权利要求2所述语句补全方法,其中,所述语句补全规则包括关键词规则、重复词规则和缺省规则,3. The sentence completion method of claim 2, wherein the sentence completion rules include keyword rules, repeated word rules, and default rules,
    所述基于所述语句补全规则,对所述待补全语句进行补全处理,获得所述初步补全结果的步骤包括:The step of performing completion processing on the sentence to be completed based on the sentence completion rule, and obtaining the preliminary completion result includes:
    基于所述关键词规则,对所述待补全语句进行补全处理,获得所述初步补全结果;或者Based on the keyword rules, perform completion processing on the sentence to be completed to obtain the preliminary completion result; or
    基于所述重复词规则,对所述待补全语句进行补全处理,获得所述初步补全结果;或者Based on the repeated word rule, perform completion processing on the sentence to be completed to obtain the preliminary completion result; or
    基于所述缺省规则,对所述待补全语句进行补全处理,获得所述初步补全结果。Based on the default rule, perform completion processing on the sentence to be completed to obtain the preliminary completion result.
  5. 如权利要求4所述语句补全方法,其中,所述基于所述关键词规则,对所述待补全语句进行补全处理,获得所述初步补全结果的步骤包括:5. The sentence completion method of claim 4, wherein the step of performing completion processing on the sentence to be completed based on the keyword rule, and obtaining the preliminary completion result comprises:
    基于所述关键词规则,在所述待补全语句中确定目标短语;Based on the keyword rules, determine a target phrase in the sentence to be completed;
    基于所述目标短语,对所述关联语句进行分段,获得所述关联语句对应的各分段语句;以及Segmenting the related sentence based on the target phrase to obtain each segmented sentence corresponding to the related sentence; and
    基于各所述分段语句,对所述待补全语句进行补全处理,获得所述初步补全结果。Based on each of the segmented sentences, performing completion processing on the sentence to be completed to obtain the preliminary completion result.
  6. 如权利要求4所述语句补全方法,其中,所述基于所述缺省规则,对所述待补全语句进行补全处理,获得所述初步补全结果的步骤包括:5. The sentence completion method of claim 4, wherein the step of performing completion processing on the sentence to be completed based on the default rule to obtain the preliminary completion result comprises:
    获取所述第一分析结果和所述第二分析结果中的各分词信息;以及Acquiring each word segmentation information in the first analysis result and the second analysis result; and
    基于预设语法顺序,将各所述分词信息进行顺序连接,获得所述初步补全结果。Based on the preset grammatical sequence, the word segmentation information is sequentially connected to obtain the preliminary completion result.
  7. 如权利要求1所述语句补全方法,其中,所述获取待补全语句的步骤包括:5. The sentence completion method according to claim 1, wherein the step of obtaining the sentence to be completed comprises:
    获取待预测语句,并将所述待预测语句输入预设语句补全预测模型,以确定所述待预测语句是否需要进行补全处理;Acquiring a sentence to be predicted, and inputting the sentence to be predicted into a preset sentence completion prediction model to determine whether the sentence to be predicted needs to be completed;
    若所述待预测语句需要进行补全处理,则将所述待预测语句作为所述待补全语句;或者If the sentence to be predicted needs to be completed, use the sentence to be predicted as the sentence to be completed; or
    获取待预测语句,并对所述待预测语句进行依存句法分析,确定所述待预测语句是否缺少预设语句成分;Acquiring the sentence to be predicted, and performing dependency syntactic analysis on the sentence to be predicted to determine whether the sentence to be predicted lacks a preset sentence component;
    若所述待预测语句缺少所述预设语句成分,则将所述待预测语句作为所述待补全语句。If the sentence to be predicted lacks the preset sentence component, the sentence to be predicted is used as the sentence to be completed.
  8. 如权利要求7所述语句补全方法,其中,所述将所述待补全语句输入预设语句补全预测模型,以确定所述待补全语句是否需要进行补全处理的步骤之前,所述语句补全方法还包括:7. The sentence completion method of claim 7, wherein before the step of inputting the sentence to be completed into a preset sentence completion prediction model to determine whether the sentence to be completed needs to be completed, the The sentence completion method also includes:
    获取各待补全训练语句和基础预测模型,并分别对各所述待补全训练语句进行分词,获得各所述待补全训练语句对应的分词结果;Obtain each training sentence to be completed and a basic prediction model, and perform word segmentation on each training sentence to be completed, to obtain a word segmentation result corresponding to each training sentence to be completed;
    基于各所述分词结果,分别对各所述待补全训练语句进行编码,获得各所述待补全训练语句对应的第一编码结果;Based on each of the word segmentation results, respectively encode each of the training sentences to be completed to obtain a first coding result corresponding to each of the training sentences to be completed;
    分别对所述待补全训练语句进行依存句法分析,获得各所述待补全训练语句对应的句法分析结果;Performing dependent syntax analysis on the training sentences to be completed respectively to obtain the syntax analysis results corresponding to each training sentence to be completed;
    基于各所述句法分析结果,分别对各所述待补全训练语句进行编码,获得各所述待补全训练语句对应的第二编码结果;Based on each of the syntactic analysis results, respectively encode each of the to-be-completed training sentences to obtain a second coding result corresponding to each of the to-be-completed training sentences;
    基于各所述第一编码结果和各所述第二编码结果,生成各所述待补全训练语句对应的目标编码结果;以及Based on each of the first encoding results and each of the second encoding results, generating a target encoding result corresponding to each of the training sentences to be completed; and
    基于各所述目标编码结果,对所述基础预测模型进行迭代训练,直至所述基础预测模型达到预设迭代结束条件,获得所述预设语句补全预测模型。Based on each of the target coding results, iterative training is performed on the basic prediction model until the basic prediction model reaches a preset iteration end condition, and the preset sentence completion prediction model is obtained.
  9. 如权利要求1所述语句补全方法,其中,所述获取待补全语句和所述待补全语句对应的关联语句的步骤包括:5. The sentence completion method according to claim 1, wherein the step of obtaining the sentence to be completed and the associated sentence corresponding to the sentence to be completed comprises:
    获取初始待补全语句和所述初始待补全语句对应的初始关联语句;以及Obtaining the initial sentence to be completed and the initial associated sentence corresponding to the initial sentence to be completed; and
    分别对所述初始待补全语句和所述初始关联语句进行去口语化处理,获得所述初始待补全语句对应的所述待补全语句和所述初始关联语句对应的所述关联语句。The initial to-be-completed sentence and the initial related sentence are respectively subjected to de-spoken processing to obtain the to-be-completed sentence corresponding to the initial to-be-completed sentence and the related sentence corresponding to the initial related sentence.
  10. 一种语句补全设备,其中,所述语句补全设备包括:存储器、处理器以及存储在存储器上的用于实现所述语句补全方法的程序,A sentence completion device, wherein the sentence completion device includes a memory, a processor, and a program stored on the memory for implementing the sentence completion method,
    所述存储器用于存储实现语句补全方法的程序;The memory is used to store a program for implementing the sentence completion method;
    所述处理器用于执行实现所述语句补全方法的程序,以实现以下步骤:The processor is used to execute a program that implements the sentence completion method, so as to implement the following steps:
    获取待补全语句和所述待补全语句对应的关联语句,并分别对所述待补全语句和所述关联语句进行依存句法分析,获得所述关联语句对应的第一分析结果和所述待补全语句对应的第二分析结果;Acquire the sentence to be completed and the related sentence corresponding to the sentence to be completed, and perform dependency syntactic analysis on the sentence to be completed and the related sentence, respectively, to obtain the first analysis result and the related sentence corresponding to the related sentence The second analysis result corresponding to the sentence to be completed;
    将所述第一分析结果和所述第二分析结果输入预设语句补全模型,基于所述第一分析结果和所述第二分析结果,对所述待补全语句进行补全处理,获得初步补全结果;以及The first analysis result and the second analysis result are input into a preset sentence completion model, and based on the first analysis result and the second analysis result, the sentence to be completed is complemented to obtain Preliminary completion results; and
    对所述初步补全结果进行后处理,获得目标补全结果。The preliminary completion result is post-processed to obtain the target completion result.
  11. 如权利要求10所述的语句补全设备,其中,所述处理器用于执行实现所述语句补全方法的程序,以实现以下步骤:10. The sentence completion device of claim 10, wherein the processor is configured to execute a program that implements the sentence completion method to implement the following steps:
    将所述第一分析结果和所述第二分析结果输入所述预设语句补全模型,匹配所述第一分析结果和所述第二分析结果共同对应的语句补全规则;以及Inputting the first analysis result and the second analysis result into the preset sentence completion model, and matching sentence completion rules corresponding to the first analysis result and the second analysis result; and
    基于所述语句补全规则,对所述待补全语句进行补全处理,获得所述初步补全结果。Based on the sentence completion rule, perform completion processing on the sentence to be completed to obtain the preliminary completion result.
  12. 如权利要求11所述的语句补全设备,其中,所述语句补全规则包括关键词规则、重复词规则和缺省规则,所述处理器用于执行实现所述语句补全方法的程序,以实现以下步骤:The sentence completion device of claim 11, wherein the sentence completion rules include keyword rules, repeated word rules, and default rules, and the processor is used to execute a program that implements the sentence completion method to Implement the following steps:
    确定所述第一分析结果和所述第二分析结果中是否存在预设关键词,若所述第一分析结果和所述第二分析结果中存在所述预设关键词,则确定所述语句补全规则为所述关键词规则;Determine whether a preset keyword exists in the first analysis result and the second analysis result, and if the preset keyword exists in the first analysis result and the second analysis result, determine the sentence The completion rule is the keyword rule;
    若所述第一分析结果和所述第二分析结果中不存在所述预设关键词,则确定所述第一分析结果和所述第二分析结果之间是否存在重复词;If the preset keyword does not exist in the first analysis result and the second analysis result, determining whether there are duplicate words between the first analysis result and the second analysis result;
    若所述第一分析结果和所述第二分析结果之间存在所述重复词,则确定所述语句补全规则为所述重复词规则;以及If the repeated word exists between the first analysis result and the second analysis result, determining that the sentence completion rule is the repeated word rule; and
    若所述第一分析结果和所述第二分析结果之间不存在所述重复词,则确定所述语句补全规则为所述缺省规则。If the repeated word does not exist between the first analysis result and the second analysis result, it is determined that the sentence completion rule is the default rule.
  13. 如权利要求11所述的语句补全设备,其中,所述语句补全规则包括关键词规则、重复词规则和缺省规则,所述处理器用于执行实现所述语句补全方法的程序,以实现以下步骤:The sentence completion device of claim 11, wherein the sentence completion rules include keyword rules, repeated word rules, and default rules, and the processor is used to execute a program that implements the sentence completion method to Implement the following steps:
    基于所述关键词规则,对所述待补全语句进行补全处理,获得所述初步补全结果;或者Based on the keyword rules, perform completion processing on the sentence to be completed to obtain the preliminary completion result; or
    基于所述重复词规则,对所述待补全语句进行补全处理,获得所述初步补全结果;或者Based on the repeated word rule, perform completion processing on the sentence to be completed to obtain the preliminary completion result; or
    基于所述缺省规则,对所述待补全语句进行补全处理,获得所述初步补全结果。Based on the default rule, perform completion processing on the sentence to be completed to obtain the preliminary completion result.
  14. 如权利要求13所述的语句补全设备,其中,所述处理器用于执行实现所述语句补全方法的程序,以实现以下步骤:The sentence completion device according to claim 13, wherein the processor is used to execute a program that implements the sentence completion method to implement the following steps:
    基于所述关键词规则,在所述待补全语句中确定目标短语;Based on the keyword rules, determine a target phrase in the sentence to be completed;
    基于所述目标短语,对所述关联语句进行分段,获得所述关联语句对应的各分段语句;以及Segmenting the related sentence based on the target phrase to obtain each segmented sentence corresponding to the related sentence; and
    基于各所述分段语句,对所述待补全语句进行补全处理,获得所述初步补全结果。Based on each of the segmented sentences, performing completion processing on the sentence to be completed to obtain the preliminary completion result.
  15. 如权利要求13所述的语句补全设备,其中,所述处理器用于执行实现所述语句补全方法的程序,以实现以下步骤:The sentence completion device according to claim 13, wherein the processor is used to execute a program that implements the sentence completion method to implement the following steps:
    获取所述第一分析结果和所述第二分析结果中的各分词信息;以及Acquiring each word segmentation information in the first analysis result and the second analysis result; and
    基于预设语法顺序,将各所述分词信息进行顺序连接,获得所述初步补全结果。Based on the preset grammatical sequence, the word segmentation information is sequentially connected to obtain the preliminary completion result.
  16. 一种可读存储介质,其中,所述可读存储介质上存储有实现语句补全方法的程序,所述实现语句补全方法的程序被处理器执行以实现以下步骤:A readable storage medium, wherein a program for implementing the sentence completion method is stored on the readable storage medium, and the program for implementing the sentence completion method is executed by a processor to implement the following steps:
    获取待补全语句和所述待补全语句对应的关联语句,并分别对所述待补全语句和所述关联语句进行依存句法分析,获得所述关联语句对应的第一分析结果和所述待补全语句对应的第二分析结果;Acquire the sentence to be completed and the related sentence corresponding to the sentence to be completed, and perform dependency syntactic analysis on the sentence to be completed and the related sentence, respectively, to obtain the first analysis result and the related sentence corresponding to the related sentence The second analysis result corresponding to the sentence to be completed;
    将所述第一分析结果和所述第二分析结果输入预设语句补全模型,基于所述第一分析结果和所述第二分析结果,对所述待补全语句进行补全处理,获得初步补全结果;以及The first analysis result and the second analysis result are input into a preset sentence completion model, and based on the first analysis result and the second analysis result, the sentence to be completed is complemented to obtain Preliminary completion results; and
    对所述初步补全结果进行后处理,获得目标补全结果。The preliminary completion result is post-processed to obtain the target completion result.
  17. 如权利要求16所述的可读存储介质,其中,所述实现语句补全方法的程序被处理器执行以实现以下步骤:16. The readable storage medium of claim 16, wherein the program for implementing the sentence completion method is executed by a processor to implement the following steps:
    将所述第一分析结果和所述第二分析结果输入所述预设语句补全模型,匹配所述第一分析结果和所述第二分析结果共同对应的语句补全规则;以及Inputting the first analysis result and the second analysis result into the preset sentence completion model, and matching sentence completion rules corresponding to the first analysis result and the second analysis result; and
    基于所述语句补全规则,对所述待补全语句进行补全处理,获得所述初步补全结果。Based on the sentence completion rule, perform completion processing on the sentence to be completed to obtain the preliminary completion result.
  18. 如权利要求17所述的可读存储介质,其中,所述语句补全规则包括关键词规则、重复词规则和缺省规则,所述实现语句补全方法的程序被处理器执行以实现以下步骤:The readable storage medium of claim 17, wherein the sentence completion rules include keyword rules, repeated word rules, and default rules, and the program for implementing the sentence completion method is executed by a processor to implement the following steps :
    确定所述第一分析结果和所述第二分析结果中是否存在预设关键词,若所述第一分析结果和所述第二分析结果中存在所述预设关键词,则确定所述语句补全规则为所述关键词规则;Determine whether a preset keyword exists in the first analysis result and the second analysis result, and if the preset keyword exists in the first analysis result and the second analysis result, determine the sentence The completion rule is the keyword rule;
    若所述第一分析结果和所述第二分析结果中不存在所述预设关键词,则确定所述第一分析结果和所述第二分析结果之间是否存在重复词;If the preset keyword does not exist in the first analysis result and the second analysis result, determining whether there are duplicate words between the first analysis result and the second analysis result;
    若所述第一分析结果和所述第二分析结果之间存在所述重复词,则确定所述语句补全规则为所述重复词规则;以及If the repeated word exists between the first analysis result and the second analysis result, determining that the sentence completion rule is the repeated word rule; and
    若所述第一分析结果和所述第二分析结果之间不存在所述重复词,则确定所述语句补全规则为所述缺省规则。If the repeated word does not exist between the first analysis result and the second analysis result, it is determined that the sentence completion rule is the default rule.
  19. 如权利要求17所述的可读存储介质,其中,所述语句补全规则包括关键词规则、重复词规则和缺省规则,所述实现语句补全方法的程序被处理器执行以实现以下步骤:The readable storage medium of claim 17, wherein the sentence completion rules include keyword rules, repeated word rules, and default rules, and the program for implementing the sentence completion method is executed by a processor to implement the following steps :
    基于所述关键词规则,对所述待补全语句进行补全处理,获得所述初步补全结果;或者Based on the keyword rules, perform completion processing on the sentence to be completed to obtain the preliminary completion result; or
    基于所述重复词规则,对所述待补全语句进行补全处理,获得所述初步补全结果;或者Based on the repeated word rule, perform completion processing on the sentence to be completed to obtain the preliminary completion result; or
    基于所述缺省规则,对所述待补全语句进行补全处理,获得所述初步补全结果。Based on the default rule, perform completion processing on the sentence to be completed to obtain the preliminary completion result.
  20. 如权利要求19所述的可读存储介质,其中,所述实现语句补全方法的程序被处理器执行以实现以下步骤:The readable storage medium of claim 19, wherein the program for implementing the sentence completion method is executed by the processor to implement the following steps:
    基于所述关键词规则,在所述待补全语句中确定目标短语;Based on the keyword rules, determine a target phrase in the sentence to be completed;
    基于所述目标短语,对所述关联语句进行分段,获得所述关联语句对应的各分段语句;以及Segmenting the related sentence based on the target phrase to obtain each segmented sentence corresponding to the related sentence; and
    基于各所述分段语句,对所述待补全语句进行补全处理,获得所述初步补全结果。Based on each of the segmented sentences, performing completion processing on the sentence to be completed to obtain the preliminary completion result.
PCT/CN2020/134320 2020-04-15 2020-12-07 Sentence completion method and device, and readable storage medium WO2021208460A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010302609.X 2020-04-15
CN202010302609.XA CN111507088B (en) 2020-04-15 2020-04-15 Sentence completion method, equipment and readable storage medium

Publications (1)

Publication Number Publication Date
WO2021208460A1 true WO2021208460A1 (en) 2021-10-21

Family

ID=71877633

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/134320 WO2021208460A1 (en) 2020-04-15 2020-12-07 Sentence completion method and device, and readable storage medium

Country Status (2)

Country Link
CN (1) CN111507088B (en)
WO (1) WO2021208460A1 (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111507088B (en) * 2020-04-15 2022-12-16 深圳前海微众银行股份有限公司 Sentence completion method, equipment and readable storage medium
CN112084770B (en) * 2020-09-14 2024-07-05 深圳前海微众银行股份有限公司 Word slot filling method, device and readable storage medium
CN112035651B (en) * 2020-09-25 2024-04-09 北京小米松果电子有限公司 Sentence completion method, sentence completion device and computer readable storage medium
CN112417107A (en) * 2020-10-22 2021-02-26 联想(北京)有限公司 Information processing method and device
CN112487197A (en) * 2020-11-06 2021-03-12 中科云谷科技有限公司 Method and device for constructing knowledge graph based on conference record and processor
CN112560476A (en) * 2020-12-09 2021-03-26 中科讯飞互联(北京)信息科技有限公司 Text completion method, electronic device and storage device
CN112560477B (en) * 2020-12-09 2024-04-16 科大讯飞(北京)有限公司 Text completion method, electronic equipment and storage device
CN114638212A (en) * 2020-12-16 2022-06-17 科沃斯商用机器人有限公司 Model training method and device, electronic equipment and storage medium
CN112949280B (en) * 2021-03-02 2023-07-07 中国联合网络通信集团有限公司 Data processing method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140067368A1 (en) * 2012-08-29 2014-03-06 Microsoft Corporation Determining synonym-antonym polarity in term vectors
CN108334487A (en) * 2017-07-14 2018-07-27 腾讯科技(深圳)有限公司 Lack semantics information complementing method, device, computer equipment and storage medium
CN110245240A (en) * 2019-05-31 2019-09-17 国网电子商务有限公司 A kind of determination method and device of problem data answer
CN110427625A (en) * 2019-07-31 2019-11-08 腾讯科技(深圳)有限公司 Sentence complementing method, device, medium and dialog process system
CN111507088A (en) * 2020-04-15 2020-08-07 深圳前海微众银行股份有限公司 Sentence completion method, equipment and readable storage medium

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2809136B2 (en) * 1995-06-26 1998-10-08 日本電気株式会社 Natural language dialogue device
CN107305550A (en) * 2016-04-19 2017-10-31 中兴通讯股份有限公司 A kind of intelligent answer method and device
CN106777018B (en) * 2016-12-08 2020-05-22 竹间智能科技(上海)有限公司 Method and device for optimizing input sentences in intelligent chat robot
CN107329995B (en) * 2017-06-08 2018-03-23 北京神州泰岳软件股份有限公司 A kind of controlled answer generation method of semanteme, apparatus and system
CN107247707B (en) * 2017-06-27 2020-08-04 鼎富智能科技有限公司 Enterprise association relation information extraction method and device based on completion strategy
WO2019079922A1 (en) * 2017-10-23 2019-05-02 腾讯科技(深圳)有限公司 Session information processing method and device, and storage medium
CN109325234B (en) * 2018-10-10 2023-06-20 深圳前海微众银行股份有限公司 Sentence processing method, sentence processing device and computer readable storage medium
CN109522419B (en) * 2018-11-15 2020-08-04 北京搜狗科技发展有限公司 Session information completion method and device
CN109766556B (en) * 2019-01-18 2023-06-23 广东小天才科技有限公司 Corpus restoration method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140067368A1 (en) * 2012-08-29 2014-03-06 Microsoft Corporation Determining synonym-antonym polarity in term vectors
CN108334487A (en) * 2017-07-14 2018-07-27 腾讯科技(深圳)有限公司 Lack semantics information complementing method, device, computer equipment and storage medium
CN110245240A (en) * 2019-05-31 2019-09-17 国网电子商务有限公司 A kind of determination method and device of problem data answer
CN110427625A (en) * 2019-07-31 2019-11-08 腾讯科技(深圳)有限公司 Sentence complementing method, device, medium and dialog process system
CN111507088A (en) * 2020-04-15 2020-08-07 深圳前海微众银行股份有限公司 Sentence completion method, equipment and readable storage medium

Also Published As

Publication number Publication date
CN111507088A (en) 2020-08-07
CN111507088B (en) 2022-12-16

Similar Documents

Publication Publication Date Title
WO2021208460A1 (en) Sentence completion method and device, and readable storage medium
US11250033B2 (en) Methods, systems, and computer program product for implementing real-time classification and recommendations
US11126798B1 (en) Applied artificial intelligence technology for conversational inferencing and interactive natural language generation
US10474478B2 (en) Methods, systems, and computer program product for implementing software applications with dynamic conditions and dynamic actions
CN107247706B (en) Text sentence-breaking model establishing method, sentence-breaking method, device and computer equipment
US10705796B1 (en) Methods, systems, and computer program product for implementing real-time or near real-time classification of digital data
US10262062B2 (en) Natural language system question classifier, semantic representations, and logical form templates
US10528329B1 (en) Methods, systems, and computer program product for automatic generation of software application code
US10671929B2 (en) Question correction and evaluation mechanism for a question answering system
US20190130305A1 (en) Methods, systems, and computer program product for implementing an intelligent system with dynamic configurability
US10467122B1 (en) Methods, systems, and computer program product for capturing and classification of real-time data and performing post-classification tasks
US8972408B1 (en) Methods, systems, and articles of manufacture for addressing popular topics in a social sphere
US10460028B1 (en) Syntactic graph traversal for recognition of inferred clauses within natural language inputs
CN110276071B (en) Text matching method and device, computer equipment and storage medium
WO2021143206A1 (en) Single-statement natural language processing method and apparatus, computer device, and readable storage medium
WO2014155209A1 (en) User collaboration for answer generation in question and answer system
JP2010250814A (en) Part-of-speech tagging system, training device and method of part-of-speech tagging model
WO2018205704A1 (en) Electronic device, intelligent voice navigation method and computer readable storage medium
US11699034B2 (en) Hybrid artificial intelligence system for semi-automatic patent infringement analysis
KR101717230B1 (en) Document summarization method using recursive autoencoder based sentence vector modeling and document summarization system
CN112101042A (en) Text emotion recognition method and device, terminal device and storage medium
CN113779062A (en) SQL statement generation method and device, storage medium and electronic equipment
CN115437626A (en) OCL statement automatic generation method and device based on natural language
CN113626608B (en) Semantic-enhancement relationship extraction method and device, computer equipment and storage medium
CN113569559A (en) Short text entity emotion analysis method and system, electronic equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20930996

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20930996

Country of ref document: EP

Kind code of ref document: A1