Statement generation method and device, electronic equipment, storage medium and computer program product
By displaying an interface in an electronic device, receiving input and generating sentences in response, the problem of a cumbersome sentence generation process in the prior art is solved, efficient sentence generation is achieved, and user operations are simplified.
Patent Information
- Application Number
- CN202410450457.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-15
- Publication Date
- 2024-10-11
AI Technical Summary
The process of generating sentences with existing electronic devices is cumbersome, time-consuming, and inefficient, making it difficult to meet users' rapid editing needs.
By displaying the first interface, receiving user input, and generating a second statement based on the element response of the statement, the process of organizing statements for the user is simplified and the efficiency of generating statements is improved.
It realizes the rapid generation of statements required by users based on interface elements, simplifies the user operation process, and significantly improves the efficiency of statement generation.
Smart Images

Figure CN118760362A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of electronic technology, and specifically relates to a sentence generation method, device, electronic device, storage medium and computer program product. Background Art
[0002] With the development of electronic devices, the functions of electronic devices are also increasing. For example, users can edit sentences through electronic devices.
[0003] In the related art, an electronic device can display an information input box in an interface so that a user can manually input information through an input method and then generate a sentence. However, the process of generating a sentence in this way is relatively cumbersome, time-consuming, and inefficient. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a sentence generation method, device, electronic device, storage medium and computer program product, which can improve the efficiency of generating sentences.
[0005] In a first aspect, an embodiment of the present application provides a sentence generation method, which includes: displaying a first interface, the first interface including a first sentence; receiving a first input; in response to the first input, obtaining a second sentence based on elements of the first sentence, wherein the first sentence is different from the second sentence.
[0006] In a second aspect, an embodiment of the present application provides a sentence generation device, which includes: a display module, a receiving module, and a processing module. The display module is used to display a first interface, and the first interface includes a first sentence. The receiving module is used to receive a first input. The processing module is used to obtain a second sentence according to an element of the first sentence in response to the receiving module receiving the first input, wherein the first sentence is different from the second sentence.
[0007] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.
[0008] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0009] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0010] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.
[0011] In an embodiment of the present application, the electronic device can display a first interface, the first interface including a first sentence; receive a first input; and in response to the first input, obtain a second sentence according to an element of the first sentence, wherein the first sentence is different from the second sentence. In this way, the electronic device can obtain the second sentence required by the user according to the elements of the sentence in the first interface, thereby simplifying the process of the user organizing the sentence and improving the efficiency of generating the sentence. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 is a flow chart of a sentence generation method provided in an embodiment of the present application;
[0013] Figure 2 This is one of the example schematic diagrams of a conversation interface of an electronic device provided in an embodiment of the present application;
[0014] Figure 3A This is a second example schematic diagram of a conversation interface of an electronic device provided in an embodiment of the present application;
[0015] Figure 3B This is a third example schematic diagram of a conversation interface of an electronic device provided in an embodiment of the present application;
[0016] Figure 4A This is a fourth example schematic diagram of a conversation interface of an electronic device provided in an embodiment of the present application;
[0017] Figure 4B This is a fifth example schematic diagram of a conversation interface of an electronic device provided in an embodiment of the present application;
[0018] Figure 4C This is a sixth example schematic diagram of a conversation interface of an electronic device provided in an embodiment of the present application;
[0019] Figure 5A This is a seventh example schematic diagram of a conversation interface of an electronic device provided in an embodiment of the present application;
[0020] Figure 5B This is an eighth example schematic diagram of a conversation interface of an electronic device provided in an embodiment of the present application;
[0021] Figure 5C This is a ninth example schematic diagram of a conversation interface of an electronic device provided in an embodiment of the present application;
[0022] Figure 5DThis is a tenth example schematic diagram of a conversation interface of an electronic device provided in an embodiment of the present application;
[0023] Figure 5E This is an eleventh example schematic diagram of a conversation interface of an electronic device provided in an embodiment of the present application;
[0024] Fig. 5F This is a twelfth example schematic diagram of a conversation interface of an electronic device provided in an embodiment of the present application;
[0025] Figure 6 It is a structural schematic diagram of a sentence generation device provided in an embodiment of the present application;
[0026] Figure 7 This is one of the hardware structure diagrams of an electronic device provided in an embodiment of the present application;
[0027] Figure 8 This is the second schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0028] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0029] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way are interchangeable where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0030] The terms "at least one (item)", "at least one of" and the like in the specification and claims of the present application refer to any one, any two or a combination of more than two of the objects included therein. For example, at least one (item) of a, b, and c can be represented by: "a", "b", "c", "a and b", "a and c", "b and c" and "a, b and c", where a, b, and c can be single or multiple. Similarly, "at least two (items)" refers to two or more, and its meaning is similar to that of "at least one (item)".
[0031] The following is an explanation of the professional terms involved in the sentence generation method, device, electronic device, storage medium and computer program product provided in this application.
[0032] 1) Sentence components
[0033] The components of a sentence include six types: subject, predicate, object, attributive, complement, and adverbial.
[0034] Subject: It is the object of the statement in the sentence, indicating who or what;
[0035] Predicate: It is a component that makes a statement about the subject of the sentence, explaining what or how the subject is;
[0036] Object: It is the controlling component of the predicate verb, indicating the object, result, place, tool, etc. of the action.
[0037] Complement: It supplements the predicate verb to explain the situation, result, place, quantity, time, etc. of the action.
[0038] Attributive: It is a modifying component before the noun in a sentence, indicating the nature or state of things, or limiting the possession, quality, quantity, etc. of things.
[0039] Adverbial modifier: It is a modifying component before the verb or adjective in a sentence, indicating the manner, state, time, place or degree of the action.
[0040] 2) Sentence collocation rules
[0041] The sentence component collocation rules include: Chinese sentence component collocation rules and English sentence component collocation rules;
[0042] Among them, the sentence components in Chinese sentences that conform to Chinese grammar have fixed positions. Specifically, the positions between the sentence components can be: [adverbial] (attributive) subject [adverbial] predicate <complement> (attributive) object <complement>. Exemplarily, the Chinese sentence that conforms to Chinese grammar is "My kitten eats fresh fish slowly", and the sentence components in this Chinese sentence are: "My" is the attributive; "kitten" is the subject; "slowly" is the adverbial; "eat" is the predicate; "fresh" is the attributive; "fish" is the object; the positions between the sentence components are consistent with the above [adverbial] (attributive) subject [adverbial] predicate <complement> (attributive) object <complement>.
[0043] In another Chinese sentence that conforms to Chinese grammar, "The horse runs very fast", the sentence components in this Chinese sentence are: "horse" is the subject; "run" is the predicate; "quickly" is the complement, and the positions of the sentence components are the same as the above-mentioned [adverbial modifier] (attributive) subject [adverbial modifier] predicate <complement> (attributive) object <complement>.
[0044] Therefore, the sentence component collocation rules can be determined according to [adverbial] (attributive) subject [adverbial] predicate <complement> (attributive) object <complement>. For example, in a Chinese sentence including a subject, a predicate and an object, the subject must be preceded by an attributive, the subject must be followed by an adverbial or predicate, the predicate must be preceded by a subject or an adverbial, and the predicate must be followed by a complement, an attributive or an object. If the sentence component of the first word in the adjacent words is a subject and the sentence component of the second word is an object, then the adjacent words do not meet the sentence component collocation rules.
[0045] In addition, in Chinese sentences that conform to Chinese grammar, the part of speech of the words whose sentence components are subjects can be nouns and pronouns, for example, he, the part of speech of the words whose sentence components are predicates can be verbs, adjectives, and nouns, the part of speech of the words whose sentence components are objects can be nouns, pronouns, and numerals, and the part of speech of the words whose sentence components are adverbials can be adverbs and adjectives. Therefore, the collocation of sentence components can be determined according to the collocation of sentence components, but it is not limited to this.
[0046] 3) Main clause
[0047] The main clause is the main body of the sentence and can be used alone or is a sentence with basic sentence components. The basic sentence components include: subject, predicate and object.
[0048] 4) Subordinate clause
[0049] A subordinate clause is a clause that belongs to the main clause. It is a grammatical structure in most languages. In Chinese or English grammar, a subordinate clause is a clause that cannot form an independent sentence but can have a subject and a predicate. For example, in English grammar, it is a non-main clause introduced by the introductory words such as that, who, whom, when, why, where, how, which, etc.
[0050] The sentence generation method, device, electronic device, storage medium and computer program product provided in the embodiments of the present application are described in detail below in conjunction with the accompanying drawings through specific embodiments and their application scenarios.
[0051] The sentence generation method, device, electronic device, storage medium, and computer program product provided in the embodiments of the present application can be applied in a message editing scenario. For example, a user edits a message in a chat interface in an electronic device, wherein a specific application scenario example is as follows:
[0052] In one example, an electronic device displays a private chat session interface, which includes three messages, which may be "My cat slowly eats fresh fish", "Today is a particularly good day, great", and "How is the weather today"; when a user needs to input information "My British shorthair cat slowly eats fresh fish" in the private chat session interface, the user can click the input control in the private chat session interface so that the electronic device can display an input box and a keyboard control; then, the user can manually input "My British shorthair cat slowly eats fresh fish" through the keyboard control. In this way, the electronic device can obtain information through the user's manual input.
[0053] In another example, when the user needs to input the information "My British shorthair cat eats fresh fish slowly" in the private chat session interface, the user can long press and input the information "My cat eats fresh fish slowly" from the private chat session interface in the electronic device, so that the electronic device can display a copy control; then, when the user needs to copy the information "My cat eats fresh fish slowly", the user can click and input the copy control, so that the electronic device copies the information "My cat eats fresh fish slowly"; then the user can click and input the input control in the private chat session interface, so that the electronic device can display an input box and a keyboard control; then, the user can long press and input the input box, so that the electronic device can copy the information "My cat eats fresh fish slowly" in the input box, and then, the user can move the cursor of the electronic device to after the information "My cat" so that the electronic device can determine the location where the information is added; then, the user can manually input "British shorthair" through the keyboard control, so that the electronic device can obtain the information "My British shorthair cat eats fresh fish slowly". In this way, the electronic device can obtain the information in the copy session interface and edit the copied information to obtain the information required by the user.
[0054] In the sentence generation method, device, electronic device, storage medium and computer program product provided in the embodiments of the present application, the electronic device can display a first interface, the first interface includes a first sentence; receive a first input; in response to the first input, obtain a second sentence according to the elements of the first sentence, wherein the first sentence is different from the second sentence. In this way, the electronic device can obtain the second sentence required by the user according to the elements of the sentence in the first interface, simplifying the process of the user organizing the sentence and improving the efficiency of generating the sentence.
[0055] The execution subject of the sentence generation method provided in the embodiment of the present application may be a sentence generation device, and the sentence generation device may be an electronic device, or a functional module in an electronic device. The technical solution provided in the embodiment of the present application is described below using an electronic device as an example.
[0056] The present application embodiment provides a sentence generation method. Figure 1 FIG. 1 is a flowchart of a method for generating a sentence according to an embodiment of the present application. Figure 1 As shown, the sentence generation method provided in the embodiment of the present application may include the following steps 201 to 203.
[0057] Step 201: The electronic device displays a first interface.
[0058] In the embodiment of the present application, the above-mentioned first interface includes a first sentence.
[0059] Optionally, in an embodiment of the present application, the above-mentioned conversation interface is any conversation interface in an electronic device that can send messages or display messages.
[0060] Exemplarily, the above-mentioned conversation interface may be a chat conversation interface, a text message conversation interface, a comment area interface, or a document editing interface, etc. The specific interface may be determined according to actual use requirements, and is not limited in the embodiments of the present application.
[0061] For example, taking the session interface as a chat session interface as an example, the chat session interface may be a group chat session interface or a private chat session interface.
[0062] Optionally, in the embodiment of the present application, the first sentence may be a conversation message in the first interface or a sentence composed of preset text in the first interface.
[0063] Optionally, in the embodiment of the present application, the first sentence may include at least one of the following: Chinese, English, German or Arabic, etc. The specific language may be determined according to actual usage, and the embodiment of the present application does not limit it.
[0064] Exemplarily, the first statement may be sent by a contact corresponding to the conversation interface.
[0065] For example, Figure 2 As shown, taking the private chat interface as an example, the private chat interface 10 displays contact A and contact B, and contact A is the user corresponding to the electronic device; the private chat interface 10 includes three messages, which are "My cat is eating fresh fish slowly", "Today is a very good day, great" and "How is the weather today", and the private chat interface 10 includes an input box 11. Among them, "How is the weather today" and "My cat is eating fresh fish slowly" are sent by contact A; "Today is a very good day, great" is sent by contact B.
[0066] Optionally, in an embodiment of the present application, the electronic device may display the first interface based on user input.
[0067] Exemplarily, taking the first interface as a conversation interface, when the electronic device displays the system desktop, if the user needs to display the conversation interface, the user can click on the chat application icon in the system desktop to make the electronic device run the chat application corresponding to the chat application icon and display the application interface of the chat application, which includes at least one session identifier; then, the electronic device can display the conversation interface corresponding to one session identifier among the at least one session identifier based on the user's input of the one session identifier.
[0068] Step 202: The electronic device receives a first input.
[0069] In the embodiment of the present application, the first input is used to select a first sentence from the first interface.
[0070] Optionally, in the embodiment of the present application, the first input may specifically be an input of a first sentence.
[0071] Optionally, in the embodiment of the present application, the first input may include any of the following: a user's click input, long press input, sliding input, or preset track input on the first message, etc. The specific input may be determined according to actual usage, and the embodiment of the present application does not limit the input.
[0072] Step 203: The electronic device obtains a second sentence according to elements of the first sentence in response to the first input.
[0073] In the embodiment of the present application, the first statement mentioned above is different from the second statement.
[0074] Optionally, in an embodiment of the present application, the words included in the first sentence are different from the words included in the second sentence.
[0075] Optionally, in an embodiment of the present application, the number of words included in the second sentence may be less than or greater than the number of words included in the first sentence.
[0076] Optionally, in an embodiment of the present application, the above-mentioned elements may include at least one of sentence components and punctuation marks of each word in the first sentence.
[0077] Optionally, in the embodiment of the present application, the above sentence components may be any one of the following: subject, predicate, object, attributive, complement and adverbial.
[0078] Optionally, in an embodiment of the present application, the electronic device determines the sentence components of each word in the first sentence in the first message in response to the above-mentioned first input, and combines the words corresponding to the first sentence components in the above-mentioned first sentence according to the sentence component collocation rules to obtain a second sentence.
[0079] Optionally, the first sentence component includes at least one of the following: a subject, a predicate and an object.
[0080] Exemplarily, taking the first message sentence "My cat slowly eats fresh fish" as an example, the electronic device can obtain the word "cat" corresponding to the subject, the word "eat" corresponding to the predicate and the word "fish" corresponding to the object from the first message sentence, and then the electronic device can combine the subject "cat", the predicate "eat" and the object "fish" according to the sentence component collocation rules of subject, predicate and object to obtain the second message sentence "Cat eats fish", and display the second message sentence "Cat eats fish" in the conversation interface.
[0081] Optionally, in the embodiment of the present application, after obtaining the second sentence, the electronic device may display the second sentence in the first interface.
[0082] Optionally, in an embodiment of the present application, after the electronic device displays the second sentence, the user can edit the second sentence to obtain an edited second sentence, and display the edited second sentence in the conversation interface.
[0083] Exemplarily, the above-mentioned editing process may include at least one of the following: adding process, deleting process, and replacing process.
[0084] Optionally, in the embodiment of the present application, the edited second sentence may be a word or a complete sentence.
[0085] In the sentence generation method provided in the embodiment of the present application, the electronic device can display a first interface, the first interface includes a first sentence; receive a first input; and in response to the first input, obtain a second sentence according to the elements of the first sentence, wherein the first sentence is different from the second sentence. In this way, the electronic device can obtain the second sentence required by the user according to the elements of the sentence in the first interface, which simplifies the process of the user organizing the sentence and improves the efficiency of generating the sentence.
[0086] Optionally, in an embodiment of the present application, before the above step 202, the sentence generation method provided in the embodiment of the present application further includes the following step 301, and the above step 202 can be specifically implemented by the following step 202a.
[0087] Step 301: The electronic device displays a statement editing control.
[0088] Optionally, in an embodiment of the present application, the sentence editing control may include at least one of a sentence contraction control, a sentence expansion control, and a sentence combination control.
[0089] Optionally, in an embodiment of the present application, the electronic device may display a sentence editing control in the first interface.
[0090] Exemplarily, the electronic device may display a sentence editing control in a control display area corresponding to the first sentence.
[0091] Exemplarily, the electronic device may display a sentence contraction control, a sentence expansion control, and a sentence combination control in the control display area corresponding to the first sentence.
[0092] Step 202a: The electronic device receives a first input to a sentence editing control.
[0093] In an embodiment of the present application, the electronic device can determine the sentence components of each word in the first sentence based on the first input to the sentence editing control.
[0094] In the embodiment of the present application, the electronic device can determine the sentence components of each word in the first sentence through a first algorithm.
[0095] Exemplarily, the first algorithm includes any one of the following: an artificial intelligence (AI) algorithm, a neural network algorithm or a Chinese speech N-Gram model.
[0096] For example, in response to the first input, the electronic device may input the first sentence into the N-Gram model, thereby obtaining the sentence components of each word in the first sentence through the N-Gram model.
[0097] Optionally, in the embodiment of the present application, the above step 203 can be specifically implemented by the following step 203a.
[0098] Step 203a: The electronic device obtains a second sentence in response to the first input according to at least one of the subject, the object, and the predicate of the first sentence.
[0099] In an embodiment of the present application, when the above-mentioned first input is an input to a sentence abbreviation control, after the electronic device obtains the sentence components of each word in the first sentence, the electronic device can extract the subject, predicate and object sentence components from the sentence components of each word in the first sentence; and then combine the subject, predicate and object sentence components according to the sentence component collocation rules to obtain the second sentence.
[0100] Exemplarily, taking the first sentence "My cat slowly eats fresh fish" as an example, if the user needs to shorten the sentence "My cat slowly eats fresh fish", the user clicks on the shortening control so that the electronic device can extract the subject "cat", the predicate "eat" and the object "fish" from the first sentence "My cat slowly eats fresh fish"; then, according to the sentence component collocation rules, "cat", "eat" and "fish" are combined to directly obtain the second sentence "Cat eats fish".
[0101] For example, in combination Figure 2,like Figure 3A As shown; in the case where the user needs to input the information "cat eats fish", the user can long press the message "my cat slowly eats fresh fish" to make the electronic device display the sentence contraction control 20, the sentence expansion control 21 and the sentence closing control 22 and the keyboard control 12. Figure 3B As shown, the user can then click and input the abbreviation control 20 so that the electronic device can directly display "Cat eats fish", that is, the second message sentence mentioned above, in the input box 11.
[0102] In an embodiment of the present application, the electronic device can perform operations corresponding to the first sentence editing control, such as sentence shortening, based on the second sentence editing control, without the need for manual input by the user, thereby improving the flexibility and efficiency of the electronic device in editing message sentences.
[0103] Optionally, in the embodiment of the present application, the above step 203 can be specifically implemented through the following steps 401 to 403.
[0104] Step 401: In response to a first input, the electronic device displays at least one of a subject, an object, and a predicate of a first sentence in an input control, and displays the first sentence or N candidate words in a candidate word area.
[0105] In the embodiment of the present application, the above-mentioned N candidate words are related to the elements of the first sentence.
[0106] Optionally, in the embodiment of the present application, the above-mentioned input control may be an input bar or an input box.
[0107] Optionally, in an embodiment of the present application, when the above-mentioned first input is an input to a sentence expansion control, the electronic device may display the subject, object, and predicate of the first sentence in the input box, and display N candidate words in the candidate word area in the input box.
[0108] Optionally, in an embodiment of the present application, the above-mentioned N candidate words are obtained by the electronic device through an information search method, and the N candidate words are the modifier words that best match the first sentence.
[0109] Exemplarily, the above-mentioned information search method can be a big data method or a crawler method.
[0110] Exemplarily, the electronic device may display the first sentence in the first interface in a first display manner.
[0111] Exemplarily, the first display mode may include any one of the following: highlight display, color display or border display.
[0112] Optionally, in an embodiment of the present application, when the electronic device displays the first sentence in the first interface according to the first display mode, the electronic device may display each word in the first sentence according to different display styles in the first display mode.
[0113] It should be noted that a display style can correspond to a sentence component, for example, red can correspond to an attributive, blue can correspond to a subject, green can correspond to an object, purple can correspond to a predicate, yellow can correspond to an adverbial, and orange can correspond to a complement. The specific color can be determined according to actual usage, and the embodiment of the present application does not limit it.
[0114] For example, the first display mode is color display, and the first sentence is "My cat eats fresh fish slowly" for example. "My" in the first sentence is an attributive, and the display color of the word "My" is red; "Cat" in the first sentence is a subject, and the display color of the word "Cat" is blue; "Slowly" in the first sentence is an adverbial, and the display color of the word "Slowly" is orange; "Eat" in the first sentence is a predicate, and the display color of the word "Eat" is purple; "Fresh" in the first sentence is an attributive, and the display color of the word "Fresh" is red; "Fish" in the first sentence is an object, and the display color of the word "Fish" is green. In this way, the user can distinguish the sentence components in the first sentence according to different colors.
[0115] Step 402: The electronic device receives a second input.
[0116] In an embodiment of the present application, the second input can be used to select M candidate words from N candidate words, where M is less than or equal to N.
[0117] Optionally, in the embodiment of the present application, the second input may be a click input, a long press input, a sliding input, or a preset track input of the M candidate words, etc. The specific input may be determined according to actual usage, and the embodiment of the present application does not limit the input.
[0118] Step 403: The electronic device obtains a second sentence according to at least one of the subject, the object, and the predicate of the first sentence displayed by the input control and the second input.
[0119] Optionally, in an embodiment of the present application, after the electronic device determines M candidate words, the electronic device may input the M candidate words into the above-mentioned first algorithm to obtain sentence components of the M candidate words; then, according to the sentence component collocation rules, the above-mentioned M candidate words and the words corresponding to the subject, object, and predicate in the first sentence are combined to obtain the second sentence.
[0120] For example, in combination Figure 3A ,like Figure 4AAs shown, if the user wants to expand the message "My cat slowly eats fresh fish", the user can click and input the sentence expansion control 21, so that the electronic device can directly display the first message sentence "My cat slowly eats fresh fish" in the input box 11 according to the color display method; "My" in the first message sentence is red, "cat" in the first message sentence is blue, "slowly" in the first message sentence is orange, "eat" in the first message sentence is purple, "fresh" in the first message sentence is red, and "fish" in the first message sentence is green, and the display of the sentence contraction control 20, the sentence expansion control 21 and the sentence combination control 22 are cancelled; as shown in FIG. Figure 4B As shown, the user can then click and input the cat in "My cat slowly eats fresh fish", so that the electronic device can display three candidate words in the candidate word area 13 in the input box 11, and the three candidate words are "Civet cat", "Puppet" and "British shorthair". Thus, the user can click and input "British shorthair"; Figure 4C As shown, the electronic device can add "British Shorthair" between "my" and "cat" in "My cat slowly eats fresh fish", so as to obtain the second message sentence "My British Shorthair cat slowly eats fresh fish", and display the second message sentence "My British Shorthair cat slowly eats fresh fish" in the input box 11.
[0121] Optionally, in an embodiment of the present application, after the electronic device displays the second sentence in the input box, the electronic device may edit the second sentence according to the user's input to the text editing control; thereby obtaining the edited second sentence, and displaying the edited second sentence in the input box.
[0122] In an embodiment of the present application, the electronic device can display N candidate words matching the first sentence according to the sentence expansion editing control, and then expand the first sentence using the N candidate words, eliminating the need for the user to manually re-enter the message sentence, thereby improving the flexibility and efficiency of the electronic device in editing sentences.
[0123] Optionally, in an embodiment of the present application, the first interface further includes a third sentence, and the first input indicates a complete sentence; the step 203 can be specifically implemented through the following step 501.
[0124] Step 501: The electronic device obtains a second sentence according to elements of the first sentence and elements of the third sentence.
[0125] In an embodiment of the present application, the electronic device can combine the words corresponding to the sentence components of the first sentence and the words corresponding to the sentence components of the third sentence based on the sentence components of the first sentence and the sentence components of the third sentence and according to the sentence component matching rules to obtain the second sentence.
[0126] Optionally, in the embodiment of the present application, when the third sentence includes the first multimedia file, the third sentence may be a description sentence of key information in the first multimedia file.
[0127] Exemplarily, the first multimedia file may be any of the following: a picture, a moving picture, a video or an audio.
[0128] For example, taking the first multimedia file as a picture, after the electronic device determines the picture, the electronic device can input the picture into the second algorithm to obtain a text description of key information of the picture.
[0129] For example, the second algorithm may be any one of the following: an AI algorithm or a neural network algorithm.
[0130] Optionally, in an embodiment of the present application, after obtaining the description sentence of the key information in the first multimedia file, the electronic device may input the description sentence of the key information in the first multimedia file into the above-mentioned first algorithm to obtain the sentence components of the description sentence of the key information in the above-mentioned first multimedia file.
[0131] Optionally, in an embodiment of the present application, the first interface includes at least two sentences, and the at least two sentences include the third sentence; when the first input is a user input to a sentence control, the electronic device can display the first control and the second control in the control display area of each of the at least two sentences.
[0132] Optionally, in an embodiment of the present application, the electronic device can receive input to the first control corresponding to the above-mentioned first sentence, thereby using the first sentence as the main sentence; and the electronic device can receive input to the second control corresponding to the third sentence, thereby using the third sentence as the subordinate clause; thus, the electronic device can divide the sentences in the first interface into main sentences and subordinate clauses, thereby filling in the main sentence according to the words in the subordinate clause.
[0133] Optionally, in an embodiment of the present application, after the electronic device determines that the third sentence is a clause, the electronic device can determine the sentence components of each word in the third sentence, and then delete the words corresponding to the sentence components subject, predicate, and object in the third sentence; and display the words in the third sentence except the words corresponding to the subject, predicate, and object in the candidate word area in the first interface.
[0134] For example, in combination Figure 3A ,like Figure 5A As shown, if the user needs to combine two messages in the private chat session interface, the user can click on the combine control 22 to input, such as Figure 5BAs shown, the electronic device can display the main sentence control and the subordinate sentence control in the message display area of each of the three messages in the private chat session interface, and cancel the display of the shortened sentence control 20, the expanded sentence control 21 and the combined sentence control 22; as shown Figure 5C As shown, the user can then click and input the main sentence control corresponding to the message "My cat slowly eats fresh fish" so that the electronic device can display the message "My cat slowly eats fresh fish" in the input box 11; Figure 5D As shown, the subordinate clause control corresponding to the message "My cat slowly eats fresh fish" is canceled, the main clause control corresponding to the message "Today is a particularly good day, great" is canceled, and the main clause control corresponding to the message "How is the weather today" is canceled; as shown in FIG. Figure 5E As shown, the user can then click and input the clause control corresponding to the message "Today is a really good weather, awesome", so that the electronic device can divide the message "Today is a really good weather, awesome" according to the sentence components, thereby obtaining the words "today", "really one", "especially good", "weather", and "awesome" corresponding to the sentence components of the message; then, the electronic device can display the four words "today", "really one", "especially good", "weather", and "awesome" in the candidate word area 13 of the input box 11; as shown in FIG. Fig. 5F As shown, the user can click to input the word "awesome", and the electronic device can add the word "awesome" to the end of "My cat eats fresh fish slowly" according to the sentence component collocation rules, and obtain the second message sentence "My cat eats fresh fish slowly, which is great", and display the second message sentence "My cat eats fresh fish slowly, which is great" in the input box 11.
[0135] In an embodiment of the present application, the electronic device can determine the subordinate clause from the conversation interface based on the sentence combination control, and add the words in the subordinate clause to the main sentence without the need for manual input by the user, and without the need for the user to manually re-enter the message sentence, thereby improving the flexibility and efficiency of the electronic device in editing message sentences.
[0136] It should be noted that the above-mentioned method embodiments, or various possible implementation methods in each method embodiment, can be executed separately, or, under the premise that there is no contradiction, can also be executed in combination with each other. The specific implementation can be determined according to actual usage requirements, and the embodiments of the present application do not limit this.
[0137] It should be noted that the execution subject of the sentence generation method provided in the embodiment of the present application can be a sentence generation device, or an electronic device, or can also be a functional module or entity in an electronic device. In the embodiment of the present application, the sentence generation device provided in the embodiment of the present application is described by taking the sentence generation method executed by the sentence generation device as an example.
[0138] Figure 6 A possible structural diagram of a sentence generating device involved in an embodiment of the present application is shown. Figure 6 As shown, the sentence generating device 70 may include: a display module 71 , a receiving module 72 and a processing module 73 .
[0139] The display module 71 is used to display a first interface, and the first interface includes a first sentence. The receiving module 72 is used to receive a first input. The processing module 73 is used to obtain a second sentence according to the elements of the first sentence in response to the receiving module 72 receiving the first input, wherein the first sentence is different from the second sentence.
[0140] In a possible implementation, the display module 71 is further configured to display a sentence editing control before the receiving module 72 receives the first input. The receiving module 72 is specifically configured to receive the first input to the sentence editing control.
[0141] In a possible implementation, the processing module 73 is specifically configured to obtain a second sentence in response to the first input according to at least one of the subject, the object, and the predicate of the first sentence.
[0142] In a possible implementation, the processing module 73 is specifically used to respond to the first input, display at least one of the subject, object, and predicate of the first sentence in the input control, and display the first sentence or N candidate words in the candidate word area, where the N candidate words are related to the elements of the first sentence. The receiving module 72 is also used to receive the second input. The processing module 73 is also used to obtain the second sentence based on at least one of the subject, object, and predicate of the first sentence displayed in the input control and the second input.
[0143] In a possible implementation, the processing module 73 is specifically configured to obtain the second statement according to the elements of the first statement and the elements of the third statement.
[0144] The embodiment of the present application provides a sentence generation device, which can display a first interface, the first interface includes a first sentence; receive a first input; and in response to the first input, obtain a second sentence according to the elements of the first sentence, wherein the first sentence is different from the second sentence. In this way, the electronic device can obtain the second sentence required by the user according to the elements of the sentence in the first interface, simplifying the process of the user organizing the sentence and improving the efficiency of generating the sentence.
[0145] The sentence generation device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a car electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0146] The sentence generation device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0147] The sentence generation device provided in the embodiment of the present application can implement each process implemented in the above embodiment. To avoid repetition, it will not be repeated here.
[0148] Alternatively, if Figure 7 As shown, an embodiment of the present application further provides an electronic device 90, including a processor 91 and a memory 92, wherein the memory 92 stores programs or instructions that can be executed on the processor 91, and when the program or instructions are executed by the processor 91, the various steps of the above-mentioned statement generation method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not described here.
[0149] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0150] Figure 8 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0151] The electronic device 100 includes but is not limited to components such as a radio frequency unit 101, a network module 102, an audio output unit 103, an input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, a memory 109, and a processor 110.
[0152] Those skilled in the art will appreciate that the electronic device 100 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 110 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 8 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0153] Among them, the display unit 106 is used to display a first interface, the first interface includes a first sentence; the user input unit 107 is used to receive a first input; the processor 110 is used to respond to the first input and obtain a second sentence according to the elements of the first sentence, wherein the first sentence is different from the second sentence.
[0154] The embodiment of the present application provides an electronic device, which can display a first interface, the first interface including a first sentence; receive a first input; and in response to the first input, obtain a second sentence according to an element of the first sentence, wherein the first sentence is different from the second sentence. In this way, the electronic device can obtain the second sentence required by the user according to the elements of the sentence in the first interface, simplifying the process of the user organizing the sentence and improving the efficiency of generating the sentence.
[0155] Optionally, in the embodiment of the present application, the display unit 106 is further configured to display a sentence editing control before receiving the first input. The user input unit 107 is specifically configured to receive the first input to the sentence editing control.
[0156] Optionally, in an embodiment of the present application, the processor 110 is specifically configured to obtain a second sentence in response to a first input according to at least one of a subject, an object, and a predicate of the first sentence.
[0157] Optionally, in an embodiment of the present application, the processor 110 is specifically used to display at least one of the subject, object, and predicate of the first sentence in the input control in response to the first input, and display the first sentence or N candidate words in the candidate word area, where the N candidate words are related to the elements of the first sentence. The user input unit 107 is also used to receive a second input. The processor 110 is also used to obtain a second sentence based on at least one of the subject, object, and predicate of the first sentence displayed in the input control and the second input.
[0158] Optionally, in an embodiment of the present application, the above-mentioned first interface also includes a third sentence, the first input indicates a combined sentence, and the above-mentioned processor 110 is specifically used to obtain the second sentence according to the elements of the first sentence and the elements of the third sentence.
[0159] The electronic device provided in the embodiment of the present application can implement each process implemented in the above method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described here.
[0160] The beneficial effects of various implementations in this embodiment can be specifically referred to the beneficial effects of the corresponding implementations in the above method embodiment. To avoid repetition, they will not be described again here.
[0161] It should be understood that in the embodiment of the present application, the input unit 104 may include a graphics processor (Graphics Processing Unit, GPU) 1041 and a microphone 1042, and the graphics processor 1041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 106 may include a display panel 1061, and the display panel 1061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 107 includes a touch panel 1071 and at least one of other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include two parts: a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0162] The memory 109 can be used to store software programs and various data. The memory 109 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 109 may include a volatile memory or a non-volatile memory, or the memory 109 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 109 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0163] The processor 110 may include one or more processing units; optionally, the processor 110 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 110.
[0164] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0165] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0166] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0167] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0168] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned statement generation method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0169] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0170] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0171] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A sentence generation method, It is characterized in that The method comprises: Displaying a first interface, wherein the first interface includes a first sentence; receiving a first input; In response to the first input, a second statement is obtained according to elements of the first statement, wherein the first statement is different from the second statement.
2. The method according to claim 1, It is characterized in that Before receiving the first input, the method further includes: Display the statement edit control; The receiving a first input comprises: A first input to the statement edit control is received.
3. The method according to claim 1, It is characterized in that The step of obtaining a second statement in response to the first input and according to elements of the first statement includes: In response to the first input, a second sentence is obtained according to at least one of a subject, an object, and a predicate of the first sentence.
4. The method according to claim 3, It is characterized in that The step of obtaining a second sentence in response to the first input according to at least one of a subject, an object, and a predicate of the first sentence includes: In response to the first input, displaying at least one of the subject, object, and predicate of the first sentence in the input control, and displaying the first sentence or N candidate words in the candidate word area, wherein the N candidate words are related to elements of the first sentence; receiving a second input; A second sentence is obtained according to at least one of the subject, the object, and the predicate of the first sentence displayed by the input control and the second input.
5. The method according to claim 1, It is characterized in that The first interface further includes a third sentence, the first input indicates a combined sentence, and the second sentence is obtained according to the elements of the first sentence, including: A second statement is obtained according to the elements of the first statement and the elements of the third statement.
6. A sentence generating device, It is characterized in that The device comprises: a display module, a receiving module and a processing module; The display module is used to display a first interface, wherein the first interface includes a first sentence; The receiving module is used to receive a first input; The processing module is used to obtain a second statement according to elements of the first statement in response to the first input received by the receiving module, wherein the first statement is different from the second statement.
7. The device according to claim 6, It is characterized in that The display module is further configured to display a sentence editing control before the receiving module receives the first input; The receiving module is specifically configured to receive a first input to the sentence editing control.
8. The device according to claim 6, It is characterized in that The processing module is specifically configured to obtain a second sentence in response to the first input according to at least one of a subject, an object, and a predicate of the first sentence.
9. The device according to claim 8, It is characterized in that The processing module is specifically configured to, in response to the first input, display at least one of the subject, object, and predicate of the first sentence in the input control, and display the first sentence or N candidate words in the candidate word area, wherein the N candidate words are related to elements of the first sentence; The receiving module is further used to receive a second input; The processing module is further used to obtain a second sentence according to at least one of the subject, object and predicate of the first sentence displayed by the input control and the second input.
10. The device according to claim 6, It is characterized in that The first interface also includes a third statement, and the processing module is specifically used to obtain a second statement according to elements of the first statement and elements of the third statement.
11. An electronic device, It is characterized in that The method comprises a processor, a memory and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the sentence generation method as claimed in any one of claims 1 to 5.
12. A readable storage medium, It is characterized in that The readable storage medium stores a program or an instruction, and when the program or the instruction is executed by the processor, the steps of the sentence generation method according to any one of claims 1 to 5 are implemented.
13. A computer program product, It is characterized in that The computer program product is stored in a storage medium, and the computer program product is executed by at least one processor to implement the steps of the sentence generation method according to any one of claims 1 to 5.
