Translation engine-based professional vocabulary translation method, tool and electronic equipment

文档序号:1938187 发布日期:2021-12-07 浏览:20次 中文

阅读说明:本技术 一种基于翻译引擎的专业词汇的翻译方法、工具及电子设备 (Translation engine-based professional vocabulary translation method, tool and electronic equipment ) 是由 刘何超 林雅婷 陈源圳 于 2021-08-25 设计创作,主要内容包括:本发明实施例涉及自然语言处理领域,公开了一种基于翻译引擎的专业词汇的翻译方法,该方法需要获取不需要翻译的专业词汇的汇总文本,并将所述汇总文本保存于配置文件中,然后调用翻译引擎,根据配置文件处理需要翻译的资源文本,以得到翻译结果,本发明实施例提供的翻译方法,能够利用翻译引擎实现对带有无法翻译和不需要翻译的专业词汇的文本的翻译,翻译结果准确性高且可读性强。(The embodiment of the invention relates to the field of natural language processing, and discloses a translation method of professional vocabularies based on a translation engine.)

1. A translation method of professional vocabularies based on a translation engine is characterized by comprising the following steps:

acquiring a summary text of a professional vocabulary which does not need to be translated, and storing the summary text in a configuration file;

and calling a translation engine, and processing the resource file to be translated according to the configuration file to obtain a translation result.

2. The translation method according to claim 1,

before the invoking of the translation engine and the processing of the resource file to be translated according to the configuration file to obtain the translation result, the method further includes:

and acquiring translation parameters in a front-end interface or command line mode, wherein the translation parameters at least comprise a target language.

3. The translation method according to claim 2,

the calling translation engine processes the resource file to be translated according to the configuration file to obtain a translation result, and the method comprises the following steps:

preprocessing the resource text according to the configuration file;

translating the preprocessed resource text into a target language through a translation engine to obtain an intermediate translation text;

and carrying out post-processing on the intermediate translation text according to the configuration file, and optimizing a translation to obtain the translation result.

4. The translation method according to claim 3,

the preprocessing the resource text according to the configuration file comprises the following steps:

and reading the configuration file, and replacing the professional vocabulary which does not need to be translated in the resource text by using a specific placeholder.

5. The translation method according to claim 3,

the post-processing the intermediate translation text comprises:

and after the placeholders in the intermediate translation text are restored to corresponding terms, outputting the translation result.

6. The translation method according to claim 3,

the translation parameters also include a resource file path,

the translating the preprocessed resource text into the target language through the translation engine to obtain an intermediate translation text, which includes:

reading the corresponding resource file according to the resource file path;

and calling a translation engine interface, and translating the preprocessed resource text into a target language by combining the resource file to obtain an intermediate translation text.

7. The translation method according to any one of claims 2 to 6,

the translation parameters further include: the encoding format and file type of the translation engine,

after the calling translation engine processes the resource file to be translated according to the configuration file to obtain a translation result, the method further comprises:

performing code conversion on the translation result according to the coding format of the translation engine;

and outputting the translation result after code conversion according to the file type of the translation engine.

8. The translation method according to claim 7,

the code conversion of the translation result according to the coding format of the translation engine further comprises:

and converting and coding the translation result according to the coding format of the translation engine, and then displaying the character as a messy code to perform forced transcoding.

9. A specialized vocabulary translation tool based on a translation engine, comprising:

the configuration module is used for acquiring a summary text of the professional vocabulary which does not need to be translated and storing the summary text in a configuration file;

and the translation module is used for calling a translation engine and processing the resource text to be translated according to the configuration file to obtain a translation result.

10. The translation tool of claim 9, further comprising:

and the acquisition module is used for acquiring the translation parameters in a front-end interface or command line mode.

11. The translation tool of claim 10, further comprising:

and the output module is used for performing code conversion on the translation result according to the coding format of the translation engine and outputting the translation result after code conversion according to the file type of the translation engine.

12. An electronic device, comprising:

at least one processor; and the number of the first and second groups,

a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,

the memory stores instructions executable by the processor to enable the processor to perform the method of any one of claims 1-8.

13. A computer-readable storage medium having computer-executable instructions stored thereon for causing a computer to perform the method of any one of claims 1-8.

Technical Field

The embodiment of the invention relates to the field of natural language processing, in particular to a translation method, a translation tool and electronic equipment of professional vocabularies based on a translation engine.

Background

With the development of the automobile industry, the export volumes of german automobiles, american automobiles, japanese automobiles, korean automobiles, domestic automobiles and the like are on the increase trend, and language localization becomes very important for the market after automobile maintenance.

The translation engines such as google and Baidu have high translation accuracy and readability due to the stored big data of the translation cases, but due to the strong professional automobile technology and the diversity of the translation rules of the translation engines, the workload of manual inspection and checking and correction of actual translation files is huge, how to solve the problem that the google translation engine can be used for fast and efficiently translating, and how to realize the unified expression that translated text conforms to the professional automobile technology, the translation engine becomes a difficult problem to be solved urgently.

Disclosure of Invention

The embodiment of the application provides a translation method, a translation tool and electronic equipment for professional vocabularies based on a translation engine, and can solve the problem that the translation engine cannot translate the professional vocabularies.

The purpose of the embodiment of the invention is realized by the following technical scheme:

in order to solve the above technical problem, in a first aspect, an embodiment of the present invention provides a method for translating a professional vocabulary based on a translation engine, including:

acquiring a summary text of a professional vocabulary which does not need to be translated, and storing the summary text in a configuration file;

and calling a translation engine, and processing the resource file to be translated according to the configuration file to obtain a translation result.

In some embodiments of the present invention, the,

before the invoking of the translation engine and the processing of the resource file to be translated according to the configuration file to obtain the translation result, the method further includes:

and acquiring translation parameters in a front-end interface or command line mode, wherein the translation parameters at least comprise a target language.

In some embodiments, the invoking a translation engine, processing the resource file to be translated according to the configuration file to obtain a translation result, includes:

preprocessing the resource text according to the configuration file;

translating the preprocessed resource text into a target language through a translation engine to obtain an intermediate translation text;

and carrying out post-processing on the intermediate translation text according to the configuration file, and optimizing a translation to obtain the translation result.

In some embodiments, the preprocessing the resource text according to the configuration file includes:

and reading the configuration file, and replacing the professional vocabulary which does not need to be translated in the resource text by using a specific placeholder.

In some embodiments, the post-processing the intermediate translated text comprises:

and after the placeholders in the intermediate translation text are restored to corresponding terms, outputting the translation result.

In some embodiments, the translation parameters further include a resource file path,

the translating the preprocessed resource text into the target language through the translation engine to obtain an intermediate translation text, which includes:

reading the corresponding resource file according to the resource file path;

and calling a translation engine interface, and translating the preprocessed resource text into a target language by combining the resource file to obtain an intermediate translation text.

In some embodiments, the translation parameters further include: the encoding format and file type of the translation engine,

after the calling translation engine processes the resource file to be translated according to the configuration file to obtain a translation result, the method further comprises:

performing code conversion on the translation result according to the coding format of the translation engine;

and outputting the translation result after code conversion according to the file type of the translation engine.

In some embodiments, the transcoding the translation result according to the encoding format of the translation engine further includes:

and converting and coding the translation result according to the coding format of the translation engine, and then displaying the character as a messy code to perform forced transcoding.

In order to solve the above technical problem, in a second aspect, an embodiment of the present invention provides a translation tool for a specialized vocabulary based on a translation engine, including:

the configuration module is used for acquiring a summary text of the professional vocabulary which does not need to be translated and storing the summary text in a configuration file;

and the translation module is used for calling a translation engine and processing the resource text to be translated according to the configuration file to obtain a translation result.

In some embodiments, the translation tool further comprises:

and the acquisition module is used for acquiring the translation parameters in a front-end interface or command line mode.

In some embodiments, the translation tool further comprises:

and the output module is used for performing code conversion on the translation result according to the coding format of the translation engine and outputting the translation result after code conversion according to the file type of the translation engine.

In order to solve the above technical problem, in a third aspect, an embodiment of the present invention provides an electronic device, including:

at least one processor; and the number of the first and second groups,

a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,

the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of the first aspect as described above.

In order to solve the above technical problem, in a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium storing computer-executable instructions for causing a computer to perform the method according to the first aspect.

In order to solve the above technical problem, in a fifth aspect, the present invention further provides a computer program product, which includes a computer program stored on a computer-readable storage medium, the computer program including program instructions, which, when executed by a computer, cause the computer to execute the method according to the first aspect.

Compared with the prior art, the invention has the beneficial effects that: different from the situation of the prior art, the embodiment of the invention provides a translation method of a professional vocabulary based on a translation engine, the method needs to obtain a summary text of the professional vocabulary which does not need to be translated, the summary text is stored in a configuration file, then the translation engine is called, and a resource text which needs to be translated is processed according to the configuration file to obtain a translation result.

Drawings

One or more embodiments are illustrated by the accompanying figures in the drawings that correspond thereto and are not to be construed as limiting the embodiments, wherein elements/modules and steps having the same reference numerals are represented by like elements/modules and steps, unless otherwise specified, and the drawings are not to scale.

FIG. 1 is a flowchart illustrating a method for translating a professional vocabulary based on a translation engine according to an embodiment of the present invention;

FIG. 2 is another flowchart illustrating a method for translating a professional vocabulary based on a translation engine according to an embodiment of the present invention;

FIG. 3 is a schematic sub-flow chart of step 130 of FIG. 1;

FIG. 4 is another flowchart illustrating a method for translating a specialized vocabulary based on a translation engine according to an embodiment of the present invention;

FIG. 5 is a schematic structural diagram of a specialized vocabulary translation tool based on a translation engine according to a second embodiment of the present invention;

FIG. 6 is a schematic structural diagram of another specialized vocabulary translation tool based on a translation engine according to a second embodiment of the present invention;

fig. 7 is a schematic diagram of a hardware structure of an electronic device according to a third embodiment of the present invention.

Detailed Description

The present invention will be described in detail with reference to specific examples. The following examples will assist those skilled in the art in further understanding the invention, but are not intended to limit the invention in any way. It should be noted that variations and modifications can be made by persons skilled in the art without departing from the spirit of the invention. All falling within the scope of the present invention.

In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.

It should be noted that, if not conflicted, the various features of the embodiments of the invention may be combined with each other within the scope of protection of the present application. Additionally, while functional block divisions are performed in apparatus schematics, with logical sequences shown in flowcharts, in some cases, steps shown or described may be performed in sequences other than block divisions in apparatus or flowcharts.

Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.

In addition, the technical features involved in the embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.

Specifically, the embodiments of the present invention will be further explained below with reference to the drawings.

Example one

An embodiment of the present invention provides a method for translating a professional vocabulary based on a translation engine, and please refer to fig. 1, which shows a flow of the method for translating the professional vocabulary based on the translation engine according to the embodiment of the present invention, where the method for translating the professional vocabulary based on the translation engine includes, but is not limited to, the following steps:

step 110: acquiring a summary text of a professional vocabulary which does not need to be translated, and storing the summary text in a configuration file;

in the embodiment of the invention, for a large number of professional vocabularies existing in the fields such as automobiles and the like, such as special symbols and texts which do not need to be translated, the vocabularies can be left un-translated in the subsequent translation process. Therefore, before translation is started, the professional vocabularies need to be collected and gathered and tool configuration needs to be carried out to obtain a configuration file, and the professional vocabularies in the text needing translation can be matched by calling the configuration file in the translation process, so that the professional vocabularies are automatically reserved or replaced, the workload of manual replacement or modification is reduced, and the program operation efficiency is improved.

Step 120: and processing the resource file to be translated according to the configuration file to obtain a translation result.

In the embodiment of the invention, after the configuration files and other translation tools are configured, the configuration files and the translation engine are called to process the resource text according to the target language to be translated finally, so that the final translation result is obtained. The translation engine may be a web page translation engine such as a google translation engine, a hectic translation engine, or software in a computer, or an application program in a mobile phone, such as a road dictionary, or even an off-line stored electronic dictionary, and specifically, may be set according to actual needs, and does not need to be restricted by the limitations of the embodiments of the present invention.

In some embodiments, please refer to fig. 2, which illustrates another flow of the method for translating a professional vocabulary based on a translation engine according to an embodiment of the present invention, before the invoking the translation engine and processing a resource file to be translated according to the configuration file to obtain a translation result, the method further includes:

step 130: acquiring translation parameters in a front-end interface or command line mode;

wherein the translation parameters include at least a target language. Further, the translation parameters may further include: resource file path, encoding format and file type of the translation engine, etc. In the embodiment of the present invention, the various translation parameters to be obtained may be various parameters related to the translation result obtained through various front-end interfaces, for example, website information is obtained through a Uniform Resource Locator (URL), so as to obtain a translation engine used when the current user imports the Resource text, or a target language to be translated by the Resource text is obtained through selection of a language menu by the user, or a Resource file path to be translated is obtained through a cmd command line. When a user specifies translation parameters such as a resource file path, a current language, a target language and the like through a front-end interface or a command line, a plurality of resource text files can be translated in sequence, so that each translation file can generate a corresponding translation document. It should be noted that, because the coding formats used by the different translation engines and the file formats of the imported and output translation documents are different, before performing the translation work, the translation parameters such as the coding formats and the file types of the translation engines need to be read.

In some embodiments, please refer to fig. 3, which shows a sub-flow of the step 130 shown in fig. 1, where the invoking a translation engine processes the resource file to be translated according to the configuration file to obtain a translation result, further comprising:

step 121: preprocessing the resource text according to the configuration file;

specifically, the configuration file is read, and a special vocabulary which does not need to be translated in the resource text is replaced by a specific placeholder. In the embodiment of the invention, the text which does not need translation and special symbols in the resource text is replaced by the specific placeholder by reading the configuration file, so that the resource text is preprocessed. The placeholders cannot be translated in the translation process, and after the translation is finished, the placeholders are replaced by corresponding terms.

Step 122: translating the preprocessed resource text into a target language through a translation engine to obtain an intermediate translation text;

specifically, reading a corresponding resource file according to the resource file path; and calling a translation engine interface, and translating the preprocessed resource text into a target language to obtain an intermediate translation text. In the embodiment of the invention, after the text which needs to be translated and has special symbols in the resource text is replaced by the specific placeholder to obtain the resource text containing the placeholder, a translation engine interface is called, the translation of grammar and common words is processed through a translation engine, and the universal translation of translatable professional words is carried out, so that the intermediate translated text which contains the placeholder and is translated to the target voice is obtained.

Step 123: and carrying out post-processing on the intermediate translation text according to the configuration file, and optimizing a translation to obtain the translation result.

Specifically, after the placeholders in the partial translation result are restored to the corresponding terms, the translation result is output. In the embodiment of the invention, after the intermediate translation text which contains the placeholder and is translated to the target voice is obtained, the placeholder is restored to the corresponding professional vocabulary and/or special symbols which do not need to be translated according to the configuration file, and then the whole translation of the resource text can be completed. Further, the translated text may be optimized, such as optimizing grammar, optimizing word order, and the like.

In some embodiments, the translation parameters further include: please refer to fig. 4, which shows another flow of the translation method based on professional vocabulary of the translation engine according to an embodiment of the present invention, where after the translation engine is called, and the resource file to be translated is processed according to the configuration file to obtain a translation result, the method further includes:

step 141: performing code conversion on the translation result according to the coding format of the translation engine;

in the embodiment of the present invention, since different translation engines have different encoding formats and different types of file import and export, when outputting the translation result, encoding conversion needs to be performed according to the encoding format of the translation engine. Taking google translation engine as an example, the google translation result usually adopts the utf-8 encoding format, and therefore, the translation result needs to be converted according to the utf-8 encoding format and then output.

Further, since there may be a case where a character is converted and encoded and then displayed as a garbled code when transcoding is performed, it is necessary to perform forced transcoding on a character which is converted and encoded according to the encoding format of the translation engine and then displayed as a garbled code in the translation result. For example, when the utf-8 coding format is adopted for transcoding, part of the utf-8 characters are displayed as messy codes after being converted and coded, for the situation, the forced transcoding function can be lifted according to the requirement, and the characters which are displayed as the messy codes after being converted and coded according to the coding format of the translation engine in the translated text of the translation result to be output are deleted, so that the forced transcoding is realized.

Step 142: and outputting the translation result after code conversion according to the file type of the translation engine.

And finally, outputting the translation result subjected to code conversion according to the coding format of the translation engine according to the file type of the translation engine, so as to obtain a visualized and/or derivable translation result.

Example two

The embodiment of the present invention provides a translation tool based on professional vocabulary of a translation engine, please refer to fig. 5, which shows a structure of the translation tool based on professional vocabulary of a translation engine according to the embodiment of the present invention, where the translation tool 200 based on professional vocabulary of a translation engine includes: a configuration module 210 and a translation module 220.

The configuration module 210 is configured to obtain a summary text of a professional vocabulary that does not need to be translated, and store the summary text in a configuration file;

the translation module 220 is configured to invoke a translation engine, and process the resource text to be translated according to the configuration file to obtain a translation result.

In some embodiments, please refer to fig. 6, which illustrates a structure of another translation tool based on professional vocabulary of a translation engine according to an embodiment of the present invention, where the translation tool 200 further includes: the obtaining module 230 is configured to obtain the translation parameters through a front-end interface or a command line, where the translation parameters at least include a target language.

In some embodiments, the translation module 220 is further configured to pre-process the resource text according to the configuration file; translating the preprocessed resource text into a target language through a translation engine to obtain an intermediate translation text; and carrying out post-processing on the intermediate translation text according to the configuration file, and optimizing a translation to obtain the translation result.

In some embodiments, the translation module 220 is further configured to read the configuration file and replace the specialized vocabulary in the resource text that does not need to be translated with a specific placeholder.

In some embodiments, the translation module 220 is further configured to output the translation result after the placeholders in the partial translation result are restored to the corresponding terms.

In some embodiments, the translation parameters further include a resource file path, and the translation module 220 is further configured to read a corresponding resource file according to the resource file path; and calling a translation engine interface, and translating the preprocessed resource text into a target language by combining the resource file to obtain an intermediate translation text.

In some embodiments, please refer to continuing fig. 6, the translation tool 200 further comprises: and the output module 240 is configured to perform code conversion on the translation result according to the coding format of the translation engine, and output the translation result after code conversion according to the file type of the translation engine.

In some embodiments, the output module 240 is further configured to perform forced transcoding on the characters, which are displayed as scrambled codes after being converted and encoded according to the encoding format of the translation engine, in the translation result.

EXAMPLE III

An embodiment of the present invention further provides an electronic device, please refer to fig. 7, which shows a hardware structure of the electronic device capable of executing the method for translating professional vocabularies based on the translation engine shown in fig. 1 to fig. 4.

The electronic device 10 includes: at least one processor 11; and a memory 12 communicatively coupled to the at least one processor 11, one processor 11 being illustrated in fig. 7. The memory 12 stores instructions executable by the at least one processor 11, the instructions being executable by the at least one processor 11 to enable the at least one processor 11 to perform the method for translating a specialized vocabulary based on a translation engine as described above with reference to fig. 1-4. The processor 11 and the memory 12 may be connected by a bus or other means, and fig. 7 illustrates the connection by a bus as an example.

The memory 12 is a non-volatile computer readable storage medium, and can be used for storing non-volatile software programs, non-volatile computer executable programs, and modules, such as program instructions/modules corresponding to the professional vocabulary translation method based on the translation engine in the embodiment of the present application, for example, the modules shown in fig. 5 to 6. The processor 11 executes various functional applications and data processing of the electronic device by executing the nonvolatile software programs, instructions and modules stored in the memory 12, that is, implements the translation method based on the professional vocabulary of the translation engine in the above method embodiment.

The memory 12 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created from use of a translation apparatus based on a professional vocabulary of the translation engine, and the like. Further, the memory 12 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, the memory 12 may optionally include memory located remotely from the processor 11, and these remote memories may be connected to a translation engine based specialized vocabulary translation device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.

The one or more modules are stored in the memory 12, and when executed by the one or more processors 11, perform a translation engine-based specialized vocabulary translation method in any of the above-described method embodiments, e.g., perform the method steps of fig. 1-4 described above, to implement the functions of the modules and units of fig. 5-6.

The product can execute the method provided by the embodiment of the application, and has the corresponding functional modules and beneficial effects of the execution method. For technical details that are not described in detail in this embodiment, reference may be made to the methods provided in the embodiments of the present application.

Embodiments of the present application also provide a non-transitory computer-readable storage medium storing computer-executable instructions for execution by one or more processors, for example, to perform the method steps of fig. 1-4 described above to implement the functions of the modules of fig. 5-6.

Embodiments of the present application further provide a computer program product comprising a computer program stored on a non-volatile computer-readable storage medium, the computer program comprising program instructions that, when executed by a computer, cause the computer to perform a translation engine based specialized vocabulary translation method in any of the above-described method embodiments, for example, to perform the method steps of fig. 1 to 4 described above, to implement the functions of the modules in fig. 5 to 6.

The embodiment of the invention provides a translation method of professional vocabularies based on a translation engine, which is characterized in that a summary text of the professional vocabularies which do not need to be translated is required to be obtained, the summary text is stored in a configuration file, then the translation engine is called, and resource texts which need to be translated are processed according to the configuration file to obtain a translation result.

It should be noted that the above-described device embodiments are merely illustrative, where the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.

Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a general hardware platform, and certainly can also be implemented by hardware. 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 hardware related to instructions of 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.

Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; within the idea of the invention, also technical features in the above embodiments or in different embodiments may be combined, steps may be implemented in any order, and there are many other variations of the different aspects of the invention as described above, which are not provided in detail for the sake of brevity; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

13页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:身份验证装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!