[go: up one dir, main page]

CN112329480B - A method, device and electronic device for adjusting region - Google Patents

A method, device and electronic device for adjusting region Download PDF

Info

Publication number
CN112329480B
CN112329480B CN201910656601.0A CN201910656601A CN112329480B CN 112329480 B CN112329480 B CN 112329480B CN 201910656601 A CN201910656601 A CN 201910656601A CN 112329480 B CN112329480 B CN 112329480B
Authority
CN
China
Prior art keywords
translation
language
original
width
area
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910656601.0A
Other languages
Chinese (zh)
Other versions
CN112329480A (en
Inventor
郑昊
王新伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Sogou Technology Development Co Ltd
Original Assignee
Beijing Sogou Technology Development Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Sogou Technology Development Co Ltd filed Critical Beijing Sogou Technology Development Co Ltd
Priority to CN201910656601.0A priority Critical patent/CN112329480B/en
Publication of CN112329480A publication Critical patent/CN112329480A/en
Application granted granted Critical
Publication of CN112329480B publication Critical patent/CN112329480B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Machine Translation (AREA)

Abstract

本发明实施例提供了一种区域调整方法、装置和电子设备,其中,所述方法包括:确定翻译界面的原文编辑区中翻译原文的原文语言,和所述翻译原文对应翻译译文的译文语言;依据所述原文语言和译文语言,确定匹配的预设比值信息;依据匹配的预设比值信息调整所述原文编辑区的宽度和翻译界面中译文展示区的宽度,并在译文展示区中展示所述翻译译文;进而能够将调整后的原文编辑区中翻译原文和调整宽度后的译文展示区中翻译译文高度调整为等高,从而避免翻译原文与翻译译文对照错乱。

The embodiments of the present invention provide a method, device and electronic device for adjusting an area, wherein the method comprises: determining an original language of a translated original text in an original text editing area of a translation interface, and a translation language of a translation corresponding to the translated original text; determining matching preset ratio information according to the original text language and the translation language; adjusting the width of the original text editing area and the width of a translation display area in the translation interface according to the matching preset ratio information, and displaying the translation in the translation display area; and then adjusting the height of the translated original text in the adjusted original text editing area and the translation in the translation display area after the width is adjusted to be equal, thereby avoiding confusion between the translated original text and the translation.

Description

Region adjustment method and device and electronic equipment
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method and an apparatus for adjusting a region, and an electronic device.
Background
With the advancement of globalization, communication between countries in academia, business, life and the like (such as academic communication of countries, import and export trade of commodities, travel from country) is becoming increasingly frequent, but there are differences in languages of the countries, and users may not be able to master the language of each country, and thus may bring a certain obstacle to the communication of academia, business, life and the like. Therefore, translation tools have been developed to solve the obstacles to users caused by language confusion; a user may translate text in one language to text in another language, such as english to chinese, korean to chinese, english to german, etc., through a translation application.
Most of the existing translation tools are designed based on translations between branch in the indo-euler, i.e. mutual translations between different languages with latin letters as writing carrier, such as english-german, english-law, english-russia, etc. Because of the relatedness of different branch in the Indoodles and the similarity of written letters, on the premise of expressing the same information content, the typesetting effect of languages is approximately 1:1, so that the ratio of an original text editing area to a translated text display area in the current translation tool is a fixed 1:1 design.
But the typesetting effect of Chinese or other non-IndoOdori languages (including IndoOdori that do not use Latin letters (such as Sanskrit and Bos) and IndoOdori that use Latin letters is not 1:1; resulting in a scene of translating chinese or other non-euler languages (including euler languages that do not use latin letters (such as sanskrit and bos) with euler languages that use latin letters, if fixed 1:1 typesetting is performed according to existing translation tools, a contrast misalignment of the original text in the original editing area and the translated text in the translated text display area; as shown in fig. 1.
Disclosure of Invention
The embodiment of the invention provides a region adjustment method for avoiding comparison dislocation of translation original text in an original text editing region and translation version in a translation display region.
Correspondingly, the embodiment of the invention also provides a region adjusting device and electronic equipment, which are used for guaranteeing the implementation and application of the method.
In order to solve the above problems, an embodiment of the present invention discloses a region adjustment method, which specifically includes: 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.
The embodiment of the invention also discloses a region adjusting device, which specifically comprises: the language determining module is used for determining the original language of the translation original in the original editing area of the translation interface and the translation language of the translation corresponding to the translation of the translation original; the ratio determining module is used for determining matched preset ratio information according to the original language and the translated language; and the region adjustment module is used for adjusting the width of the original text editing region and the width of a translation display region in the translation interface according to the matched preset ratio information, and displaying the translation in the translation display region.
Optionally, the area adjustment module includes: the width acquisition sub-module is used for acquiring the total width of the original text editing area and the translated text display area in the translation interface; and the width adjustment sub-module 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.
Optionally, the width adjustment sub-module 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.
Optionally, the ratio determining module is configured to determine the matched preset ratio information based on the mapping relationship searched by the original language and the translated language.
Optionally, the apparatus further comprises: the first ratio information determining module is used for 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 apparatus further comprises: the second ratio information determining module is used for extracting a plurality of groups of samples corresponding to one language pair according to the statistical device, wherein one group of samples comprises samples of two languages with the same expression content, and the samples of one language are sentences; 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.
The embodiment of the invention also discloses a readable storage medium, which enables the electronic equipment to execute the region adjustment method according to any one of the embodiments of the invention when the instructions in the storage medium are executed by the processor of the electronic equipment.
The embodiment of the invention also discloses an electronic device, which comprises 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, and the one or more programs comprise 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.
The embodiment of the invention has the following advantages:
In the embodiment of the invention, the original language of the translation original in the original editing area of the translation interface and the translation language of the translation corresponding to the translation of the translation original can be determined, then the matched preset ratio information is determined according to the original language and the translation language, then the width of the original editing area and the width of the 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.
Drawings
FIG. 1 is a schematic diagram of a translation interface of the prior art;
FIG. 2 is a flow chart of steps of an embodiment of a zone adjustment method of the present invention;
FIG. 3a is a schematic diagram of a translation interface after adjusting the width of the original text editing and translation display area according to an embodiment of the present invention;
FIG. 3b is a schematic diagram of a translation interface after editing the original text and adjusting the width of the translation display area according to an embodiment of the present invention;
FIG. 3c is a schematic diagram of a translation interface after adjusting the width of the original text editing and translation display area according to an embodiment of the present invention;
FIG. 4 is a flow chart of steps of an embodiment of a method of determining preset ratio information in accordance with the present invention;
fig. 5a is a schematic diagram of a reference translation text of chinese in a predetermined area according to an embodiment of the present invention;
FIG. 5b is a schematic diagram of a reference translation of Arabic in a predetermined region according to an embodiment of the present invention;
FIG. 5c is a schematic diagram showing a Japanese reference translation in a predetermined region according to an embodiment of the present invention;
FIG. 5d is a schematic view of a reference translation of English in a predetermined region according to an embodiment of the present invention;
FIG. 6 is a flowchart illustrating steps of an alternate embodiment of a method of determining preset ratio information in accordance with the present invention;
FIG. 7 is a flow chart of steps of an alternative embodiment of a zone adjustment method of the present invention;
FIG. 8 is a block diagram of an embodiment of a zone adjusting device of the present invention;
FIG. 9 is a block diagram of an alternative embodiment of a zone adjusting device of the present invention;
FIG. 10 illustrates a block diagram of an electronic device for zone adjustment, according to an exemplary embodiment;
fig. 11 is a schematic structural view of an electronic device for region adjustment according to another exemplary embodiment of the present invention.
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.

Claims (12)

1. A method of region adjustment, 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;
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;
The step of determining the preset ratio information comprises the following steps:
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;
Or, 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.
2. The method according to claim 1, wherein 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 comprises:
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.
3. The method according to claim 2, wherein adjusting the width of the original editing area and the width of the translated version display area according to the matched preset ratio information and total width comprises:
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.
4. The method of claim 1, wherein determining the matched predetermined ratio information based on the original language and the translated language comprises:
and searching a mapping relation based on the original language and the translated language, and determining matched preset ratio information.
5. The method of claim 1, wherein the presentation styles are the same comprising: 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.
6. An area adjustment device, comprising:
The language determining module is used for determining the original language of the translation original in the original editing area of the translation interface and the translation language of the translation corresponding to the translation of the translation original;
the ratio determining module is used for determining matched preset ratio information according to the original language and the translated language;
The region adjustment module is used for adjusting the width of the original text editing region and the width of a translation display region in the translation interface according to the matched preset ratio information, and displaying the translation in the translation display region;
The ratio determining module is specifically configured to translate the reference translation original text of one language into reference translation translations of multiple 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;
Or, for a language pair, extracting a plurality of groups of samples corresponding to the language pair according to a statistical device, 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.
7. The apparatus of claim 6, wherein the region adjustment module comprises:
the width acquisition sub-module is used for acquiring the total width of the original text editing area and the translated text display area in the translation interface;
and the width adjustment sub-module 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.
8. The apparatus of claim 6, wherein the width adjustment sub-module is configured to calculate a first target width corresponding to the original editing area and a second target width corresponding to the translation display area according to the matched preset ratio information and 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.
9. The apparatus of claim 6, wherein the ratio determination module is configured to determine the matched preset ratio information based on the textual language and the translated language lookup mapping.
10. The apparatus of claim 6, wherein the presentation styles are the same comprising: 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.
11. A readable storage medium, characterized in that instructions in said storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the region adjustment method according to any one of the method claims 1-5.
12. 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 the one or more processors to perform the region adjustment method of any of method claims 1-5.
CN201910656601.0A 2019-07-19 2019-07-19 A method, device and electronic device for adjusting region Active CN112329480B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910656601.0A CN112329480B (en) 2019-07-19 2019-07-19 A method, device and electronic device for adjusting region

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910656601.0A CN112329480B (en) 2019-07-19 2019-07-19 A method, device and electronic device for adjusting region

Publications (2)

Publication Number Publication Date
CN112329480A CN112329480A (en) 2021-02-05
CN112329480B true CN112329480B (en) 2024-11-12

Family

ID=74319451

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910656601.0A Active CN112329480B (en) 2019-07-19 2019-07-19 A method, device and electronic device for adjusting region

Country Status (1)

Country Link
CN (1) CN112329480B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111126080B (en) * 2019-12-20 2023-08-29 常州新途软件有限公司 Checking method for text translation of vehicle-mounted device
CN113177389A (en) * 2021-04-23 2021-07-27 网易(杭州)网络有限公司 Text processing method and device, electronic equipment and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105975461A (en) * 2016-05-27 2016-09-28 成都优译信息技术有限公司 Method for newly adding translation in DWG format file

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2433403B (en) * 2005-12-16 2009-06-24 Emil Ltd A text editing apparatus and method
US8799756B2 (en) * 2012-09-28 2014-08-05 Interactive Memories, Inc. Systems and methods for generating autoflow of content based on image and user analysis as well as use case data for a media-based printable product
CN104093085B (en) * 2014-04-22 2016-08-24 腾讯科技(深圳)有限公司 Method for information display and device
JP6342298B2 (en) * 2014-10-31 2018-06-13 株式会社東芝 Character recognition device, image display device, image search device, character recognition method and program
CN104881406B (en) * 2015-06-15 2018-05-04 上海携程商务有限公司 Web page translation method and system
CN106649248A (en) * 2016-12-19 2017-05-10 成都优译信息技术股份有限公司 Single-line text alignment method and translated file processing method of DWG file
CN106814950A (en) * 2016-12-25 2017-06-09 语联网(武汉)信息技术有限公司 A kind of method and system that original text and translation are adjusted alignment
CN107766340A (en) * 2017-10-24 2018-03-06 广东欧珀移动通信有限公司 Method, device and terminal for displaying text
CN108345589A (en) * 2017-11-22 2018-07-31 语联网(武汉)信息技术有限公司 A kind of translation on line method of full original text reference
CN108182183B (en) * 2017-12-27 2021-09-17 北京百度网讯科技有限公司 Picture character translation method, application and computer equipment
CN109598185B (en) * 2018-09-04 2022-09-20 创新先进技术有限公司 Image recognition translation method, device and equipment and readable storage medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105975461A (en) * 2016-05-27 2016-09-28 成都优译信息技术有限公司 Method for newly adding translation in DWG format file

Also Published As

Publication number Publication date
CN112329480A (en) 2021-02-05

Similar Documents

Publication Publication Date Title
US10296201B2 (en) Method and apparatus for text selection
CN107688399B (en) Input method and device and input device
CN111414766B (en) Translation method and device
CN108829686B (en) Translation information display method, device, equipment and storage medium
CN109388810A (en) A kind of data processing method, device and the device for data processing
CN110858100B (en) Method and device for generating association candidate words
CN112329480B (en) A method, device and electronic device for adjusting region
CN110795014B (en) Data processing method and device and data processing device
CN113033163B (en) Data processing method and device and electronic equipment
CN113920293A (en) Information identification method and device, electronic equipment and storage medium
CN109471538B (en) Input method, input device and input device
CN108108356B (en) Character translation method, device and equipment
CN108628461B (en) Input method and device and method and device for updating word stock
CN110781689B (en) Information processing method, device and storage medium
CN110780749B (en) Character string error correction method and device
CN110147426B (en) Method for determining classification label of query text and related device
CN112528129B (en) Language searching method and device for multilingual translation system
CN111597325B (en) Text query method and device
CN110837741B (en) Machine translation method, device and system
CN112905023B (en) Input error correction method, device and device for input error correction
CN112612442B (en) Input method and device and electronic equipment
CN113407038A (en) Input method, input device and input device
CN109388328B (en) Input method, device and medium
CN109271094B (en) Text editing method, device and equipment
CN113534972B (en) A method and device for prompting an entry and a device for prompting an entry

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20220725

Address after: 100084. Room 9, floor 01, cyber building, building 9, building 1, Zhongguancun East Road, Haidian District, Beijing

Applicant after: BEIJING SOGOU TECHNOLOGY DEVELOPMENT Co.,Ltd.

Address before: 310018 room 1501, building 17, No.57, kejiyuan Road, Baiyang street, Hangzhou Economic and Technological Development Zone, Zhejiang Province

Applicant before: SOGOU (HANGZHOU) INTELLIGENT TECHNOLOGY Co.,Ltd.

Applicant before: BEIJING SOGOU TECHNOLOGY DEVELOPMENT Co.,Ltd.

GR01 Patent grant
GR01 Patent grant
TG01 Patent term adjustment
TG01 Patent term adjustment