Detailed Description
In order that the above-recited objects, features and advantages of the present invention will become more readily apparent, a more particular description of the invention will be rendered by reference to the appended drawings and appended detailed description.
One of the core concepts of the embodiment of the invention is that the width of an original text editing area and a translated text display area in a translation interface is adjusted according to the language of the translated text and the language of the translated text, so that the comparison dislocation of the translated text and the translated text is avoided.
The translation interface is used for displaying translation, wherein an original text editing area in the translation interface is used for editing translation original text, and a translation display area is used for displaying translation.
Referring to fig. 2, a flowchart illustrating steps of an embodiment of a method for adjusting a region according to the present invention may specifically include the following steps:
Step 202, determining an original language of a translation original in an original editing area of a translation interface and a translation language of a translation corresponding to the translation of the translation original.
When a user needs to translate, a translation application or a translation tool in the terminal can be started, a translation interface is entered, translation originals are input in an original edition area of the translation interface, and a translation language corresponding to the translation is set; then, executing translation operation, namely checking the translation of the translation language corresponding to the translation original text; of course, after the user finishes inputting the translation original text and setting the translation language, the user can directly check the translation text of the translation language corresponding to the translation original text without executing translation operation; the embodiments of the present invention are not limited in this regard. The translation application may be an application capable of providing a translation service, and when the translation application is restarted or a translation tool enters the translation interface each time, the width of the original text editing area and the width of the translation display area in the translation interface may be a default value or a width value after the last width adjustment; the embodiments of the present invention are not limited in this regard. In addition, the default value of the width of the original text editing area and the default value of the width of the translated text display area may be the same or different, which is not limited in the embodiment of the present invention.
After determining that the user needs to translate the translation original text, on one hand, the translation application or the translation tool can determine an original text language corresponding to the translation original text, determine a translation language corresponding to the translation translated text of the translation original text, and then adjust the widths of the original text editing area and the translation display area according to the original text language and the translation language. On the other hand, the translation application or the translation tool can translate the translation original text in the original text editing area to obtain the translation corresponding to the translation language; and then displaying the translated version in the translated version display area for the user to view.
In the embodiment of the present invention, a manner of adjusting the widths of the original text editing area and the translated text display area according to the original text language and the translated text language may refer to steps 204-206:
step 204, determining matched preset ratio information according to the original language and the translated language.
And step 206, adjusting the width of the original text editing area and the width of a translation display area in the translated interface according to the matched preset ratio information, and displaying the translated version in the translation display area.
In the embodiment of the invention, the corresponding preset ratio information between any two languages can be predetermined, and the preset ratio information between any two languages can be determined according to the height ratio of the texts with the same content expressed by the two languages when displayed in the preset area according to the same display style. Wherein, the display style may include: the same display style may refer to the same number of characters, the same word spacing, the same line spacing, and the same segment spacing. For example, if the chinese text is displayed in the preset area according to the display style 1 to have the height X1, and the english text (such as the english translation corresponding to the chinese text) with the same content as the chinese text is displayed in the preset area according to the display style 1 to have the height X2, the corresponding preset ratio information between chinese and english may be X1/X2.
Correspondingly, the display patterns of the original text editing area and the translation display area in the translation interface are the same, and the display patterns of the original text editing area and the translation display area are the same as those of the preset area; and then the width of the original text editing area and the width of the translated text display area can be adjusted according to the preset ratio information, and the heights of the translated text in the adjusted original text editing area and the translated text in the width-adjusted translated text display area can be adjusted to be equal, so that the disorder of the comparison of the translated text and the translated text is avoided.
According to the embodiment of the invention, the preset ratio information matched with the pair of the original language and the translated language can be searched from the preset ratio information stored in advance according to the original language and the translated language; and then adjusting the width of the original text editing area and the width of the translated text display area according to the matched preset ratio information. And displaying the translated version in the translated version display area, so that the translated version is convenient for users to review.
In one example of the present invention, a user inputs a chinese text in an original text editing area of a translation interface as shown in a left area of fig. 3a, sets a translation language to english, and performs a translation operation; the translation application or the translation tool can determine an original language (Chinese) corresponding to the translation original text and a translation language (English) corresponding to the translation original text in an original text editing area in the translation interface; then, according to the original language and the translated language, determining matched preset ratio information, for example, the preset ratio information corresponding to Chinese-English is 1:1.40, and the matched preset ratio information can be determined to be 1:1.40; and then adjusting the width of the original text editing area and the width of a translation display area in the translation interface according to the matched preset ratio information, displaying the translation in the translation display area as shown in the right area in fig. 3a, wherein the translation original text (Chinese) in the original text editing of the translation interface and the translation (English) in the translation display area can be compared with each other.
In one example of the present invention, after a user inputs a chinese text in an original text editing area of a translation interface as shown in a left area in fig. 3b, sets a translation language to arabic and performs a translation operation; the translation application or the translation tool can determine an original language (Chinese) corresponding to the translation original in an original editing area in the translation interface and a translated language (Arabic) corresponding to the translation of the corresponding translation original in a translated version display area; then, according to the original language and the translated language, determining matched preset ratio information, for example, the preset ratio information corresponding to Chinese-Arabic is 1:0.91, and determining the matched preset ratio information is 1:0.91; and then adjusting the width of the original text editing area and the width of the translation display area in the translation interface according to the matched preset ratio information, displaying the translation in the translation display area as shown in the right area in fig. 3b, wherein the translation original text (Chinese) in the original text editing of the translation interface and the translation (Arabic) in the translation display area can be compared with each other.
In one example of the present invention, a user inputs a Chinese text in an original text editing area of a translation interface as shown in a left area in fig. 3c, and sets a translation language to japanese and performs a translation operation; the translation application or the translation tool can determine an original language (Chinese) corresponding to the translation original in an original editing area in the translation interface and a translated language (Japanese) corresponding to the translation of the corresponding translation original in a translated version display area; then, according to the original language and the translated language, determining matched preset ratio information, for example, the preset ratio information corresponding to Chinese-Arabic is 1:1.22, and determining the matched preset ratio information is 1:1.22; and then adjusting the width of the original text editing area and the width of the translation display area in the translation interface according to the matched preset ratio information, displaying the translation in the translation display area as shown in the right area in fig. 3c, wherein the translation original text (Chinese) in the original text editing of the translation interface and the translation (Japanese) in the translation display area can be compared with each other.
In summary, in the embodiment of the present invention, an original language of a translation original in an original editing area of a translation interface and a translation language of a translation corresponding to the translation original can be determined, then matched preset ratio information is determined according to the original language and the translation language, and then a width of the original editing area and a width of a translation display area in the translated interface are adjusted according to the matched preset ratio information, and the translation is displayed in the translation display area; and the heights of the translation texts in the adjusted original text editing area and the translation text display area after the width adjustment can be adjusted to be equal, so that the disorder of the comparison of the translation original texts and the translation texts is avoided.
In the embodiment of the present invention, the ways of determining the preset ratio information in advance include a plurality of ways, wherein one way of implementing the determination of the preset ratio information can refer to steps 402-406:
Referring to fig. 4, a flowchart of the steps of one embodiment of a method of determining preset ratio information of the present invention is shown.
Step 402, translating the reference translation original text of one language into reference translation translations of a plurality of other languages.
Step 404, recording the original text height of the reference translation original text in the preset area, and recording the translation height of the reference translation translations of the other languages in the preset area.
Step 406, determining preset ratio information between the language and each other language according to the ratio of the original text height to each translated text height.
In the embodiment of the invention, aiming at any two languages, the corresponding preset ratio information between the two languages can be determined according to the height ratio of the texts expressing the same content in the preset area according to the same display style.
In one implementation of the invention, a translation original text of one language can be selected as a reference translation original text, and then the reference translation original text of the language is translated into reference translation translations of a plurality of other languages; and determining the corresponding preset ratio information between the language and various other languages according to the original text height of the reference translation original text of the language in the preset area and the translation height of the preset area of various other languages. Wherein the reference translation script of a language includes a plurality of sentences.
In one implementation of the present invention, the reference translation text in the language may be translated into a reference translation in another language at a time, and then the original text height of the reference translation text in the preset area may be recorded, and the translation height of the reference translation in the other language in the preset area may be recorded. For example, the description will be given taking, as an example, a reference translation text for translating a reference translation text of chinese into a plurality of other languages: the height of the reference translation text of the recorded Chinese is 378px in the preset area, as shown in FIG. 5 a; (1) And translating the Chinese reference translation text into Arabic reference translation text, and recording that the height of the Arabic reference translation text in a preset area is 344px, as shown in FIG. 5 b. (2) And translating the corresponding reference translation text of the Chinese language into the reference translation text of the Japanese language, and recording the height 463px of the reference translation text of the Japanese language in a preset area, as shown in fig. 5 c. (3) And translating the corresponding reference translation text of the Chinese language into the reference translation text of the English language, and recording the height of the reference translation text of the English language in a preset area as 531px, as shown in fig. 5 d.
Then, respectively calculating the ratio of the original text height to the translation text height corresponding to various other languages, and determining the corresponding preset ratio information between the language and various other languages according to the calculated ratio; one implementation manner may be to use the calculated ratio as the preset ratio information corresponding to the language and other languages corresponding to the ratio. In the process of calculating the ratio of the original text height to the translation heights corresponding to various other languages, the original text height can be mapped to 1 as a reference, the translation heights corresponding to various other languages can be mapped to corresponding mapping values, and then the ratio of the mapping value 1 of the original text height to the mapping value of the translation heights corresponding to various other languages can be calculated respectively. For example, based on the above example, based on mapping the height 378px of the corresponding reference translation text in the preset area of chinese to 1, the height 344px of the reference translation text in arabic language in the preset area may be mapped to 0.91, the height 463px of the reference translation text in japanese in the preset area may be mapped to 1.22, and the height 531px of the reference translation text in english in the preset area may be mapped to 1.40. Then calculating the ratio of the mapping value 1 of the original text height corresponding to Chinese to the mapping value 0.91 of the translated text height corresponding to Arabic to be 1:0.91, and obtaining the corresponding preset ratio information between Chinese and Arabic to be 1:0.19; and by analogy, the preset ratio information corresponding to the Chinese language and the Japanese language is 1:1.22, and the preset ratio information corresponding to the Chinese language and the English language is 1:1.40.
In another embodiment of the present invention, another way to determine the preset ratio information may be to extract a sample according to a statistical method, and calculate the preset ratio information between different languages; thereby improving the accuracy of the preset ratio information.
The following describes the calculation of the preset ratio information between a language pair by taking a sample extracted according to a statistical method as an example.
Referring to fig. 6, a flowchart of steps of an alternative embodiment of a method of determining preset ratio information of the present invention is shown.
Step 602, for a language pair, extracting a plurality of groups of samples corresponding to the language pair according to a statistical method, wherein one group of samples comprises samples of two languages with the same expression content, and the sample of one language is a sentence.
Step 604, determining a first accumulated height of a plurality of samples of one language in a preset area, and determining a second accumulated height of a plurality of samples of the other language in the preset area;
step 606, determining preset ratio information corresponding to the language pairs according to the ratio of the first accumulated height to the second accumulated height.
In the embodiment of the present invention, for convenience of subsequent description, two languages in the language pair may be referred to as language 1 and language 2, respectively.
In the embodiment of the invention, the word number length of the text translated by the user follows normal distribution, so that a sampling method of normal distribution can be adopted to determine the number of groups of samples to be collected; the set of samples includes a sample of language 1 and a sample of language 2, the sample of language 1 may be a text of a sentence corresponding to language 1, the sample of language 2 may be a sentence, and the sample of language 1 may be a translation text corresponding to language 2.
Wherein, the number of groups of samples to be collected can be determined by determining the number of samples of language 1 or the number of samples of language 2; the following is to determine the number of samples for language 1 for purposes of illustration:
In the embodiment of the invention, a reference value X, a maximum deviation D and a confidence level P and a variance E of the number of words in a sample of the language 1 can be set; and then determining the sample number N of the language 1 according to the word number reference value X, the maximum deviation D, the confidence level P and the variance E. In one example, the expression of N may be: n= (X a/2)2*E/D2.
For example, if the maximum deviation d=10, the confidence level p=0.95, X a/2 =1.96 is obtained from the normal distribution table, and n=0.038416×e can be obtained. Wherein the range can be calculated from a preset number of samples of language 1 in the historical translation data (i.e., r=x max-xmin), and then E is calculated according to the formula e≡r/6; wherein, the preset quantity can be determined according to the requirement, such as 30-50. Wherein D can be adjusted to reduce sample jitter when the number of words in the samples of language 1 extracted from the historical translation data is small.
Furthermore, in one embodiment of the invention, the confidence level may be increased and/or the maximum deviation D may be decreased if desired to increase the degree of accuracy.
Then, extracting N samples of the language 1 from the historical translation data, and extracting translation translations of the language 2 corresponding to the N samples of the language 1 as N samples of the language 2; wherein, a sample of language 1 and a sample of the corresponding language 2 may form a set of samples.
Then N samples of language 1 are added to the preset area and the sum of the heights of the N samples in the preset area (which may be referred to as a first cumulative height in the following) is determined, and N samples of language 2 are added to the preset area and the sum of the heights of the N samples in the preset area (which may be referred to as a second cumulative height in the following) is determined. In the embodiment of the present invention, the manner of adding the samples of the language 1 in the preset area is the same as the manner of adding the samples of the language 2, wherein one manner of adding the N samples of the language 1 in the preset area may be to splice each sample at the end of the period of the previous sample in the preset area. And then calculating the ratio of the first accumulated height to the second accumulated height to obtain the corresponding preset ratio information between the language pairs.
In one embodiment of the invention, after the corresponding preset ratio information between any two languages is determined, a corresponding mapping relation can be established, so that in the subsequent translation process, the mapping relation is searched according to the language of the translation original text and the language of the translation text, and the matched preset ratio information is determined. The mapping relation may include a relation among an original language identifier, a translated language identifier and preset ratio information, the original language identifier may refer to an identifier of a language corresponding to a front term in the preset ratio information, and the translated language identifier may refer to an identifier of a language corresponding to a rear term in the preset ratio information; correspondingly, any two languages can correspond to two mapping relations.
In an optional embodiment of the present invention, N groups of samples corresponding to the language pair may be selected from the historical translation data in different fields, and according to the N groups of samples, the preset ratio information corresponding to the two languages of the language pair in each field is determined. Correspondingly, any mapping relationship may include: the relation among the field identifier, the original language identifier, the translated language identifier and the preset ratio information. Therefore, in the translation process, the field of the translation original text can be determined, and the matched preset ratio information is searched from the preset ratio information in the field, so that the accuracy of width adjustment is improved.
Referring to fig. 7, a flowchart illustrating steps of an alternative embodiment of a region adjustment method of the present invention may specifically include the following steps:
step 702, determining an original language of a translation original in an original editing area of a translation interface and a translation language of a translation corresponding to the translation of the translation original.
Step 704, searching a mapping relation based on the original language and the translated language, and determining matched preset ratio information.
In the embodiment of the invention, after the user enters the translation interface, the user can set the original language and then input the translation original in the original editing area of the translation interface, or can directly input the translation original in the original editing area of the translation interface without setting the original language, and the embodiment of the invention is not limited to the above. Correspondingly, the method for determining the original language of the translation original in the original editing area according to the embodiment of the invention may include multiple ways, and one implementation way may be to obtain the language setting information of the translation original set by the user for the translation original, and determine the language of the translation original according to the language corresponding to the language setting information of the translation original. In another mode, the translation original text input by the user in the original text editing area is obtained, and language detection is performed on the translation original text to obtain an original text language corresponding to the translation original text. Of course, the two methods can be combined to determine the original language of the translation original. And language setting information of the translation set by the user for the translation can be obtained, and the language corresponding to the language setting information of the translation is determined as the translation language of the translation.
Wherein, if the predetermined mapping relationship includes: the relation among the original language identification, the translated language identification and the preset ratio information can be that the identification of the original language corresponding to the translated language is respectively compared with the original language identification in each mapping relation, and the identification of the translated language corresponding to the translated language is respectively compared with the translated language identification in each mapping relation. When the original language identifier is matched with the identifier of the original language corresponding to the translation, and the translated language identifier is matched with the identifier of the translated language corresponding to the translation, the mapping relation can be determined to be the matched mapping relation, and preset ratio information in the mapping relation can be determined to be the preset ratio information matched with the original language and the translated language.
Wherein, if the predetermined mapping relationship includes: the method and the device can analyze the field corresponding to the translation original text, find the mapping relation between the original text language and the translation language according to the identification of the field corresponding to the translation original text, and determine the matched preset ratio information. The identification of the corresponding field of the translation original text can be compared with the field identifications in the mapping relations, the identification of the corresponding original text language of the translation original text is respectively compared with the original text language identifications in the mapping relations, and the identification of the corresponding translation language of the translation is respectively compared with the translation language identifications in the mapping relations; when the domain identifier in one mapping relationship is matched with the identifier of the domain corresponding to the translation original text, the original text language identifier is matched with the identifier of the original text language corresponding to the translation original text, and the translated text language identifier is matched with the identifier of the translated text language corresponding to the translation, the mapping relationship can be determined to be the matched mapping relationship.
Step 706, obtaining the total width of the original text editing area and the translated text display area in the translation interface.
Step 708, adjusting the width of the original text editing area and the width of the translation display area according to the matched preset ratio information and the total width, and displaying the translation in the translation display area.
In the embodiment of the present invention, the sum of the widths of the original text editing area and the translated text display area (which may be referred to as the total width hereinafter) in the translation interface may be limited, so that the width of the original text editing area and the width of the translated text display area may be adjusted based on the total width of the original text editing area and the translated text display area. In the embodiment of the invention, the total width of the original text editing area and the translated text display area in the translation interface can be obtained and determined, and then the width of the original text editing area and the width of the translated text display area can be adjusted according to the matched preset ratio information and the total width, and the following substeps can be referred to:
and step 22, calculating a first target width corresponding to the original text editing area and a second target width corresponding to the translation display area according to the matched preset ratio information and the total width.
And a substep 24 of adjusting the width of the original text editing area to be a first target width and adjusting the width of the translated text display area to be a second target width.
In the embodiment of the invention, since the display patterns of the original text editing area and the translated text display area are the same, in order to ensure that the heights of the translated original text of the original text editing area and the translated text of the translated text display area are the same, the width ratio of the original text editing area to the translated text display area can be the reciprocal of the preset ratio information so as to calculate the first target width corresponding to the original text editing area and the second target width corresponding to the translated text display area. For example, assuming that the first target width is A1, the second target width is A2, the total width is a, the preset ratio information is k1:k2, the first target width information is A1, and the second target width is A2, which can be calculated by the following formula:
A1+A2=A
A1:A2=K2:K1
Wherein, A and K1 are known numbers, and the values of A1 and A2 can be obtained.
For example, if the total width is a=1000 px and the preset ratio information is k1:k2=1:1.22, a1=550px and a2=450px can be obtained.
And further, the width of the original text editing area can be adjusted to be matched with the first target width, and the width of the translated text display area can be adjusted to be matched with the second target width, wherein the width of the original text editing area can be adjusted to be the first target width, and the width of the translated text display area can be adjusted to be the second target width.
In the embodiment of the invention, the width of the translation display area can be adjusted after the translation is displayed in the translation display area, the translation can be displayed in the translation display area after the width of the translation display area is adjusted, and the translation can be displayed in the process of adjusting the width of the translation display area.
In the embodiment of the invention, the original text editing area has the translation original text before the width is adjusted, so that the translation original text in the original text editing area can be typeset again according to the width of the original text editing area in the process of adjusting the width of the original text editing area, and the translation original text is matched with the width of the original text editing area after the width is adjusted.
In an alternative embodiment of the present invention, the width of the original text editing area and the width of the translated text display may not be changed, but the height of the translated text and the height of the translated text may be unified by adjusting the font size of the translated text in the original text editing area and/or the font size of the translated text in the translated text display area, so as to avoid contrast misalignment. After determining that the translation original text corresponds to the translation text and displaying the translation text in the translation text display area, the height of the translation original text in the original text editing area can be compared with the height of the translation text in the translation text display area; and then the unification of the translation original text height and the translation text height is realized by at least one of the following modes: keeping the word size of the translation text unchanged, and adjusting the word size of the translation text; keeping the word size of the translated text unchanged, and adjusting the word size of the translated text; simultaneously adjusting the word size of the translation original text and the word size of the translation original text; the embodiments of the present invention are not limited in this regard.
In the embodiment of the invention, the method for adjusting the translation word number can be as follows, wherein the word number of the translation word is kept unchanged: when the height of the translation original text is larger than that of the translation text, the word size of the translation text can be increased; the word size of the translation may be increased each time according to the first set step size, and then the height of the translation original text is compared with the height of the translation after the word size is increased, so as to determine whether the word size of the translation needs to be increased continuously. When the height of the translation text is larger than the height of the translation text after the word size is increased, determining that the word size of the translation text needs to be increased continuously, and at this time, the word size of the translation text can be increased continuously according to the first set step length. When the height of the translation text is smaller than the height of the translation text after the word size is increased, the adjustment of the word size of the translation text can be stopped, and the word size of the translation text can be reduced according to a second set step size, wherein the second set step size is smaller than the first set step size, and the first set step size and the second set step size can be set according to requirements. When the word size of the translation is reduced according to the second set step size, the height of the translation original text can be compared with the height of the translation after the word size is reduced, and whether the word size of the translation needs to be reduced continuously is judged. When the height of the translation text is smaller than the height of the translated text after the word size is reduced, the word size of the translated text can be reduced continuously according to the second set step length; when the height of the translation original text is larger than the height of the translation translated text after the word size is reduced, the adjustment of the word size of the translation translated text can be stopped; and so on. Other modifications may, of course, be made and embodiments of the invention are not limited in this regard. The manner of maintaining the word size of the translated text and adjusting the word size of the translated text is similar to the manner of maintaining the word size of the translated text and adjusting the word size of the translated text, and will not be described herein.
In the embodiment of the invention, the mode of simultaneously adjusting the word size of the translation original text and the word size of the translation original text can be that when the height of the translation original text is larger than that of the translation original text, the word size of the translation original text can be increased, and the word size of the translation original text can be reduced; the word size of the translation may be increased according to the third set step size each time, and the word size of the translation original text may be reduced according to the third set step size until the height of the translation original text and the translation original text after the word size is adjusted is uniform. The third setting step may be set according to requirements, which is not limited in the embodiment of the present invention. When the height of the translation original text is smaller than that of the translation original text, the word size of the translation original text can be reduced, and the word size of the translation original text can be increased; the word size of the translation may be reduced according to the third set step length each time, and the word size of the translation original text may be increased according to the third set step length until the height of the translation original text and the translation original text after the word size is adjusted is uniform. Other modifications may, of course, be made and embodiments of the invention are not limited in this regard.
In an alternative embodiment of the present invention, after changing the width of the original text editing area and the translation display, or after adjusting the word size of the translation original text and/or the translation, when the user needs to further view the translation, a viewing operation, such as a clicking operation, may be performed on the translation. The corresponding translation application or translation tool may receive the corresponding viewing instruction and then enlarge the translated version and display it in a pop-up window.
In summary, in the embodiment of the present invention, an original language of a translation original in an original editing area of a translation interface and a translation language of a translation corresponding to the translation original can be determined, then matched preset ratio information is determined according to the original language and the translation language, and then a width of the original editing area and a width of a translation display area in the translation interface are adjusted according to the matched preset ratio information, and the translation is displayed in the translation display area; and the heights of the translation texts in the adjusted original text editing area and the translation text display area after the width adjustment can be adjusted to be equal, so that the disorder of the comparison of the translation original texts and the translation texts is avoided. And when the translation original text is a large piece of information, the embodiment of the invention has an obvious effect of avoiding the contrast disorder between the translation original text and the translation.
Secondly, in the embodiment of the invention, the total width of the original text editing area and the translation display area in the translation interface can be obtained, and then the first target width corresponding to the original text editing area and the second target width corresponding to the translation display area are calculated according to the matched preset ratio information and the total width; adjusting the width of the original text editing area to be the first target width, and adjusting the width of the translated text display area to be the second target width; and then under the condition of ensuring that the total width of the original text editing area and the translated text display area is unchanged, the width of the original text editing area and the width of the translated text display area are adjusted, and further, other elements in a translation interface are not required to be typeset again, so that the practicability is high, and the operation is simple and convenient.
It should be noted that, for simplicity of description, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred embodiments, and that the acts are not necessarily required by the embodiments of the invention.
Referring to fig. 8, a block diagram of an embodiment of a region adjustment device of the present invention is shown, and may specifically include the following modules:
a language determining module 802, configured to determine an original language of a translation original in an original editing area of a translation interface, and a translation language of a translation corresponding to the translation original;
the ratio determining module 804 is configured to determine matched preset ratio information according to the original language and the translated language;
The region adjustment module 806 is configured to adjust the width of the original text editing region and the width of the translation display region in the translation interface according to the matched preset ratio information, and display the translated version in the translation display region.
Referring to fig. 9, a block diagram of an alternative embodiment of the zone adjusting device of the present invention is shown.
In an alternative embodiment of the present invention, the area adjustment module 806 includes:
a width obtaining submodule 8062, configured to obtain total widths of the original text editing area and the translated text display area in the translation interface;
and the width adjustment submodule 8064 is used for adjusting the width of the original text editing area and the width of the translated text display area according to the matched preset ratio information and the total width.
In an optional embodiment of the present invention, the width adjustment submodule 8064 is configured to calculate, according to the matched preset ratio information and the total width, a first target width corresponding to the original text editing area and a second target width corresponding to the translated text display area; and adjusting the width of the original text editing area to be the first target width, and adjusting the width of the translated text display area to be the second target width.
In an optional embodiment of the present invention, the ratio determining module 804 is configured to determine the matched preset ratio information based on the mapping relationship between the original language and the translated language.
In an alternative embodiment of the present invention, the apparatus further comprises:
A first ratio information determining module 808, configured to translate the reference translation originals in one language into reference translation translations in a plurality of other languages, respectively; recording the original text height of the reference translation original text in a preset area, and recording the translation height of the reference translation translations of other languages in the preset area; determining preset ratio information between the language and each other language according to the ratio of the original text height to each translation height; the display style of the preset area, the original text editing area and the translated text display area is the same, and the reference translated text comprises a plurality of sentences.
In an alternative embodiment of the present invention, the apparatus further comprises:
the second ratio information determining module 810 is configured to extract, for a language pair, a plurality of groups of samples corresponding to the language pair according to a statistical device, where a group of samples includes samples of two languages with the same expression content, and a sample of one language is a sentence; determining a first accumulated height of a plurality of samples of one language in a preset area, and determining a second accumulated height of a plurality of samples of the other language in the preset area; determining corresponding preset ratio information between the language pairs according to the ratio of the first accumulated height to the second accumulated height; the display modes of the preset area, the original text editing area and the translated text display area are the same.
In an alternative embodiment of the present invention, the displaying patterns are the same and include: the word spacing is the same, the line spacing is the same, the segment spacing is the same, and the word size is the same.
In summary, in the embodiment of the present invention, an original language of a translation original in an original editing area of a translation interface and a translation language of a translation corresponding to the translation original can be determined, then matched preset ratio information is determined according to the original language and the translation language, and then a width of the original editing area and a width of a translation display area in the translated interface are adjusted according to the matched preset ratio information, and the translation is displayed in the translation display area; and the heights of the translation texts in the adjusted original text editing area and the translation text display area after the width adjustment can be adjusted to be equal, so that the disorder of the comparison of the translation original texts and the translation texts is avoided.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
Fig. 10 is a block diagram illustrating a configuration of an electronic device 1000 for zone adjustment, according to an example embodiment. For example, electronic device 1000 may be a mobile phone, computer, digital broadcast terminal, messaging device, game console, tablet device, medical device, exercise device, personal digital assistant, or the like.
Referring to fig. 10, an electronic device 1000 may include one or more of the following components: a processing component 1002, a memory 1004, a power component 1006, a multimedia component 1008, an audio component 1010, an input/output (I/O) interface 1012, a sensor component 1014, and a communication component 1016.
The processing component 1002 generally controls overall operation of the electronic device 1000, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing element 1002 may include one or more processors 1020 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component 1002 can include one or more modules that facilitate interaction between the processing component 1002 and other components. For example, the processing component 1002 may include a multimedia module to facilitate interaction between the multimedia component 1008 and the processing component 1002.
The memory 1004 is configured to store various types of data to support operations at the device 1000. Examples of such data include instructions for any application or method operating on the electronic device 1000, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 1004 may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
The power component 1006 provides power to the various components of the electronic device 1000. Power component 1006 can include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for electronic device 1000.
The multimedia component 1008 includes a screen between the electronic device 1000 and the user that provides an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or slide action, but also the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia assembly 1008 includes a front-facing camera and/or a rear-facing camera. When the electronic device 1000 is in an operational mode, such as a shooting mode or a video mode, the front-facing camera and/or the rear-facing camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
The audio component 1010 is configured to output and/or input audio signals. For example, the audio component 1010 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 1000 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in memory 1004 or transmitted via communication component 1016. In some embodiments, the audio component 1010 further comprises a speaker for outputting audio signals.
The I/O interface 1012 provides an interface between the processing assembly 1002 and peripheral interface modules, which may be a keyboard, click wheel, buttons, and the like. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
The sensor assembly 1014 includes one or more sensors for providing status assessment of various aspects of the electronic device 1000. For example, the sensor assembly 1014 may detect an on/off state of the device 1000, a relative positioning of components such as a display and keypad of the electronic device 1000, the sensor assembly 1014 may also detect a change in position of the electronic device 1000 or a component of the electronic device 1000, the presence or absence of a user's contact with the electronic device 1000, an orientation or acceleration/deceleration of the electronic device 1000, and a change in temperature of the electronic device 1000. The sensor assembly 1014 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact. The sensor assembly 1014 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1014 can also include an acceleration sensor, a gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 1016 is configured to facilitate communication between the electronic device 1000 and other devices, either wired or wireless. The electronic device 1000 may access a wireless network based on a communication standard, such as WiFi, 2G, or 3G, or a combination thereof. In one exemplary embodiment, the communication part 1014 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1014 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 1000 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic elements for executing the methods described above.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as memory 1004, including instructions executable by processor 1020 of electronic device 1000 to perform the above-described method. For example, the non-transitory computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
A non-transitory computer readable storage medium, which when executed by a processor of an electronic device, causes the electronic device to perform a zone adjustment processing method, the method comprising: determining an original language of a translation original in an original editing area of a translation interface and a translation language of a translation corresponding to the translation of the translation original; determining matched preset ratio information according to the original language and the translated language; and adjusting the width of the original text editing area and the width of a translation display area in a translation interface according to the matched preset ratio information, and displaying the translation in the translation display area.
Optionally, the adjusting the width of the original text editing area and the width of the translation display area in the translation interface according to the matched preset ratio information includes: acquiring the total width of a original text editing area and a translated text display area in the translation interface; and adjusting the width of the original text editing area and the width of the translated text display area according to the matched preset ratio information and the total width.
Optionally, the adjusting the width of the original text editing area and the width of the translated text displaying area according to the matched preset ratio information and the total width includes: calculating a first target width corresponding to the original text editing area and a second target width corresponding to the translated text display area according to the matched preset ratio information and the total width; and adjusting the width of the original text editing area to be the first target width, and adjusting the width of the translated text display area to be the second target width.
Optionally, the determining the matched preset ratio information according to the original language and the translated language includes: and searching a mapping relation based on the original language and the translated language, and determining matched preset ratio information.
Optionally, the method further comprises the step of determining preset ratio information: respectively translating the reference translation original text of one language into reference translation translations of a plurality of other languages; recording the original text height of the reference translation original text in a preset area, and recording the translation height of the reference translation translations of other languages in the preset area; determining preset ratio information between the language and each other language according to the ratio of the original text height to each translation height; the display style of the preset area, the original text editing area and the translated text display area is the same, and the reference translated text comprises a plurality of sentences.
Optionally, the method further comprises the step of determining preset ratio information: for a language pair, extracting a plurality of groups of samples corresponding to the language pair according to a statistical method, wherein one group of samples comprises samples of two languages with the same expression content, and the sample of one language is a sentence; determining a first accumulated height of a plurality of samples of one language in a preset area, and determining a second accumulated height of a plurality of samples of the other language in the preset area; determining corresponding preset ratio information between the language pairs according to the ratio of the first accumulated height to the second accumulated height; the display modes of the preset area, the original text editing area and the translated text display area are the same.
Optionally, the displaying patterns are the same, including: the word spacing is the same, the line spacing is the same, the segment spacing is the same, and the word size is the same.
Fig. 11 is a schematic structural view of an electronic device 1100 for region adjustment according to another exemplary embodiment of the present invention. The electronic device 1100 may be a server, which may vary widely in configuration or performance, and may include one or more central processing units (central processing units, CPUs) 1122 (e.g., one or more processors) and memory 1132, one or more storage mediums 1130 (e.g., one or more mass storage devices) that store applications 1142 or data 1144. Wherein the memory 1132 and the storage medium 1130 may be transitory or persistent. The program stored on the storage medium 1130 may include one or more modules (not shown), each of which may include a series of instruction operations on a server. Still further, the central processor 1122 may be provided in communication with a storage medium 1130, executing a series of instruction operations in the storage medium 1130 on a server.
The servers may also include one or more power supplies 1126, one or more wired or wireless network interfaces 1150, one or more input output interfaces 1158, one or more keyboards 1156, and/or one or more operating systems 1141, such as Windows Server, mac OS XTM, unixTM, linuxTM, freeBSDTM, and the like.
An electronic device comprising a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by one or more processors, the one or more programs comprising instructions for: determining an original language of a translation original in an original editing area of a translation interface and a translation language of a translation corresponding to the translation of the translation original; determining matched preset ratio information according to the original language and the translated language; and adjusting the width of the original text editing area and the width of a translation display area in a translation interface according to the matched preset ratio information, and displaying the translation in the translation display area.
Optionally, the adjusting the width of the original text editing area and the width of the translation display area in the translation interface according to the matched preset ratio information includes: acquiring the total width of a original text editing area and a translated text display area in the translation interface; and adjusting the width of the original text editing area and the width of the translated text display area according to the matched preset ratio information and the total width.
Optionally, the adjusting the width of the original text editing area and the width of the translated text displaying area according to the matched preset ratio information and the total width includes: calculating a first target width corresponding to the original text editing area and a second target width corresponding to the translated text display area according to the matched preset ratio information and the total width; and adjusting the width of the original text editing area to be the first target width, and adjusting the width of the translated text display area to be the second target width.
Optionally, the determining the matched preset ratio information according to the original language and the translated language includes: and searching a mapping relation based on the original language and the translated language, and determining matched preset ratio information.
Optionally, the method further comprises the following operation of determining the preset ratio information: respectively translating the reference translation original text of one language into reference translation translations of a plurality of other languages; recording the original text height of the reference translation original text in a preset area, and recording the translation height of the reference translation translations of other languages in the preset area; determining preset ratio information between the language and each other language according to the ratio of the original text height to each translation height; the display style of the preset area, the original text editing area and the translated text display area is the same, and the reference translated text comprises a plurality of sentences.
Optionally, the method further comprises the following operation of determining the preset ratio information: for a language pair, extracting a plurality of groups of samples corresponding to the language pair according to statistical electronic equipment, wherein one group of samples comprises samples of two languages with the same expression content, and the sample of one language is a sentence; determining a first accumulated height of a plurality of samples of one language in a preset area, and determining a second accumulated height of a plurality of samples of the other language in the preset area; determining corresponding preset ratio information between the language pairs according to the ratio of the first accumulated height to the second accumulated height; the display modes of the preset area, the original text editing area and the translated text display area are the same.
Optionally, the displaying patterns are the same, including: the word spacing is the same, the line spacing is the same, the segment spacing is the same, and the word size is the same.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or terminal device that comprises the element.
The above description of a region adjustment method, a region adjustment device and an electronic device provided by the present invention applies specific examples to illustrate the principles and embodiments of the present invention, and the description of the above examples is only used to help understand the method and core idea of the present invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.