Robot voice configuration method, electronic equipment and storage medium
By searching for text data in the robot's local storage and sending it to the cloud to generate voice files, the problem of inefficient robot speech synthesis is solved, and the effect of resource saving and cost reduction is achieved.
Patent Information
- Application Number
- CN202411116630.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2024-12-13
AI Technical Summary
The existing robot voice synthesis technology is inefficient, occupies a large amount of local storage and computing resources, and each robot synthesizes voice independently, resulting in repeated work increasing the cost of voice synthesis.
By finding out whether the same text data exists in the robot local storage, if it does not exist, text data is sent to the cloud for voice file generation, and receiving and applying the target voice file generated in the cloud for voice configuration, reducing duplicate generation and resource usage.
It reduces the cost of speech synthesis, improves the efficiency of speech synthesis, and reduces the use of local storage and computing resources of robots.
Smart Images

Figure CN119132275A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of robot technology, and in particular to a robot voice configuration method, electronic equipment and storage medium. Background Art
[0002] Robots are mechanical devices that can automatically perform tasks. They can run pre-programmed programs and complete various types of tasks. With the development of mobile Internet and artificial intelligence technology, robots are widely used in various service places to provide customers with services such as guiding and delivering goods. In actual applications, when robots perform tasks, they often need to be configured with voice information to provide corresponding services.
[0003] In current intelligent speech technology, when text-to-speech (TTS) is used for speech synthesis, a series of processes that consume system resources and time are required, such as processing text, converting text to pinyin, and converting pinyin to matrix. In the prior art, the robot speech management system relies on local resources for speech synthesis, which not only occupies a large amount of local storage and computing resources of the robot, but also each robot independently synthesizes speech, which results in excessive duplication of work, increased speech synthesis costs, and low speech synthesis efficiency. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a robot voice configuration method, an electronic device and a storage medium, aiming to solve the technical problem of low efficiency of robot voice synthesis in the prior art.
[0005] To solve the above technical problems, the embodiments of the present invention provide the following technical solutions:
[0006] In a first aspect, an embodiment of the present invention provides a robot voice configuration method, which is applied to a robot, and the method includes:
[0007] Determine whether there is second text data identical to the first text data among a plurality of text data locally stored by the robot, where the first text data is text data for generating a voice file;
[0008] When the second text data does not exist, sending the first text data to the cloud, so that the cloud generates a corresponding target voice file based on the first text data after receiving the first text data;
[0009] Receive the target voice file sent by the cloud, and complete the voice configuration of the robot based on the target voice file.
[0010] In some embodiments, the text data includes standard content and contextual content;
[0011] The determining whether there is second text data identical to the first text data among the plurality of text data locally stored by the robot comprises:
[0012] Performing content segmentation on the first text data and the plurality of text data locally stored by the robot respectively to obtain first standard content and first context content of the first text data and second standard content and second context content of the plurality of text data;
[0013] comparing the first standard content with the second standard content, and the first contextual content with the second contextual content;
[0014] If the semantics of the first standard content is different from the semantics of the second standard content, and / or the semantics of the first context content is different from the semantics of the second context content, then there is no second text data identical to the first text data among the plurality of text data locally stored by the robot;
[0015] If the semantics of the first standard content is the same as the semantics of the second standard content, and the semantics of the first context content is the same as the semantics of the second context content, then second text data identical to the first text data exists in the plurality of text data locally stored by the robot.
[0016] In some embodiments, the method further comprises:
[0017] When the second text data exists, if the number of voice files corresponding to the second text data is one, the voice configuration of the robot is completed based on the voice file corresponding to the second text data; if the number of voice files corresponding to the second text data is at least two, one of the at least two voice files corresponding to the second text data is selected to complete the voice configuration of the robot.
[0018] In some embodiments, the method further comprises:
[0019] During the initialization and startup of the robot, a first voice file is compared with a second voice file, wherein the first voice file is a voice file stored locally on the robot, and the second voice file is a voice file stored in the cloud and corresponding to the first voice file;
[0020] If the version of the first voice file is lower than the version of the second voice file, a voice file update request is sent to the cloud, so that the cloud sends the second voice file to the robot after receiving the voice file update request.
[0021] In a second aspect, an embodiment of the present invention provides a robot voice configuration method, which is applied to the cloud, and the method includes:
[0022] receiving first text data sent by the robot, and determining whether there is third text data identical to the first text data in the plurality of text data stored in the cloud, wherein the first text data is text data for generating a voice file;
[0023] When the third text data does not exist, generating a corresponding target voice file based on the first text data;
[0024] The target voice file is sent to the robot, so that after receiving the target voice file, the robot completes the voice configuration of the robot based on the target voice file.
[0025] In some embodiments, the text data includes standard content and contextual content;
[0026] The determining whether there is third text data identical to the first text data among the plurality of text data stored in the cloud includes:
[0027] Performing content segmentation on the first text data and the plurality of text data stored in the cloud, respectively, to obtain first standard content and first context content of the first text data and third standard content and third context content of the plurality of text data;
[0028] comparing the first standard content with the third standard content, and the first contextual content with the third contextual content;
[0029] If the semantics of the first standard content is different from the semantics of the third standard content, and / or the semantics of the first context content is different from the semantics of the third context content, then there is no third text data identical to the first text data among the plurality of text data stored in the cloud;
[0030] If the semantics of the first standard content is the same as the semantics of the third standard content, and the semantics of the first context content is the same as the semantics of the third context content, then there is third text data that is the same as the first text data among the plurality of text data stored in the cloud.
[0031] In some embodiments, the first text data includes a time stamp, and the time stamp is used to indicate the urgency of generating the voice file;
[0032] The generating a corresponding target voice file based on the first text data includes:
[0033] Acquire a time mark of the first text data, wherein the time mark includes an urgent generation mark and a common generation mark;
[0034] If the time mark is an urgent generation mark, generating a corresponding target voice file from the first text data;
[0035] If the time mark is a common generation mark, storing the first text data in a first container in the cloud;
[0036] When the amount of the first text data in the first container is greater than or equal to a preset amount, the first text data in the first container is generated into a corresponding target voice file.
[0037] In some embodiments, the target voice file includes voice purpose, voice type, and creation time;
[0038] After generating a corresponding target voice file based on the first text data, the method further includes:
[0039] According to the voice purpose, voice type and creation time of the target voice file, the target voice file is stored in the storage level corresponding to the voice storage container, wherein the voice storage container includes several storage levels, each storage level can be used to store voice files.
[0040] In a third aspect, an embodiment of the present invention provides an electronic device, including:
[0041] A processor and a memory communicatively connected to the processor;
[0042] The memory stores computer program instructions executable by the processor, and when the computer program instructions are called by the processor, the processor executes any one of the robot voice configuration methods proposed in the first aspect or the second aspect, or executes steps in any possible implementation of any one of the robot voice configuration methods proposed in the first aspect or the second aspect.
[0043] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which is stored computer program instructions executable by a processor, and when the computer program instructions are called by the processor, the processor executes any one of the robot voice configuration methods proposed in the first aspect or the second aspect, or executes the steps in any possible implementation of any one of the robot voice configuration methods proposed in the first aspect or the second aspect.
[0044] Beneficial effects of the embodiments of the present invention: Different from the prior art, the robot voice configuration method provided by the embodiments of the present invention is applied to a robot, and the method includes: determining whether there is second text data identical to the first text data among a plurality of text data locally stored by the robot, the first text data being the text data of the voice file to be generated; when the second text data does not exist, sending the first text data to the cloud, so that the cloud generates a corresponding target voice file based on the first text data after receiving the first text data; receiving the target voice file sent by the cloud, and completing the voice configuration of the robot based on the target voice file.
[0045] In the present invention, it is first determined whether there is second text data identical to the first text data in the local storage of the robot. If the second text data does not exist, it means that there is no corresponding voice file in the local storage of the robot, and the first text data is sent to the cloud to synthesize the voice file. After the cloud generates the corresponding target voice file based on the first text data, it sends the target voice file to the robot, and the robot completes the corresponding voice configuration based on the received target voice file. This method reduces the generation of duplicate voice files by determining whether there are voice files available for reuse in the local storage of the robot, and after determining that a voice file needs to be generated, the voice file is generated using the cloud, without occupying too much local storage and computing resources of the robot, thereby reducing the cost of speech synthesis and improving the efficiency of speech synthesis. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art description. Obviously, the drawings described below only illustrate certain embodiments of the present invention and should not be regarded as limiting the scope of protection. For those of ordinary skill in the art, other related drawings can also be obtained based on these drawings without creative work.
[0047] Figure 1 is a schematic diagram of an application scenario of a robot voice configuration method provided by some embodiments of the present invention;
[0048] Figure 2 is a schematic diagram of the structure of an electronic device provided by some embodiments of the present invention;
[0049] Figure 3 is a flowchart of a robot voice configuration method provided by some embodiments of the present invention;
[0050] Figure 4 yes Figure 3 A schematic diagram of a sub-flow of step S100 in the robot voice configuration method shown in the embodiment;
[0051] Figure 5 is a flowchart of a robot voice configuration method provided by other embodiments of the present invention;
[0052] Figure 6 yes Figure 5 A schematic diagram of a sub-flow chart of step S500 in the robot voice configuration method shown in the embodiment. DETAILED DESCRIPTION
[0053] In order to make the purpose and advantages of the embodiments of the present invention easier to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. The detailed description of the embodiments of the present invention in the drawings below does not limit the scope of protection claimed by the present invention, but only represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0054] It should be noted that, if no conflict is constituted, the various technical features involved in the embodiments of the present invention described below can be combined with each other, and are all within the scope of protection of the present invention. In addition, although the functional modules are divided in the device or structural schematic diagram, and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a different order from the module division in the device, or in a different order from the flow chart. In addition, the "first", "second", "third" and other similar expressions used herein do not limit the data and execution order, but are only for the purpose of convenience of explanation and to distinguish between the same or similar items with basically the same functions and effects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features.
[0055] Unless otherwise defined, the technical terms and scientific terms used in this specification have the same meanings as those generally understood by those of ordinary skill in the art of the present invention. The terms used in this specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. It should be understood that the term "and / or" used in this specification includes any and all combinations of one or more of the related listed items.
[0056] See also Figure 1 , Figure 1 A schematic diagram of an application scenario of a robot voice configuration method provided in some embodiments of the present invention.
[0057] like Figure 1As shown, in this application scenario, there are: a robot 100 and a cloud 200, and the robot 100 and the cloud 200 are connected via a network communication. It should be understood that examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0058] In the embodiment of the present invention, the robot 100 may be a mobile robot based on a SLAM system, for example, it may be any one or more of a cleaning robot, a delivery robot, a pet robot, a disinfection robot, a transport robot, a nursing robot, a remote monitoring robot, etc. Among them, the cleaning robot includes but is not limited to: a sweeping robot, a vacuuming robot, a mopping robot, or a floor washing robot.
[0059] It is worth noting that the cloud 200 can be any one or more of a suitable speech synthesis device, system, platform, etc. having a speech synthesis function. For example, the cloud 200 can be a cloud service platform, a cloud service system, a cloud computing device, a cloud storage device, a cloud generation device, a cloud server, etc.
[0060] It should be understood that Figure 1 The application scenario shown only schematically shows a situation in which a robot 100 and a cloud 200 cooperate with each other to generate a voice file corresponding to the text data of the voice file to be generated, and does not impose any limitation on any situation such as the structure, type and number of the robot 100 and the cloud 200 in other application scenarios or embodiments. For example, in some other application scenarios, the robot 100 can send the text data of the voice file to be generated to two or more clouds 200, so that the two or more clouds 200 generate the corresponding target voice file according to the text data of the voice file to be generated after receiving the text data of the voice file to be generated.
[0061] In order to facilitate understanding of the robot voice configuration method provided by the embodiment of the present invention, the electronic device provided by the embodiment of the present invention is first introduced in detail.
[0062] See also Figure 2 , Figure 2 A schematic structural diagram of an electronic device 110 provided in some embodiments of the present invention is shown.
[0063] In some embodiments, the electronic device 110 is deployed on the robot 100 or the cloud 200, and is connected to the robot 100 or the cloud 200 for communication. Specifically, the electronic device 110 can be independently installed inside or outside the robot 100 or the cloud 200, or the electronic device 110 can also be integrated inside or outside the robot 100 or the cloud 200, and the embodiment of the present invention does not impose any restrictions on this. The robot 100 and the cloud 200 can perform any robot voice configuration method provided in the embodiment of the present invention through the electronic device 110, or perform any possible implementation steps of any robot voice configuration method provided in the embodiment of the present invention, so as to implement any robot voice configuration method provided in the embodiment of the present invention.
[0064] For example, Figure 2 As shown, the electronic device 110 includes at least one processor 111 and a memory 112 ( Figure 2 In the example of a bus system connection and a processor, the components in the electronic device 110 are coupled together through the bus system 113, and the bus system 113 is used to realize the connection and communication between these components. It is easy to understand that the bus system 113 includes not only a data bus, but also a power bus, a control bus, and a status signal bus. However, for the sake of clarity and brevity, Figure 2 In the figure, various buses are labeled as bus system 113. It should be understood that Figure 2 The structure shown in the embodiment is only for illustration and does not impose any limitation on the structure of the electronic device 110. Figure 2 More or fewer components as shown, or with Figure 2 Different configurations are shown.
[0065] Specifically, the processor 111 is used to provide computing and control capabilities to control the electronic device 110 to perform corresponding tasks. For example, the robot 100 and / or the cloud 200 are controlled to perform any robot voice configuration method provided in the embodiment of the present invention, or to perform any steps in any possible implementation of any robot voice configuration method provided in the embodiment of the present invention. Those skilled in the art can understand that the processor 111 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can 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 gates or transistor logic devices, discrete hardware components.
[0066] The memory 112 is a non-transitory computer-readable storage medium, which can be used to store non-transitory software programs, non-transitory computer executable programs, instructions and modules, for example, programs, instructions and modules corresponding to the robot voice configuration method in the embodiment of the present invention. In some embodiments, the memory 112 may include a program storage area and a data storage area, and the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the processor 111, etc. The processor 111 executes various functional applications and data processing of the electronic device 110 by running the non-transitory software programs, instructions and modules stored in the memory 112, so as to implement any robot voice configuration method provided in the embodiment of the present invention, or execute any possible implementation of any robot voice configuration method provided in the embodiment of the present invention. Among them, the memory 112 may include a high-speed random access memory, and may also include a non-transitory memory. For example, at least one disk storage device, a flash memory device or other non-transitory solid-state storage device. In some embodiments, the memory 112 may also include a memory remotely arranged relative to the processor 111, and these remote memories may be connected to the processor 111 through a communication network. It can be understood that examples of the above-mentioned communication network include but are not limited to the Internet, corporate intranet, local area network, mobile communication network and combinations thereof.
[0067] It can be understood from the above that the robot voice configuration method provided in the embodiment of the present invention can be implemented by various suitable types of robots and / or clouds with certain computing and control capabilities. For example, it can be implemented by the above-mentioned robot 100 and / or cloud 200. Specifically, it is implemented by the electronic device 110 in the above-mentioned robot 100 and / or cloud 200. The robot voice configuration method provided in the embodiment of the present invention is described in detail below in conjunction with the exemplary applications and implementations of the robots and cloud provided in the embodiment of the present invention.
[0068] First, a robot voice configuration method applied to a robot provided in an embodiment of the present invention is described in detail.
[0069] See also Figure 3 , Figure 3 A schematic flow chart of a robot voice configuration method provided in some embodiments of the present invention is shown.
[0070] Those skilled in the art will appreciate that the robot voice configuration method provided in the embodiment of the present invention can be applied to the above robot (eg, robot 100). Specifically, the robot voice configuration method is executed by one or at least two processors of an electronic device in the robot.
[0071] like Figure 3 As shown, the robot voice configuration method includes but is not limited to the following steps S100-S300:
[0072] S100: Determine whether there is second text data identical to first text data among a plurality of text data stored locally in the robot, where the first text data is text data for generating a voice file.
[0073] Specifically, after receiving the voice configuration request, the robot responds to the voice configuration request, parses the voice configuration request, and obtains relevant voice generation information. Among them, the voice generation information includes text data of the voice file to be generated, that is, the first text data. It is easy to understand that the voice configuration request can be a request information generated by the user operating the robot display interface, or it can also be a request information generated by the robot's timer timing trigger, or it can also be a request information generated by the cloud and sent to the robot, or it can also be any other suitable voice configuration request information. For example, in some embodiments, when the robot is a delivery robot, the delivery robot adds a warehouse No. 3, and the delivery robot does not have any voice files about warehouse No. 3 in the local storage. When a customer's items are placed in warehouse No. 3, in order to inform the customer to collect the items placed in warehouse No. 3, a new voice file for informing the customer to collect the items placed in warehouse No. 3 needs to be generated. The user can operate the robot's display interface and enter the text content "Hello, your items are placed in warehouse No. 3, please collect them in time." Then the robot generates a corresponding voice configuration request.
[0074] Among them, the text data, as the text content of text-to-speech conversion, is unique. Therefore, after obtaining the first text data, several text data stored locally by the robot are compared with the first text data one by one to determine whether there is a second text data that is the same as the first text data among the several text data stored locally by the robot.
[0075] In some embodiments, several text data stored locally by the robot can be saved in an appropriate data structure, such as a hash table, a dictionary, or a database, for quick search and comparison. When the robot uses a hash table or a dictionary to store text data, the key (Key) serves as the unique identifier of the text data or the text data itself, and the value (Value) can be the text content or other relevant information of the text data. Look up the unique identifier of the first text data or the first text data itself in the hash table or dictionary. If there is a corresponding key, it means that there is a second text data identical to the first text data in the several text data stored locally by the robot. If there is no corresponding key, it means that there is no second text data identical to the first text data in the several text data stored locally by the robot.
[0076] It should be understood that the multiple text data stored locally by the robot can be compared with the first text data one by one in any other suitable manner to determine whether there is second text data that is identical to the first text data among the multiple text data stored locally by the robot. The embodiment of the present invention does not impose any limitation on this.
[0077] In some embodiments, the text data includes standard content and contextual content. When comparing the first text data with several text data stored locally by the robot, by comparing the standard content of the first text data and the several text data stored locally by the robot, as well as comparing the contextual content of the first text data and the several text data stored locally by the robot, it is determined whether there is second text data identical to the first text data in the several text data stored locally by the robot.
[0078] See also Figure 4 , Figure 4 A sub-flow diagram of step S100 in the robot voice configuration method provided in some embodiments of the present invention is shown.
[0079] like Figure 4 As shown, in some embodiments, determining whether there is second text data identical to the first text data among the plurality of text data locally stored by the robot specifically includes but is not limited to the following steps S110-S140:
[0080] S110: Performing content segmentation on the first text data and the plurality of text data stored locally by the robot respectively to obtain the first standard content and the first context content of the first text data and the second standard content and the second context content of the plurality of text data.
[0081] The standard content refers to the main information or core part of the text data, and the context content refers to other parts of the text data that are set around the standard content. For example, in some embodiments, the text content of a certain text data is "Hello, your item is placed in warehouse No. 3, please collect it in time." Then, the standard content of the text data is: "Your item is placed in warehouse No. 3", and the context content of the text data is: "Hello", "Please collect it in time".
[0082] Specifically, the standard content and context content in the first text data can be identified through semantic recognition technology, and then the first text data can be segmented using the split_text function or other appropriate functions, methods or technologies to obtain the first standard content and first context content of the first text data.
[0083] Similarly, semantic recognition technology can be used to identify the standard content and contextual content in each text data stored locally by the robot, and then the split_text function or other appropriate functions, methods or technologies can be used to split each text data stored locally by the robot to obtain the second standard content and second contextual content of each text data stored locally by the robot.
[0084] In some embodiments, after segmenting to obtain the first standard content and the first context content of the first text data, and the second standard content and the second context content of each text data stored locally by the robot, they can be stored in a suitable data structure for subsequent processing and comparison.
[0085] In some embodiments, segmentation rules may be defined according to actual usage requirements, for example, using regular expressions to match specific patterns to perform content segmentation on text data.
[0086] In some embodiments, before segmenting special text data containing special symbols, tags or formats, the special text data may be preprocessed, for example, by removing or converting special symbols to convert the special text data into text data in a standard format.
[0087] S120: Compare the first standard content with the second standard content, and the first context content with the second context content.
[0088] Specifically, after segmenting to obtain the first standard content and the first context content of the first text data, the second standard content and the second context content of each text data stored locally by the robot, a string similarity algorithm (e.g., Jaccard similarity, Levenshtein distance) can be used to respectively compare the first standard content of the first text data and the second standard content of each text data stored locally by the robot, and respectively compare the first context content of the first text data with the second context content of each text data stored locally by the robot. In some embodiments, the SequenceMatcher function can be used to calculate the similarity between the first standard content and the second standard content, and to calculate the similarity between the first context content and the second context content, wherein the similarity score is between 0 and 1, 1 represents completely identical, 0 represents completely different, and between 0 and 1 represents partially identical.
[0089] It is understandable that other similarity algorithms or natural language processing techniques (such as word vectors, BERT models, etc.) can also be used to improve the accuracy and efficiency of the comparison.
[0090] S130: If the semantics of the first standard content is different from the semantics of the second standard content, and / or the semantics of the first context content is different from the semantics of the second context content, then there is no second text data identical to the first text data among the plurality of text data locally stored by the robot.
[0091] S140: If the semantics of the first standard content is the same as the semantics of the second standard content, and the semantics of the first context content is the same as the semantics of the second context content, then there is second text data that is the same as the first text data among the plurality of text data locally stored by the robot.
[0092] Specifically, if the comparison determines that the first standard content of the first text data is different from the second standard content of each text data stored locally by the robot, and / or the first context content of the first text data is different from the second context content of each text data stored locally by the robot, it means that each text data stored locally by the robot is different from the first text data, that is, there is no second text data that is the same as the first text data among the several text data stored locally by the robot.
[0093] In some embodiments, if comparison determines that the first standard content of the first text data is the same as the second standard content of at least one text data stored locally by the robot, and the first context content of the first text data is the same as the second context content of the at least one text data, it means that at least one text data stored locally by the robot is the same as the first text data, that is, there is second text data that is the same as the first text data among the several text data stored locally by the robot.
[0094] S200: When the second text data does not exist, the first text data is sent to the cloud, so that the cloud generates a corresponding target voice file based on the first text data after receiving the first text data.
[0095] Specifically, when there is no second text data that is identical to the first text data among the several text data stored locally by the robot, it means that a voice file corresponding to the first text data needs to be generated. The robot then sends the first text data to the cloud through a suitable communication method (such as WiFi network, 4G network, 5G network, etc.), so that after receiving the first text data, the cloud generates a corresponding target voice file based on the received first text data.
[0096] In some embodiments, the robot may send the first text data to the cloud via an HTTP request, for example, using the requests.post method to send the first text data to a cloud API.
[0097] S300: Receive the target voice file sent by the cloud, and complete the voice configuration of the robot based on the target voice file.
[0098] Specifically, after receiving the first text data and generating a corresponding target voice file based on the first text data, the cloud sends the generated target voice file to the robot through an appropriate communication method (such as Wi-Fi network, 4G network, 5G network, etc.).
[0099] The robot receives the target voice file sent from the cloud, stores the received target voice file in the robot's local memory or storage unit, and then uses the received target voice file to update the robot's voice configuration, that is, loads the file storage path of the received target voice file to the corresponding voice engine, so that when the target voice file needs to be used, the target voice file stored in the robot's local memory or storage unit can be obtained and read through the configuration function of the voice engine.
[0100] In some embodiments, using the target voice file to update the voice configuration of the robot may also include other operations, such as verifying the target voice file, playing the target voice file, associating the target voice file with the first text data, storing the associated target voice file and the first text data in the memory or storage unit of the robot, etc. Those skilled in the art should understand that any other suitable operations may also be included, and the embodiments of the present invention do not impose any limitation on this.
[0101] In some embodiments, if there are one or more second text data that are the same as the first text data among several text data stored locally by the robot, that is, there are one or more voice files corresponding to the second text data in the local storage of the robot, the voice configuration of the robot is completed based on the voice file or by selecting one of the voice files from multiple voice files.
[0102] In some embodiments, the robot voice configuration method further includes but is not limited to the following steps S400:
[0103] S400: When there is second text data, if the number of voice files corresponding to the second text data is one, the voice configuration of the robot is completed based on the voice file corresponding to the second text data; if the number of voice files corresponding to the second text data is at least two, one of the at least two voice files corresponding to the second text data is selected to complete the voice configuration of the robot.
[0104] Specifically, when there is one or more second text data identical to the first text data among several text data stored locally in the robot, it means that there is no need to generate a voice file corresponding to the first text data, and there are one or more voice files corresponding to the second text data in the local storage of the robot.
[0105] When the number of voice files corresponding to the second text data is one, the robot obtains the voice file corresponding to the second text data from the local storage, and completes the voice configuration of the robot based on the voice file.
[0106] When the number of voice files corresponding to the second text data is at least two, the robot obtains at least two voice files corresponding to the second text data from the local storage, selects one of the most suitable voice files from the at least two voice files, and then completes the voice configuration of the robot based on the selected voice file. It is easy to understand that one of the most suitable voice files can be selected from at least two voice files according to a preset rule. For example, in some embodiments, the preset rule is to select the voice file with the latest generation time as the most suitable voice file. In some other embodiments, the preset rule is to select the voice file with the smallest storage space as the most suitable voice file. Obviously, one of the most suitable voice files can also be selected from at least two voice files according to any other suitable preset rules, and the embodiment of the present invention does not impose any restrictions on this.
[0107] In some embodiments, the robot can detect and determine whether the first voice file stored locally is the same version as the second voice file stored in the cloud and corresponding to the first voice file during each initialization startup process, thereby ensuring that the voice files in the robot's local storage are the latest and available, improving the robot's voice service quality, and optimizing the user experience.
[0108] Exemplarily, in some embodiments, the robot voice configuration method further includes but is not limited to the following steps S401-S402:
[0109] S401: During the initialization and startup of the robot, a first voice file is compared with a second voice file, where the first voice file is a voice file stored locally on the robot, and the second voice file is a voice file stored in the cloud and corresponding to the first voice file.
[0110] Specifically, the robot locally stores a first voice file for use by the robot, that is, the first voice file is a voice file stored locally on the robot for use by the robot. The cloud stores a second voice file corresponding to the first voice file, that is, the second voice file is a voice file stored in the cloud and corresponding to the first voice file.
[0111] During the initialization process, the robot downloads the second voice file corresponding to the first voice file from the cloud and saves it to the robot's local storage. Then, by using the extract_audio_features function and the Librosa library, the feature information (such as version, MFCC (Mel-frequency cepstral coefficient), spectrogram, etc.) of the first voice file and the second voice file are extracted respectively, and the feature information of the first voice file and the second voice file are compared to see if they are the same. For example, in an embodiment of the present invention, the versions of the first voice file and the second voice file are compared to see if they are the same.
[0112] S402: If the version of the first voice file is lower than the version of the second voice file, a voice file update request is sent to the cloud, so that the cloud sends the second voice file to the robot after receiving the voice file update request.
[0113] Specifically, if the comparison determines that the version of the first voice file is lower than the version of the second voice file, it means that the first voice file in the local storage of the robot is not the latest, may contain errors or is unavailable, and it is necessary to obtain the latest available second voice file corresponding to the first voice file from the cloud. The robot sends a voice file update request to the cloud through a suitable communication method (such as WiFi network, 4G network, 5G network, etc.), so that after receiving the voice file update request, the cloud sends the latest available second voice file corresponding to the first voice file to the robot.
[0114] In summary, the robot voice configuration method provided by the embodiment of the present invention is applied to a robot, and the method includes: determining whether there is second text data that is the same as the first text data among a plurality of text data stored locally by the robot, the first text data being the text data of the voice file to be generated; when the second text data does not exist, sending the first text data to the cloud, so that the cloud generates a corresponding target voice file based on the first text data after receiving the first text data; receiving the target voice file sent by the cloud, and completing the voice configuration of the robot based on the target voice file.
[0115] In this embodiment, it is first determined whether there is second text data identical to the first text data in the local storage of the robot. If the second text data does not exist, it means that there is no corresponding voice file in the local storage of the robot, and the first text data is sent to the cloud to synthesize the voice file. After the cloud generates the corresponding target voice file based on the first text data, it sends the target voice file to the robot, and the robot completes the corresponding voice configuration based on the received target voice file. This method reduces the generation of duplicate voice files by determining whether there are voice files that can be reused in the local storage of the robot, and after determining that a voice file needs to be generated, the voice file is generated using the cloud, without occupying too much local storage and computing resources of the robot, thereby reducing the cost of speech synthesis and improving the efficiency of speech synthesis.
[0116] Next, the robot voice configuration method applied to the cloud provided by an embodiment of the present invention is described in detail.
[0117] See also Figure 5 , Figure 5 A schematic flow chart of a robot voice configuration method provided in some embodiments of the present invention is shown.
[0118] Those skilled in the art will appreciate that the robot voice configuration method provided in the embodiment of the present invention can be applied to the cloud (e.g., cloud 200). Specifically, the robot voice configuration method is executed by one or at least two processors of an electronic device in the cloud.
[0119] like Figure 5 As shown, the robot voice configuration method includes but is not limited to the following steps S500-S700:
[0120] S500: Receive first text data sent by the robot, and determine whether there is third text data identical to the first text data among a plurality of text data stored in the cloud, where the first text data is text data for generating a voice file.
[0121] Specifically, the robot sends the first text data to the cloud through a suitable communication method (for example, WiFi network, 4G network, 5G network, etc.), the cloud receives the first text data sent by the robot, and then compares the plurality of text data stored in the cloud with the first text data one by one to determine whether there is a third text data identical to the first text data in the plurality of text data stored in the cloud. The first text data is the text data of the voice file to be generated.
[0122] In some embodiments, several text data stored in the cloud can be saved in an appropriate data structure, such as a hash table, a dictionary, or a database, etc., for quick search and comparison. When the robot uses a hash table or a dictionary to store text data, the key (Key) serves as the unique identifier of the text data or the text data itself, and the value (Value) can be the text content or other relevant information of the text data. Look up the unique identifier of the first text data or the first text data itself in the hash table or dictionary. If there is a corresponding key, it means that there is a third text data identical to the first text data in the several text data stored in the cloud. If there is no corresponding key, it means that there is no third text data identical to the first text data in the several text data stored in the cloud.
[0123] It should be understood that the plurality of text data stored in the cloud can be compared with the first text data one by one in any other suitable manner to determine whether there is a third text data identical to the first text data in the plurality of text data stored in the cloud, and the embodiment of the present invention does not impose any limitation on this.
[0124] In some embodiments, the text data includes standard content and contextual content. When comparing the first text data with several text data stored in the cloud, by comparing the standard content of the first text data with the several text data stored in the cloud, and comparing the contextual content of the first text data with the several text data stored in the cloud, it is determined whether there is a third text data identical to the first text data in the several text data stored in the cloud.
[0125] See also Figure 6 , Figure 6 A sub-flow diagram of step S500 in the robot voice configuration method provided in some embodiments of the present invention is shown.
[0126] like Figure 6 As shown, in some embodiments, determining whether there is third text data identical to the first text data among the plurality of text data stored in the cloud specifically includes but is not limited to the following steps S510-S540:
[0127] S510: Performing content segmentation on the first text data and the plurality of text data stored in the cloud to obtain first standard content and first context content of the first text data and third standard content and third context content of the plurality of text data.
[0128] Among them, standard content refers to the main information or core part of the text data, and contextual content refers to other parts of the text data that are set around the standard content.
[0129] Specifically, the standard content and context content in the first text data can be identified through semantic recognition technology, and then the first text data can be segmented using the split_text function or other suitable functions, methods or technologies to obtain the first standard content and first context content of the first text data.
[0130] Similarly, semantic recognition technology can be used to identify the standard content and contextual content in each text data stored in the cloud, and then the split_text function or other appropriate functions, methods or technologies can be used to split each text data stored in the cloud to obtain the third standard content and third contextual content of each text data stored in the cloud.
[0131] In some embodiments, after segmenting to obtain the first standard content and the first context content of the first text data, and the third standard content and the third context content of each text data stored in the cloud, they can be stored in a suitable data structure for subsequent processing and comparison.
[0132] In some embodiments, segmentation rules may be defined according to actual usage requirements, for example, using regular expressions to match specific patterns to perform content segmentation on text data.
[0133] In some embodiments, before segmenting special text data containing special symbols, tags or formats, the special text data may be preprocessed, for example, by removing or converting special symbols to convert the special text data into text data in a standard format.
[0134] S520: Compare the first standard content with the third standard content, and the first context content with the third context content.
[0135] Specifically, after segmenting and obtaining the first standard content and the first context content of the first text data, and the third standard content and the third context content of each text data stored in the cloud, a string similarity algorithm (e.g., Jaccard similarity, Levenshtein distance) can be used to respectively compare the first standard content of the first text data and the third standard content of each text data stored in the cloud, and respectively compare the first context content of the first text data with the third context content of each text data stored in the cloud. In some embodiments, the SequenceMatcher function can be used to calculate the similarity between the first standard content and the third standard content, and to calculate the similarity between the first context content and the third context content, wherein the similarity score is between 0 and 1, 1 represents completely identical, 0 represents completely different, and between 0 and 1 represents partially identical.
[0136] It is understandable that other similarity algorithms or natural language processing techniques (such as word vectors, BERT models, etc.) can also be used to improve the accuracy and efficiency of the comparison.
[0137] S530: If the semantics of the first standard content is different from the semantics of the third standard content, and / or the semantics of the first context content is different from the semantics of the third context content, then there is no third text data identical to the first text data among the plurality of text data stored in the cloud.
[0138] S540: If the semantics of the first standard content is the same as the semantics of the third standard content, and the semantics of the first context content is the same as the semantics of the third context content, then there is third text data that is the same as the first text data among the plurality of text data stored in the cloud.
[0139] Specifically, if the comparison determines that the first standard content of the first text data is different from the third standard content of each text data stored in the cloud, and / or the first context content of the first text data is different from the third context content of each text data stored in the cloud, it means that each text data stored in the cloud is different from the first text data, that is, there is no third text data that is the same as the first text data among the multiple text data stored in the cloud.
[0140] In some embodiments, if the comparison determines that the first standard content of the first text data is the same as the third standard content of at least one text data stored in the cloud, and the first context content of the first text data is the same as the third context content of the at least one text data, it means that at least one text data stored in the cloud is the same as the first text data, that is, there is a third text data that is the same as the first text data among the multiple text data stored in the cloud.
[0141] S600: When the third text data does not exist, generate a corresponding target voice file based on the first text data.
[0142] Specifically, after determining that there is no third text data identical to the first text data among the several text data stored in the cloud, the cloud generates a corresponding target voice file based on the first text data using text-to-speech (TTS) synthesis technology, and then sends the generated target voice file to the robot through a suitable communication method (such as WiFi network, 4G network, and 5G network, etc.).
[0143] In some embodiments, the cloud first normalizes the first text data to ensure that text symbols, abbreviations, and numbers are presented in a standard form, and performs basic language processing on the text content of the first text data, such as word segmentation, part-of-speech tagging, syntactic analysis, etc., for subsequent speech synthesis. Then, select a suitable TTS engine (such as Google TTS, Amazon Polly, Microsoft Azure TTS, etc.), and set the parameters of speech synthesis, such as pronunciation role, speaking speed, pitch, etc., to ensure that the generated voice file meets the expected effect. Then, the normalized text is input into the selected TTS engine, the TTS engine is used to convert the text into voice data, and the generated voice data is saved as a target voice file. Among them, the format of the target voice file can be a commonly used audio format, such as MP3, WAV and other audio formats.
[0144] In some embodiments, after the text is converted into a voice file that can be used by the robot through appropriate speech synthesis technology, some necessary post-processing can be performed on the generated voice file, such as noise reduction, volume adjustment, etc., to improve the sound quality of the voice file.
[0145] In some embodiments, the first text data includes a time tag, and the time tag is used to indicate the urgency or priority of generating a voice file, wherein the time tag includes an urgent generation tag and a normal generation tag. After receiving the first text data, the cloud determines whether to immediately generate a target voice file corresponding to the first text data according to the time tag of the first text data.
[0146] Exemplarily, in some embodiments, based on the first text data, generating a corresponding target voice file specifically includes but is not limited to the following steps S610-S640:
[0147] S610: Acquire a time tag of the first text data, where the time tag includes an urgent generation tag and a normal generation tag.
[0148] When sending the first text data to the cloud, the robot may attach a corresponding time stamp to the first text data based on the text content of the first text data, and the time stamp is used to indicate the urgency or priority of generating the voice file.
[0149] Exemplarily, after receiving the first text data sent by the robot and determining to generate a target voice file corresponding to the first text data, the cloud parses the received first text data, extracts the time stamp attached to the first text data from the first text data, and then determines the urgency or priority of generating the voice file based on the time stamp attached to the first text data, thereby determining whether to immediately generate the target voice file corresponding to the first text data.
[0150] S620: If the time mark is an urgent generation mark, generate a corresponding target voice file from the first text data.
[0151] In some embodiments, if the time stamp attached to the first text data is an urgent generation mark, it means that the urgency or priority of generating a voice file is very high, and the target voice file corresponding to the first text data needs to be generated immediately. The cloud uses appropriate speech synthesis technology to generate a corresponding target voice file that can be used by the robot from the first text data. In this way, it can be ensured that text data that needs to generate voice files urgently can be processed first, thereby improving the response efficiency and resource utilization of the system.
[0152] S630: If the time mark is a common generation mark, the first text data is stored in a first container in the cloud.
[0153] In some embodiments, if the time stamp attached to the first text data is a common generation stamp, it indicates that the urgency or priority of generating a voice file is low, and it is not necessary to immediately generate a target voice file corresponding to the first text data. The cloud stores the first text data in a first container in the cloud, so that at a suitable subsequent generation time, the first text data is generated into a corresponding target voice file through a suitable speech synthesis technology. The first container is used to store the first text data whose time stamp is a common generation stamp.
[0154] S640: When the amount of the first text data in the first container is greater than or equal to a preset amount, generating a corresponding target voice file from the first text data in the first container.
[0155] Specifically, the cloud detects the number of first text data stored in the first container in real time by a suitable method (such as a counter, a calculator, etc.), and compares the number of first text data with a preset number. When the number of first text data stored in the first container is greater than or equal to the preset number, it means that the first text data stored in the first container is relatively large, and it is necessary to generate the target voice file corresponding to each first text data in a timely manner. The cloud generates the corresponding target voice file from each first text data stored in the first container by a suitable speech synthesis technology. In the above manner, when the first container stores the first text data greater than or equal to the preset number, it means that there are a large number of new speech synthesis requirements. At this time, the cost of generating a single voice file by centrally processing each first text data can be reduced and the efficiency of speech synthesis can be improved. It should be understood that the preset number can be determined according to the actual application scenario and demand setting. For example, in some embodiments, the preset number can be 10, 15 or other suitable numbers, and the embodiment of the present invention does not make any limitation to this.
[0156] S700: Sending the target voice file to the robot, so that after receiving the target voice file, the robot completes the voice configuration of the robot based on the target voice file.
[0157] Specifically, after generating the target voice file, the cloud sends the generated target voice file to the robot through an appropriate communication method (for example, Wi-Fi network, 4G network, 5G network, etc.), so that after receiving the target voice file, the robot completes the voice configuration of the robot based on the received target voice file.
[0158] In some embodiments, the target voice file includes voice purpose, voice type and creation time. To facilitate searching for the generated target voice file, after the target voice file is generated, the target voice file can be stored in the storage level corresponding to the voice storage container in the cloud according to the voice purpose, voice type and creation time of the target voice file.
[0159] In some embodiments, after generating a corresponding target voice file based on the first text data, the robot voice configuration method further includes but is not limited to the following steps S800:
[0160] S800: According to the voice purpose, voice type and creation time of the target voice file, the target voice file is stored in the storage level corresponding to the voice storage container, wherein the voice storage container includes several storage levels, each storage level can be used to store the voice file.
[0161] Specifically, when generating a corresponding target voice file according to the first text data, the cloud can attach corresponding storage tags such as voice purpose, voice type and creation time to the generated target voice file based on the text content of the first text data, and the storage tags are used to characterize the storage level of the voice storage container of the target voice file in the cloud. Among them, the voice storage container is used to store the generated voice file, and the voice storage container includes several storage levels, each of which can be used to store voice files. In an embodiment of the present invention, the voice storage container includes at least three storage levels, and the at least three storage levels are respectively used to store target voice files with storage tags corresponding to the storage levels.
[0162] Exemplarily, after receiving the first text data sent by the robot and generating a target voice file corresponding to the first text data, the cloud parses the generated target voice file to extract storage tags attached to the target voice file, such as voice purpose, voice type, and creation time, from the target voice file.
[0163] Then, according to the storage mark attached to the target voice document, the storage level corresponding to the generated voice file is determined, and the target voice file is stored in the storage level corresponding to the voice storage container. For example, the at least three storage levels of the voice storage container in the embodiment of the present invention are: the first storage level, the second storage level and the third storage level. According to the storage marks such as the voice purpose, voice type and creation time attached to the target voice document, the corresponding storage paths are dynamically generated in the first storage level, the second storage level and the third storage level respectively, and then a unique file name is generated by using the creation timestamp or UUID, and the target voice file is stored in the storage path of the corresponding storage level. Through the above method, the generated voice files can be reasonably organized and managed, the utilization rate of cloud storage resources and the retrieval efficiency of voice files can be improved, and the orderly management and efficient retrieval of voice files can be realized.
[0164] To sum up, the robot voice configuration method provided by the embodiment of the present invention is applied to the cloud, and the method includes: receiving first text data sent by the robot, determining whether there is third text data identical to the first text data among a plurality of text data stored in the cloud, the first text data being the text data of the voice file to be generated; when the third text data does not exist, generating a corresponding target voice file based on the first text data; sending the target voice file to the robot, so that after receiving the target voice file, the robot completes the voice configuration of the robot based on the target voice file.
[0165] In this embodiment, after receiving the first text data sent by the robot, it is determined whether there is a third text data identical to the first text data in the cloud. If the third text data does not exist, it means that there is no corresponding voice file in the cloud. The cloud generates a corresponding target voice file based on the first text data, and sends the target voice file to the robot, so that the robot completes the voice configuration of the robot based on the received target voice file. This method reduces the generation of duplicate voice files, reduces the cost of speech synthesis, improves the efficiency of speech synthesis, and saves storage and computing resources by determining whether there are voice files available for reuse in the cloud.
[0166] An embodiment of the present invention provides a computer-readable storage medium, on which computer program instructions executable by a processor are stored. When the computer program instructions are called by the processor, the processor executes any robot voice configuration method provided by the embodiment of the present invention, or executes the steps in any possible implementation of any robot voice configuration method provided by the embodiment of the present invention.
[0167] In some embodiments, computer program instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
Claims
1. A robot voice configuration method, applied to a robot, characterized in that: The method comprises: Determining whether there is second text data identical to the first text data among a plurality of text data locally stored by the robot, wherein the first text data is text data for generating a voice file; When the second text data does not exist, sending the first text data to the cloud, so that the cloud generates a corresponding target voice file based on the first text data after receiving the first text data; Receive the target voice file sent by the cloud, and complete the voice configuration of the robot based on the target voice file.
2. The method according to claim 1, characterized in that Text data includes standard content and contextual content; The determining whether there is second text data identical to the first text data among the plurality of text data locally stored by the robot comprises: Performing content segmentation on the first text data and the plurality of text data locally stored by the robot respectively to obtain first standard content and first context content of the first text data and second standard content and second context content of the plurality of text data; comparing the first standard content with the second standard content, and the first contextual content with the second contextual content; If the semantics of the first standard content is different from the semantics of the second standard content, and / or the semantics of the first context content is different from the semantics of the second context content, then there is no second text data identical to the first text data among the plurality of text data locally stored by the robot; If the semantics of the first standard content is the same as the semantics of the second standard content, and the semantics of the first context content is the same as the semantics of the second context content, then second text data identical to the first text data exists in the plurality of text data locally stored by the robot.
3. The method according to claim 1, characterized in that The method further comprises: When the second text data exists, if the number of voice files corresponding to the second text data is one, the voice configuration of the robot is completed based on the voice file corresponding to the second text data; if the number of voice files corresponding to the second text data is at least two, one of the at least two voice files corresponding to the second text data is selected to complete the voice configuration of the robot.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: During the initialization and startup of the robot, a first voice file is compared with a second voice file, wherein the first voice file is a voice file stored locally on the robot, and the second voice file is a voice file stored in the cloud and corresponding to the first voice file; If the version of the first voice file is lower than the version of the second voice file, a voice file update request is sent to the cloud, so that the cloud sends the second voice file to the robot after receiving the voice file update request.
5. A robot voice configuration method, applied to the cloud, characterized in that: The method comprises: receiving first text data sent by the robot, and determining whether there is third text data identical to the first text data in the plurality of text data stored in the cloud, wherein the first text data is text data for generating a voice file; When the third text data does not exist, generating a corresponding target voice file based on the first text data; The target voice file is sent to the robot, so that after receiving the target voice file, the robot completes the voice configuration of the robot based on the target voice file.
6. The method according to claim 5, characterized in that Text data includes standard content as well as contextual content; The determining whether there is third text data identical to the first text data among the plurality of text data stored in the cloud includes: Performing content segmentation on the first text data and the plurality of text data stored in the cloud, respectively, to obtain first standard content and first context content of the first text data and third standard content and third context content of the plurality of text data; comparing the first standard content with the third standard content, and the first contextual content with the third contextual content; If the semantics of the first standard content is different from the semantics of the third standard content, and / or the semantics of the first context content is different from the semantics of the third context content, then there is no third text data identical to the first text data among the plurality of text data stored in the cloud; If the semantics of the first standard content is the same as the semantics of the third standard content, and the semantics of the first context content is the same as the semantics of the third context content, then there is third text data that is the same as the first text data among the plurality of text data stored in the cloud.
7. The method according to claim 5 or 6, characterized in that: The first text data includes a time mark, and the time mark is used to indicate the urgency of generating a voice file; The generating a corresponding target voice file based on the first text data includes: Acquire a time mark of the first text data, wherein the time mark includes an urgent generation mark and a common generation mark; If the time mark is an urgent generation mark, generating a corresponding target voice file from the first text data; If the time mark is a common generation mark, storing the first text data in a first container in the cloud; When the amount of the first text data in the first container is greater than or equal to a preset amount, the first text data in the first container is generated into a corresponding target voice file.
8. The method according to claim 5 or 6, characterized in that: The target voice file includes voice purpose, voice type and creation time; After generating a corresponding target voice file based on the first text data, the method further includes: According to the voice purpose, voice type and creation time of the target voice file, the target voice file is stored in the storage level corresponding to the voice storage container, wherein the voice storage container includes several storage levels, each storage level can be used to store voice files.
9. An electronic device, characterized in that: include: A processor and a memory communicatively connected to the processor; The memory stores computer program instructions executable by the processor, and when the computer program instructions are called by the processor, the processor executes the robot voice configuration method as described in any one of claims 1-4, or executes the robot voice configuration method as described in any one of claims 5-8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions executable by a processor, and when the computer program instructions are called by the processor, the processor executes the robot voice configuration method according to any one of claims 1 to 8.
