Automatic music dubbing method and device, electronic equipment and computer program product
By detecting the plot consistency of adjacent sentences in the document and determining emotional categories using a large language model, and automatically selecting the soundtrack, the problem of automatic soundtracking of electronic documents in the prior art is solved, and the soundtrack efficiency is improved.
Patent Information
- Application Number
- CN202411940315.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-11
AI Technical Summary
It is difficult for the prior art to achieve automatic soundtracking of electronic documents, and musicians need to have a deep understanding of the document content to match the soundtrack atmosphere and document emotions.
By detecting whether adjacent statements in the document belong to the same plot, the document is divided into multiple plot units, and the emotional categories of each plot unit are determined using a large language model, and music that is the same as the emotional category is selected as the background music.
Automatic plot division and emotional category determination of electronic documents are realized, and the soundtrack is automatically selected according to the emotional category, which improves the soundtrack efficiency and reduces the need for understanding the document content.
Smart Images

Figure CN119807426A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of document music matching, and in particular to an automatic music matching method, device, electronic device and computer program product. Background Art
[0002] By arranging music for electronic documents, the narrative effect of the document can be improved, thereby enhancing the auditory experience of the audience. In the process of arranging music, the arranging personnel need to have a deep understanding of the content of the document in order to match the atmosphere of the music with the emotions of the document content. This process is very energy-consuming for the arranging personnel. Therefore, how to provide a method for automatically arranging music for electronic documents has become a technical problem that needs to be solved urgently by those skilled in the art. Summary of the invention
[0003] In view of this, the present application proposes an automatic music arrangement method, device, electronic device and computer program product, which can automatically arrange music for electronic documents.
[0004] The technical solutions proposed in this application are as follows:
[0005] In a first aspect, an embodiment of the present application provides an automatic music arrangement method, comprising:
[0006] By detecting whether adjacent sentences in a document belong to the same plot, the document is divided into a plurality of plot units; when the adjacent sentences have the same plot elements, it indicates that the adjacent sentences belong to the same plot;
[0007] Inputting each plot unit and prompt sentence into the large language model to obtain the emotion category of each plot unit output by the large language model; the prompt sentence is used to instruct the large language model to perform the task of determining the emotion category of each plot unit;
[0008] Select music with the same emotional category as each plot unit as the background music of each plot unit.
[0009] Furthermore, in the above method, the step of detecting whether adjacent sentences in a document belong to the same plot includes:
[0010] Extracting the sentence representation of each sentence in the adjacent sentences and the paragraph representation of the paragraph where each sentence is located;
[0011] Determine the temporal structure features of each sentence based on the sentence representation and paragraph representation corresponding to each sentence;
[0012] By comparing the temporal structure features of each sentence, it is determined whether each sentence in the adjacent sentences belongs to the same plot.
[0013] Furthermore, in the above method, extracting the sentence representation of each sentence in the adjacent sentences and the paragraph representation of the paragraph to which each sentence belongs, determining the temporal structure features of each sentence according to the sentence representation and paragraph representation corresponding to each sentence, and determining whether each sentence in the adjacent sentences belongs to the same plot by comparing the temporal structure features of each sentence, includes:
[0014] The adjacent sentences are input into a pre-trained plot division model so that the plot division model extracts the sentence representation of each sentence in the adjacent sentences and the paragraph representation of the paragraph where each sentence is located, and determines the temporal structural features of each sentence based on the sentence representation and paragraph representation corresponding to each sentence. By comparing the temporal structural features of each sentence, it is determined whether each sentence in the adjacent sentences belongs to the same plot and outputs it.
[0015] Further, in the method described above, the plot division model includes a representation extraction network, a temporal structure feature extraction network and a linear layer network;
[0016] The step of inputting the adjacent sentences into a pre-trained plot division model so that the plot division model extracts the sentence representation of each sentence in the adjacent sentences and the paragraph representation of the paragraph to which each sentence belongs, determining the temporal structure features of each sentence according to the sentence representation and paragraph representation corresponding to each sentence, and determining whether each sentence in the adjacent sentences belongs to the same plot and outputting the result by comparing the temporal structure features of each sentence, comprises:
[0017] Inputting the adjacent sentences into the representation extraction network, and extracting the sentence representation of each sentence in the adjacent sentences and the paragraph representation of the paragraph where each sentence is located through the representation extraction network;
[0018] The temporal structure feature extraction network extracts the temporal structure feature of each sentence from the concatenation features of each sentence; the concatenation feature of each sentence is obtained by concatenating the sentence representation and the paragraph representation corresponding to each sentence;
[0019] The linear layer network is used to compare the temporal structure features of each sentence, determine whether each sentence in the adjacent sentences belongs to the same plot, and output it.
[0020] Furthermore, in the above method, the representation extraction network includes a BERT network; and the temporal structure feature extraction network includes a bidirectional GRU network.
[0021] Furthermore, in the above method, the step of selecting music of the same emotional category as each plot unit as background music for each plot unit includes:
[0022] Selecting target music whose genre is consistent with the genre of the document from a preset music library;
[0023] Music having the same emotional category as that of each plot unit is selected from the target music as background music of each plot unit.
[0024] Furthermore, in the above method, the prompt sentence includes the optional emotion category of each plot unit, the description of each emotion category and the task description sentence;
[0025] The task description statement is used to instruct the large language model to select the emotion category corresponding to each plot unit from the optional emotion categories.
[0026] In a second aspect, an embodiment of the present application provides an automatic music arrangement device, comprising:
[0027] A division module, used for dividing the document into a plurality of plot units by detecting whether adjacent sentences in the document belong to the same plot; when the adjacent sentences have the same plot elements, it indicates that the adjacent sentences belong to the same plot;
[0028] An input module, used to input each plot unit and a prompt sentence into the large language model, and obtain the emotion category of each plot unit output by the large language model; the prompt sentence is used to instruct the large language model to perform the task of determining the emotion category of each plot unit;
[0029] The selection module is used to select music with the same emotional category as each plot unit as the background music of each plot unit.
[0030] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0031] A memory and a processor; wherein the memory is used to store programs; and the processor is used to implement any of the methods described above by running the programs in the memory.
[0032] In a fourth aspect, an embodiment of the present application provides a computer program product, the computer program product comprising a computer program, and when the computer program is executed by a processor, the computer program implements any one of the above methods. Optionally, the computer program can be stored in a readable storage medium of a computer device or in the cloud; the processor of the computer device reads the computer program from the readable storage medium or the cloud.
[0033] The automatic music matching method proposed in the present application divides the document into multiple plot units by detecting whether adjacent sentences in the document belong to the same plot. When adjacent sentences have the same plot elements, it means that the adjacent sentences belong to the same plot. Each plot unit and the prompt sentence are input into the large language model to obtain the emotional category of each plot unit output by the large language model. The prompt sentence is used to instruct the large language model to perform the task of determining the emotional category of each plot unit, and select the music with the same emotional category as each plot unit as the background music of each plot unit. In this way, it is possible to automatically divide the document into plots and automatically determine the emotional category corresponding to each plot unit, and then select appropriate music for each plot unit according to the emotional category. There is no need for staff to have an in-depth understanding of the document, which effectively improves the efficiency of music matching. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0035] Figure 1 It is a flowchart of an automatic music arrangement method provided in an embodiment of the present application.
[0036] Figure 2 It is a structural diagram of the plot division model provided in the embodiment of the present application.
[0037] Figure 3 It is a schematic diagram of the music library structure of the novel soundtrack provided in the embodiment of the present application.
[0038] Figure 4 It is a structural schematic diagram of an automatic music arrangement device provided in an embodiment of the present application.
[0039] Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0041] By composing music for electronic documents, the narrative effect of the document can be improved, thereby enhancing the audience's listening experience. For example, as a new way of reading, audiobooks have developed rapidly around the world in recent years. Their convenience and companionship meet the reading needs of modern people in scenarios such as commuting and sports. With the rapid development of the industry, many creators have enhanced the narrative effect of the story and improved the audience's listening experience by commuting and exercising.
[0042] In the process of composing music, the composer needs to have an in-depth understanding of the content of the document so that the atmosphere created by the music can match the emotions of the document content. For example, when composing music for novels or other literary works, the composer needs to have an in-depth understanding of the plot, characters and themes of the novel so that the atmosphere created by the music can match the emotions of the novel content. In addition, even for the same emotion, different types of novels may require different styles of music to set off. It can be seen that from reading the novel text, grasping the emotions of the novel, to selecting music that matches the artistic conception and genre, all of them test the music literacy, creative thinking and technical ability of the composer, and the process is undoubtedly time-consuming and labor-intensive. Therefore, how to provide a method for automatically composing music for electronic documents has become a technical problem that technicians in this field need to solve urgently.
[0043] Based on this, the present application proposes an automatic music arrangement method, device, electronic device and computer program product. The technical solution achieves the purpose of automatic music arrangement for electronic documents by automatically dividing the document into plots and automatically determining the emotional category corresponding to each plot unit, and selecting appropriate music for each plot unit according to the emotional category.
[0044] The embodiment of the present application provides an automatic music arrangement method, which can be executed by an electronic device, which can be any device with data and instruction processing functions, for example, a notebook computer, a tablet computer, a desktop computer, a mobile device (for example, a mobile phone, a personal digital assistant, a dedicated messaging device) and other types of user terminals, or a combination of any two or more of these electronic devices, or a server. Figure 1 As shown, the method includes:
[0045] S101. Divide the document into multiple plot units by detecting whether adjacent sentences in the document belong to the same plot.
[0046] The above-mentioned document refers to a document that needs to be matched with music. The type of the document is not limited in this embodiment, and the document may be a novel, prose, drama, or historical literature.
[0047] Adjacent sentences in a document refer to a group of sentences in a document that have an adjacent relationship. Taking any sentence in a document except the first and last sentences as an example, the previous sentence of the sentence and the next sentence of the sentence are both in an adjacent relationship with the sentence, and the sentence, the previous sentence of the sentence, and the next sentence of the sentence can be determined as a group of adjacent sentences. In other words, any sentence in a document except the first and last sentences can form a group of adjacent sentences with its previous and next sentences. The first sentence in a document is the first sentence of the document, and the sentence and the next sentence of the sentence are determined as a group of adjacent sentences; the last sentence in a document is the last sentence of the document, and the sentence and the previous sentence of the sentence are determined as a group of adjacent sentences.
[0048] When adjacent sentences have the same plot elements, it means that the adjacent sentences belong to the same plot. Plot elements refer to the elements that constitute the plot, including events, characters, time, place, etc. When at least one plot element changes, it means that the plot has changed. There may be small fluctuations in the emotions within the plot, but overall it is stable and consistent, and the content of a plot will not have a turning point in events. For example, adjacent sentences include the first sentence, the second sentence, and the third sentence. The first sentence is the previous sentence of the second sentence, and the third sentence is the next sentence of the second sentence. If the first sentence and the second sentence have the same plot elements, it means that the first sentence and the second sentence belong to the same plot. If the plot elements in the second sentence and the third sentence change, it means that the second sentence and the third sentence do not belong to the same plot, and the second sentence and the third sentence constitute the boundary between the previous and next plots.
[0049] In this embodiment, the document is divided into a plurality of plot units by detecting whether adjacent sentences in the document belong to the same plot.
[0050] More specifically, when the adjacent sentences include the first sentence, the second sentence and the third sentence, and the first sentence is the previous sentence of the second sentence, and the third sentence is the next sentence of the second sentence, it is detected whether the second sentence and the first sentence belong to the same plot, and whether the second sentence and the third sentence belong to the same plot. It should be noted that although the first sentence and the third sentence are in the same adjacent sentence group, the first sentence and the third sentence are not actually adjacent, so it is not necessary to detect whether the first sentence and the third sentence belong to the same plot.
[0051] If the second sentence belongs to the same plot as the first sentence, and the second sentence belongs to the same plot as the third sentence, then it means that the first sentence, the second sentence and the third sentence belong to the same plot; if the second sentence belongs to the same plot as the first sentence, and the second sentence and the third sentence do not belong to the same plot, then it means that the second sentence and the third sentence constitute the boundary between the previous and next plots, and a plot separator marker can be set between the second sentence and the third sentence; if the second sentence does not belong to the same plot as the first sentence, and the second sentence and the third sentence belong to the same plot, then it means that the second sentence and the first sentence constitute the boundary between the previous and next plots, and a plot separator marker can be set between the second sentence and the first sentence.
[0052] For the first sentence in the document, the sentence and the sentence after it are determined as a group of adjacent sentences. If the sentence and the sentence after it do not belong to the same plot, it means that the sentence and the sentence after it form the boundary between the previous and next plots, and a plot separation mark can be set between the sentence and the sentence after it; For the last sentence in the document, the sentence and the sentence before it are determined as a group of adjacent sentences. If the sentence and the sentence before it do not belong to the same plot, it means that the sentence and the sentence before it form the boundary between the previous and next plots, and a plot separation mark can be set between the sentence and the sentence before it.
[0053] According to the records of the above embodiment, all adjacent sentences in the entire document are identified to determine whether the adjacent sentences belong to the same plot, and a document including multiple plot separation marks is obtained. It should be noted that the present embodiment sets the plot separation marks at both the beginning and the end of the document. In this way, the document between any two adjacent plot separation marks can be regarded as a plot unit.
[0054] For example, according to the above embodiment, all adjacent sentences in the following document can be identified to determine whether the adjacent sentences belong to the same plot, and a document including multiple plot separation marks can be obtained. A, B, C, and D represent plot separation marks.
[0055] AThere is a famous mountain in the sea, called Huaguo Mountain. On the top of the mountain, there is a fairy stone. The stone is 36 feet 5 inches high and 24 feet in circumference. There are no trees to shade it, but there are orchids on the left and right. Since the creation of the world, it has been blessed with the beauty of nature and the beauty of the sun and the moon. After a long time, it has become spiritual. The fairy egg inside burst one day and produced a stone egg as big as a ball. When it saw the wind, it turned into a stone monkey. It has all the facial features and limbs. It learned to crawl and walk, and bowed to all directions. Two golden lights shot out of its eyes and rushed to the Dou Palace. BThe holy and benevolent Jade Emperor in the sky was alarmed. He sat in the Lingxiao Palace of the Golden Palace and gathered the immortals. When he saw the golden light, he ordered the Thousand-Li Eyes and the Wind-Ears to open the South Gate to watch. The two generals obeyed the order and went out. They saw clearly and heard clearly.
[0056] Soon he reported back: "I was ordered to watch the golden light. It is the border of the small country of Aolai in the east of the Dongsheng Continent. There is a flower and fruit mountain. On the mountain there is a fairy stone. The stone laid an egg, which turned into a stone monkey. There it bowed to the four directions, with golden light in its eyes, shooting into the sky. Now it is eating food and water, and the golden light will disappear." The Jade Emperor showed mercy and said: "Things below are born from the essence of heaven and earth, so there is nothing strange about them."
[0057] C The monkeys in the mountains can walk and jump, eat grass and trees, drink stream water, pick mountain flowers, and look for tree fruits; they keep company with wolves and insects, tigers and leopards, deer and roe deer, and macaques; they sleep under the cliffs at night and travel in the caves in the morning. It is true that "there is no year in the mountains, and the year is unknown after the cold ends". When the weather is hot, they will play under the shade of pines with other monkeys to avoid the heat. Look at them one by one - jumping and climbing trees, picking flowers and looking for fruits; throwing marbles, playing with the monkeys, running in the sand, building pagodas; chasing dragonflies, catching wax; praying to the gods; pulling vines, weaving straw brooms; catching lice, biting and pinching; straightening sweaters, picking nails; touching and rubbing; pushing and pressing; pulling and pulling. Let them play under the green pines and wash by the green stream. D
[0058] Among them, the documents between A and B are regarded as a plot unit, the documents between B and C are regarded as a plot unit, and the documents between C and D are regarded as a plot unit.
[0059] In some embodiments, a plot element extraction model may be used to detect whether adjacent sentences in a document belong to the same plot.
[0060] Specifically, a large number of documents can be obtained as training samples, and the plot elements of each sentence in the document can be marked as training labels. During training, the training samples are input into the plot element extraction model to obtain the prediction results output by the plot element extraction model, and the loss of the plot element extraction model is determined by comparing the prediction results output by the plot element extraction model with the training labels. The parameters of the plot element extraction model are adjusted for the purpose of reducing the loss of the plot element extraction model, and then the above training process is repeated until the plot element extraction model meets the training expectations. The above plot element extraction model can be obtained based on the training of a large language model, which is not limited in this embodiment.
[0061] The document in this embodiment can be input into the trained plot element extraction model, so that the plot element extraction model analyzes the document sentence by sentence and extracts the plot element corresponding to each sentence in the document. Then, by comparing whether the plot elements are the same, it is determined whether adjacent sentences belong to the same plot, and a document including multiple plot separation marks is obtained, and then the document between any two adjacent plot separation marks is regarded as a plot unit.
[0062] S102: Input each plot unit and prompt sentence into the large language model to obtain the emotion category of each plot unit output by the large language model.
[0063] In the embodiment of the present application, a large language model is used to determine the emotion category corresponding to each plot unit.
[0064] The above prompt sentence is used to instruct the large language model to perform the task of determining the emotion category of each plot unit. In some embodiments, the prompt sentence is "identify the emotion category of the text".
[0065] In order to make the large language model more accurately identify the emotion category corresponding to each plot unit, more specific content can be set in the prompt sentence. In other embodiments, the prompt sentence includes the optional emotion category of each plot unit, the description of each emotion category and the task description sentence, and the task description sentence is used to instruct the large language model to select the emotion category corresponding to each plot unit from the optional emotion categories.
[0066] Optional emotion categories refer to emotion categories for selection by the large language model. The types of optional emotion categories should be as rich as possible, covering emotion categories that appear in various documents. For example, the optional emotion categories include: Highlight (excitement, excitement, and passion); Romance (romance and love); Happiness (happiness, pleasure, and relaxation); Warmth (warmth, kindness, and family); Mystery (mystery, curiosity, fantasy, and science fiction); Tension (tension and suspense); Sadness (sadness, sadness, loneliness, and helplessness); Injury (physical injury and fighting); Conflict (verbal conflict and ideological differences); Neutral (quiet, peaceful, and tranquil). Among them, Warmth, Highlight, Romance, Happiness, and Mystery are positive emotions, Tension, Sadness, Injury, and Conflict are negative emotions, and Neutral is a neutral emotion.
[0067] The description of each emotion category refers to a detailed explanation of each emotion category and the distinction between similar emotion categories, so that the large language model can have an in-depth understanding of the emotion category and then correctly match the emotion category for each plot unit.
[0068] For example, the description of the emotion category of Mystery is: reading this kind of scene usually makes people feel surprise, mystery, curiosity and desire to explore. For example, in science fiction, fantasy, and adventure novels, the protagonist comes to a new world for the first time and sees surprising and novel things, or it is a foreshadowing of mysterious, supernatural, and ancient events. Pay attention to the difference with Tension. This kind of emotion does not make people feel depressed, but more of a curiosity, understanding, and desire to explore the unknown.
[0069] The description of the emotional category of Sadness is: reading this type of plot usually makes people feel depressed, lonely, helpless, etc. This type of plot makes people feel depressed and pervasive sadness.
[0070] The description of the Neutral emotion category is: neutral, quiet, peaceful, tranquil, or having no emotional tendency is usually labeled Neutral.
[0071] The description of the emotion category of Happiness is: reading this kind of plot usually makes people feel relaxed, happy, lively or funny.
[0072] The description of the emotion category of Conflict is: used to describe scenes such as arguments, disputes, resistance, disagreements, and conflicts. It may be a quarrel between characters, or it may be a character's inner struggle, or the task has encountered a major crisis. Reading this type of plot usually makes people feel a sense of contradiction, discomfort or depression. Different from Sadness, the plot rhythm of Conflict is more intense.
[0073] The description of the emotion category Injury is: used for scenes such as action, adventure, combat or mission that have caused great psychological trauma. Different from Highlight, the plot of Thunder usually involves bleeding, violence and shock. Reading this kind of plot will make people feel nervous, painful, desperate, tragic and brave to die.
[0074] The description of the emotion category of Highlight is: often used in action, adventure, combat scenes, or non-combat, adventure scenes, where characters are sure to win through intelligence and strategy. Reading this type of plot will make people feel excited, stimulated, passionate and hopeful. This type of plot will not make people feel despair and pain.
[0075] The description of the emotion category Warmth is: used to describe scenes of coziness, benevolence, warmth, and care, such as human mutual assistance, family harmony and friendship, etc.
[0076] The description of the emotion category of Romance is: Reading this kind of plot usually makes people feel sweet, happy and relaxed.
[0077] The description of the emotional category of Tension is: Reading this type of plot usually makes people feel nervous and uneasy, such as the eve of the truth coming to light, the villain ambushing behind the scenes, etc., the eve of ghosts appearing, the rhythm of this type of plot is fast and depressing.
[0078] The task description statement is a descriptive statement of the task performed by the large language model, which is used to instruct the large language model to select the emotion category corresponding to each plot unit from the optional emotion categories, for example, "You need to select the emotion category output corresponding to each plot unit from the provided optional emotion categories."
[0079] In a specific embodiment, the prompt statement is:
[0080] "For emotions, only 10 types are considered: 0: Mystery. Reading this type of scene usually makes people feel surprised, mysterious, curious and want to explore. For example, in science fiction, fantasy, and adventure novels, the protagonist comes to a new world for the first time and sees surprising and novel things, or it is a foreshadowing of mysterious, supernatural, and ancient events. Pay attention to the difference between Tension. This type of emotion does not make people feel depressed, but more of a curiosity, understanding, and desire to explore the unknown; 1: Sadness. Reading this type of plot usually makes people feel depressed, lonely, helpless, etc. This type of plot makes people feel depressed and pervasive. Sadness; 2: Neutral, neutral, quiet, peaceful, tranquil, or no emotional tendency is usually marked as Neutral; 3: Happiness, reading this kind of plot usually makes people feel relaxed, happy, lively or funny; 4: Conflict, used to describe scenes such as arguments, disputes, resistance, disagreements, and conflicts. It may be a quarrel between characters, or it may be a character's inner struggle, or the task has encountered a major crisis. Reading this kind of plot usually makes people feel a sense of contradiction, discomfort or depression, which is different from Sadness, Conflict. lict has a more intense plot rhythm; 5: Injury, used in scenes of action, adventure, combat or missions that have caused great psychological trauma. Different from Highlight, the plot of Thunder usually involves bleeding, violence and shock. Reading this kind of plot will make people feel nervous, painful, desperate, tragic and brave to die. 6: Highlight, often used in action, adventure, combat scenes, or in non-combat and adventure scenes, where the characters win through intelligence and strategy. Reading this kind of plot will make people feel excited, stimulated and passionate. 7: Warmth, used to describe scenes of warmth, kindness, warmth, and care, such as mutual assistance among people, harmonious family love, etc. 8: Romance, reading this type of plot usually makes people feel sweet, happy, and relaxed; 9: Tension, reading this type of plot mostly makes people feel nervous and uneasy, such as the eve of the truth coming to light, the villain ambushing in the dark, the eve of the appearance of ghosts, etc., the rhythm of this type of plot is fast and depressing. You only need to reply to the emotional category number that the text is most likely to belong to, such as 0"
[0081] In order to make the results of the large language model more accurate, the large language model can be fine-tuned before use. The fine-tuning method of some embodiments is to obtain a large number of plot units as training samples, and label the emotion category corresponding to each plot unit according to the above-mentioned optional emotion category as a training label. Then input the training samples and prompt sentences into the large language model to obtain the results output by the large language model. By comparing the results output by the large language model and the training labels, the loss of the large language model is determined, and the parameters of the large language model are adjusted with the goal of reducing the loss of the large language model until the large language model meets the training expectations.
[0082] The fine-tuning method of some other embodiments is to obtain a large number of plot units as training samples, label the emotion category corresponding to each plot unit according to the above-mentioned optional emotion category as a training label, and then input the training samples, prompt sentences and training labels into the large language model, so that the large language model can learn to generate knowledge of the emotion category corresponding to the plot unit based on the plot unit and the prompt sentence, so as to have the corresponding ability.
[0083] Each plot unit and prompt sentence is input into the fine-tuned large language model to obtain the sentiment category of each plot unit output by the large language model. The large language model has the ability to capture long-distance dependencies, extensive knowledge representation, and strong sentiment perception, so it also has good sentiment recognition capabilities for documents of genres outside the sample set. In addition, the large language model has a stronger context understanding ability and a larger memory window, and the accuracy of distinguishing sentiment categories is also higher.
[0084] The large language model may adopt a mature large language model in the prior art, and this embodiment does not limit this.
[0085] S103, selecting music with the same emotional category as each plot unit as the background music of each plot unit.
[0086] In the embodiment of the present application, a music library is pre-set, and music with the same emotional category as each plot unit is selected from the music library as the background music of each plot unit, and then the background music of each plot unit is inserted into the corresponding position of each plot unit. For example, when plot unit A is played, the background music corresponding to plot unit A is inserted, and when plot unit B is played, the background music corresponding to plot unit B is inserted.
[0087] In the above embodiment, the document is divided into multiple plot units by detecting whether adjacent sentences in the document belong to the same plot. When adjacent sentences have the same plot elements, it means that the adjacent sentences belong to the same plot. Each plot unit and the prompt sentence are input into the large language model to obtain the emotional category of each plot unit output by the large language model. The prompt sentence is used to instruct the large language model to perform the task of determining the emotional category of each plot unit, and select the music with the same emotional category as each plot unit as the background music of each plot unit. In this way, it is possible to automatically divide the document into plots and automatically determine the emotional category corresponding to each plot unit, and then select appropriate music for each plot unit according to the emotional category. There is no need for staff to have a deep understanding of the document, which effectively improves the efficiency of music matching.
[0088] In addition to determining whether each sentence in adjacent sentences belongs to the same plot in the manner described in the above embodiment, as an optional implementation method, another embodiment of the present application discloses that the steps of the above embodiment to detect whether adjacent sentences in a document belong to the same plot may specifically include the following steps:
[0089] Extract sentence representations of each sentence in adjacent sentences and paragraph representations of the paragraphs to which each sentence belongs; determine the temporal structural features of each sentence based on the sentence representations and paragraph representations corresponding to each sentence; and determine whether each sentence in adjacent sentences belongs to the same plot by comparing the temporal structural features of each sentence.
[0090] Specifically, we can first extract the sentence representation of each sentence in adjacent sentences and the paragraph representation of the paragraph to which each sentence belongs, and then concatenate the sentence representation and paragraph representation corresponding to each sentence to obtain the concatenated representation corresponding to each sentence. On the basis of the concatenated representation corresponding to each sentence, we can extract the temporal structure features of each sentence, and by comparing the temporal structure features of each sentence, determine whether the sentences in adjacent sentences belong to the same plot.
[0091] In some embodiments, a feature extraction model capable of extracting representations, such as a BERT (Bidirectional Encoder Representation from Transformers) model, can be set to extract the sentence representations of each sentence in adjacent sentences and the paragraph representations of the paragraphs where each sentence is located; then a temporal structure feature extraction model, such as a recurrent neural network (RNN), is set to extract the temporal structure features of each sentence based on the concatenated representations corresponding to each sentence, and finally, the Sim Layer is used to simulate or emulate to determine whether each sentence in the adjacent sentences belongs to the same plot. It should be noted that the feature extraction model, the temporal structure feature extraction model, and the SimLayer need to be supervised in advance so that each model has the corresponding capabilities.
[0092] Since different document authors have different writing styles, for example, some like to divide the text into sections while others do not, there may be certain problems in dividing the plots in a chapter using only paragraphs as the smallest unit. This embodiment proposes a method of integrating the joint features of paragraphs and sentences to determine whether each sentence in adjacent sentences belongs to the same plot. In this way, sentences are used as the dividing line of the plots, and the features of sentences and paragraphs are combined to solve the problem of inaccurate plot division caused by the irregular segmentation of some documents.
[0093] As an optional implementation, another embodiment of the present application discloses that the steps of the above embodiment extract the sentence representation of each sentence in the adjacent sentences and the paragraph representation of the paragraph where each sentence is located, determine the temporal structure features of each sentence according to the sentence representation and paragraph representation corresponding to each sentence, and determine whether each sentence in the adjacent sentences belongs to the same plot by comparing the temporal structure features of each sentence. Specifically, the following steps may be included:
[0094] Adjacent sentences are input into a pre-trained plot division model so that the plot division model extracts the sentence representation of each sentence in the adjacent sentences and the paragraph representation of the paragraph where each sentence is located, and determines the temporal structural features of each sentence according to the sentence representation and paragraph representation corresponding to each sentence. By comparing the temporal structural features of each sentence, it is determined whether each sentence in the adjacent sentences belongs to the same plot and outputs it.
[0095] In the embodiment of the present application, a plot division model is pre-trained, and the plot division model can extract the sentence representation of each sentence in adjacent sentences and the paragraph representation of the paragraph where each sentence is located, and then concatenate the sentence representation and paragraph representation corresponding to each sentence to obtain the concatenated representation of each sentence, determine the temporal structure characteristics of each sentence according to the concatenated representation of each sentence, and by comparing the temporal structure characteristics of each sentence, determine whether each sentence in the adjacent sentences belongs to the same plot and output it.
[0096] More specifically, if Figure 2 As shown, the plot division model includes a representation extraction network, a temporal structure feature extraction network and a linear layer network. The steps of the above embodiment input adjacent sentences into the pre-trained plot division model so that the plot division model extracts the sentence representation of each sentence in the adjacent sentences and the paragraph representation of the paragraph where each sentence is located, determines the temporal structure feature of each sentence according to the sentence representation and paragraph representation corresponding to each sentence, and determines whether each sentence in the adjacent sentences belongs to the same plot and outputs it by comparing the temporal structure features of each sentence. Specifically, the following steps may be included:
[0097] Adjacent sentences are input into the representation extraction network, and the sentence representation of each sentence in the adjacent sentences and the paragraph representation of each sentence are extracted through the representation extraction network; the temporal structure feature of each sentence is extracted from the splicing features of each sentence through the temporal structure feature extraction network; the splicing feature of each sentence is obtained by splicing the sentence representation and paragraph representation corresponding to each sentence; the temporal structure features of each sentence are compared through the linear layer network to determine whether each sentence in the adjacent sentences belongs to the same plot and output it.
[0098] The representation extraction network is used to extract the sentence representation of each sentence in adjacent sentences and the paragraph representation of each sentence. In some embodiments, the BERT model is selected as the representation extraction network. The sentence representation and paragraph representation corresponding to each sentence are concatenated to obtain the concatenated features. The temporal structure feature extraction network is used to extract the temporal structure features of each sentence from the concatenated features of each sentence. In some embodiments, a bidirectional GRU (Bidirectional Gated Recurrent Unit) is selected as the temporal structure feature extraction network to increase the temporal and spatial information in the representation. Finally, the temporal structure features of each sentence are compared through a linear layer network (LinearLayer) to determine whether each sentence in the adjacent sentences belongs to the same plot and output it.
[0099] In a specific embodiment, the plot division model can analyze the document sentence by sentence to determine whether adjacent sentences belong to the same plot.
[0100] like Figure 2 As shown, s i,jn represents the nth sentence in the jth paragraph of the i-th chapter, p i,j represents the jth paragraph of the i-th chapter, s i,jn and p i,j After the representation extraction network extracts the representation, we get es i,jn and ep i,j Then, concatenate the representation of each sentence with the representation of its paragraph to get esp i,jn , esp i,jn Send it to the temporal structure feature extraction network to obtain the temporal structure feature h i,jn Among them, s i,jn The previous sentence i,jn-1 The corresponding splicing representation exp i,jn-1 , sent to the temporal structure feature extraction network to obtain the temporal structure feature h i,jn-1 ,s i,jn The last sentence of i,jn+1 The corresponding splicing representation esp i,jn+1 , and is also sent to the temporal structure feature extraction network to obtain the temporal structure feature h i,jn+1, and then concatenate the temporal structure features corresponding to each sentence in the adjacent sentences to obtain the temporal concatenation feature |h i,jn -h i,jn-1 |h i,jn |h i,jn -h i,jn+1 |, send the time series splicing features to the Linear Layer to judge s through the Linear Layer i,jn With s i,jn-1 、s i,jn With s i,jn+1 Whether they belong to the same plot, get the output result O i,jn .
[0101] It should be noted that, when the adjacent sentences include the first two sentences in the document, or the adjacent sentences include the last two sentences in the document, only the temporal structure features of the two sentences are sent to the Linear Layer to determine whether the two sentences belong to the same plot through the Linear Layer.
[0102] The representation extraction network, temporal structure feature extraction network and linear layer network in the plot division model can be trained as a whole. Specifically, a large number of sample documents can be obtained as training samples. It should be noted that if music is composed for novels, novels of various genres need to be obtained as training samples. If music is composed for poetry, poetry of various genres need to be obtained as training samples. If music is composed for drama, drama of various genres need to be obtained as training samples. Exemplarily, if music is composed for novels, sample documents should include novels of multiple popular genres such as contemporary, urban, historical, fantasy, and Xianxia on multiple Chinese novel reading websites.
[0103] Then, relevant personnel need to fully understand the definition of plot division and sentiment classification tasks, and then read the sample documents. After reading, the plot content is divided and labeled to obtain a labeled data set. After obtaining the labeled plot data set, it is necessary to filter out illegal characters, extra spaces, and line breaks. At the same time, in order to ensure the accuracy of the plot unit division, two people can review each plot unit in the plot data set. If both people fail to pass the review, it means that the plot unit is questionable and the questionable plot unit will be discarded.
[0104] The sample document is input into the plot division model to obtain the prediction results output by the plot division model. The loss of the plot division model is determined by comparing the annotated plot units with the prediction results output by the plot division model. The parameters of the plot division model are adjusted with the goal of reducing the loss of the plot division model, and then the above training process is repeated until the plot division model meets the training requirements.
[0105] In some embodiments, relevant personnel may annotate the emotion categories of each plot unit in the obtained plot data set to obtain an emotion data set. In order to ensure the accuracy of the emotion category classification, two people may review each content in the emotion data set. If both people fail to pass the review, it means that the content is questionable and the questionable content is discarded. In this way, the training data set of the large language model in the above embodiment can be obtained. Based on this training data set, the large language model can be trained according to the records of the above embodiment.
[0106] In the above embodiment, sentences can be used as the dividing lines of plots, and the features of sentences and paragraphs can be combined to solve the problem of inaccurate plot division caused by non-standard segmentation of some documents.
[0107] As an optional implementation, another embodiment of the present application discloses that the steps of the above embodiment select music with the same emotional category as each plot unit as the background music of each plot unit, which may specifically include the following steps:
[0108] Select target music whose genre is consistent with the genre of the document from a preset music library; and select music whose emotional category is the same as that of each plot unit from the target music as background music for each plot unit.
[0109] In the embodiment of the present application, a music library is pre-set, and the music library stores music adapted to documents of different genres. For example, if the document is a novel, such as Figure 3 As shown, the music library includes music adapted to documents of multiple genres, such as contemporary, urban, historical, fantasy, and fairy tales. The music adapted to documents of any genre includes music of different emotional categories.
[0110] Therefore, after determining the emotion category of each plot unit, the corresponding music collection of the genre can be determined according to the genre of the document, and then music of the same emotion category can be selected from the music collection of the genre as the background music of each plot unit. If there are multiple music of the same emotion category, one can be randomly selected from them, which is not limited in this embodiment.
[0111] In this way, by first selecting a music collection with the same genre from the music library, and then selecting music of the same emotional category from the music collection with the same genre, music that matches the genre of the document can be matched.
[0112] Corresponding to the above-mentioned automatic music arrangement method, the present application embodiment also discloses an automatic music arrangement device, see Figure 4 As shown, the device comprises:
[0113] The division module 100 is used to divide the document into multiple plot units by detecting whether adjacent sentences in the document belong to the same plot; when adjacent sentences have the same plot elements, it means that the adjacent sentences belong to the same plot;
[0114] An input module 110 is used to input each plot unit and a prompt sentence into the large language model to obtain the emotion category of each plot unit output by the large language model; the prompt sentence is used to instruct the large language model to perform the task of determining the emotion category of each plot unit;
[0115] The selection module 120 is used to select music with the same emotion category as each plot unit as the background music of each plot unit.
[0116] As an optional implementation, another embodiment of the present application discloses that the device in the above embodiment further includes:
[0117] The detection module is used to extract the sentence representation of each sentence in adjacent sentences and the paragraph representation of the paragraph where each sentence is located; determine the temporal structure characteristics of each sentence according to the sentence representation and paragraph representation corresponding to each sentence; and determine whether each sentence in adjacent sentences belongs to the same plot by comparing the temporal structure characteristics of each sentence.
[0118] As an optional implementation, another embodiment of the present application discloses that the detection module in the above embodiment is specifically used for:
[0119] Adjacent sentences are input into a pre-trained plot division model so that the plot division model extracts the sentence representation of each sentence in the adjacent sentences and the paragraph representation of the paragraph where each sentence is located, and determines the temporal structural features of each sentence according to the sentence representation and paragraph representation corresponding to each sentence. By comparing the temporal structural features of each sentence, it is determined whether each sentence in the adjacent sentences belongs to the same plot and outputs it.
[0120] As an optional implementation, another embodiment of the present application discloses that the plot division model includes a representation extraction network, a temporal structure feature extraction network and a linear layer network; the detection module of the above embodiment is specifically used for:
[0121] Adjacent sentences are input into the representation extraction network, and the sentence representation of each sentence in the adjacent sentences and the paragraph representation of each sentence are extracted through the representation extraction network; the temporal structure feature of each sentence is extracted from the splicing features of each sentence through the temporal structure feature extraction network; the splicing feature of each sentence is obtained by splicing the sentence representation and paragraph representation corresponding to each sentence; the temporal structure features of each sentence are compared through the linear layer network to determine whether each sentence in the adjacent sentences belongs to the same plot and output it.
[0122] As an optional implementation, it is disclosed in another embodiment of the present application that the representation extraction network of the above embodiment includes a BERT network; and the temporal structure feature extraction network includes a bidirectional GRU network.
[0123] As an optional implementation, another embodiment of the present application discloses that the selection module 120 in the above embodiment is specifically used for:
[0124] Select target music whose genre is consistent with the genre of the document from a preset music library; and select music whose emotional category is the same as that of each plot unit from the target music as background music for each plot unit.
[0125] As an optional implementation method, another embodiment of the present application discloses that the prompt statement includes optional emotion categories for each plot unit, a description of each emotion category and a task description statement; the task description statement is used to instruct the large language model to select the emotion category corresponding to each plot unit from the optional emotion categories.
[0126] Specifically, the device provided in this embodiment belongs to the same application concept as the method provided in the above embodiment of this application, can execute the method provided in any of the above embodiments of this application, and has the corresponding functional modules and beneficial effects of the execution method. For the technical details not fully described in this embodiment, please refer to the specific processing content of the method provided in the above embodiment of this application, which will not be repeated here.
[0127] The functions implemented by the above modules can be implemented by the same or different processors respectively, and the embodiments of the present application are not limited thereto.
[0128] It should be understood that the units in the above devices can be implemented in the form of a processor calling software. For example, the device includes a processor, the processor is connected to a memory, and instructions are stored in the memory. The processor calls the instructions stored in the memory to implement any of the above methods or realize the functions of each unit of the device, wherein the processor can be a general-purpose processor, such as a CPU or a microprocessor, etc., and the memory can be a memory in the device or a memory outside the device. Alternatively, the units in the device can be implemented in the form of hardware circuits, and the functions of some or all units can be realized by designing the hardware circuits. The hardware circuit can be understood as one or more processors; for example, in one implementation, the hardware circuit is an ASIC, and the functions of some or all of the above units are realized by designing the logical relationship of the components in the circuit; for another example, in another implementation, the hardware circuit can be implemented by PLD, taking FPGA as an example, which can include a large number of logic gate circuits, and the connection relationship between the logic gate circuits is configured by the configuration file, so as to realize the functions of some or all of the above units. All units of the above devices can be implemented in the form of a processor calling software, or in the form of hardware circuits, or in part by a processor calling software, and the remaining part is implemented in the form of hardware circuits.
[0129] In an embodiment of the present application, a processor is a circuit with the ability to process signals. In one implementation, the processor may be a circuit with the ability to read and run instructions, such as a CPU, a microprocessor, a GPU, or a DSP; in another implementation, the processor may implement certain functions through the logical relationship of a hardware circuit, and the logical relationship of the hardware circuit is fixed or reconfigurable, such as a hardware circuit implemented by an ASIC or PLD, such as an FPGA. In a reconfigurable hardware circuit, the process of the processor loading a configuration document to implement the hardware circuit configuration can be understood as the process of the processor loading instructions to implement the functions of some or all of the above units. In addition, it can also be a hardware circuit designed for artificial intelligence, which can be understood as an ASIC, such as an NPU, TPU, DPU, etc.
[0130] It can be seen that each unit in the above device can be one or more processors (or processing circuits) configured to implement the above method, such as: CPU, GPU, NPU, TPU, DPU, microprocessor, DSP, ASIC, FPGA, or a combination of at least two of these processor forms.
[0131] In addition, all or part of the units in the above device can be integrated together, or can be implemented independently. In one implementation, these units are integrated together and implemented in the form of a SOC. The SOC may include at least one processor for implementing any of the above methods or implementing the functions of each unit of the device. The type of the at least one processor may be different, for example, including a CPU and an FPGA, a CPU and an artificial intelligence processor, a CPU and a GPU, etc.
[0132] An embodiment of the present application further provides a control device, which includes a processor and an interface circuit. The processor in the control device is connected to an input-output component through the interface circuit of the control device.
[0133] The input-output component specifically refers to a hardware component that enables a user to input information and output information to the user, such as a microphone, keyboard, handwriting tablet, touch screen, display, speaker, printer, etc.
[0134] The above-mentioned interface circuit can be any interface circuit that can realize the data communication function, for example, it can be a USB interface circuit, a Type-C interface circuit, a serial port circuit, a PCIE circuit, etc.
[0135] The processor in the control device is a circuit with signal processing capability, which improves the efficiency of music arrangement by executing any one of the automatic music arrangement methods introduced in the above embodiments. The specific implementation of the processor can refer to the above processor implementation, and the embodiments of this application are not strictly limited.
[0136] When the control device is applied to a device with a human-computer interaction function, the input and output components of the control device may be input components and output components on the device, such as a microphone, a keyboard, a handwriting tablet, a touch screen, a display, an audio player, etc. At the same time, the processor of the control device may be a CPU or GPU, etc. provided by the device, and the interface circuit of the control device may be an interface circuit between the information input component of the device and a processor such as a CPU or GPU.
[0137] Corresponding to the above-mentioned automatic music arrangement method, the embodiment of the present application also discloses an electronic device, see Figure 5 As shown, the electronic device includes:
[0138] Memory 200 and processor 210;
[0139] The memory 200 is connected to the processor 210 and is used to store programs;
[0140] The processor 210 is used to implement the automatic music arrangement method disclosed in any of the above embodiments by running the program stored in the memory 200.
[0141] Specifically, the electronic device may further include: a bus, a communication interface 220 , an input device 230 and an output device 240 .
[0142] The processor 210, the memory 200, the communication interface 220, the input device 230 and the output device 240 are connected to each other via a bus.
[0143] A bus may include a pathway that transfers information between components of a computer system.
[0144] The processor 210 may be a general-purpose processor, such as a general-purpose central processing unit (CPU), a microprocessor, etc., or an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application. It may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0145] The processor 210 may include a main processor, and may also include a baseband chip, a modem, and the like.
[0146] The memory 200 stores a program for executing the technical solution of the present application, and may also store an operating system and other key services. Specifically, the program may include a program code, and the program code includes computer operation instructions. More specifically, the memory 200 may include a read-only memory (ROM), other types of static storage devices that can store static information and instructions, a random access memory (RAM), other types of dynamic storage devices that can store information and instructions, a disk storage, a flash, and the like.
[0147] The input device 230 may include a device for receiving data and information input by a user, such as a keyboard, a mouse, a camera, a scanner, a light pen, a voice input device, a touch screen, a pedometer, or a gravity sensor.
[0148] Output device 240 may include devices that allow information to be output to a user, such as a display screen, printer, speaker, etc.
[0149] The communication interface 220 may include any transceiver or the like to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Network (WLAN), etc.
[0150] The processor 210 executes the program stored in the memory 200 and calls other devices, which can be used to implement the various steps of the automatic music arrangement method provided in the above embodiments of the present application.
[0151] In addition to the above methods and devices, the embodiments of the present application may also be computer program products, which include computer programs. When the computer programs are executed by a processor, the automatic music arrangement method provided by any of the above embodiments of the present application may be executed. Optionally, the computer program may be stored in a readable storage medium or in the cloud of a computer device; the processor of the computer device reads the computer program from the readable storage medium or the cloud.
[0152] The computer program product may be written in any combination of one or more programming languages to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages such as Java, C++, etc., and also conventional procedural programming languages such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0153] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK).
[0154] In addition, the embodiments of the present application may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes each step of the automatic music arrangement method provided in the above embodiments.
[0155] The computer readable storage medium may adopt any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may include, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0156] Specifically, the specific working contents of each part of the above-mentioned electronic device, computer program product and storage medium, as well as the specific processing contents when the computer program product or the computer program on the above-mentioned storage medium is executed by the processor, can all be found in the contents of the various embodiments of the above-mentioned automatic music arrangement method, and will not be repeated here.
[0157] For the aforementioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for the present application.
[0158] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0159] The steps in the methods of each embodiment of the present application can be adjusted in order, combined and deleted according to actual needs, and the technical features recorded in each embodiment can be replaced or combined.
[0160] The modules and sub-modules in the devices and terminals in the various embodiments of the present application can be combined, divided and deleted according to actual needs.
[0161] In the several embodiments provided in the present application, it should be understood that the disclosed terminals, devices and methods can be implemented in other ways. For example, the terminal embodiments described above are only schematic, for example, the division of modules or submodules is only a logical function division, and there may be other division methods in actual implementation, such as multiple submodules or modules can be combined or integrated into another module, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.
[0162] The modules or submodules described as separate components may or may not be physically separated, and the components of the modules or submodules may or may not be physical modules or submodules, that is, they may be located in one place, or they may be distributed on multiple network modules or submodules. Some or all of the modules or submodules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0163] In addition, each functional module or submodule in each embodiment of the present application may be integrated into one processing module, or each module or submodule may exist physically separately, or two or more modules or submodules may be integrated into one module. The above-mentioned integrated modules or submodules may be implemented in the form of hardware or in the form of software functional modules or submodules.
[0164] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0165] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly by hardware, software units executed by a processor, or a combination of the two. The software unit may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0166] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also 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 "including a..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0167] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An automatic music arrangement method, characterized in that: include: Dividing the document into a plurality of plot units by detecting whether adjacent sentences in the document belong to the same plot; When the adjacent sentences have the same plot elements, it means that the adjacent sentences belong to the same plot; Inputting each plot unit and prompt sentence into the large language model to obtain the emotion category of each plot unit output by the large language model; The prompt sentence is used to instruct the large language model to perform a task of determining the emotion category of each plot unit; Select music with the same emotional category as each plot unit as the background music of each plot unit.
2. The method according to claim 1, characterized in that The step of detecting whether adjacent sentences in a document belong to the same plot includes: Extracting the sentence representation of each sentence in the adjacent sentences and the paragraph representation of the paragraph where each sentence is located; Determine the temporal structure features of each sentence based on the sentence representation and paragraph representation corresponding to each sentence; By comparing the temporal structure features of each sentence, it is determined whether each sentence in the adjacent sentences belongs to the same plot.
3. The method according to claim 2, characterized in that The extracting the sentence representation of each sentence in the adjacent sentences and the paragraph representation of the paragraph where each sentence is located, determining the temporal structure features of each sentence according to the sentence representation and the paragraph representation corresponding to each sentence, and determining whether each sentence in the adjacent sentences belongs to the same plot by comparing the temporal structure features of each sentence, includes: The adjacent sentences are input into a pre-trained plot division model so that the plot division model extracts the sentence representation of each sentence in the adjacent sentences and the paragraph representation of the paragraph where each sentence is located, and determines the temporal structural features of each sentence based on the sentence representation and paragraph representation corresponding to each sentence. By comparing the temporal structural features of each sentence, it is determined whether each sentence in the adjacent sentences belongs to the same plot and outputs it.
4. The method according to claim 3, characterized in that The plot division model includes a representation extraction network, a temporal structure feature extraction network and a linear layer network; The step of inputting the adjacent sentences into a pre-trained plot division model so that the plot division model extracts the sentence representation of each sentence in the adjacent sentences and the paragraph representation of the paragraph to which each sentence belongs, determining the temporal structure features of each sentence according to the sentence representation and paragraph representation corresponding to each sentence, and determining whether each sentence in the adjacent sentences belongs to the same plot and outputting the result by comparing the temporal structure features of each sentence, comprises: Inputting the adjacent sentences into the representation extraction network, and extracting the sentence representation of each sentence in the adjacent sentences and the paragraph representation of the paragraph where each sentence is located through the representation extraction network; The temporal structure feature extraction network extracts the temporal structure feature of each sentence from the concatenation features of each sentence; the concatenation feature of each sentence is obtained by concatenating the sentence representation and the paragraph representation corresponding to each sentence; The linear layer network is used to compare the temporal structure features of each sentence, determine whether each sentence in the adjacent sentences belongs to the same plot, and output it.
5. The method according to claim 4, characterized in that The representation extraction network includes a BERT network; the temporal structure feature extraction network includes a bidirectional GRU network.
6. The method according to claim 1, characterized in that The step of selecting music of the same emotional category as each plot unit as background music for each plot unit includes: Selecting target music whose genre is consistent with the genre of the document from a preset music library; Music having the same emotional category as that of each plot unit is selected from the target music as background music of each plot unit.
7. The method according to claim 1, characterized in that The prompt sentence includes the optional emotion category of each plot unit, the description of each emotion category and the task description sentence; The task description statement is used to instruct the large language model to select the emotion category corresponding to each plot unit from the optional emotion categories.
8. An automatic music arrangement device, characterized in that: include: A division module, for dividing the document into a plurality of plot units by detecting whether adjacent sentences in the document belong to the same plot; When the adjacent sentences have the same plot elements, it means that the adjacent sentences belong to the same plot; An input module, used for inputting each plot unit and prompt sentence into the large language model to obtain the emotion category of each plot unit output by the large language model; The prompt sentence is used to instruct the large language model to perform a task of determining the emotion category of each plot unit; The selection module is used to select music with the same emotional category as each plot unit as the background music of each plot unit.
9. An electronic device, characterized in that: include: Memory and processor; Wherein, the memory is used to store programs; The processor is used to implement the method according to any one of claims 1 to 7 by running the program in the memory.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.