Disclosure of Invention
According to the text editing method and device provided by the invention, the voice recognition function is added in the existing text editing tool, and the added voice recognition function can recognize various local dialects, so that the text editing efficiency can be improved.
In a first aspect, the present invention provides a text editing method, including:
collecting a voice signal input by a user, and storing the voice signal input by the user as an audio file;
carrying out dialect classification on the audio file through a background database, translating the audio file into a text of a corresponding dialect, and replacing the text of the corresponding dialect with a standard mandarin text;
writing the standard Mandarin text into a text file.
In a second aspect, the present invention provides a text editing apparatus, comprising:
the voice recording module is used for collecting voice signals input by a user and storing the voice signals input by the user as an audio file;
the background data matching module is used for carrying out dialect classification on the audio file through a background database, translating the audio file into a text of a corresponding dialect and replacing the text of the corresponding dialect with a standard mandarin text;
and the text output module is used for writing the standard mandarin text into a text file.
The text editing method and the text editing device provided by the embodiment of the invention collect the voice signal input by a user and store the voice signal input by the user as an audio file; carrying out dialect classification on the audio file through a background database, translating the audio file into a text of a corresponding dialect, and replacing the text of the corresponding dialect with a standard mandarin text; writing the standard Mandarin text into a text file. Compared with the prior art, the text editing method and the text editing device have the advantages that the voice recognition function is added in the existing text editing tool, and the added voice recognition function can recognize various local dialects, so that the text editing efficiency can be improved.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention provides a text editing method, as shown in fig. 1, the method comprises:
and S11, collecting the voice signal input by the user, and saving the voice signal input by the user as an audio file.
S12, dialect classification is carried out on the audio files through a background database, the audio files are translated into texts of corresponding dialects, and the texts of the corresponding dialects are replaced by standard Mandarin texts.
And S13, writing the standard Mandarin text into a text file.
Compared with the prior art, the text editing method provided by the embodiment of the invention has the advantages that the voice recognition function is added in the existing text editing tool, and the added voice recognition function can recognize various local dialects, so that the typing time can be saved, the text entry difficulty is reduced, and the text editing efficiency can be improved.
Optionally, the collecting the voice signal input by the user and saving the voice signal input by the user as an audio file includes:
after the text editing interface detects that a user starts a voice input function, voice signals input by the user are collected according to a sentence-by-sentence input mode or an integral input mode selected by the user, and the collected voice signals are stored into a plurality of audio files in sequence.
Further, after the collecting the voice signal input by the user and saving the voice signal input by the user as an audio file, the dialect classifying the audio file through the background database, translating the audio file into a text of a corresponding dialect, and replacing the text of the corresponding dialect with a standard mandarin text, further includes:
and extracting the characteristics of the audio file to obtain characteristic parameters corresponding to the audio file.
Optionally, the step S12 specifically includes:
carrying out dialect classification on the characteristic parameters corresponding to the audio files by utilizing an acoustic database;
obtaining a text of the corresponding dialect according to the characteristic parameters corresponding to the audio file and by combining a text database;
replacing the text of the corresponding dialect with standard mandarin text.
In order to facilitate better understanding of the present invention, the following text editing process is given by taking support of seven dialects as an example:
1) and carrying out dialect classification on the characteristic parameters corresponding to the audio files by utilizing an acoustic database.
The acoustic database provides voice data of seven dialects (north dialects, wu dialects, xiang dialects, gan dialects, yue dialects, hakk dialects and Min dialects), and specifically performs voice data classification according to voices and grammars of local dialects so as to judge the local dialects category to which the audio file belongs.
2) And obtaining the text of the corresponding dialect according to the characteristic parameters corresponding to the audio file and by combining a text database.
The text database provides text data of various local dialects, and particularly translates the audio file into texts of corresponding dialects according to vocabularies, sentences and grammars of the local dialects.
3) Replacing the text of the corresponding dialect with standard mandarin text.
An embodiment of the present invention further provides a text editing apparatus, as shown in fig. 2, the apparatus includes:
the voice recording module is used for collecting voice signals input by a user and storing the voice signals input by the user as an audio file;
the background data matching module is used for carrying out dialect classification on the audio file through a background database, translating the audio file into a text of a corresponding dialect and replacing the text of the corresponding dialect with a standard mandarin text;
and the text output module is used for writing the standard mandarin text into a text file.
Compared with the prior art, the text editing device provided by the embodiment of the invention has the advantages that the voice recognition function is added in the existing text editing tool, and the added voice recognition function can recognize various local dialects, so that the typing time can be saved, the text entry difficulty is reduced, and the text editing efficiency can be improved.
Optionally, the voice input module is configured to, after detecting that the user starts a voice input function on the text editing interface, acquire a voice signal input by the user according to a sentence-by-sentence input mode or an entire input mode selected by the user, and store the acquired voice signal as a plurality of audio files in sequence.
Further, the apparatus further comprises:
and the characteristic extraction module is used for extracting the characteristics of the audio file to obtain the characteristic parameters corresponding to the audio file.
Optionally, the background data matching module includes, as shown in fig. 3:
the acoustic database is used for carrying out dialect classification on the audio file according to voice data of a plurality of dialects provided in the acoustic database;
a text database for providing text data of a plurality of dialects;
the comparison matching unit is used for obtaining the text of the corresponding dialect according to the characteristic parameters corresponding to the audio file, the type of the dialect and the text data of the dialect;
and the replacing unit is used for replacing the text of the corresponding dialect with standard Mandarin text.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.