CN111897775A - Embedded system translation method, device, equipment and readable storage medium - Google Patents

Embedded system translation method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN111897775A
CN111897775A CN202010741307.2A CN202010741307A CN111897775A CN 111897775 A CN111897775 A CN 111897775A CN 202010741307 A CN202010741307 A CN 202010741307A CN 111897775 A CN111897775 A CN 111897775A
Authority
CN
China
Prior art keywords
translation
file
target
code
embedded system
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010741307.2A
Other languages
Chinese (zh)
Inventor
石伟平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiamen Yealink Network Technology Co Ltd
Original Assignee
Xiamen Yealink Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xiamen Yealink Network Technology Co Ltd filed Critical Xiamen Yealink Network Technology Co Ltd
Priority to CN202010741307.2A priority Critical patent/CN111897775A/en
Publication of CN111897775A publication Critical patent/CN111897775A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata
    • G06F16/148File search processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/31Indexing; Data structures therefor; Storage structures
    • G06F16/316Indexing structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/40Processing or translation of natural language
    • G06F40/58Use of machine translation, e.g. for multi-lingual retrieval, for server-side translation for client devices or for real-time translation

Abstract

The invention provides a translation method, a translation device, translation equipment and a readable storage medium for an embedded system, wherein the method comprises the following steps: extracting a translation serial number of a text to be translated, and sequentially acquiring offset position codes corresponding to the translation serial number from a target translation file; the target translation file comprises a pre-constructed translation number code, an offset position code, a translation content code and a translation content; and matching translation content codes corresponding to the offset position codes in sequence, acquiring translation contents corresponding to the translation content codes from the target translation file, and generating a target translation text according to the acquired translation contents. The translation file is coded and stored according to a specific format, only the index of the translation content is needed to be carried out according to the code during translation, and a translation source is not needed to be stored in the translation file, so that the translation efficiency of an embedded system can be effectively improved, and the occupied space of the translation file is reduced.

Description

Embedded system translation method, device, equipment and readable storage medium
Technical Field
The present invention relates to the field of translation technologies, and in particular, to a method, an apparatus, a device, and a readable storage medium for embedded system translation.
Background
At present, in a translation scheme of a Dect mobile phone system, translations of various countries are stored in sub-files, translation files comprise translation sources and translation contents which correspond to one another one by one, when a certain language needs to be translated, the system loads the translation files into a memory, and then the translation sources are matched with the corresponding translation contents one by one to complete translation work. The key is to search corresponding translation contents through a translation source, so that each translation source needs to be stored in running codes. Therefore, the existing translation method of the embedded system has the defects of low efficiency of searching translation contents and large occupied space of translation files.
Disclosure of Invention
The technical problem to be solved by the embodiments of the present invention is to provide a method, an apparatus, a device and a readable storage medium for translating an embedded system, which can improve the translation efficiency of the embedded system and reduce the occupied space of a translated file.
In order to solve the above technical problem, an embodiment of the present invention provides an embedded system translation method, including:
extracting a translation serial number of a text to be translated, and sequentially acquiring offset position codes corresponding to the translation serial number from a target translation file; the target translation file comprises a pre-constructed translation number code, an offset position code, a translation content code and a translation content;
and matching translation content codes corresponding to the offset position codes in sequence, acquiring translation contents corresponding to the translation content codes from the target translation file, and generating a target translation text according to the acquired translation contents.
Further, before the extracting the translation serial number of the text to be translated and sequentially acquiring the offset position code corresponding to the translation serial number from the target translation file, the method further includes:
and inquiring a pre-constructed translation file database according to a translation task instruction input by a user to obtain a target translation file corresponding to the translation task instruction.
Further, the first 4 bytes of the file header of the target translation file are used for storing the translation quantity code.
Further, in the target translation file, the storage space of each offset position code is 2 bytes.
In order to solve the same technical problem, the invention also provides an embedded system translation device, which comprises:
the code acquisition module is used for extracting the translation serial number of the text to be translated and sequentially acquiring the offset position code corresponding to the translation serial number from the target translation file; the target translation file comprises a pre-constructed translation number code, an offset position code, a translation content code and a translation content;
and the translation generation module is used for matching translation content codes corresponding to the offset position codes in sequence, acquiring translation contents corresponding to the translation content codes from the target translation file and generating a target translation text according to the acquired translation contents.
The embedded system translation device further comprises:
and the file matching module is used for inquiring a pre-constructed translation file database according to the translation task instruction input by the user and acquiring a target translation file corresponding to the translation task instruction.
Further, the first 4 bytes of the file header of the target translation file are used for storing the translation quantity code.
Further, in the target translation file, the storage space of each offset position code is 2 bytes.
In order to solve the same technical problem, the present invention further provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the memory is coupled to the processor, and when the processor executes the computer program, the embedded system translation method according to any one of the above embodiments is implemented.
In order to solve the same technical problem, the present invention further provides a computer-readable storage medium, where a computer program is stored, and when the computer program runs, the apparatus where the computer-readable storage medium is located is controlled to execute any one of the embedded system translation methods.
Compared with the prior art, the invention has the following beneficial effects:
the embodiment of the invention provides a translation method, a translation device, translation equipment and a readable storage medium for an embedded system, wherein the method comprises the following steps: extracting a translation serial number of a text to be translated, and sequentially acquiring offset position codes corresponding to the translation serial number from a target translation file; the target translation file comprises a pre-constructed translation number code, an offset position code, a translation content code and a translation content; and matching translation content codes corresponding to the offset position codes in sequence, acquiring translation contents corresponding to the translation content codes from the target translation file, and generating a target translation text according to the acquired translation contents. The translation file is coded and stored according to a specific format, only the index of the translation content is needed to be carried out according to the code during translation, and a translation source is not needed to be stored in the translation file, so that the translation efficiency of the embedded system can be effectively improved, and the occupied space of the translation file is reduced.
Drawings
Fig. 1 is a flowchart illustrating an embedded system translation method according to an embodiment of the present invention;
FIG. 2 is a diagram of a prior art translation document provided by an embodiment of the present invention;
FIG. 3 is a diagram of a translation document according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an embedded system translation apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described clearly and completely with reference to the accompanying 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.
Referring to fig. 2, it should be noted that, in the prior art, translation sub-files of each country are stored, taking japanese translation files as an example, the format of the translation files is shown in fig. 2, and the translation files include one-to-one translation sources and translation contents, where the left column is the translation source, the right column is the translation contents, that is, "Save" is the translation source, and "Save する" is the translation contents.
In the existing embedded system translation scheme, when a certain language needs to be translated, a system loads translation files into a memory, and then the translation files are matched with corresponding translation contents one by one through translation sources so as to finish translation work. The key is to search corresponding translation contents through a translation source, so that each translation source needs to be stored in running codes. Therefore, the existing translation method of the embedded system has the defects of low efficiency of searching translation contents and large occupied space of translation files.
Referring to fig. 1, an embodiment of the present invention provides an embedded system translation method, including:
s1, extracting the translation serial number of the text to be translated, and sequentially acquiring offset position codes corresponding to the translation serial number from the target translation file; the target translation file comprises a pre-constructed translation number code, an offset position code, a translation content code and a translation content.
In the embodiment of the invention, the first 4 bytes of the file header of the target translation file are used for storing the translation quantity code; in the target translation file, the storage space of each offset position code is 2 bytes.
It should be noted that, in the embodiment of the present invention, codes stored in a target translation file are stored according to a certain sequence, so that in the translation process, a translation serial number needs to be extracted from a text to be translated first, so as to obtain codes in a corresponding sequence, and then, the codes are used to sequentially obtain translation contents corresponding to the text to be translated.
S2, sequentially matching translation content codes corresponding to the offset position codes, acquiring translation contents corresponding to the translation content codes from the target translation file, and generating a target translation text according to the acquired translation contents.
In one embodiment, before step S1, the method further includes the steps of:
and inquiring a pre-constructed translation file database according to a translation task instruction input by a user to obtain a target translation file corresponding to the translation task instruction.
In practical application, the text to be translated needs to be translated into a specific language according to actual requirements, so that before translation, a target translation file is inquired according to an instruction input by a user, and a required target translation text can be translated according to the acquired target translation file.
Referring to fig. 3, based on the above scheme, the following embodiment of the present invention is specifically illustrated:
1. the translation sub-files of each country are stored firstly, in each translation file, the first four bytes of the file head store the translation number, then each two bytes store each translation offset position, and then specific translation content.
2. As shown in fig. 3:
of the four bytes in the file header, "0 x 030 x 000 x 000 x 00" indicates the number of translations 3.
"0 x 100 x 00" indicates that the offset position for the first translation is 0x 100 x00, corresponding to callout 5. Note that, if the content of note 2 is 0x 100 x00, the order of the lower order before the upper order is used, and therefore the 16-ary numerical value is 0x 000 x 10. 0010h on the left side of label 5 is 0x 000 x10 in 16 th-order, which indicates that the address for storing E4 … is 0x 000 x10, and therefore the offset address of the translated content, E4 BF 9D E5 AD 98E 38199E 3828B, with respect to the file is 0x 000 x 10.
"0 x1c 0x 00" indicates that the second translation offset is 0x1c 0x00, corresponding to label 6.
"0 x 220 x 00" indicates that the third translation offset is set to 0x 220 x00, corresponding to the notation 7.
It should be noted that, because the translation content codes in the translation file are stored in sequence, the translation sources can be hard-coded into numbers in sequence, so that the translation content is translated through the number index without storing the translation sources.
For example, if a first translation needs to be found, the position of the first translation can be found by shifting 4 bytes from the file header (since the first four bytes of the file header represent the total number of translations, the subscript starts from 0, the 4 th and 5 th bytes record the shift position of the first translation, the 6 th and 7 th bytes record the shift position of the second translation, and so on), and then the first translation is found, so that traversal search is not needed, and the search efficiency of the translation content is effectively improved.
Compared with the prior art, the embodiment of the invention has the following beneficial effects:
1. the search translation speed is high, the search translation speed is fixed, and the search translation speed cannot be influenced by the translation number.
2. The space occupied by the translation file is reduced by about 1 half.
3. Memory consumption is reduced, and the translation file does not need to be loaded into the memory.
It should be noted that the above method or flow embodiment is described as a series of acts or combinations for simplicity, but those skilled in the art should understand that the present invention is not limited by the described acts or sequences, as some steps may be performed in other sequences or simultaneously according to the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are exemplary embodiments and that no single embodiment is necessarily required by the inventive embodiments.
Referring to fig. 4, in order to solve the same technical problem, the present invention further provides an embedded system translation apparatus, including:
the code acquisition module is used for extracting the translation serial number of the text to be translated and sequentially acquiring the offset position code corresponding to the translation serial number from the target translation file; the target translation file comprises a pre-constructed translation number code, an offset position code, a translation content code and a translation content. In the embodiment of the present invention, further, the first 4 bytes of the file header of the target translation file are used for storing the translation quantity code. In the target translation file, the storage space of each offset position code is 2 bytes.
And the translation generation module is used for matching translation content codes corresponding to the offset position codes in sequence, acquiring translation contents corresponding to the translation content codes from the target translation file and generating a target translation text according to the acquired translation contents.
The embedded system translation device further comprises:
and the file matching module is used for inquiring a pre-constructed translation file database according to the translation task instruction input by the user and acquiring a target translation file corresponding to the translation task instruction.
It can be understood that the foregoing device item embodiments correspond to the method item embodiments of the present invention, and the embedded system translation device provided in the embodiments of the present invention can implement the embedded system translation method provided in any method item embodiment of the present invention.
In order to solve the same technical problem, the present invention further provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the memory is coupled to the processor, and when the processor executes the computer program, the embedded system translation method according to any one of the above embodiments is implemented.
The embedded system translation terminal device can be a desktop computer, a notebook computer, a palm computer, a cloud server and other computing devices. The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The general processor can be a microprocessor or the processor can be any conventional processor, and the processor is a control center of the embedded system translation terminal device and is connected with various parts of the whole embedded system translation terminal device by various interfaces and lines.
The memory may mainly 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, and the like; the storage data area may store data created according to the use of the mobile phone, and the like. In addition, the memory may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
In order to solve the same technical problem, the present invention further provides a computer-readable storage medium, where a computer program is stored, and when the computer program runs, the apparatus where the computer-readable storage medium is located is controlled to execute any one of the embedded system translation methods.
The computer program may be stored in a computer readable storage medium, which when executed by a processor, may implement the steps of the various method embodiments described above. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
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. In addition, in the drawings of the embodiment of the apparatus provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, and may be specifically implemented as one or more communication buses or signal lines. One of ordinary skill in the art can understand and implement it without inventive effort.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention.

Claims (10)

1. An embedded system translation method is characterized by comprising the following steps:
extracting a translation serial number of a text to be translated, and sequentially acquiring offset position codes corresponding to the translation serial number from a target translation file; the target translation file comprises a pre-constructed translation number code, an offset position code, a translation content code and a translation content;
and matching translation content codes corresponding to the offset position codes in sequence, acquiring translation contents corresponding to the translation content codes from the target translation file, and generating a target translation text according to the acquired translation contents.
2. The embedded system translation method according to claim 1, before the extracting the translation serial number of the text to be translated and sequentially obtaining the offset position code corresponding to the translation serial number from the target translation file, further comprising:
and inquiring a pre-constructed translation file database according to a translation task instruction input by a user to obtain a target translation file corresponding to the translation task instruction.
3. The embedded system translation method according to claim 1, wherein the first 4 bytes of the file header of the target translation file are used for storing the translation quantity code.
4. The embedded system translation method according to claim 1, wherein the storage space of each offset position code in the target translation file is 2 bytes.
5. An embedded system translation device, comprising:
the code acquisition module is used for extracting the translation serial number of the text to be translated and sequentially acquiring the offset position code corresponding to the translation serial number from the target translation file; the target translation file comprises a pre-constructed translation number code, an offset position code, a translation content code and a translation content;
and the translation generation module is used for matching translation content codes corresponding to the offset position codes in sequence, acquiring translation contents corresponding to the translation content codes from the target translation file and generating a target translation text according to the acquired translation contents.
6. The embedded system translator according to claim 5, further comprising:
and the file matching module is used for inquiring a pre-constructed translation file database according to the translation task instruction input by the user and acquiring a target translation file corresponding to the translation task instruction.
7. The embedded system translation device according to claim 5, wherein the first 4 bytes of the file header of the target translation file are used for storing the translation quantity code.
8. The embedded system translation device according to claim 5, wherein the storage space of each offset position code in the target translation file is 2 bytes.
9. A terminal device comprising a processor, a memory and a computer program stored in the memory and configured to be executed by the processor, wherein the memory is coupled to the processor, and the processor executes the computer program to implement the embedded system translation method according to any one of claims 1 to 4.
10. A computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and wherein when the computer program runs, the computer-readable storage medium controls a device in which the computer-readable storage medium is located to execute the embedded system translation method according to any one of claims 1 to 4.
CN202010741307.2A 2020-07-28 2020-07-28 Embedded system translation method, device, equipment and readable storage medium Pending CN111897775A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010741307.2A CN111897775A (en) 2020-07-28 2020-07-28 Embedded system translation method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010741307.2A CN111897775A (en) 2020-07-28 2020-07-28 Embedded system translation method, device, equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN111897775A true CN111897775A (en) 2020-11-06

Family

ID=73182316

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010741307.2A Pending CN111897775A (en) 2020-07-28 2020-07-28 Embedded system translation method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN111897775A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1061666A (en) * 1990-11-19 1992-06-03 尹平祚 Microcomputer input chinese characters by voice-literal coding
US20020133481A1 (en) * 2000-07-06 2002-09-19 Google, Inc. Methods and apparatus for providing search results in response to an ambiguous search query
CN1452093A (en) * 2003-04-21 2003-10-29 北京嘉盛联侨信息工程技术有限公司 Method of bidirectional translation of terms using single thesaurus
CN101634985A (en) * 2008-07-24 2010-01-27 英业达股份有限公司 Network translation system and method for automatically judging language system of query word
CN101963957A (en) * 2010-09-28 2011-02-02 北京握奇数据系统有限公司 Method for implementing electronic dictionary on intelligent card and intelligent card

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1061666A (en) * 1990-11-19 1992-06-03 尹平祚 Microcomputer input chinese characters by voice-literal coding
US20020133481A1 (en) * 2000-07-06 2002-09-19 Google, Inc. Methods and apparatus for providing search results in response to an ambiguous search query
CN1452093A (en) * 2003-04-21 2003-10-29 北京嘉盛联侨信息工程技术有限公司 Method of bidirectional translation of terms using single thesaurus
CN101634985A (en) * 2008-07-24 2010-01-27 英业达股份有限公司 Network translation system and method for automatically judging language system of query word
CN101963957A (en) * 2010-09-28 2011-02-02 北京握奇数据系统有限公司 Method for implementing electronic dictionary on intelligent card and intelligent card

Similar Documents

Publication Publication Date Title
CN108334609B (en) Method, device, equipment and storage medium for realizing JSON format data access in Oracle
CN107391762B (en) Log data processing method and device
CN103455475B (en) Composition method, equipment and system
CN105988996B (en) Index file generation method and device
CN101661391A (en) Object serializing method, object deserializing method, device and system
CN109241095B (en) Rapid query method, terminal and storage medium
CN109902114B (en) ES cluster data multiplexing method, system, computer device and storage medium
CN106648569B (en) Target serialization realization method and device
US20200204688A1 (en) Picture book sharing method and apparatus and system using the same
CN104267974B (en) The call method and device of business interface
CN109471893B (en) Network data query method, equipment and computer readable storage medium
CN111563366A (en) Document processing method and device and electronic equipment
CN115526160A (en) Rich text processing method, device and equipment and storage medium
JPH09245043A (en) Information retrieval device
CN102063416B (en) Method and system for embedding double-byte fonts into PDF file
CN111897775A (en) Embedded system translation method, device, equipment and readable storage medium
CN111552527A (en) Method, device and system for translating characters in user interface and storage medium
CN104704487A (en) Translation processing device and program
CN111353289A (en) Document comparison method and device, storage medium and electronic equipment
CN111125216A (en) Method and device for importing data into Phoenix
CN115422270A (en) Information processing method and device
CN109840080B (en) Character attribute comparison method and device, storage medium and electronic equipment
CN111563387B (en) Sentence similarity determining method and device, sentence translating method and device
CN110555070B (en) Method and apparatus for outputting information
CN115617773A (en) Data migration method, device and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20201106

RJ01 Rejection of invention patent application after publication