Text translation method and device, electronic device, and storage medium

By extracting and normalizing the numbers in the pending text and converting them according to the numerical type, the shortcomings of existing digital translation methods in terms of accuracy and resource utilization are solved, and efficient digital translation is achieved.

CN113609874BActive Publication Date: 2025-03-25ZHUHAI KINGSOFT OFFICE SOFTWARE +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110697444.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-23
Publication Date
2025-03-25
Estimated Expiration
2041-06-23

AI Technical Summary

Technical Problem

The existing digital translation methods have shortcomings in accuracy and resource utilization. The neural network method is costly and has a large resource utilization. However, rules-based methods cannot build a complete digital translation system, which is prone to translation errors.

Method used

A text translation method is proposed, by obtaining the text to be processed, extracting the numbers to be translated, normalizing according to the preset standards of the source language, and converting them according to the numerical type to realize numerical translation between each language.

Benefits of technology

It improves the accuracy of digital translation, realizes translation between languages ​​and various types of numbers, and reduces system costs and resource usage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113609874B_ABST
    Figure CN113609874B_ABST
Patent Text Reader

Abstract

Disclosed are a text translation method and device, an electronic device, and a storage medium. The method comprises: obtaining a text to be processed, and determining a source language and a target language for translating the text to be processed; extracting numbers to be translated from the text to be processed, wherein the numbers to be translated include at least one of numbers expressed in a source language and Arabic numbers; performing normalization processing on the numbers to be translated according to a preset standard corresponding to the source language to obtain processed numbers; and converting the processed numbers from the source language to the target language according to the numerical type of the processed numbers to obtain target numbers in the target language. By performing normalization processing on the numbers to be translated corresponding to the source language to obtain standardized numbers to be translated, translation between various languages ​​and various types of numbers can be achieved, thereby improving the accuracy of digital translation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a text translation method and device, an electronic device, and a storage medium. Background Art

[0002] In the process of text translation, since numbers usually contain key information in the text, the accuracy of digital translation is very important, especially in the fields of finance, technology, etc.

[0003] At present, digital translation is usually performed using a neural network-based method or a rule-based method. However, the digital translation method based on a neural network requires a large amount of labeled training data for translation model training, which increases the system cost. In addition, translation between different languages ​​requires a large number of translation models, and each translation model has a huge number of parameters, which requires a large amount of machine resources and also increases the operation and maintenance costs. Compared with the neural network-based method, the rule-based digital translation method reduces the system cost and reduces the occupation of machine resources. However, the translation method does not build a complete translation system for digital translation between different languages. It does not support translation of some types or ranges of numbers, and is prone to translation errors. Therefore, it is necessary to improve the rule-based digital translation method to improve the accuracy of digital translation. Summary of the invention

[0004] In order to overcome the problems existing in the related art, the present invention provides a text translation method, device, electronic device and storage medium, which improve the accuracy of digital translation.

[0005] According to a first aspect of the present disclosure, a text translation method is proposed, comprising:

[0006] Acquire a text to be processed, and determine a source language and a target language for translating the text to be processed;

[0007] Extracting numbers to be translated from the text to be processed, wherein the numbers to be translated include at least one of numbers expressed in a source language and Arabic numerals;

[0008] According to the preset standard corresponding to the source language, the numbers to be translated are normalized to obtain processed numbers;

[0009] According to the numerical type of the processed number, the processed number is converted from the source language to the target language to obtain a target number in the target language.

[0010] According to a second aspect of the present disclosure, a text translation device is provided, comprising:

[0011] An acquisition unit, used for acquiring a text to be processed and determining a source language and a target language for translating the text to be processed;

[0012] An extraction unit, configured to extract numbers to be translated from the text to be processed, wherein the numbers to be translated include at least one of numbers expressed in a source language and Arabic numerals;

[0013] A processing unit, configured to perform normalization processing on the to-be-translated numbers according to a preset standard corresponding to the source language to obtain processed numbers;

[0014] A mapping unit is used to convert the processed number from the source language to the target language according to the numerical type of the processed number to obtain a target number in the target language.

[0015] According to a third aspect of the present disclosure, an electronic device is proposed, the device comprising a memory and a processor, the memory being used to store computer instructions executable on the processor, the processor being used to implement the text translation method described in any implementation manner of the present disclosure when executing the computer instructions.

[0016] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the text translation method described in any implementation manner of the present disclosure is implemented.

[0017] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the program is executed by a processor, the text translation method described in any implementation manner of the present disclosure is implemented.

[0018] In the disclosed embodiment, by extracting the numbers to be translated from the text to be processed, the numbers to be translated are normalized according to the preset standard corresponding to the source language to obtain processed numbers, and according to the numerical type of the processed numbers, the processed numbers are converted from the source language to the target language to obtain target numbers in the target language. By normalizing the numbers to be translated corresponding to the source language to obtain standardized numbers to be translated, translation between various languages ​​and various types of numbers can be achieved, thereby improving the accuracy of digital translation.

[0019] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0021] Figure 1 is a flowchart of a text translation method proposed according to at least one embodiment of the present disclosure;

[0022] Figure 2 is a structural schematic diagram of a text translation device proposed according to at least one embodiment of the present disclosure;

[0023] Figure 3 is a structural diagram of an electronic device proposed according to at least one embodiment of the present disclosure. DETAILED DESCRIPTION

[0024] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the embodiments of the present invention as detailed in the appended claims.

[0025] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments of the present invention, and are not intended to limit the embodiments of the present invention. The singular forms of "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0026] It should be understood that although the terms first, second, third, etc. may be used to describe various information in embodiments of the present invention, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of embodiments of the present invention, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0027] Figure 1 is a flowchart of a text translation method provided by at least one embodiment of the present disclosure. Figure 1 As shown, the method includes steps 101-104.

[0028] In step 101, a text to be processed is obtained, and a source language and a target language for translating the text to be processed are determined.

[0029] Among them, the text to be processed is the text to be translated. The text to be processed can be a piece of text input by a user in the interaction interface of an electronic device, or a piece of text obtained by the electronic device. The embodiments of the present disclosure do not limit the acquisition method of the text to be processed.

[0030] When using the software installed in the electronic device to translate the text to be processed, generally, the user can set the source language and the target language for translation. In some implementation manners, the source language of the text to be processed can also be determined by performing text recognition on the text to be processed. For example, in the case where the text to be processed is a piece of text expressed in Chinese, the source language can be determined as Chinese by performing text recognition on the text to be processed.

[0031] When the source language and the target language for translating the text to be processed are determined, that is, the source language and the target language for translating the numbers to be translated included in the text to be processed are determined.

[0032] In step 102, the numbers to be translated in the text to be processed are extracted. The numbers to be translated include at least one of the numbers represented in the source language and Arabic numerals.

[0033] In the embodiments of the present disclosure, a preset regular expression can be used to match the text to be processed to obtain the numbers to be translated in the text to be processed. Among them, the numbers to be translated include at least one of the numbers represented in the source language and Arabic numerals. That is, the numbers to be translated can be the numbers represented in the source language, such as Chinese numerals "one, two, three", etc., or English numerals "one, two, three...", or Arabic numerals "1234...", or the numbers represented by a combination of the source language and Arabic numerals, such as 50 million.

[0034] Taking the source language as Chinese as an example, the regular expression is used to extract the characters that belong to Chinese numerals or Arabic numerals in the text to be processed. Specifically, each character in the text to be processed can be sequentially detected to determine whether it is any one of the multiple numbers defined in the regular expression. When a number within the matching range of the regular expression is detected, the number is saved and the matching continues until a non-matching word is detected. At this time, the matching is aborted and the previously matched numbers are extracted as the numbers to be translated. By this method, the entire text to be processed is traversed to extract the numbers to be translated included in the text to be processed.

[0035] In step 103, according to the preset standard corresponding to the source language, the numbers to be translated are normalized to obtain the processed numbers.

[0036] In the actual translation process, the expression of numbers in the text to be processed may be arbitrary, resulting in non-standard numerical expressions, such as abbreviations of numbers, mixing Arabic numerals with numbers in the source language, etc. For the above non-standard expressions, it is difficult to accurately translate numbers using rule-based methods.

[0037] In an embodiment of the present disclosure, a method for normalizing numbers to be translated is proposed, in which numbers to be translated whose digital expressions do not conform to preset standards corresponding to the source language are mapped into processed numbers that conform to the preset standards, thereby achieving normalized processing of numbers to be translated.

[0038] Since the processed numbers obtained through the normalization process conform to the digital expression norms of the source language, it is beneficial to subsequently accurately map the processed numbers from the source language to the target language, thereby obtaining accurate digital translation results.

[0039] In step 104, the processed number is converted from the source language to the target language according to the numerical type of the processed number to obtain a target number in the target language.

[0040] According to the numerical type of the processed number, that is, the data type of the number to be translated in a standardized expression is an integer, fraction, decimal, etc., the processed number is converted from the source language to a number expressed in the target language according to the mapping method corresponding to the corresponding numerical type, so as to obtain the target number in the target language.

[0041] In the disclosed embodiment, by extracting the numbers to be translated from the text to be processed, the numbers to be translated are normalized according to the preset standard corresponding to the source language to obtain processed numbers, and according to the numerical type of the processed numbers, the processed numbers are converted from the source language to the target language to obtain target numbers in the target language. By normalizing the numbers to be translated corresponding to the source language to obtain standardized numbers to be translated, translation between various languages ​​and various types of numbers can be achieved, thereby improving the accuracy of digital translation.

[0042] In some implementations, the number to be translated in the text to be processed is replaced by a target number in the target language corresponding to the number to be translated in the text to be processed, thereby achieving translation of the number in the text to be processed.

[0043] In some languages, the digital representation may contain non-digital words or symbols, so it is difficult to match using regular expressions. To solve this problem, the present disclosure proposes a digital extraction method, which is specifically as follows:

[0044] First, sequentially scan the first character in the text to be processed, where the first character includes either a word or a symbol. That is, sequentially scan each word or symbol in the text to be processed, and the symbols include various styles of symbols contained in the corresponding language, such as the period “。” in Chinese, the comma “,” and the hyphen “-” in English, etc.

[0045] Next, for the first character obtained by scanning, according to the second preset rule corresponding to the type of the first character, extract the first character into a list or skip the first character without extraction, where the list is initially empty. That is, in the case where the type of the first character meets the extraction criteria in the second preset rule, the first character is extracted into the list; otherwise, if the type of the first character does not meet the extraction criteria, the first character is skipped without extraction.

[0046] Among them, the type of the first character includes at least one of a cardinal number, an ordinal number, a conjunction, and an Arabic numeral. If the first character scanned is not any of the above types, the first character is skipped without extraction. That is, if the first character, that is, the first character, neither represents a number nor is a conjunction, such as a word, it is not extracted.

[0047] In one example, when the type of the first character is a cardinal number, the first character is added to the list. Among them, a cardinal number is a numeral that describes the quantity of things. For example, if the first character is an English cardinal number such as “one”, “two”, “three”, a Chinese cardinal number such as “一二三”, or an Arabic numeral cardinal number such as “1234…”, etc., such a first character is directly added to the list.

[0048] In one example, when the type of the first character is an ordinal number, if the current list is not empty, that is, the list already stores the first characters extracted previously, the first character is added to the list; conversely, if the current list is empty, that is, no other first characters have been extracted previously, the first character is skipped without extraction. For example, when the first character is an ordinal number such as “first” or “second”, if the current list is empty, it indicates that the ordinal number does not belong to the same word as the previous number but represents the meaning of an ordinal number such as “first” or “second”, so the first character is skipped without extraction. And when the current list is not empty, the ordinal number may be a character representing the denominator in a fraction in a number phrase. For example, one fifth represents the denominator in a fraction. Then the first character is extracted into the list to form the number to be translated together with the characters already existing in the list.

[0049] In one example, when the type of the first character is a conjunction, if the last character of the current list is a cardinal number, then add the first character to the list; conversely, if the last character of the current list is not a base word, including the case where the current list is empty, then skip the first character without extraction. For example, when the first character is a connecting symbol such as ",", "-", etc., if the last character in the list is a cardinal number, it indicates that the first character is a connector for connecting subsequent numbers, then extract the first character into the list and use it together with the previously extracted cardinal number as the number to be translated.

[0050] In one example, when the type of the first character is an Arabic numeral, then add the first character to the list. That is to say, if an Arabic numeral is encountered, regardless of the situation of the list at this time, add the first character to the list.

[0051] Finally, in response to the operation of skipping the first character without extraction, concatenate the first characters in the list into a string to obtain the number to be translated, and clear the list.

[0052] That is to say, once the situation of skipping the first character without extraction occurs, concatenate the existing first characters in the current list into a string to obtain the number to be translated. At the same time, clear the list and continue to traverse the text to be processed, and the list is empty during the subsequent traversal.

[0053] For example, for the text "There are 1329 students here", when the Arabic numerals "1", "3", "2", "9" are detected, extract them into the list respectively. Until encountering "个", skip it without extraction, then concatenate the above-extracted Arabic numerals into a string to obtain the number to be translated 1329.

[0054] Another example, for the text "The centimeter is one-tenth of the decimeter or one-hundredth of the meter", when the character "one" of the type of cardinal number is detected, extract "one" into the list; next, when the connecting symbol "-" is detected, since there is a cardinal number "one" in the list at this time, that is, it meets the extraction condition, then extract the connecting symbol "-" into the list; then, when the ordinal number "tenth" is detected, since the list is not empty at this time, the ordinal number meets the extraction condition, then extract "tenth" into the list. When "of" is detected, since the type of this character is not any of the above, skip it without extraction, then concatenate the characters that already exist in the list at this time into a string to obtain the number to be translated "one-tenth".

[0055] In the embodiment of the present disclosure, a number extraction method is proposed, which can accurately and completely extract the numbers contained in the text, and is the basis for accurately translating the numbers in the text to be processed.

[0056] In some implementations, the obtained numbers to be translated are screened, and numbers that do not need to be translated are deleted.

[0057] In one example, when the number to be translated contains only digital units, such as "ten thousand", "million", etc., but no numbers, the digital units may be words expressing degree or proper nouns, such as "thank you very much", "Vanke", "thousands and millions", etc. Although they contain digital units, they are not numbers that need to be translated, so they are deleted and no subsequent processing is performed.

[0058] In another example, for chapter marks, such as "2.2.2", no translation is required, and they are deleted without subsequent mapping.

[0059] In another example, expressions that do not conform to numerical syntax rules are also deleted and not processed later, for example, character strings such as "3%thousand" and "%hundred" that do not represent true numerical meanings.

[0060] In the disclosed embodiment, by deleting character strings that do not actually need to be translated in the numbers to be translated, incorrect translation is avoided, resulting in the translated text expressing a meaning inconsistent with the original text.

[0061] In some implementations, the incompletely expressed digits to be translated can be mapped to completely expressed digits so that the mapped digits conform to the rules of digit translation, thereby obtaining a correct translation result. The complete expression is an expression of a digit or a digit unit without omitting any digits in the digits. This is applicable to Arabic numerals, English numerals, or Chinese numerals. When it is detected that the digits to be translated are not completely expressed, the complete expression is obtained according to the corresponding mapping relationship.

[0062] For example, if there is no number before the decimal separator "." or "point", it means that the integer part that is zero is omitted. Then, according to the language of the number, the zero in the language is supplemented to obtain the complete number.

[0063] For example, for “.3”, add the Arabic numeral 0 to the integer position to get “0.3”; for “point three”, add “zero” to the integer position, and so on.

[0064] For another example, in the case where there is no number before the numerical unit, it means that the "one" before the numerical unit is omitted. Then, according to the language of the number, the "one" in that language is supplemented to obtain the numerically complete expression.

[0065] For example, supplement the "one" before the numerical unit "ten thousand" for "ten thousand eight thousand".

[0066] For yet another example, in the case where the numerical unit is missing, the numerical unit is supplemented. For example, for "twelve thousand", the numerical unit is supplemented to obtain the numerically complete expression "twelve thousand".

[0067] In the embodiments of the present disclosure, these numerically incomplete expressions are mapped to numerically complete expressions to implement the normalization processing of numbers.

[0068] In some implementation manners, in the case where the number to be translated contains numbers expressed in two or more languages, the number is converted into a number expressed in the same language.

[0069] For example, for a number to be translated that contains both Chinese and Arabic numerals, the Chinese numerals can be converted into Arabic numerals, or the Arabic numerals can be converted into Chinese numerals, so that the converted number only contains numbers expressed in one language.

[0070] In one example, the multiple languages contained in the number to be translated can be converted into numbers expressed in the source language.

[0071] In yet another example, multiple languages can be converted into Arabic numerals. For example, in the case where Chinese numerals and English numerals are included, both the Chinese numerals and the English numerals can be converted into Arabic numerals.

[0072] For example, convert "fifty million" to "fifty million"; or convert "five thousand" to "5000".

[0073] In some implementation manners, in the case where the number to be translated contains traditional Chinese characters or special characters, the traditional Chinese characters or special characters are converted into corresponding simplified Chinese characters with the same meaning to implement the normalization processing of numbers. For example, convert the traditional Chinese character "壹" to the simplified Chinese character "一", convert "萬" to the simplified Chinese character "万"; convert the special Chinese characters "廿", "卅" to the simplified Chinese characters "twenty", "thirty", etc.

[0074] In some embodiments, when the processed number contains a decimal and a digital unit, the decimal can be scaled according to the digital unit contained in the processed number, and the processed number can be updated according to the scaling result, so that the processed number is mapped to a decimal or integer in a standard expression, and then the subsequent mapping is performed to accurately translate the decimal. For example, for an expression such as "0.3 billion" that contains a decimal and a unit, the processed number is first scaled, that is, "0.3" is multiplied by the scaling multiple represented by "100 million", and after obtaining a processed number containing only integers, the processed number is then mapped to the target language.

[0075] In some embodiments, if the number to be translated is already in a standardized form, the above steps are performed on the number to be translated, and the number to be translated including decimals and digital units is scaled to obtain the processed number.

[0076] In the disclosed embodiment, by mapping the processed numbers into processed numbers that comply with digital expression rules, the processed numbers can be accurately mapped into target numbers subsequently to obtain accurate digital translation results.

[0077] After the normalization process is completed, the mapping to the target language can then be performed.

[0078] In some implementation schemes, the processed number can be first decomposed according to the numerical type of the processed number and the category of the source language; then the decomposed parts can be respectively mapped to the numerical parts of the target language; finally, according to the category of the target language, the numerical parts can be combined to obtain the target number.

[0079] The processed numbers may be decomposed in the following manner.

[0080] First, multiple categories of separators in the source language are detected in the processed numbers. The numerical types include integers, decimals, and fractions. Each category of separators corresponds to the numerical type and is related to the source language, that is, when the source language category and the numerical category are known, the type of separator can be determined, see Table 1.

[0081] Table 1

[0082]

[0083] Next, the numerical category of the processed number is determined according to the category of the detected separator. That is, according to the detected separator, it can be determined whether the processed number is an integer, a decimal or a fraction. For example, in the case of detecting a "dot", it can be determined that the processed number is a decimal; in the case of detecting a dot "divided by", it can be determined that the processed number is a fraction; and in the case of not detecting a separator, it can be determined that the processed number is an integer.

[0084] Finally, the processed number is decomposed according to the numerical category of the processed number and the type of the source language. That is, the processed number is decomposed according to the preset decomposition rules corresponding to the numerical type and the type of the source language to obtain one or more corresponding parts.

[0085] As for integers, although there are no visible separators in the numbers, for Chinese and English integers, digital units can be used as separators to decompose the integers into multiple digits and digital unit parts. Among them, the digital unit can be regarded as a scaling factor. Afterwards, according to the constructed mapping table of Chinese numerals or English numerals to Arabic numerals, the corresponding Arabic numerals are converted by looking up the table, and then the Arabic numerals are multiplied by the corresponding scaling factor (digital unit) to obtain the Arabic numerals corresponding to the Chinese numerals / English numerals.

[0086] For Arabic numerals, when converting to English, the numbers are divided into blocks with "1000" as the base, and then each block is processed as "hundreds" and "tens" respectively to convert them into English numerals.

[0087] When converting to Chinese, the numbers are divided into blocks based on "10000", and then each block is processed separately as "thousands", "hundreds" and "tens", and finally converted into Chinese numbers.

[0088] For decimals, conventional floating-point operations may cause precision loss and translation errors. To solve this problem, the present disclosure converts floating-point operations into string operations. For example, the floating-point addition "2+0.78" will produce the result "2.7800000000000002", and after conversion into a string operation, the result of "'2'+'0.78'" is "'2.78'".

[0089] The processed number is decomposed according to the separator corresponding to the decimal. The integer part obtained by decomposition is decomposed using the integer decomposition rule described above and mapped to the target number of the target language; the decimal part is directly translated through a dictionary.

[0090] For fractions, decompose them according to the following method.

[0091] Decompose the processed number into a first integer part and a first fractional part according to the delimiter of the first type among the delimiters.

[0092] The delimiter of the first type is the delimiter corresponding to fractions in various source languages, as shown in Table 1. Through the first delimiter, decompose the processed number into a first integer part and a first fractional part.

[0093] Taking Arabic numerals as an example, "1 1 / 2" is decomposed into a first integer part "1" and a first fractional part "1 / 2" through the delimiter of the first type "space" in Arabic numerals.

[0094] Taking Chinese as an example, "one and one half" is decomposed into a first integer part "one" and a first fractional part "one half" through the delimiter of the first type "and" in Chinese.

[0095] Taking English as an example, "one and one half" is decomposed into a first integer part "one" and a first fractional part "one half" through the delimiter of the first type "and" in English.

[0096] Next, decompose the first fractional part into a second integer part and a third integer part according to the delimiter of the second type among the delimiters. Wherein, in the case that the processed number does not contain the delimiter of the first type, the first fractional part is the processed number. That is to say, in the case that the processed number does not contain an integer part and only contains a decimal part or a fractional part, directly decompose the decimal part or the fractional part.

[0097] For the first fractional part obtained by decomposition according to the delimiter of the first type, the first fractional part can be further decomposed according to the delimiter of the second type. Wherein, the delimiter of the second type is the symbol representing a fraction in the source language.

[0098] The delimiter of the second type usually includes " / " or "-" in Arabic numerals. For the first fractional part "1 / 2", it can be decomposed into a second integer part "1" and a third integer part "2" according to the delimiter of the second type " / " in Arabic numerals. That is, the second integer part represents the numerator and the third integer part represents the denominator.

[0099] The delimiter of the second type is, for example, "fen zhi" in Chinese. For the first fractional part "one half", it can be decomposed into a second integer part "one" and a third integer part "two" according to the delimiter of the second type "fen zhi" in Chinese.

[0100] When expressing numbers in English, it is usually considered that the separator before the ordinal word, or "of", or "over", is the second type of separator. When expressing English fractions with cardinal numbers plus ordinal numbers, since the ordinal numbers above twenty contain cardinal numbers, such as twenty fifth, the decomposition method that considers the separator before the ordinal number as the second type of separator will lead to decomposition errors, making the mapped target number also wrong.

[0101] Therefore, in view of the expression characteristics of fractions in English numbers, the embodiment of the present disclosure also uses words that meet the following conditions as the second type of separators.

[0102] In one case, if there is no first set connecting character after the word representing a numerical unit above one hundred, it is considered that there is a second type of separator after the numerical unit above one hundred, wherein the first set connecting character includes any one of "," and "and".

[0103] In English, the units of numbers above one hundred include "thousand", "million", and "billion". For numbers above one thousand, usually count from the right end of the number to the left end, and divide every three digits by the first set connecting character ",". For example, the number "7,166,234" is expressed in English as "seven million, one hundred and sixty sixthousand, two hundred and thirty four".

[0104] For numbers above one thousand, for example, "1231" can also be expressed as "one thousand and one hundred and thirty one", that is, using "and" to divide the thousands and hundreds.

[0105] That is to say, if there is no first-set connecting character "," or "and" after the digits above the hundred, it means that the digit itself is a whole thousand or a whole million, and there are no other digits after it. Therefore, if there is no first-set connecting character after the word representing the digits above the hundred, it is considered that there is a second separator after the digit.

[0106] For example, the number "1000 / 27" is expressed in English as "one thousand twenty seventh". If the conventional method is followed, the part before the ordinal number seventh is used as the numerator, and seventh is used as the denominator. In this fractional expression, the denominator is actually an integer. Therefore, according to the method proposed in the embodiment of the present disclosure, when it is detected that there is no first set connecting character "," or "and" after "thousand", it is considered that there is a second separator here, so the English number is decomposed into the second integer part (numerator) as one thousand, and the third integer part (denominator) as twentyseventh.

[0107] The decomposition method for English fractions proposed in the embodiment of the present disclosure can avoid the incorrect connection of ordinal numbers in the numerator and denominator.

[0108] In another case, if a word representing a number is followed by a word representing a number of the same level, it is considered that there is a second separator between the two numbers of the same level.

[0109] In the expression of cardinality in English, two words representing numbers of the same level will not appear consecutively. This happens because the latter number represents the denominator in a fraction.

[0110] For example, the number "3 / 7" is expressed in English as "three sevenths". If two unit words appear consecutively, it can be considered that there is a second separator between the two unit words, that is, the English number is decomposed into the second integer part (numerator) being three and the second integer part (denominator) being seventh.

[0111] For another example, the number "20 / 21" is expressed in English as "twenty twenty first". If the conventional method is used, the part before the ordinal word first is used as the numerator and first is used as the denominator, and the decomposition result is obviously incorrect. However, according to the method proposed in the embodiment of the present disclosure, if two tens appear consecutively in the English number, it can be considered that there is a second separator between the two tens, that is, the English number is decomposed into the second integer part (numerator) as twenty and the second integer part (denominator) as twenty first.

[0112] The method for decomposing English fractions proposed in the embodiments of the present disclosure can avoid the misdecomposition of ordinal numbers in the denominator.

[0113] In another case, when there is no second set connecting word after the word representing the hundreds digit, it is considered that there is a second type of separator after the hundreds digit, wherein the second set connecting character is, for example, "and".

[0114] For example, if there is no "and" after "hundred", it means that the number itself is a hundred, and there are no other numbers after it. Therefore, if there is no second set connecting character after the word representing the numerical unit of hundreds, it is considered that there is a second separator after "hundred".

[0115] For example, the number "100 / 1001" is expressed in English as "one hundred one thousand and first". If the conventional method is followed, the part before the ordinal number first is used as the numerator and first is used as the denominator, and the decomposition result is obviously incorrect. Therefore, according to the method proposed in the embodiment of the present disclosure, when it is detected that there is no second set connecting character "and" after "hundred", it is considered that there is a second separator here, so the English number is decomposed into the second integer part (numerator) as one hundred and the third integer part (denominator) as on thousand and first.

[0116] The method for decomposing English fractions proposed in the embodiment of the present disclosure can avoid the incorrect connection between the hundreds digit in the numerator and the ordinal number in the denominator.

[0117] In the disclosed embodiments, the above-mentioned square solution method is proposed to address the problems existing in the existing English fraction decomposition, thereby avoiding the erroneous connection of the cardinal number in the numerator and the ordinal number in the denominator, and avoiding the erroneous decomposition of the ordinal number in the denominator, thereby improving the accuracy of English fraction decomposition and laying the foundation for the accurate translation of English fractions.

[0118] In some cases, "and" follows "hundred", but this "and" means "also", such as "one hundred and one half", which can mean both "100 1 / 2" and "101 / 2", which are obviously not equivalent. In order to avoid this ambiguity, when translating mixed fractions with whole numbers, "of" is usually used to indicate the separator between the numerator and the denominator, that is, "100 1 / 2" is translated into English as "one hundred and one of two".

[0119] After decomposing the processed number, the decomposed parts can be mapped to corresponding numerical parts in the target language using a dictionary, and then the numerical parts are combined according to the category of the target language to obtain the target number. The translation of the number in the text to be processed is completed by replacing the number to be translated in the text to be processed with the target number.

[0120] Figure 2 is a schematic diagram of the structure of a text translation device according to at least one embodiment of the present disclosure. Figure 2 As shown, the device includes: an acquisition unit 201, which is used to acquire a text to be processed and determine a source language and a target language for translating the text to be processed; an extraction unit 202, which is used to extract numbers to be translated from the text to be processed, and the numbers to be translated include at least one of numbers expressed in the source language and Arabic numerals; a processing unit 203, which is used to normalize the numbers to be translated according to a preset standard corresponding to the source language to obtain processed numbers; and a mapping unit 204, which is used to convert the processed numbers from the source language to the target language according to the numerical type of the processed numbers to obtain target numbers in the target language.

[0121] In some implementations, the extraction unit is specifically used to: sequentially scan the first character in the text to be processed, the first character including any one of a word and a symbol; for the scanned first character, according to a second preset rule corresponding to the type of the first character, extract the first character into a list or skip the first character without extraction, wherein the list is initially empty; in response to an operation of skipping the first character without extraction, concatenating the first characters in the list into a character string to obtain the number to be translated, and clearing the list.

[0122] In some implementations, the type of the first character includes at least one of a cardinality, an ordinal number, a conjunction, and an Arabic numeral, and the second preset rule corresponding to the type of the first character includes at least one of the following: in response to the first character being a cardinality, adding the first character to the list; in response to the first character being an ordinal number, adding the first character to the list if the list is not empty, otherwise skipping the first character without extracting it; in response to the first character being a conjunction, adding the first character to the list if the last character in the list is a cardinality, wherein the conjunction includes a conjunction symbol; in response to the first character being an Arabic numeral, adding the first character to the list; in response to the first character being a non-number or a conjunction, skipping the extraction.

[0123] In some implementations, the device further includes a deleting unit for deleting, after extracting the numbers to be translated from the text to be processed, the numbers to be translated that meet at least one of the following conditions: the numbers to be translated do not have numerical meaning; the numbers to be translated are chapter symbols; the numbers to be translated do not conform to numerical syntax.

[0124] In some implementations, the preset standard includes at least one of the following: fully expressing the number to be translated; if the number to be translated contains numbers expressed in two or more languages, converting the number into a number expressed in the same language.

[0125] In some implementations, the device further includes an updating unit for scaling the decimal according to the digital units included in the processed number in response to the processed number containing decimals and digital units, and updating the processed number according to the scaling result.

[0126] In some implementations, the mapping unit is specifically used to: decompose the processed number according to the numerical type of the processed number and the category of the source language; map the decomposed parts into numerical parts of the target language respectively; and combine the numerical parts according to the category of the target language to obtain the target number.

[0127] In some implementations, when the mapping unit is used to decompose the processed number according to the numerical type of the processed number and the category of the source language, it is specifically used to: detect multiple categories of separators in the source language in the processed number, each category of separators corresponds to a numerical category; determine the numerical category of the processed number according to the category of the detected separator; and decompose the processed number according to a preset decomposition rule corresponding to the numerical category.

[0128] In some implementations, when the numerical type of the processed number is a fraction, the mapping unit, when used to decompose the processed number according to a preset decomposition rule corresponding to the numerical type, is specifically used to: decompose the processed number into a first integer part and a first fractional part according to a first type of separator among the separators; decompose the first fractional part into a second integer part and a third integer part according to a second type of separator among the separators, wherein, when the processed number does not contain the first type of separator, the first fractional part is the processed number.

[0129] In some implementations, the device also includes a separator unit for, when the source language is English, using words that meet the following conditions as second-type separators: a word representing a numerical unit above one hundred is not followed by a first-set connecting character; a word representing a number is followed by a word representing a number of the same level; a word representing a numerical unit of one hundred is not followed by a second-set connecting character.

[0130] At least one embodiment of the present disclosure further provides an electronic device, such as Figure 3 As shown, the device includes a memory and a processor, the memory is used to store computer instructions that can be executed on the processor, and the processor is used to implement the text translation method described in any embodiment of the present disclosure when executing the computer instructions.

[0131] At least one embodiment of the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, and when the program is executed by a processor, the text translation method described in any embodiment of the present disclosure is implemented.

[0132] At least one embodiment of the present disclosure further provides a computer program product, including a computer program, which, when executed by a processor, implements the text translation method described in any embodiment of the present disclosure.

[0133] It should be understood by those skilled in the art that one or more embodiments of the present specification may be provided as a method, system or computer program product. Therefore, one or more embodiments of the present specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, one or more embodiments of the present specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0134] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the data processing device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0135] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0136] The embodiments of the subject matter and functional operations described in this specification may be implemented in the following: digital electronic circuits, tangibly embodied computer software or firmware, computer hardware including the structures disclosed in this specification and their structural equivalents, or a combination of one or more of them. The embodiments of the subject matter described in this specification may be implemented as one or more computer programs, i.e., one or more modules in computer program instructions encoded on a tangible non-temporary program carrier to be executed by a data processing device or to control the operation of the data processing device. Alternatively or additionally, the program instructions may be encoded on an artificially generated propagation signal, such as a machine-generated electrical, optical or electromagnetic signal, which is generated to encode information and transmit it to a suitable receiver device for execution by a data processing device. The computer storage medium may be a machine-readable storage device, a machine-readable storage substrate, a random or serial access memory device, or a combination of one or more of them.

[0137] The processes and logic flows described in this specification can be performed by one or more programmable computers executing one or more computer programs to perform corresponding functions by operating on input data and generating output. The processes and logic flows can also be performed by special purpose logic circuits, such as FPGAs (field programmable gate arrays) or ASICs (application-specific integrated circuits), and the apparatus can also be implemented as special purpose logic circuits.

[0138] Computers suitable for executing computer programs include, for example, general and / or special microprocessors, or any other type of central processing unit. Typically, the central processing unit will receive instructions and data from a read-only memory and / or a random access memory. The basic components of a computer include a central processing unit for implementing or executing instructions and one or more memory devices for storing instructions and data. Typically, the computer will also include one or more large-capacity storage devices for storing data, such as magnetic disks, magneto-optical disks, or optical disks, or the computer will be operably coupled to this large-capacity storage device to receive data from it or to transmit data to it, or both. However, the computer does not necessarily have such a device. In addition, the computer can be embedded in another device, such as a mobile phone, a personal digital assistant (PDA), a mobile audio or video player, a game console, a global positioning system (GPS) receiver, or a portable storage device such as a universal serial bus (USB) flash drive, to name a few.

[0139] Computer readable media suitable for storing computer program instructions and data include all forms of non-volatile memory, media and memory devices, including, for example, semiconductor memory devices (e.g., EPROM, EEPROM and flash memory devices), magnetic disks (e.g., internal hard disks or removable disks), magneto-optical disks, and CD ROM and DVD-ROM disks. The processor and memory may be supplemented by, or incorporated in, special purpose logic circuitry.

[0140] Although this specification includes many specific implementation details, these should not be interpreted as limiting the scope of any invention or the scope of protection claimed, but are mainly used to describe the features of the specific embodiments of specific inventions. Certain features described in multiple embodiments in this specification may also be implemented in combination in a single embodiment. On the other hand, the various features described in a single embodiment may also be implemented separately in multiple embodiments or in any suitable sub-combination. In addition, although features may work in certain combinations as described above and even initially claim protection, one or more features from the claimed combination may be removed from the combination in some cases, and the claimed combination may point to a sub-combination or a variation of a sub-combination.

[0141] Similarly, although operations are depicted in a particular order in the accompanying drawings, this should not be understood as requiring that these operations be performed in the particular order shown or performed sequentially, or requiring that all illustrated operations be performed to achieve the desired results. In some cases, multitasking and parallel processing may be advantageous. In addition, the separation of various system modules and components in the above-described embodiments should not be understood as requiring such separation in all embodiments, and it should be understood that the described program components and systems can generally be integrated together in a single software product, or packaged into multiple software products.

[0142] Thus, specific embodiments of the subject matter have been described. Other embodiments are within the scope of the appended claims. In some cases, the actions recited in the claims can be performed in a different order and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the particular order or sequential order shown to achieve the desired results. In some implementations, multitasking and parallel processing may be advantageous.

[0143] The above description is merely a preferred embodiment of one or more embodiments of the present specification and is not intended to limit one or more embodiments of the present specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present specification shall be included in the scope of protection of one or more embodiments of the present specification.

Claims

1. A text translation method, characterized in that: The method comprises: Acquire a text to be processed, and determine a source language and a target language for translating the text to be processed; Extracting numbers to be translated from the text to be processed, wherein the numbers to be translated include at least one of numbers expressed in a source language and Arabic numerals; According to the preset standard corresponding to the source language, the numbers to be translated are normalized to obtain processed numbers; According to the numerical type of the processed number, convert the processed number from the source language to the target language to obtain a target number in the target language; The converting the processed number from the source language to the target language according to the numerical type of the processed number to obtain a target number in the target language includes: Decomposing the processed number according to the numerical type of the processed number and the category of the source language; Map the decomposed parts to numerical parts of the target language respectively; Combining the numerical parts according to the category of the target language to obtain the target number; In the case where the number type of the processed number is a fraction type and the source language is English, the method further includes using a word that meets at least one of the following conditions as a second type of separator: a word representing a digital unit above the hundredth place is not followed by a first set connecting character; a word representing a number is followed by a word representing a number of the same level; a word representing a digital unit of the hundredth place is not followed by a second set connecting character; The decomposing the processed number comprises: decomposing a first fractional part of the processed number of a fractional type into a second integer part and a third integer part based on the second type of separator.

2. The method according to claim 1, characterized in that The step of extracting the numbers to be translated from the text to be processed includes: sequentially scanning the first characters in the text to be processed, wherein the first characters include any one of a word and a symbol; For a first character obtained by scanning, according to a second preset rule corresponding to the type of the first character, extract the first character into a list or skip the first character without extracting it, wherein the list is initially empty; In response to the operation of skipping the first character and not extracting it, the first characters in the list are concatenated into a character string to obtain the number to be translated, and the list is cleared.

3. The method according to claim 2, characterized in that The type of the first character includes at least one of a cardinal number, an ordinal number, a conjunction, and an Arabic numeral, and the second preset rule corresponding to the type of the first character includes at least one of the following: In response to the first character being a cardinal number, adding the first character to the list; In response to the first character being an ordinal number, if the list is not empty, adding the first character to the list, otherwise skipping the first character without extracting it; In response to the first character being a conjunction, if the last character in the list is a cardinality, adding the first character to the list, wherein the conjunction includes a hyphen; In response to the first character being an Arabic numeral, adding the first character to the list; In response to the first character being a non-digit or a conjunction, the extraction is skipped.

4. The method according to claim 1, characterized in that: After extracting the numbers to be translated from the text to be processed, the method further includes: deleting the numbers to be translated that meet at least one of the following conditions: The number to be translated does not have a numerical meaning; The numbers to be translated are chapter symbols; The number to be translated does not conform to the numerical syntax.

5. The method according to any one of claims 1 to 4, characterized in that: The preset criteria include at least one of the following: Completely describe the numbers to be translated; When the number to be translated includes numbers expressed in two or more languages, the number is converted into a number expressed in the same language.

6. The method according to claim 5, characterized in that The method further comprises: In response to the processed number containing decimals and digital units, The decimal is scaled according to the digital unit contained in the processed number, and the processed number is updated according to the scaled result.

7. The method according to claim 1, characterized in that Decomposing the processed number according to the numerical type of the processed number and the category of the source language, including: Detecting multiple categories of separators in the source language in the processed numbers, each category of separators corresponding to a numerical type; Determining the numerical type of the processed number according to the type of the detected separator; The processed number is decomposed according to a preset decomposition rule corresponding to the numerical type.

8. The method according to claim 7, characterized in that In the case where the numerical type of the processed number is a fraction, decomposing the processed number according to a preset decomposition rule corresponding to the numerical type includes: decomposing the processed number into a first integer portion and a first fractional portion according to a first type of separator among the separators; The first fractional part is decomposed into a second integer part and a third integer part according to a second type of separator among the separators, wherein the first fractional part is the processed number if the first type of separator is not included in the processed number.

9. A text translation device, characterized in that: The device comprises: An acquisition unit, used for acquiring a text to be processed and determining a source language and a target language for translating the text to be processed; An extraction unit, configured to extract numbers to be translated from the text to be processed, wherein the numbers to be translated include at least one of numbers expressed in a source language and Arabic numerals; A processing unit, configured to perform normalization processing on the to-be-translated numbers according to a preset standard corresponding to the source language to obtain processed numbers; A mapping unit for converting the processed number from the source language to the target language according to the numerical type of the processed number to obtain a target number in the target language; The converting of the processed number from the source language to the target language according to the numerical type of the processed number to obtain a target number in the target language includes: Decomposing the processed number according to the numerical type of the processed number and the category of the source language; Map the decomposed parts to numerical parts of the target language respectively; Combining the numerical parts according to the category of the target language to obtain the target number; In the case where the numerical type of the processed number is a fraction type and the source language is English, the device is used to use a word that meets at least one of the following conditions as a second type of separator: there is no first set connection character after the word representing a digital unit above the hundredth place; there is a word representing a number of the same level after the word representing the number; there is no second set connection character after the word representing the digital unit of the hundredth place; The decomposing the processed number comprises: decomposing a first fractional part of the processed number of a fractional type into a second integer part and a third integer part based on the second type of separator.

10. An electronic device, characterized in that: The device comprises a memory and a processor, wherein the memory is used to store computer instructions executable on the processor, and the processor is used to implement the method according to any one of claims 1 to 8 when executing the computer instructions.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

12. A computer program product, comprising a computer program, characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Conversion method and device and electronic device

    CN109558599A

  • Text translation method, device and equipment

    CN109977430A