WO2023061020A1 - Web content translation method, computer device, storage medium, and program product - Google Patents
Web content translation method, computer device, storage medium, and program product Download PDFInfo
- Publication number
- WO2023061020A1 WO2023061020A1 PCT/CN2022/111902 CN2022111902W WO2023061020A1 WO 2023061020 A1 WO2023061020 A1 WO 2023061020A1 CN 2022111902 W CN2022111902 W CN 2022111902W WO 2023061020 A1 WO2023061020 A1 WO 2023061020A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- content
- target
- webpage
- translation
- type
- 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.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/958—Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/40—Processing or translation of natural language
- G06F40/58—Use of machine translation, e.g. for multi-lingual retrieval, for server-side translation for client devices or for real-time translation
Definitions
- the present application relates to the technical field of terminals, in particular to a method for translating web page content, computer equipment, storage media and program products.
- users can use the translation engine on the browser to view information described in other languages that they are not familiar with when browsing the web. For example, the user can click the translate button on the browser, and the browser will translate the The English shopping webpage is converted into a Chinese shopping webpage, which is convenient for users to view the information on the webpage.
- a professional translation engine such as code samples, formulas, poems, etc.
- the existing browser translation engine will convert all the content in the webpage without distinction to translate.
- the first aspect of the present application provides a method for translating webpage content, including: when receiving a translation request for webpage content, parsing the code of the webpage content; The first content in the web page content is translated to obtain the translated content of the first content, the first content does not include the target content; the translated result of the web page content is displayed, and the translated result includes the target content and the translated content of the first content.
- the reservation instruction includes a target tag, and the target tag is used to identify the target content.
- the code of parsing the content of the web page includes the retention instruction of the target tag, and the target tag identifies the target content, so the target content in the web page content that does not need to be translated can be determined through the target tag.
- the reserved instruction includes a target program interface, and an input value of the target program interface is target content.
- the target program interface in the code of the webpage content can be analyzed, and the input value of the target program interface is the target content in the webpage content that needs to be kept in its original form.
- the present application provides a method for translating webpage content, including: when a translation request for webpage content is received, identifying the webpage content to determine the target content in the webpage content; determining the content type of the target content; The translation engine of the content type translates the target content, and translates the first content in the webpage content through the translation engine of the browser, and obtains the translated content of the target content and the translated content of the first content respectively, and the first content does not include the target content Content: displaying the translation result of the web page content, the translation result includes the translation content of the target content and the translation content of the first content.
- the translation request may include user operations, or instructions generated based on user operations, such as the user triggers the translation control and speaks the voice containing the translation keywords, and for example, based on the user triggering the translation control or speaking the voice containing the keywords, generates Translation requests, etc.
- the translation request can also be automatically generated by the terminal.
- the terminal can automatically identify the content of the webpage.
- it can automatically generate a translation request for the current webpage content.
- the viewing object For children, the elderly, etc., translation requests for English web content can be automatically generated.
- the target content and its content type in the webpage content There are many ways to determine the target content and its content type in the webpage content. For example, the reserved instruction in the code of the webpage content can be parsed, and then the target content and its content type in the webpage content can be determined.
- identifying the webpage content and determining the target content in the webpage content includes: when receiving a translation request for webpage content, translating the webpage content Perform detection to obtain multiple content areas; determine at least one target content area from the multiple content areas according to the label code of the web page content in each content area, and the target content area includes the target content.
- multiple content areas in the web page content can be determined first, and then the target content area including the target content can be determined from the multiple content areas.
- identifying the webpage content and determining the target content in the webpage content includes: when receiving a translation request for webpage content, identifying the webpage content Target content that matches the preset content in .
- the preset content can include multiple types, and correspondingly, there are multiple ways to identify the target content that matches the preset content.
- the preset content can be a content keyword, and then identifying the target content that matches the preset content can be To: identify the content keywords contained in the webpage content, and when the number of the content keywords in the webpage content is greater than a preset number, determine the part of the webpage content including the content keywords in the webpage content as the target content.
- the preset content can include content features
- the recognition model can be used to identify web page content.
- the recognition model can include a model based on deep learning technology and model training through a large number of trainings.
- the recognition model can include several training models.
- part of the webpage content in the webpage content whose matching degree with the content feature is greater than a preset threshold can be determined as the target content through the recognition model.
- the content of the webpage can be matched with the preset content, and the target content in the content of the webpage can be determined.
- the preset content includes preset characters or preset controls
- identifying the target content in the webpage content that matches the preset content includes: when receiving When a translation request for webpage content is received, identify the webpage content; when it is recognized that the webpage content includes preset characters or preset controls, determine the area in the webpage content that satisfies the adjacent positional relationship with the preset characters or preset controls is the target content area, and the target content area includes the target content.
- the preset characters or preset controls that prompt the target content in the text content can be identified, so that the content in the target content area that satisfies the adjacent positional relationship with the preset characters or preset controls can be determined as the target content.
- determining the content type of the target content includes: displaying a type selection control for the target content, where the type selection control includes at least one selectable type; In the selection operation of the target type, the content type of the target content is determined as the target type.
- the content type of the target content can be determined according to the user operation.
- displaying a type selection control for the target content includes: displaying translation prompt information for the target content in the target content area, and a translation decision control, where the translation prompt information is used to prompt the user whether to translate the target content; In response to a user's determination operation on the translation decision control, a type selection control for the target content is displayed.
- the method for translating webpage content further includes: in response to the user's negative operation on the translation decision control, using the browser's translation engine to translate the first content in the webpage content to obtain the translation of the first content Content: displaying the translation result of the web page content, the translation result includes the target content and the translation content of the first content.
- a non-translation decision for the target content can be determined according to user operations.
- the translation engine of the content type is used to translate the target content
- the translation engine of the browser is used to translate the first content in the webpage content, to obtain the translated content of the target content and the first content respectively.
- the translation content of the content including: displaying the use prompt information of the translation engine of the content type of the target content, and the use decision control; in response to the determination operation of the use decision control, translating the target content by the translation engine of the content type, and by The browser translation engine translates the first content in the webpage content, and respectively obtains the translated content of the target content and the translated content of the first content.
- the decision to use the translation engine of the content type to translate the target content can be determined according to the user operation.
- determining the content type of the target content includes: identifying the type of the target content to obtain the content type of the target content.
- the terminal can automatically determine the content type of the target content.
- the method provided by the first aspect can also be used in combination with the method provided by the second aspect. In other words, it not only detects whether there are reserved instructions in the source code of the webpage, but also performs identification of the webpage content. limited) or simultaneously.
- the present application provides a computer device, and the computer device includes at least one processor and a memory.
- the memory is used to store instructions
- the processor is used to execute the instructions to implement the method for translating webpage content in the first aspect or the second aspect.
- the present application provides a computer-readable storage medium, where a program is stored in the computer-readable storage medium, and the program causes a computer device to execute the method for translating webpage content in the first aspect or the second aspect.
- the present application provides a computer program product, the computer program product includes computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the above-mentioned first aspect or second aspect is realized method for translating web content.
- the computer device provided by the above third aspect, the computer-readable storage medium provided by the fourth aspect, and the computer program product provided by the fifth aspect correspond to the method provided by the above first aspect or the second aspect, therefore, its For the beneficial effects or various implementation manners that can be achieved, reference can be made to the above, and details will not be repeated here.
- FIG. 1 is a schematic diagram of an implementation scenario of the method for translating webpage content provided by the present application
- FIG. 2 is a schematic diagram of another implementation scenario of the method for translating webpage content provided by the present application.
- FIG. 3 is a schematic diagram of some user pages of the method for translating webpage content provided by the present application.
- FIG. 4 is a schematic diagram of the implementation subject of the method for translating webpage content provided by the present application.
- FIG. 5 is a schematic flow diagram of the method for translating webpage content provided by the present application.
- FIG. 6 is another schematic flowchart of the method for translating webpage content provided by the present application.
- FIG. 7 is a schematic diagram of another part of the user page of the method for translating webpage content provided by the present application.
- FIG. 8 is a schematic diagram of another part of the user page of the method for translating webpage content provided by the present application.
- FIG. 9 is a schematic diagram of another part of the user page of the method for translating webpage content provided by the present application.
- FIG. 10 is another schematic flowchart of the method for translating webpage content provided by the present application.
- FIG. 11 is a schematic diagram of the execution architecture of the method for translating webpage content provided by the present application.
- FIG. 12 is a schematic structural diagram of a computer device provided by the present application.
- the webpage content translation method of the present application can be performed by computer equipment, and the computer equipment can include at least one of a terminal or a server, wherein the terminal can include a smart phone, a notebook computer, a tablet computer, a smart wearable device, a vehicle-mounted smart terminal, a smart TV (also known as smart big screen), virtual reality equipment, mixed reality equipment, augmented reality equipment, or robot equipment (such as shopping mall navigation robots, children or patient care robots), etc., servers can include local servers, cloud servers, etc., terminals and Servers can be connected by wire or wirelessly, and so on.
- the terminal can include a smart phone, a notebook computer, a tablet computer, a smart wearable device, a vehicle-mounted smart terminal, a smart TV (also known as smart big screen), virtual reality equipment, mixed reality equipment, augmented reality equipment, or robot equipment (such as shopping mall navigation robots, children or patient care robots), etc.
- servers can include local servers, cloud servers, etc.
- terminals and Servers can be connected by wire
- the method for translating webpage content can be executed by terminal 10, and terminal 10 can respond to the translation request of the user for the English content of the webpage, and display the translation result of the English content.
- the translation result includes English poetry in the English content, and the Chinese translation results corresponding to content other than poetry in English content.
- some content in the webpage content that does not need to be translated can be retained here, effectively improving the user experience of using the translation function.
- the method for translating web page content can be jointly executed by the terminal 20 and the server 30, the terminal 20 can respond to the user's request for translation of the English content of the web page, and send a content translation request to the server 30, and the server 30 can identify the content in the English content.
- the Chinese translation results of the English poems are obtained by means of the poetry translation engine, and the Chinese translation results of the English content other than the English poems are obtained by means of the default translation engine.
- the terminal 20 can translate the Chinese translation of the English content returned by the server 30 The results are displayed on the user interface for users to view.
- the webpage content can be identified here, and the more professional part of the webpage content can be processed by a professional translation engine in its field, which can improve The accuracy of the translation results can effectively improve the user experience of using the translation function.
- the webpage content translation method of the present application can be executed by a browser application on a terminal, and the browser application can display webpages and provide a translation function for webpage content, and the user can trigger the browser application to set
- the translation control of the browser application can initiate a translation request for the webpage content.
- the browser application can include a default translation engine, which can translate the webpage content, and the webpage of the browser application can display the translation result of the webpage content.
- browser application 1 displays webpage 1, and webpage 1 contains an English article, which contains multiple chemical formulas, and the user triggers the translation button 01 on webpage 1, and browser application 1 can translate webpage 1
- the code is analyzed to determine the reserved instructions for each chemical formula.
- the browser application 1 translates the content in the English article of webpage 1 except the chemical formula using the default translation engine to obtain the Chinese translation results of other content.
- Browse The browser application 1 refreshes and displays the webpage 1, and the webpage 1 now includes the original chemical formula and Chinese translation results of other contents.
- the common subjects and the relationship between various subjects can be referred to in FIG. Open the browser application on the terminal device, and the terminal device can run the browser application installed on it according to the user's opening operation.
- the computer device of the network content provider can use network-related technologies to provide the content code of the web page to the terminal device.
- Network-related technologies can include Hyper Text Markup Language (Hyper Text Markup Language, HTML), cascading style Cascading Style Sheets (CSS), and programming language application programming interface (Javascript Application Programming Interface, Js API), etc.
- browser applications can display webpage content according to the content code received by the terminal device.
- the browser application can also integrate a translation plug-in to realize the translation function.
- the user can trigger the translation button on the browser application, and the browser application can respond to the trigger operation of the user, and translate part or all of the web page content through the translation plug-in, and display Get the translation result.
- Terminal devices can include mobile phones, laptops, smart wearable devices, tablet computers, etc.
- the terminal can display the translation results of webpage content, and the presentation methods can include displaying on the screen, using speakers to broadcast, etc.
- FIG. 5 is a schematic flow diagram of a method for translating webpage content provided by the present application. include:
- Users can request the webpage content they want to view on the terminal. For example, the user can enter a network address, click a webpage link, etc., and the terminal can send a webpage content request to the server of the webpage content provider according to the network address.
- the server of the webpage content provider is in After receiving the request, the code of the requested webpage content can be returned to the terminal, and the terminal can analyze the code and perform page rendering, thereby displaying the webpage content on the page.
- an application program can be installed on the terminal, and the user can perform operations on the application program.
- a browser application can be installed on the terminal, and the user can click a webpage link on the browser application, and perform operations on the webpage link received according to the webpage link.
- the code of the webpage content is parsed, and the page is rendered, so that the webpage content is displayed on the browser page of the browser application.
- the content of the web page can include one or more forms of content including text, voice, image, video, etc.
- the content of the web page can be expressed in Chinese, English, Arabic, Mongolian and other languages.
- the content of the web page can be Parts include the following special content, such as poetry, proper nouns, formulas, codes, etc.
- the content of the web page may include part or all of the content displayed on the web page where it is located.
- web page 1 is a patent search result web page, and the content of the web page may include web page 1
- the patent documents displayed in , and the content of the webpage may also include search keywords, filter conditions and patent documents displayed in the webpage 1, and so on.
- a webpage content 1 is displayed on a browser page, and the webpage content 1 includes an appreciation and analysis of an ancient Chinese poem, and the appreciation and analysis of an ancient Chinese poem includes an ancient Chinese poem and an appreciation and analysis in Chinese for the ancient Chinese poem.
- the user can initiate a translation request for webpage content on the terminal.
- the terminal can set a translation control, the user can trigger the translation control, and the terminal responds to the trigger operation on the translation control, that is, receives a translation request from the user for the webpage content.
- the terminal can be equipped with a voice assistant, and the user can speak to the terminal to translate the content of the webpage, and the terminal can collect the user's voice and perform recognition, and obtain the recognition result of the user's voice, which means receiving a translation request from the user for the content of the webpage.
- the translation control, voice assistant, etc. can be functions set on the terminal, such as the mobile phone can slide up from the bottom of the screen to call up the voice assistant, etc.; the translation control, voice assistant, etc. can also be set on the application program of the terminal functions, such as the browser page of the browser application can be set with a translation button, and so on.
- the web content provider may, according to the characteristics of the web content, add reservation instructions to the code to restrict the translation of some web content.
- the web content may be an English form, which includes several English proper nouns in the computer field, in order to prevent these English proper nouns from being translated into other languages, web content providers can add reserved instructions for these English proper nouns in the code of web content.
- the reserved instruction can include multiple types.
- the reserved instruction can be obtained based on the extended HTML tag.
- the reserved instruction can include the extended HTML tag to identify part of the webpage content through the extended HTML tag.
- the extended HTML tag can be dt, including dt.
- the reserved command can be such as: ⁇ dt>edge ⁇ /dt>, this reserved command can control the English word edge not to be translated by the terminal, but to be kept in the translation result of the webpage content where it is located.
- the reserved instruction can include Js API, wherein, dt.Keep can control part of the content not to be translated, and retain the original Js API, such as dt.Keep(a), the reserved instruction can control dt.Keep The input value a will not be translated by the terminal, and will remain in the translation result of the webpage content where it is located.
- Js APIs such as dt.Read, dt.SetRangePolicy, and some code logic can be used to determine when the target content is translated, which needs Part of the content reserved.
- dt.Read can read the external text library, which contains texts that need to be preserved during the translation process, such as poems, proper nouns, chemical formulas, etc., and then can be compared with the content of the web page to determine whether there is an external text library. Any one or more texts in the text library, if they exist, can be determined through dt.SetRangePolicy. Based on the text in the web page content, the retention policy for the part of the content centered on the text in the web content can be determined through dt.SetRangePolicy Determine multiple retention policies. For example, dt.SetRangePolicy(1) can indicate that the text, its previous word, and the next word are preserved.
- dt.SetRangePolicy(0) can indicate that the text is the sentence it is in Preserve, that is, retain all the text within the range of a period before the text and a period after the text, etc.
- the retention policy in dt.SetRangePolicy can be flexibly configured and used according to actual needs, and will not be described here.
- the browser page may further include a translation button, and the code of the webpage content 1 is parsed in response to the trigger operation of the translation button by the user (that is, receiving a translation request for the webpage content).
- the terminal parses the reservation instruction, it can determine that part of the webpage content indicated by the reservation instruction is the target content, and then the terminal can translate the first content in the webpage content. If the first content does not include the target content, it can be seen that The first content may be all or part of other content except the target content in the webpage content.
- the translation engine of the browser application may translate other content in the webpage content except the target content to obtain translated content of other content.
- the default translation engine of the browser will translate other content in web page content 1 except Chinese ancient poems, that is, Chinese appreciation and analysis, and obtain the meaning of Chinese appreciation and analysis The same appreciation in English.
- the translation result includes the target content and the translation content of the first content.
- a translation result of the webpage content 1 is displayed on the browser page, and the translation result includes an ancient Chinese poem and an English appreciation analysis of the ancient Chinese poem.
- the method for translating webpage content may be executed by a terminal, or jointly executed by a terminal and a server.
- FIG. 6 is a schematic flowchart of a method for translating webpage content provided by the present application.
- the webpage content 2 is displayed on the browser page, and the webpage content 2 includes a popular science article, and the popular science article includes two chemical formulas and some popular science in English.
- a recognition model can be constructed based on convolutional neural network technology, the recognition model can be trained through training data, and the trained recognition model can be used to determine the content of the webpage. Included target content that matches preset content.
- the content of the webpage can be detected to obtain multiple content areas, and according to the tag code of part of the content in each content area, determine from the multiple content areas At least one target content area includes target content.
- the application When the application receives a translation request for webpage content, it can first detect the webpage content through a detection algorithm to obtain multiple content areas.
- the detection algorithm can include text detection algorithms, image detection algorithms, etc., and text detection algorithms such as Connectionist Text Proposal Network (CTPN), DBNet (a text detection algorithm), for example, through the text detection algorithm to detect the content of the webpage 2, you can get content area 1, content area 2 and content area 2.
- CPN Connectionist Text Proposal Network
- DBNet a text detection algorithm
- the label code can include HTML part of the content identified by the label or CSS style, and if so, determine that the content area where the part of content is located is the target content area.
- the computer device determines the tag code 2 of part of the content in the content area 2 from the code of the web page content 2, analyzes the tag code 2, and determines that this part of the content is displayed in a special format of a single line, then the part can be determined
- the content area 2 where the content is located is a target content area.
- poems, formulas, etc. in the content of the web page will have some emphatic text or punctuation marks before displaying.
- a one-click copy button can be set on the page , based on these features, therefore, when the application receives a translation request for the content of the web page, it can identify the content of the web page, and determine whether the content of the web page contains preset characters or preset controls, such as "as follows", " The following", “or”, “if yes", “:”, etc., preset controls include buttons, text boxes, etc., such as a text box whose text content is "copy after login", the recognition algorithm can include text, image, video recognition algorithms such as text recognition algorithms such as convolutional recurrent neural network (Convolutional Recurrent Neural Network, CRNN) combined with neural network-based temporal classification (Connectionist Temporal Classification, CTC), and so on.
- CNN convolutional recurrent neural network
- CTC Connectionist Temporal Classification
- the target content area can include the area where the preset character or preset control is located as the center area, and the area adjacent to the center area area, the adjacent position relationship can include the relationship between two adjacent areas, for example, the area where part of the content below the recognized preset character "below" can be determined as the target content area, and for example, the identified The area where the content on the left side of the preset control is located may be determined as the target content area.
- the content type of the target content can be confirmed in a variety of ways.
- the content type of the target content can be identified through a type identification model.
- the type identification model can be based on A neural network model trained on a large amount of data. For example, input the target content 1 in the content area 2 into the type recognition model 1 to obtain the content type of the target content 1: chemical formula.
- type character libraries corresponding to different content types can be obtained.
- Typical characters of a type of content type are stored in a type character library.
- the type character library of chemical formula type can include some common chemical formulas, common reaction conditions, arrows, etc. , equal sign, gas symbol, etc. type characters.
- the similarity between the characters in the target content and the characters in different types of character libraries can be determined, and the content type corresponding to the type of character library with the highest similarity can be determined as the content type of the target content.
- the target content 1 in the content area 2 is compared with multiple types of character libraries, and the content type of the target content 1 is obtained according to the comparison results: chemical formula.
- the content type of the target content can be determined by the user, and the computer device can display relevant information and controls on the user page, specifically, the computer device can display translation prompt information for the target content in the target content area on the page
- the translation decision control can be used to prompt the user whether to translate the target content
- the translation decision control can be used for the user to make a decision to translate or not translate the target content, for example, see Figure 7, the terminal browser page displays the translation prompt information : "It is detected that this part of the text may be code or poetry, continue to translate?", and translation decision controls: "Yes" button and "Skip" button.
- the computer device may display a type selection control for the target content in response to the user's determination operation on the translation decision control.
- the selection operation of the target type determines that the target type is the content type of the target content in the target content area. For example, see Figure 8.
- the browser page can display the type selection controls for the target content: “Determine which of the following types of content” text box, "Code” button , “formula” button, “poetry” button and “other” button, the user triggers the "formula” button in the type selection control, and the terminal can determine that the content type of the target content is a formula.
- the terminal or server can store the corresponding relationship between the content type and the translation engine.
- the terminal or server can find the translation engine of the content type of the target content from the corresponding relationship, and pass the The translation engine of the content type translates the target content.
- the translation engine of the content type and the translation engine of the browser can be set on the terminal. After the terminal determines the content type of the target content, it can directly translate the target content through the translation engine of the content type, and translate the webpage content through the translation engine of the browser. Translate the first content in the target content to obtain the translated content of the target content and the translated content of the first content respectively.
- the terminal translates the target content through the translation engine of the chemical formula
- the translation engine of the browser translates the English popular science in web content 2 except the chemical formula, and obtains the translated content of the chemical formula and the Chinese translation of the English popular science .
- the translation engine of the content type and the translation engine of the browser can be set on the server, the terminal can send the target content and the content type to the server, the server can determine the translation engine of the content type, and use the translation engine of the content type to Translating the target content and translating the first content in the web page content through the translation engine of the browser to obtain the translated content of the target content and the translated content of the first content respectively, and the server returns the obtained target content to the terminal The translated content and the translated content of the first content.
- the browser page in response to the user's selection operation on the target type, can display the use prompt information and the use decision control of the translation engine for the content type of the target content, and in response to the determination operation on the use decision control, you can Translate the target content through the translation engine of the content type, and translate the first content in the webpage content through the translation engine of the browser, and obtain the translated content of the target content and the translated content of the first content respectively, and the first content does not include target content.
- the user triggers the "formula” button in the type selection control, and the browser page displays the use prompt message of the formula translation engine "Continue to translate, it is recommended to use a professional translation engine, such as A translation” and the use decision control: " “Yes” button and "Skip” button, if the user triggers the "Yes” button, it will display that the target content is translated using A translation, and other content is translated using the translation engine that comes with the browser.
- the translation result includes the translated content of the target content and the translated content of the first content.
- the browser page can display the translation result of the webpage content 2, and the translation result includes the translation content of the chemical formula and the Chinese translation of the original English popular science.
- This application can identify the content of the webpage, translate the target content in it using the translation engine of the content type to which the target type belongs, and translate the first content using the translation engine of the browser, so that more accurate and professional translation results can be obtained , effectively improving the user experience when using the translation function of the browser.
- the method for translating webpage content may be executed by a terminal, and a browser (browser application) is installed on the terminal.
- a browser browser application
- FIG. 10 is a schematic flowchart of a method for translating webpage content provided by the present application.
- web page content translation methods may include:
- the user wants to browse the webpage through the browser, and the browser can request the webpage content from the webpage content provider after receiving the webpage browsing request initiated by the user, and the webpage content provider can use the extended HTML/Js to generate the webpage
- the code of the content and when receiving the information requesting the content of the webpage sent by the terminal where the browser is located, it will send back the code of the requested webpage content to the terminal, and the browser can analyze the code of the content of the webpage, and perform Page rendering, so as to display the webpage content on the browser page, so that the user can view the webpage content.
- the browser when the user views the webpage content, he wants the browser to automatically translate the webpage content. For example, if the user clicks the translation button on the browser page, the browser can respond to the user's click operation on the translation button and automatically translate the webpage content.
- the code is parsed.
- the extended HTML or Js API may include: a reserved instruction including extended HTML tags (such as dt), or a reserved instruction including a Js API (such as dt.Keep).
- the reserved instruction can be dt.Keep(a), and the reserved instruction includes dt .Keep, the input value of dt.Keep is variable a.
- part of the code of the web page content may be as follows:
- the input data (via dt.Read) from at least one object such as the user, terminal, and web content provider can be read.
- the data can include proper nouns, specific text, etc., and the terminal can perform Before translating, compare whether there is target content identical to any input data in the target content, and if so, translate the first content in the web page content through the translation engine of the browser.
- the webpage content is detected to obtain multiple content areas, and the multiple content areas are determined according to the label codes of part of the content in each content area
- the target content area that exists in the zone, the target content area includes the target content.
- determining the original text to be retained according to the style may include: determining multiple content areas of the web page content through a text detection algorithm, and combining each content area A tag code for the inner text that identifies the target content area that contains the target content displayed in a special format.
- the webpage content is identified, and when it is recognized that the webpage content includes preset characters or preset controls, it is determined that the browser page matches the The area where the preset character or preset control satisfies the adjacent positional relationship is the target content area.
- determining the original text to retain may include: identifying the web page content, determining whether to include such as "below”, “below”, “Or”, “if yes", ":” and other preset characters and/or buttons, text boxes and other preset controls, if they exist, determine that the browser page satisfies the adjacent positional relationship with the preset characters or preset controls
- the area within is the target content area, and part of the content within the target content area is determined to be the target content.
- the above two methods are executed when the terminal does not resolve the reservation instruction for any content in the webpage content.
- the terminal when the terminal parses the retention instruction for the target content in the webpage content, it can also obtain multiple content areas by detecting the webpage content, and identify the webpage according to the tag code of part of the content in each content area. Whether there are preset characters or preset controls in the content, etc., to obtain the target content area where the target content in the web page content is located.
- the terminal in response to the user's negative operation on the translation decision control, can use the browser's translation engine to translate the first content in the webpage content, obtain the translated content of the first content, and display the target content on the browser page and the translated content of the first content, the first content does not include the target content.
- the control uses the prompt information to prompt the user whether to use the translation engine of the target type to translate the target content.
- the terminal in response to the user's negative operation on using the decision control, the terminal translates all webpage content through the translation engine of the browser, and obtains and displays the translation result of the webpage content on the browser page.
- This application can analyze the content of the webpage, determine the target content that does not need to be translated or needs professional translation, and set up multiple controls that interact with the user to provide different translation services for the user according to the needs of the user, effectively improving the user's The sense of experience in the process of using the translation function.
- a computer device 100 may include a screen 1001 , a processor 1002 , a memory 1003 and a communication bus 1004 .
- the memory 1003 is used to store one or more computer programs 1005 .
- One or more computer programs 1005 are configured to be executed by the processor 1002 .
- the one or more computer programs 1005 include instructions, which can be used to implement all or part of the steps of the method for locating an indoor parking lot in the computer device 100 .
- computer device 100 may include more or fewer components than shown, or combine certain components, or separate certain components, or arrange different components.
- computer device 100 may also include a camera.
- the processor 1002 may include one or more processing units, for example: the processor 1002 may include an application processor (application processor, AP), a modem, a graphics processing unit (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU), etc. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
- application processor application processor, AP
- modem graphics processing unit
- GPU graphics processing unit
- ISP image signal processor
- controller video codec
- digital signal processor digital signal processor
- baseband processor baseband processor
- neural network processor neural-network processing unit
- the processor 1002 may also be provided with a memory for storing instructions and data.
- the memory in processor 1002 is a cache memory.
- the memory may hold instructions or data that the processor 1002 has just used or recycled. If the processor 1002 needs to use the instruction or data again, it can be directly recalled from the memory. Repeated access is avoided, and the waiting time of the processor 1002 is reduced, thus improving the efficiency of the system.
- processor 1002 may include one or more interfaces.
- the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transmitter (universal asynchronous receiver/transmitter, UART) interface, mobile industry processor interface (mobile industry processor interface, MIPI), general-purpose input/output (general-purpose input/output, GPIO) interface, SIM interface, and/or USB interface, etc.
- I2C integrated circuit
- I2S integrated circuit built-in audio
- PCM pulse code modulation
- PCM pulse code modulation
- UART universal asynchronous transmitter
- MIPI mobile industry processor interface
- GPIO general-purpose input/output
- SIM interface SIM interface
- USB interface etc.
- the memory 1003 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, internal memory, plug-in hard disk, smart memory card (Smart Media Card, SMC), secure digital (Secure Digital (SD) card, flash card (Flash Card), at least one disk storage device, flash memory device, or other volatile solid-state storage device.
- a non-volatile memory such as a hard disk, internal memory, plug-in hard disk, smart memory card (Smart Media Card, SMC), secure digital (Secure Digital (SD) card, flash card (Flash Card), at least one disk storage device, flash memory device, or other volatile solid-state storage device.
- This embodiment also provides a computer storage medium, in which computer instructions are stored, and when the computer instructions are run on the electronic equipment, the electronic equipment executes the steps of the above-mentioned related methods to realize the positioning of the indoor parking lot in the above-mentioned embodiments. method.
- This embodiment also provides a computer program product, which, when running on a computer, causes the computer to execute the above related steps, so as to realize the indoor parking lot positioning method in the above embodiment.
- an embodiment of the present application also provides a device, which may specifically be a chip, a component or a module, and the device may include a connected processor and a memory; wherein the memory is used to store computer-executable instructions, and when the device is running, The processor can execute the computer-executable instructions stored in the memory, so that the chip executes the indoor parking lot positioning method in the above method embodiments.
- the computer equipment, computer storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding method provided above, therefore, the beneficial effects it can achieve can refer to the corresponding method provided above The beneficial effects in the method will not be repeated here.
- the disclosed devices and methods may be implemented in other ways.
- the device embodiments described above are schematic.
- the division of the modules or units is a logical function division.
- there may be other division methods for example, multiple units or components may be combined or may be integrated into another device, or some features may be ignored, or not implemented.
- the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
- the unit described as a separate component may or may not be physically separated, and a component displayed as a unit may be one physical unit or multiple physical units, that is, it may be located in one place, or may be distributed to multiple different places. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
- each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
- the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
- the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a readable storage medium.
- a software product which is stored in a storage medium.
- Several instructions are included to make a device (which may be a single-chip microcomputer, a chip, etc.) or a processor (processor) execute all or part of the steps of the methods described in the various embodiments of the present application.
- the aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disc and other media that can store program codes. .
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Information Transfer Between Computers (AREA)
Abstract
Description
相关申请的交叉引用Cross References to Related Applications
本申请主张于2021年10月15日提交中国专利局,申请号为202111204211.3、申请名称为“网页内容翻译方法、计算机设备、存储介质及程序产品”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 202111204211.3 and the application name "web page content translation method, computer equipment, storage medium and program product" submitted to the China Patent Office on October 15, 2021, the entire content of which is passed References are incorporated in this application.
本申请涉及终端技术领域,尤其涉及了网页内容翻译方法、计算机设备、存储介质及程序产品。The present application relates to the technical field of terminals, in particular to a method for translating web page content, computer equipment, storage media and program products.
随着技术的发展,用户在浏览网页时,可以借助浏览器上的翻译引擎查看一些由不熟悉的其他语言描述的信息,比如,用户可以点击浏览器上的翻译按钮,浏览器通过翻译引擎将英文购物网页转换为中文购物网页,方便用户查看网页内的信息。然而,网页中可以存在部分不需要翻译的内容、或需要由专业翻译引擎处理的内容,比如代码示例、公式、诗歌等,而现有的浏览器翻译引擎会将网页内的所有内容无差别地进行翻译。With the development of technology, users can use the translation engine on the browser to view information described in other languages that they are not familiar with when browsing the web. For example, the user can click the translate button on the browser, and the browser will translate the The English shopping webpage is converted into a Chinese shopping webpage, which is convenient for users to view the information on the webpage. However, there may be some content in the webpage that does not need to be translated, or that needs to be processed by a professional translation engine, such as code samples, formulas, poems, etc., and the existing browser translation engine will convert all the content in the webpage without distinction to translate.
发明内容Contents of the invention
有鉴于此,有必要提供网页内容翻译方法、计算机设备、存储介质及程序产品,可以在翻译网页内容时灵活处理,提升用户使用翻译功能时的体验感。In view of this, it is necessary to provide a method for translating webpage content, a computer device, a storage medium, and a program product, which can be flexibly handled when translating webpage content, and improve user experience when using the translation function.
本申请第一方面提供了一种网页内容翻译方法,包括:当接收到针对网页内容的翻译请求时,对网页内容的代码进行解析;当解析到针对网页内容中目标内容的保留指令时,对网页内容中的第一内容进进行翻译,得到第一内容的翻译内容,第一内容不包括目标内容;展示网页内容的翻译结果,翻译结果包括目标内容和第一内容的翻译内容。The first aspect of the present application provides a method for translating webpage content, including: when receiving a translation request for webpage content, parsing the code of the webpage content; The first content in the web page content is translated to obtain the translated content of the first content, the first content does not include the target content; the translated result of the web page content is displayed, and the translated result includes the target content and the translated content of the first content.
其中,展现翻译结果的方式可以有多种,如通过屏幕显示文本形式的翻译结果,通过扬声器播放音频形式的翻译结果,通过屏幕和扬声器配合播放视频形式的翻译结果,等等。Among them, there are many ways to display the translation results, such as displaying the translation results in text form on the screen, playing the translation results in audio form through speakers, playing the translation results in video form through the cooperation of the screen and speakers, and so on.
通过采用该技术方案,可以避免对网页内中的所有内容进行无差别翻译,保留网页内容中需要保留原始形式的目标内容,并向用户展示部分内容的翻译内容和原始形式的目标内容,有效提升用户在使用翻译功能时的体验感。By adopting this technical solution, indiscriminate translation of all content in the webpage can be avoided, the target content in the original form needs to be retained in the webpage content, and the translated content of some content and the target content in the original form are displayed to the user, effectively improving The user experience when using the translation function.
在一种可能的实现方式中,保留指令包括目标标签,目标标签用于标识目标内容。In a possible implementation manner, the reservation instruction includes a target tag, and the target tag is used to identify the target content.
通过采用该技术方案,可以解析网页内容的代码中包括目标标签的保留指令,目标标签标识目标内容,因此可以通过目标标签,确定网页内容中无需翻译的目标内容。By adopting the technical solution, the code of parsing the content of the web page includes the retention instruction of the target tag, and the target tag identifies the target content, so the target content in the web page content that does not need to be translated can be determined through the target tag.
在一种可能的实现方式中,保留指令包括目标程序接口,目标程序接口的输入值为目标内容。In a possible implementation manner, the reserved instruction includes a target program interface, and an input value of the target program interface is target content.
通过采用该技术方案,可以解析网页内容的代码中的目标程序接口,目标程序接口的输入值即为网页内容中需要保留原始形式的目标内容。By adopting this technical solution, the target program interface in the code of the webpage content can be analyzed, and the input value of the target program interface is the target content in the webpage content that needs to be kept in its original form.
第二方面,本申请提供了一种网页内容翻译方法,包括:当接收到针对网页内容的翻译请求时,对网页内容进行识别,确定网页内容中的目标内容;确定目标内容的内容类型;通 过内容类型的翻译引擎对目标内容进行翻译、以及通过浏览器的翻译引擎对网页内容中的第一内容进行翻译,分别得到目标内容的翻译内容和第一内容的翻译内容,第一内容不包括目标内容;展示网页内容的翻译结果,翻译结果包括目标内容的翻译内容和第一内容的翻译内容。In a second aspect, the present application provides a method for translating webpage content, including: when a translation request for webpage content is received, identifying the webpage content to determine the target content in the webpage content; determining the content type of the target content; The translation engine of the content type translates the target content, and translates the first content in the webpage content through the translation engine of the browser, and obtains the translated content of the target content and the translated content of the first content respectively, and the first content does not include the target content Content: displaying the translation result of the web page content, the translation result includes the translation content of the target content and the translation content of the first content.
其中,翻译请求可以包括用户操作,或基于用户操作生成的指令,如用户触发翻译控件、说出包含翻译关键字的语音,又如,基于用户触发翻译控件或说出包含关键字的语音,生成翻译请求,等等。翻译请求也可以由终端自动生成,比如,终端可以自动识别网页内容,当识别到网页内容对于其对应的查看对象来说存在查看障碍时,可以自动生成针对当前网页内容的翻译请求,如查看对象为儿童、老人等时,可以自动生成针对英文网页内容的翻译请求。Among them, the translation request may include user operations, or instructions generated based on user operations, such as the user triggers the translation control and speaks the voice containing the translation keywords, and for example, based on the user triggering the translation control or speaking the voice containing the keywords, generates Translation requests, etc. The translation request can also be automatically generated by the terminal. For example, the terminal can automatically identify the content of the webpage. When it recognizes that the content of the webpage has viewing obstacles for its corresponding viewing object, it can automatically generate a translation request for the current webpage content. For example, the viewing object For children, the elderly, etc., translation requests for English web content can be automatically generated.
确定网页内容中的目标内容及其内容类型的方式可以包括多种,比如,可以解析网页内容的代码中的保留指令,进而确定网页内容中的目标内容及其内容类型。There are many ways to determine the target content and its content type in the webpage content. For example, the reserved instruction in the code of the webpage content can be parsed, and then the target content and its content type in the webpage content can be determined.
其中,展现翻译结果的方式可以有多种,如通过屏幕显示文本形式的翻译结果,通过扬声器播放音频形式的翻译结果,通过屏幕和扬声器配合播放视频形式的翻译结果,等等。Among them, there are many ways to display the translation results, such as displaying the translation results in text form on the screen, playing the translation results in audio form through speakers, playing the translation results in video form through the cooperation of the screen and speakers, and so on.
通过采用该技术方案,可以对网页内容进行识别,确定其中需要特殊翻译处理的目标内容、以及目标内容的内容类型,从而通过内容类型的翻译引擎对目标内容进行翻译,通过浏览器的翻译引擎对第一内容进行翻译,其中不同内容类型的翻译引擎在处理其所对应内容类型的目标内容时,可以得到更加专业准确的翻译结果,因此本技术方案相比于使用浏览器的翻译引擎对所有网页内容进行处理,可以有效提升针对网页内容的翻译准确性。By adopting this technical solution, it is possible to identify the content of the webpage, determine the target content that requires special translation processing, and the content type of the target content, so that the target content can be translated through the translation engine of the content type, and the translation engine of the browser can be used to translate the target content. The first content is translated, and the translation engines of different content types can obtain more professional and accurate translation results when processing the target content of the corresponding content type. Content processing can effectively improve the translation accuracy of web content.
在一种可能的实现方式中,当接收到针对网页内容的翻译请求时,对网页内容进行识别,确定网页内容中的目标内容,包括:当接收到针对网页内容的翻译请求时,对网页内容进行检测,得到多个内容区域;根据每个内容区域中的网页内容的标签代码,从多个内容区域中确定至少一个目标内容区域,目标内容区域包括目标内容。In a possible implementation manner, when a translation request for webpage content is received, identifying the webpage content and determining the target content in the webpage content includes: when receiving a translation request for webpage content, translating the webpage content Perform detection to obtain multiple content areas; determine at least one target content area from the multiple content areas according to the label code of the web page content in each content area, and the target content area includes the target content.
通过采用该技术方案,可以先确定网页内容中的多个内容区域,进而从多个内容区域中确定包括目标内容的目标内容区域。By adopting this technical solution, multiple content areas in the web page content can be determined first, and then the target content area including the target content can be determined from the multiple content areas.
在一种可能的实现方式中,当接收到针对网页内容的翻译请求时,对网页内容进行识别,确定网页内容中的目标内容,包括:当接收到针对网页内容的翻译请求时,识别网页内容中与预设内容相匹配的目标内容。In a possible implementation, when a translation request for webpage content is received, identifying the webpage content and determining the target content in the webpage content includes: when receiving a translation request for webpage content, identifying the webpage content Target content that matches the preset content in .
预设内容可以包括多种,对应地识别与预设内容相匹配的目标内容的方式也包括多种,比如,预设内容可以为内容关键字,则识别与预设内容相匹配的目标内容可以为:识别网页内容中包含的内容关键字,当网页内容中内容关键字的数量大于预设数量时,确定网页内容中包括内容关键字的部分网页内容为目标内容。The preset content can include multiple types, and correspondingly, there are multiple ways to identify the target content that matches the preset content. For example, the preset content can be a content keyword, and then identifying the target content that matches the preset content can be To: identify the content keywords contained in the webpage content, and when the number of the content keywords in the webpage content is greater than a preset number, determine the part of the webpage content including the content keywords in the webpage content as the target content.
又比如,预设内容可以包括内容特征,识别网页内容可以通过识别模型进行,识别模型可以包括基于深度学习的技术构建,并通过大量训练进行模型训练所得的模型,识别模型可以包括若干训练后得到的内容特征,对应地,可以通过识别模型确定网页内容中与内容特征匹配度大于预设阈值的部分网页内容为目标内容。For another example, the preset content can include content features, and the recognition model can be used to identify web page content. The recognition model can include a model based on deep learning technology and model training through a large number of trainings. The recognition model can include several training models. Correspondingly, part of the webpage content in the webpage content whose matching degree with the content feature is greater than a preset threshold can be determined as the target content through the recognition model.
通过采用该技术方案,可以将网页内容与预设内容进行匹配,确定网页内容中的目标内容。By adopting the technical solution, the content of the webpage can be matched with the preset content, and the target content in the content of the webpage can be determined.
在一种可能的实现方式中,预设内容包括预设字符或预设控件,当接收到针对网页内容的翻译请求时,识别网页内容中与预设内容相匹配的目标内容,包括:当接收到针对网页内容的翻译请求时,对网页内容进行识别;当识别到网页内容中包括预设字符或预设控件时, 确定网页内容中与预设字符或预设控件满足相邻位置关系的区域为目标内容区域,目标内容区域包括目标内容。In a possible implementation manner, the preset content includes preset characters or preset controls, and when a translation request for the webpage content is received, identifying the target content in the webpage content that matches the preset content includes: when receiving When a translation request for webpage content is received, identify the webpage content; when it is recognized that the webpage content includes preset characters or preset controls, determine the area in the webpage content that satisfies the adjacent positional relationship with the preset characters or preset controls is the target content area, and the target content area includes the target content.
通过采用该技术方案,可以对文本内容中提示目标内容的预设字符或预设控件进行识别,从而将与预设字符或预设控件满足相邻位置关系的目标内容区域中的内容确定为目标内容。By adopting this technical scheme, the preset characters or preset controls that prompt the target content in the text content can be identified, so that the content in the target content area that satisfies the adjacent positional relationship with the preset characters or preset controls can be determined as the target content.
在一种可能的实现方式中,确定目标内容的内容类型,包括:显示针对目标内容的类型选择控件,类型选择控件包括至少一个可选类型;响应于用户针对类型选择控件的至少一个可选类型中目标类型的选中操作,确定目标内容的内容类型为目标类型。In a possible implementation manner, determining the content type of the target content includes: displaying a type selection control for the target content, where the type selection control includes at least one selectable type; In the selection operation of the target type, the content type of the target content is determined as the target type.
通过采用该技术方案,可以根据用户操作确定目标内容的内容类型。By adopting this technical solution, the content type of the target content can be determined according to the user operation.
在一种可能的实现方式中,显示针对目标内容的类型选择控件,包括:显示针对目标内容区域中目标内容的翻译提示信息、和翻译决策控件,翻译提示信息用于提示用户是否翻译目标内容;响应于用户针对翻译决策控件的确定操作,显示针对目标内容的类型选择控件。In a possible implementation manner, displaying a type selection control for the target content includes: displaying translation prompt information for the target content in the target content area, and a translation decision control, where the translation prompt information is used to prompt the user whether to translate the target content; In response to a user's determination operation on the translation decision control, a type selection control for the target content is displayed.
通过采用该技术方案,可以根据用户操作确定针对目标内容的翻译决定。By adopting the technical solution, it is possible to determine the translation decision for the target content according to the user operation.
在一种可能的实现方式中,网页内容翻译方法还包括:响应于用户针对翻译决策控件的否定操作,通过浏览器的翻译引擎对网页内容中的第一内容进行翻译,得到第一内容的翻译内容;显示网页内容的翻译结果,翻译结果包括目标内容和第一内容的翻译内容。In a possible implementation, the method for translating webpage content further includes: in response to the user's negative operation on the translation decision control, using the browser's translation engine to translate the first content in the webpage content to obtain the translation of the first content Content: displaying the translation result of the web page content, the translation result includes the target content and the translation content of the first content.
通过采用该技术方案,可以根据用户操作确定针对目标内容的不翻译决定。By adopting this technical solution, a non-translation decision for the target content can be determined according to user operations.
在一种可能的实现方式中,通过内容类型的翻译引擎对目标内容进行翻译、以及通过浏览器的翻译引擎对网页内容中的第一内容进行翻译,分别得到目标内容的翻译内容和第一内容的翻译内容,包括:显示针对目标内容的内容类型的翻译引擎的使用提示信息、和使用决策控件;响应于针对使用决策控件的确定操作,通过内容类型的翻译引擎对目标内容进行翻译、以及通过浏览器翻译引擎对网页内容中的第一内容进行翻译,分别得到目标内容的翻译内容和第一内容的翻译内容。In a possible implementation manner, the translation engine of the content type is used to translate the target content, and the translation engine of the browser is used to translate the first content in the webpage content, to obtain the translated content of the target content and the first content respectively. The translation content of the content, including: displaying the use prompt information of the translation engine of the content type of the target content, and the use decision control; in response to the determination operation of the use decision control, translating the target content by the translation engine of the content type, and by The browser translation engine translates the first content in the webpage content, and respectively obtains the translated content of the target content and the translated content of the first content.
通过采用该技术方案,可以根据用户操作确定使用内容类型的翻译引擎对目标内容进行翻译的使用决定。By adopting this technical solution, the decision to use the translation engine of the content type to translate the target content can be determined according to the user operation.
在一种可能的实现方式中,确定目标内容的内容类型,包括:对目标内容进行类型识别,得到目标内容的内容类型。In a possible implementation manner, determining the content type of the target content includes: identifying the type of the target content to obtain the content type of the target content.
通过采用该技术方案,可以由终端自动确定目标内容的内容类型。By adopting this technical solution, the terminal can automatically determine the content type of the target content.
第一方面提供的方法也可以和第二方面提供的方法叠加使用,换句话说,既检测网页的源代码中是否有保留指令,也执行网页内容的识别,二者可先后执行(顺序不做限定)或同时执行。The method provided by the first aspect can also be used in combination with the method provided by the second aspect. In other words, it not only detects whether there are reserved instructions in the source code of the webpage, but also performs identification of the webpage content. limited) or simultaneously.
第三方面,本申请提供了一种计算机设备,所述计算机设备包括至少一个处理器、存储器。所述存储器用于存储指令,所述处理器用于执行所述指令实现上述第一方面或第二方面的网页内容翻译方法。In a third aspect, the present application provides a computer device, and the computer device includes at least one processor and a memory. The memory is used to store instructions, and the processor is used to execute the instructions to implement the method for translating webpage content in the first aspect or the second aspect.
第四方面,本申请提供了一种计算机可读存储介质,所述计算机可读存储介质存储有程序,所述程序使得计算机设备执行上述第一方面或第二方面的网页内容翻译方法。In a fourth aspect, the present application provides a computer-readable storage medium, where a program is stored in the computer-readable storage medium, and the program causes a computer device to execute the method for translating webpage content in the first aspect or the second aspect.
第五方面,本申请提供了一种计算机程序产品,所述计算机程序产品包括计算机可读指令,当所述计算机可读指令被一个或多个处理器执行时实现上述第一方面或第二方面的网页内容翻译方法。In a fifth aspect, the present application provides a computer program product, the computer program product includes computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the above-mentioned first aspect or second aspect is realized method for translating web content.
可以理解地,上述第三方面提供的计算机设备、第四方面提供的计算机可读存储介质以及第五方面提供的计算机程序产品,与上述第一方面或第二方面提供的方法对应,因此,其 所能达到的有益效果或各种实现方式可参考上文,此处不再赘述。It can be understood that the computer device provided by the above third aspect, the computer-readable storage medium provided by the fourth aspect, and the computer program product provided by the fifth aspect correspond to the method provided by the above first aspect or the second aspect, therefore, its For the beneficial effects or various implementation manners that can be achieved, reference can be made to the above, and details will not be repeated here.
图1为本申请提供的网页内容翻译方法的实施场景示意图;FIG. 1 is a schematic diagram of an implementation scenario of the method for translating webpage content provided by the present application;
图2为本申请提供的网页内容翻译方法的另一实施场景示意图;FIG. 2 is a schematic diagram of another implementation scenario of the method for translating webpage content provided by the present application;
图3为本申请提供的网页内容翻译方法的部分用户页面示意图;FIG. 3 is a schematic diagram of some user pages of the method for translating webpage content provided by the present application;
图4为本申请提供的网页内容翻译方法的实施主体示意图;FIG. 4 is a schematic diagram of the implementation subject of the method for translating webpage content provided by the present application;
图5为本申请提供的网页内容翻译方法的流程示意图;FIG. 5 is a schematic flow diagram of the method for translating webpage content provided by the present application;
图6为本申请提供的网页内容翻译方法的另一流程示意图;FIG. 6 is another schematic flowchart of the method for translating webpage content provided by the present application;
图7为本申请提供的网页内容翻译方法的另一部分用户页面示意图;FIG. 7 is a schematic diagram of another part of the user page of the method for translating webpage content provided by the present application;
图8为本申请提供的网页内容翻译方法的另一部分用户页面示意图;FIG. 8 is a schematic diagram of another part of the user page of the method for translating webpage content provided by the present application;
图9为本申请提供的网页内容翻译方法的另一部分用户页面示意图;FIG. 9 is a schematic diagram of another part of the user page of the method for translating webpage content provided by the present application;
图10为本申请提供的网页内容翻译方法的另一流程示意图;FIG. 10 is another schematic flowchart of the method for translating webpage content provided by the present application;
图11为本申请提供的网页内容翻译方法的执行架构示意图;FIG. 11 is a schematic diagram of the execution architecture of the method for translating webpage content provided by the present application;
图12为本申请提供的计算机设备的结构示意图。FIG. 12 is a schematic structural diagram of a computer device provided by the present application.
需要说明的是,本申请中“至少一个”是指一个或者多个,“多个”是指两个或多于两个。“和/或”,描述关联对象的关联关系,表示可以存在至少三种关系,例如,A和/或B可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A,B可以是单数或者复数。本申请的说明书和权利要求书及附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不是用于描述特定的顺序或先后次序。It should be noted that in this application, "at least one" means one or more, and "multiple" means two or more than two. "And/or" describes the association relationship of associated objects, indicating that there can be at least three relationships, for example, A and/or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A, B can be singular or plural. The terms "first", "second", "third", "fourth", etc. (if any) in the description and claims of this application and the drawings are used to distinguish similar objects, not to Describe a specific order or sequence.
本申请的网页内容翻译方法可以由计算机设备执行,计算机设备可以包括终端或服务器中的至少一个,其中,终端可以包括智能手机、笔记本电脑、平板电脑、智能可穿戴设备、车载智能终端、智能电视(也称智慧大屏)、虚拟现实设备、混合现实设备、增强现实设备、或机器人设备(比如商场导航机器人、儿童或病人的看护机器人)等,服务器可以包括本地服务器、云服务器等,终端与服务器之间可以通过有线或无线方式连接,等等。The webpage content translation method of the present application can be performed by computer equipment, and the computer equipment can include at least one of a terminal or a server, wherein the terminal can include a smart phone, a notebook computer, a tablet computer, a smart wearable device, a vehicle-mounted smart terminal, a smart TV (also known as smart big screen), virtual reality equipment, mixed reality equipment, augmented reality equipment, or robot equipment (such as shopping mall navigation robots, children or patient care robots), etc., servers can include local servers, cloud servers, etc., terminals and Servers can be connected by wire or wirelessly, and so on.
比如,参见图1,网页内容翻译方法可以由终端10执行,终端10可以响应用户针对网页的英文内容的翻译请求,显示英文内容的翻译结果,翻译结果包括了英文内容中的英文诗歌、以及该英文内容中除诗歌以外其他内容对应的中文翻译结果。相比于现有通过默认翻译引擎对网页内容无差别的全部翻译,此处可以保留网页内容中无需翻译的部分内容,有效提升用户使用翻译功能的体验感。For example, referring to FIG. 1 , the method for translating webpage content can be executed by
又比如,参见图2,网页内容翻译方法可以由终端20和服务器30共同执行,终端20可以响应用户针对网页的英文内容的翻译请求,向服务器30发送内容翻译请求,服务器30可以识别英文内容中包含的英文诗歌,借助诗歌翻译引擎得到英文诗歌的中文翻译结果,借助默认翻译引擎得到英文内容中除英文诗歌以外的其他内容的中文翻译结果,终端20可以将服务器30返回的英文内容的中文翻译结果展示在用户界面上,供用户查看。相比于现有使用默认翻译引擎对网页内容无差别的全部翻译,此处可以对网页内容进行识别,将网页内容中专业性较强的部分内容使用其所属领域的专业翻译引擎处理,可以提升翻译结果的准确性,有效提升用户使用翻译功能的体验感。For another example, referring to FIG. 2 , the method for translating web page content can be jointly executed by the terminal 20 and the
具体地,在一些实施例中,本申请的网页内容翻译方法可以由终端上的浏览器应用执行,浏览器应用可以显示网页,并提供针对网页内容的翻译功能,用户可以触发浏览器应用上设置的翻译控件,即可发起针对网页内容的翻译请求,浏览器应用中可以包含默认翻译引擎,默认翻译引擎可以进行网页内容翻译,浏览器应用的网页可以显示网页内容的翻译结果。Specifically, in some embodiments, the webpage content translation method of the present application can be executed by a browser application on a terminal, and the browser application can display webpages and provide a translation function for webpage content, and the user can trigger the browser application to set The translation control of the browser application can initiate a translation request for the webpage content. The browser application can include a default translation engine, which can translate the webpage content, and the webpage of the browser application can display the translation result of the webpage content.
比如,参见图3,浏览器应用1显示网页1,网页1包含一篇英文文章,该英文文章内包含多个化学公式,用户触发网页1上的翻译按钮01,浏览器应用1可以对网页1的代码进行解析,确定其中针对每个化学公式的保留指令,浏览器应用1将网页1的英文文章中除化学公式以外的其他内容使用默认翻译引擎进行翻译,得到其他内容的中文翻译结果,浏览器应用1刷新显示网页1,网页1此时包括原有的化学公式,以及其他内容的中文翻译结果。For example, referring to Figure 3, browser application 1 displays webpage 1, and webpage 1 contains an English article, which contains multiple chemical formulas, and the user triggers the translation button 01 on webpage 1, and browser application 1 can translate webpage 1 The code is analyzed to determine the reserved instructions for each chemical formula. The browser application 1 translates the content in the English article of webpage 1 except the chemical formula using the default translation engine to obtain the Chinese translation results of other content. Browse The browser application 1 refreshes and displays the webpage 1, and the webpage 1 now includes the original chemical formula and Chinese translation results of other contents.
在本申请的一些实施例中,常见的主体以及各个主体之间的关系可以参见图4,常见的主体可以包括用户、终端设备、浏览器应用和网络内容提供商,其中,用户可以在终端设备上打开浏览器应用,终端设备可以根据用户的打开操作运行其上安装的浏览器应用,用户可以在浏览器应用上请求想要查看的网页,浏览器应用可以通过终端设备向网络内容提供商的计算机设备发送网页内容请求,网络内容提供商的计算机设备可以使用网络相关的技术向终端设备提供网页的内容代码,网络相关的技术可以包括超文本标记语言(Hyper Text Markup Language,HTML)、层叠样式表(Cascading Style Sheets,CSS)、以及编程语言应用程序接口(Javascript Application Programming Interface,Js API)等,浏览器应用可以根据终端设备接收到的内容代码显示网页内容。In some embodiments of the present application, the common subjects and the relationship between various subjects can be referred to in FIG. Open the browser application on the terminal device, and the terminal device can run the browser application installed on it according to the user's opening operation. When a computer device sends a request for web page content, the computer device of the network content provider can use network-related technologies to provide the content code of the web page to the terminal device. Network-related technologies can include Hyper Text Markup Language (Hyper Text Markup Language, HTML), cascading style Cascading Style Sheets (CSS), and programming language application programming interface (Javascript Application Programming Interface, Js API), etc., browser applications can display webpage content according to the content code received by the terminal device.
浏览器应用还可以集成翻译插件从而实现翻译功能,用户可以触发浏览器应用上的翻译按钮,浏览器应用可以响应用户的触发操作,通过翻译插件对网页内容中的部分或全部进行翻译,并显示得到的翻译结果。The browser application can also integrate a translation plug-in to realize the translation function. The user can trigger the translation button on the browser application, and the browser application can respond to the trigger operation of the user, and translate part or all of the web page content through the translation plug-in, and display Get the translation result.
终端设备可以包括如手机、笔记本电脑、智能穿戴设备、平板电脑等,终端可以展现网页内容的翻译结果,展现的方式可以包括在屏幕上显示、使用扬声器语音播报等。Terminal devices can include mobile phones, laptops, smart wearable devices, tablet computers, etc. The terminal can display the translation results of webpage content, and the presentation methods can include displaying on the screen, using speakers to broadcast, etc.
下面将详细介绍本申请的网页内容翻译方法。The web page content translation method of the present application will be introduced in detail below.
在本实施例中的网页内容翻译方法可以由终端执行,也可以由终端和服务器共同执行,参见图5,图5为本申请提供的一种网页内容翻译方法的流程示意图,网页内容翻译方法可以包括:The method for translating webpage content in this embodiment can be executed by a terminal, or jointly executed by a terminal and a server. Referring to FIG. 5, FIG. 5 is a schematic flow diagram of a method for translating webpage content provided by the present application. include:
101、在浏览器页面显示网页内容。101. Displaying webpage content on a browser page.
用户可以在终端请求想要查看的网页内容,比如,用户可以输入网络地址、点击网页链接等,终端可以根据网络地址,向网页内容提供商的服务器发送网页内容请求,网页内容提供商的服务器在接收到该请求后,可以向终端返回其所请求的网页内容的代码,终端可以对代码进行解析并进行页面渲染,从而在页面上显示网页内容。Users can request the webpage content they want to view on the terminal. For example, the user can enter a network address, click a webpage link, etc., and the terminal can send a webpage content request to the server of the webpage content provider according to the network address. The server of the webpage content provider is in After receiving the request, the code of the requested webpage content can be returned to the terminal, and the terminal can analyze the code and perform page rendering, thereby displaying the webpage content on the page.
在一些实施例中,终端上可以安装应用程序,用户可以在应用程序上进行操作,比如,终端可以安装浏览器应用,用户可以在浏览器应用上点击网页链接,以及对根据网页链接接收到的网页内容的代码进行解析,对页面进行渲染,从而在浏览器应用的浏览器页面显示网页内容。In some embodiments, an application program can be installed on the terminal, and the user can perform operations on the application program. For example, a browser application can be installed on the terminal, and the user can click a webpage link on the browser application, and perform operations on the webpage link received according to the webpage link. The code of the webpage content is parsed, and the page is rendered, so that the webpage content is displayed on the browser page of the browser application.
网页内容可以包括文本、语音、图像、视频等在内的一种或多种形式的内容,网页内容可以为由中文、英文、阿拉伯文、蒙文等语言的文字表述的内容,网页内容中可以部分包括如下特殊内容,如诗歌、专有名词、公式、代码等等,网页内容可以包括其所在网页显示的部分或全部内容,比如,网页1为一专利检索结果网页,网页内容可以包括网页1中显示的 专利文件,网页内容也可以包括网页1中显示的检索关键词、筛选条件和专利文件,等等。The content of the web page can include one or more forms of content including text, voice, image, video, etc. The content of the web page can be expressed in Chinese, English, Arabic, Mongolian and other languages. The content of the web page can be Parts include the following special content, such as poetry, proper nouns, formulas, codes, etc. The content of the web page may include part or all of the content displayed on the web page where it is located. For example, web page 1 is a patent search result web page, and the content of the web page may include web page 1 The patent documents displayed in , and the content of the webpage may also include search keywords, filter conditions and patent documents displayed in the webpage 1, and so on.
比如,在浏览器页面显示网页内容1,网页内容1包含一篇中文古诗赏析,中文古诗赏析其中包括一首中文古诗、以及针对这首中文古诗的中文赏析。For example, a webpage content 1 is displayed on a browser page, and the webpage content 1 includes an appreciation and analysis of an ancient Chinese poem, and the appreciation and analysis of an ancient Chinese poem includes an ancient Chinese poem and an appreciation and analysis in Chinese for the ancient Chinese poem.
102、当接收到针对网页内容的翻译请求时,对网页内容的代码进行解析。102. When a translation request for the webpage content is received, analyze the code of the webpage content.
用户可以在终端发起针对网页内容的翻译请求,比如,终端可以设置翻译控件,用户可以触发翻译控件,终端响应针对翻译控件的触发操作,即接收来自用户针对网页内容的翻译请求。又比如,终端可以设置语音助手,用户可以向终端说出翻译网页内容的话,终端可以采集用户语音并进行识别,得到用户语音的识别结果,即为接收到来自用户针对网页内容的翻译请求。The user can initiate a translation request for webpage content on the terminal. For example, the terminal can set a translation control, the user can trigger the translation control, and the terminal responds to the trigger operation on the translation control, that is, receives a translation request from the user for the webpage content. For another example, the terminal can be equipped with a voice assistant, and the user can speak to the terminal to translate the content of the webpage, and the terminal can collect the user's voice and perform recognition, and obtain the recognition result of the user's voice, which means receiving a translation request from the user for the content of the webpage.
在一些实施例中,翻译控件、语音助手等可以为终端上设置的功能,如手机可以从屏幕底上滑唤起语音助手,等等;翻译控件、语音助手等也可以为终端的应用程序上设置的功能,如浏览器应用的浏览器页面可以设置翻译按钮,等等。In some embodiments, the translation control, voice assistant, etc. can be functions set on the terminal, such as the mobile phone can slide up from the bottom of the screen to call up the voice assistant, etc.; the translation control, voice assistant, etc. can also be set on the application program of the terminal functions, such as the browser page of the browser application can be set with a translation button, and so on.
对网页内容的代码进行解析,确定其中是否存在控制对网页内容中的部分内容不进行翻译的保留指令。Analyzing the code of the webpage content to determine whether there is a reserved instruction controlling not to translate part of the content of the webpage.
网页内容提供商在生成网页内容的代码的过程中,可以根据网页内容的特点,在代码中加入限制对部分网页内容进行翻译操作的保留指令,比如,网页内容可以为英文表格,其中包括了若干计算机领域的英文专有名词,为了避免这些英文专有名词被翻译为其他语言,网页内容提供商可以在网页内容的代码中加入针对这些英文专有名词的保留指令。During the process of generating the code of the web content, the web content provider may, according to the characteristics of the web content, add reservation instructions to the code to restrict the translation of some web content. For example, the web content may be an English form, which includes several English proper nouns in the computer field, in order to prevent these English proper nouns from being translated into other languages, web content providers can add reserved instructions for these English proper nouns in the code of web content.
保留指令可以包括多种,在一些实施例中,保留指令可以基于扩展HTML标签得到,保留指令可以包括扩展HTML标签,通过扩展HTML标签对部分网页内容进行标识,扩展HTML标签可以为dt,包括dt的保留指令可以如:<dt>edge</dt>,该保留指令可以控制edge这个英文单词不被终端翻译,保留在其所在网页内容的翻译结果中。The reserved instruction can include multiple types. In some embodiments, the reserved instruction can be obtained based on the extended HTML tag. The reserved instruction can include the extended HTML tag to identify part of the webpage content through the extended HTML tag. The extended HTML tag can be dt, including dt The reserved command can be such as: <dt>edge</dt>, this reserved command can control the English word edge not to be translated by the terminal, but to be kept in the translation result of the webpage content where it is located.
在一些实施例中,保留指令可以包括Js API,其中,dt.Keep可以为控制部分内容不被翻译,保留原文的Js API,比如dt.Keep(a),该保留指令可以控制dt.Keep的输入值a不被终端翻译,保留在其所在网页内容的翻译结果中。In some embodiments, the reserved instruction can include Js API, wherein, dt.Keep can control part of the content not to be translated, and retain the original Js API, such as dt.Keep(a), the reserved instruction can control dt.Keep The input value a will not be translated by the terminal, and will remain in the translation result of the webpage content where it is located.
在一些实施例中,通过dt.Keep控制目标内容中的部分内容不被翻译之前,可以通过dt.Read、dt.SetRangePolicy等Js API,以及一些代码逻辑,确定在目标内容被翻译时,其中需要保留的部分内容。In some embodiments, before using dt.Keep to control part of the target content from being translated, Js APIs such as dt.Read, dt.SetRangePolicy, and some code logic can be used to determine when the target content is translated, which needs Part of the content reserved.
dt.Read可以读取外部文本库,外部文本库中包含在翻译过程中需要被保留的文本,如诗词、专有名词、化学式等,然后可以在网页内容中进行比对,确定其中是否存在外部文本库中的任一或多个文本,若存在,可以通过dt.SetRangePolicy确定基于网页内容中的该文本,对网页内容中的以该文本为中心的部分内容的保留策略,通过dt.SetRangePolicy可以确定多种保留策略,比如,dt.SetRangePolicy(1),可以表示将该文本、其前一个字以及其后一个字保留下来,又比如,dt.SetRangePolicy(0)可以表示将该文本为所在句子保留下来,即将该文本之前一个句号和该文本之后一个句号范围内的所有文本保留下来,等等,具体地dt.SetRangePolicy中的保留策略可以根据实际需求灵活配置和使用,在此不再赘述。dt.Read can read the external text library, which contains texts that need to be preserved during the translation process, such as poems, proper nouns, chemical formulas, etc., and then can be compared with the content of the web page to determine whether there is an external text library. Any one or more texts in the text library, if they exist, can be determined through dt.SetRangePolicy. Based on the text in the web page content, the retention policy for the part of the content centered on the text in the web content can be determined through dt.SetRangePolicy Determine multiple retention policies. For example, dt.SetRangePolicy(1) can indicate that the text, its previous word, and the next word are preserved. For example, dt.SetRangePolicy(0) can indicate that the text is the sentence it is in Preserve, that is, retain all the text within the range of a period before the text and a period after the text, etc. Specifically, the retention policy in dt.SetRangePolicy can be flexibly configured and used according to actual needs, and will not be described here.
比如,浏览器页面还可以包括翻译按钮,响应用户对翻译按钮的触发操作(即接收针对网页内容的翻译请求),对网页内容1的代码进行解析。For example, the browser page may further include a translation button, and the code of the webpage content 1 is parsed in response to the trigger operation of the translation button by the user (that is, receiving a translation request for the webpage content).
103、当解析到针对网页内容中目标内容的保留指令时,对网页内容内中的第一内容进行翻译,得到第一内容的翻译内容,第一内容不包括目标内容。103. When the retention instruction for the target content in the webpage content is analyzed, translate the first content in the webpage content to obtain translated content of the first content, where the first content does not include the target content.
当终端解析到保留指令时,可以确定保留指令所指示的网页内容的部分内容即为目标内容,然后终端可以对网页内容中的第一内容进行翻译处理,第一内容不包括目标内容,则可知第一内容可以为除网页内容中目标内容以外的全部或部分其他内容,比如,可以通过浏览器应用的翻译引擎翻译网页内容中除目标内容以外的其他内容,得到其他内容的翻译内容。When the terminal parses the reservation instruction, it can determine that part of the webpage content indicated by the reservation instruction is the target content, and then the terminal can translate the first content in the webpage content. If the first content does not include the target content, it can be seen that The first content may be all or part of other content except the target content in the webpage content. For example, the translation engine of the browser application may translate other content in the webpage content except the target content to obtain translated content of other content.
比如,解析到网页内容1的代码中包括针对中文古诗的保留指令1,则通过浏览器默认翻译引擎对网页内容1中除中文古诗以外的其他内容,即中文赏析进行翻译,得到与中文赏析含义相同的英文赏析。For example, if the code of web page content 1 includes reserved command 1 for ancient Chinese poems, the default translation engine of the browser will translate other content in web page content 1 except Chinese ancient poems, that is, Chinese appreciation and analysis, and obtain the meaning of Chinese appreciation and analysis The same appreciation in English.
104、在浏览器页面显示网页内容的翻译结果,翻译结果包括目标内容和第一内容的翻译内容。104. Display the translation result of the webpage content on the browser page, the translation result includes the target content and the translation content of the first content.
比如,在浏览器页面显示网页内容1的翻译结果,翻译结果包括中文古诗和该中文古诗的英文赏析。For example, a translation result of the webpage content 1 is displayed on the browser page, and the translation result includes an ancient Chinese poem and an English appreciation analysis of the ancient Chinese poem.
本实施例通过解析网页内容的代码,可以在执行对网页内容的翻译操作时,确保其中的部分内容不被翻译,得到保留了部分原文的翻译结果,提升用户使用翻译功能的体验感。In this embodiment, by analyzing the code of the webpage content, it can ensure that part of the content is not translated when performing the translation operation on the webpage content, and obtain a translation result that retains part of the original text, thereby improving the user experience of using the translation function.
在本实施例中,网页内容翻译方法可以由终端执行,也可以由终端和服务器共同执行,参见图6,图6为本申请提供的一种网页内容翻译方法的流程示意图,网页内容翻译方法可以包括:In this embodiment, the method for translating webpage content may be executed by a terminal, or jointly executed by a terminal and a server. Refer to FIG. 6 , which is a schematic flowchart of a method for translating webpage content provided by the present application. include:
201、在浏览器页面显示网页内容。201. Display webpage content on a browser page.
比如,在浏览器页面显示网页内容2,网页内容2包含一篇科普文章,科普文章中包括两个化学公式,以及一些英文科普。For example, the webpage content 2 is displayed on the browser page, and the webpage content 2 includes a popular science article, and the popular science article includes two chemical formulas and some popular science in English.
202、当接收到针对网页内容的翻译请求时,对网页内容进行识别,确定网页内容中的目标内容。202. When a translation request for webpage content is received, identify the webpage content, and determine target content in the webpage content.
当网页内容中存在如代码、诗歌、公式等内容时,可以通过如另起一行、下划线、加粗、斜体、缩进、加阴影、特殊字体等特殊格式显示这些内容,与网页内容中的其他内容加以区分,从而方便用户查看,基于这一特点,本申请中计算机设备可以对网页内容进行检测和识别,确定其中存在的以特殊格式显示的目标内容。When there are content such as codes, poems, formulas, etc. in the content of the web page, these contents can be displayed in special formats such as new line, underline, bold, italic, indented, shaded, and special fonts, which are different from other content in the web page. Contents are differentiated so that users can view them conveniently. Based on this feature, the computer equipment in this application can detect and identify the content of the webpage, and determine the target content displayed in a special format in it.
对网页内容进行识别从而确定目标内容的方式可以包括多种,比如,可以基于卷积神经网络技术构建识别模型,通过训练数据对识别模型进行训练,并通过训练后的识别模型,确定网页内容中所包含的与预设内容相匹配的目标内容。There are many ways to identify the content of the webpage to determine the target content. For example, a recognition model can be constructed based on convolutional neural network technology, the recognition model can be trained through training data, and the trained recognition model can be used to determine the content of the webpage. Included target content that matches preset content.
在一些实施例中,当接收到针对网页内容的翻译请求时,可以对网页内容进行检测,得到多个内容区域,根据每个内容区域内的部分内容的标签代码,从多个内容区域中确定至少一个目标内容区域,目标内容区域中包括目标内容。In some embodiments, when a translation request for webpage content is received, the content of the webpage can be detected to obtain multiple content areas, and according to the tag code of part of the content in each content area, determine from the multiple content areas At least one target content area includes target content.
本申请在接收到针对网页内容的翻译请求时,可以首先通过检测算法,对网页内容进行检测,得到多个内容区域,检测算法可以包括如文本检测算法、图像检测算法等,文本检测算法如比如连接文本推荐网络(Connectionist Text Proposal Network,CTPN)、DBNet(一种文本检测算法),比如,通过文本检测算法对网页内容2进行检测,可以得到内容区域1、内容区域2和内容区域2。When the application receives a translation request for webpage content, it can first detect the webpage content through a detection algorithm to obtain multiple content areas. The detection algorithm can include text detection algorithms, image detection algorithms, etc., and text detection algorithms such as Connectionist Text Proposal Network (CTPN), DBNet (a text detection algorithm), for example, through the text detection algorithm to detect the content of the webpage 2, you can get content area 1, content area 2 and content area 2.
从网页内容的代码中,确定每个内容区域内的部分内容的标签代码,对标签代码进行解析,确定该标签代码所标记的部分内容是否为以特殊方式显示的内容,标签代码可以包括通过HTML标签或CSS样式标识的部分内容,若是,则确定该部分内容所在的内容区域为目标内容区域。比如,计算机设备从网页内容2的代码中确定内容区域2内的部分内容的标签代码 2,对标签代码2进行解析,确定此部分内容是以单独一行的特殊格式显示的,则可以确定该部分内容所在的内容区域2为一个目标内容区域。From the code of the webpage content, determine the label code of part of the content in each content area, analyze the label code, and determine whether the part of the content marked by the label code is the content displayed in a special way. The label code can include HTML part of the content identified by the label or CSS style, and if so, determine that the content area where the part of content is located is the target content area. For example, the computer device determines the tag code 2 of part of the content in the content area 2 from the code of the web page content 2, analyzes the tag code 2, and determines that this part of the content is displayed in a special format of a single line, then the part can be determined The content area 2 where the content is located is a target content area.
在一些实施例中,网页内容中的诗歌、公式等在显示前会有一些强调性的文字或标点符号,显示代码时为了便于查看的用户复制完整的代码,可以在页面上设置一键复制按钮,基于这些特征,因此,本申请可以在接收到针对网页内容的翻译请求时,对网页内容进行识别,确定网页内容中是否包含预设字符或预设控件,预设字符如“如下”、“以下”、“或是”、“如是”、“:”等,预设控件包括按钮、文本框等,如文本内容为“登录后复制”的文本框,识别算法可以包括针对文本、图像、视频等的识别算法,文本识别算法如卷积循环神经网络(Convolutional Recurrent Neural Network,CRNN)结合基于神经网络的时序分类(Connectionist Temporal Classification,CTC),等等。In some embodiments, poems, formulas, etc. in the content of the web page will have some emphatic text or punctuation marks before displaying. When displaying the code, in order to facilitate the viewing of the user to copy the complete code, a one-click copy button can be set on the page , based on these features, therefore, when the application receives a translation request for the content of the web page, it can identify the content of the web page, and determine whether the content of the web page contains preset characters or preset controls, such as "as follows", " The following", "or", "if yes", ":", etc., preset controls include buttons, text boxes, etc., such as a text box whose text content is "copy after login", the recognition algorithm can include text, image, video recognition algorithms such as text recognition algorithms such as convolutional recurrent neural network (Convolutional Recurrent Neural Network, CRNN) combined with neural network-based temporal classification (Connectionist Temporal Classification, CTC), and so on.
若存在,可以将与预设字符或预设控件满足相邻位置关系的区域确定为目标内容区域,目标内容区域可以包括以预设字符或预设控件所在区域为中心区域,与该中心区域紧邻的区域,相邻位置关系可以包括两个紧邻的区域之间的关系,比如,与识别到的预设字符“如下”下方部分内容所在的区域可以确定为目标内容区域,又比如,识别到的预设控件左侧部分内容所在的区域可以确定为目标内容区域。If it exists, the area that satisfies the adjacent positional relationship with the preset character or preset control can be determined as the target content area, and the target content area can include the area where the preset character or preset control is located as the center area, and the area adjacent to the center area area, the adjacent position relationship can include the relationship between two adjacent areas, for example, the area where part of the content below the recognized preset character "below" can be determined as the target content area, and for example, the identified The area where the content on the left side of the preset control is located may be determined as the target content area.
203、确定目标内容的内容类型。203. Determine the content type of the target content.
目标内容区域内的部分内容即为目标内容,目标内容的内容类型可以有多种确认方式,在一些实施例中,可以通过类型识别模型,识别得到目标内容的内容类型,类型识别模型可以为由大量数据训练得到的神经网络模型。比如,将内容区域2中的目标内容1输入类型识别模型1,得到目标内容1的内容类型:化学公式。Part of the content in the target content area is the target content. The content type of the target content can be confirmed in a variety of ways. In some embodiments, the content type of the target content can be identified through a type identification model. The type identification model can be based on A neural network model trained on a large amount of data. For example, input the target content 1 in the content area 2 into the type recognition model 1 to obtain the content type of the target content 1: chemical formula.
在一些实施例中,可以获取不同内容类型对应的类型字符库,一个类型字符库中存储一个内容类型的典型字符,如化学公式类型的类型字符库中可以包括一些常见化学式、常见反应条件、箭头、等号、气体符号等类型字符。可以确定目标内容中的字符与不同类型字符库中类型字符的相似度,将相似度最高的类型字符库对应的内容类型确定为目标内容的内容类型。比如,将内容区域2中的目标内容1与多个类型字符库分别进行对比,根据对比结果得到目标内容1的内容类型:化学公式。In some embodiments, type character libraries corresponding to different content types can be obtained. Typical characters of a type of content type are stored in a type character library. For example, the type character library of chemical formula type can include some common chemical formulas, common reaction conditions, arrows, etc. , equal sign, gas symbol, etc. type characters. The similarity between the characters in the target content and the characters in different types of character libraries can be determined, and the content type corresponding to the type of character library with the highest similarity can be determined as the content type of the target content. For example, the target content 1 in the content area 2 is compared with multiple types of character libraries, and the content type of the target content 1 is obtained according to the comparison results: chemical formula.
在一些实施例中,目标内容的内容类型可以由用户确定,计算机设备可以在用户页面显示相关信息和控件,具体地,计算机设备在页面上可以显示针对目标内容区域内的目标内容的翻译提示信息和翻译决策控件,翻译提示信息可以用于提示用户是否翻译目标内容,翻译决策控件可以供用户做出翻译或不翻译目标内容的决策,比如,参见图7,终端的浏览器页面显示翻译提示信息:“检测到该部分文本可能为代码、诗词,是否继续翻译?”、以及翻译决策控件:“是”按钮和“跳过”按钮。In some embodiments, the content type of the target content can be determined by the user, and the computer device can display relevant information and controls on the user page, specifically, the computer device can display translation prompt information for the target content in the target content area on the page And the translation decision control, the translation prompt information can be used to prompt the user whether to translate the target content, and the translation decision control can be used for the user to make a decision to translate or not translate the target content, for example, see Figure 7, the terminal browser page displays the translation prompt information : "It is detected that this part of the text may be code or poetry, continue to translate?", and translation decision controls: "Yes" button and "Skip" button.
在一些实施例中,计算机设备可以响应用户针对翻译决策控件的确定操作,显示针对目标内容的类型选择控件,类型选择控件中可以包括多个可选类型,计算机设备可以响应用户针对可选类型中目标类型的选中操作,确定该目标类型为目标内容区域内的目标内容的内容类型。比如,参见图8,用户触发翻译决策控件中的“是”按钮后,浏览器页面可以显示针对目标内容的类型选择控件:“确定该内容为下述哪种类型”文本框、“代码”按钮、“公式”按钮、“诗词”按钮和“其他”按钮,用户触发类型选择控件中的“公式”按钮,终端可以确定目标内容的内容类型为公式。In some embodiments, the computer device may display a type selection control for the target content in response to the user's determination operation on the translation decision control. The selection operation of the target type determines that the target type is the content type of the target content in the target content area. For example, see Figure 8. After the user triggers the "Yes" button in the translation decision control, the browser page can display the type selection controls for the target content: "Determine which of the following types of content" text box, "Code" button , "formula" button, "poetry" button and "other" button, the user triggers the "formula" button in the type selection control, and the terminal can determine that the content type of the target content is a formula.
204、通过内容类型的翻译引擎对目标内容进行翻译、以及通过浏览器的翻译引擎对网页 内容中的第一内容进行翻译,分别得到目标内容的翻译后内容和第一内容的翻译内容,第一内容不包括目标内容。204. Translate the target content through the translation engine of the content type, and translate the first content in the webpage content through the translation engine of the browser, respectively obtain the translated content of the target content and the translated content of the first content, the first Content does not include target content.
终端或服务器可以存储内容类型与翻译引擎之间的对应关系,终端或服务器在需要翻译目标内容的过程时,可以从对应关系中查找目标内容的内容类型的翻译引擎,并在终端或服务器上通过内容类型的翻译引擎对目标内容进行翻译。The terminal or server can store the corresponding relationship between the content type and the translation engine. When the terminal or server needs to translate the target content, it can find the translation engine of the content type of the target content from the corresponding relationship, and pass the The translation engine of the content type translates the target content.
内容类型的翻译引擎和浏览器的翻译引擎可以设置在终端,终端在确定目标内容的内容类型后,可以直接通过内容类型的翻译引擎对目标内容进行翻译、以及通过浏览器的翻译引擎对网页内容中的第一内容进行翻译,分别得到目标内容的翻译后内容和第一内容的翻译内容。The translation engine of the content type and the translation engine of the browser can be set on the terminal. After the terminal determines the content type of the target content, it can directly translate the target content through the translation engine of the content type, and translate the webpage content through the translation engine of the browser. Translate the first content in the target content to obtain the translated content of the target content and the translated content of the first content respectively.
比如,终端通过化学公式的翻译引擎对目标内容进行翻译,听过浏览器的翻译引擎对网页内容2中除化学公式以外的英文科普进行翻译,得到化学公式的翻译内容、以及英文科普的中文译文。For example, the terminal translates the target content through the translation engine of the chemical formula, and the translation engine of the browser translates the English popular science in web content 2 except the chemical formula, and obtains the translated content of the chemical formula and the Chinese translation of the English popular science .
在一些实施例中,内容类型的翻译引擎和浏览器的翻译引擎可以设置在服务器上,终端可以向服务器发送目标内容以及内容类型,服务器可以确定内容类型的翻译引擎,并通过内容类型的翻译引擎对目标内容进行翻译、以及通过浏览器的翻译引擎对网页内容中的第一内容进行翻译,分别得到目标内容的翻译后内容和第一内容的翻译内容,服务器向终端回传得到的目标内容的翻译后内容和第一内容的翻译内容。In some embodiments, the translation engine of the content type and the translation engine of the browser can be set on the server, the terminal can send the target content and the content type to the server, the server can determine the translation engine of the content type, and use the translation engine of the content type to Translating the target content and translating the first content in the web page content through the translation engine of the browser to obtain the translated content of the target content and the translated content of the first content respectively, and the server returns the obtained target content to the terminal The translated content and the translated content of the first content.
在一些实施例中,响应于用户针对目标类型的选中操作,浏览器页面可以显示针对目标内容的内容类型的翻译引擎的使用提示信息和使用决策控件,响应于针对使用决策控件的确定操作,可通过内容类型的翻译引擎对目标内容进行翻译、以及通过浏览器的翻译引擎对网页内容中第一内容进行翻译,分别得到目标内容的翻译后内容和第一内容的翻译内容,第一内容不包括目标内容。In some embodiments, in response to the user's selection operation on the target type, the browser page can display the use prompt information and the use decision control of the translation engine for the content type of the target content, and in response to the determination operation on the use decision control, you can Translate the target content through the translation engine of the content type, and translate the first content in the webpage content through the translation engine of the browser, and obtain the translated content of the target content and the translated content of the first content respectively, and the first content does not include target content.
比如,参见图9,用户触发类型选择控件中的“公式”按钮,浏览器页面显示公式翻译引擎的使用提示信息“继续翻译,推荐使用专业的翻译引擎,如A翻译”和使用决策控件:“是”按钮和“跳过”按钮,用户触发“是”按钮,则显示使用A翻译对目标内容翻译,使用浏览器自带的翻译引擎对其他内容翻译。For example, as shown in Figure 9, the user triggers the "formula" button in the type selection control, and the browser page displays the use prompt message of the formula translation engine "Continue to translate, it is recommended to use a professional translation engine, such as A translation" and the use decision control: " "Yes" button and "Skip" button, if the user triggers the "Yes" button, it will display that the target content is translated using A translation, and other content is translated using the translation engine that comes with the browser.
205、在浏览器页面显示网页内容的翻译结果,翻译结果包括目标内容的翻译内容和第一内容的翻译内容。205. Display the translation result of the web page content on the browser page, the translation result includes the translated content of the target content and the translated content of the first content.
比如,浏览器页面可以显示网页内容2的翻译结果,翻译结果包括化学公式的翻译内容、以及原英文科普的中文译文。For example, the browser page can display the translation result of the webpage content 2, and the translation result includes the translation content of the chemical formula and the Chinese translation of the original English popular science.
本申请可以对网页内容进行识别,将其中的目标内容使用该目标类型所属的内容类型的翻译引擎进行翻译,将第一内容使用浏览器的翻译引擎进行翻译,可以得到更加准确和专业的翻译结果,有效提升用户使用浏览器翻译功能时的体验感。This application can identify the content of the webpage, translate the target content in it using the translation engine of the content type to which the target type belongs, and translate the first content using the translation engine of the browser, so that more accurate and professional translation results can be obtained , effectively improving the user experience when using the translation function of the browser.
在本实施例中,网页内容翻译方法可以由终端执行,终端上安装了浏览器(浏览器应用),具体地可以参见图10,图10为本申请提供的一种网页内容翻译方法的流程示意图,网页内容翻译方法可以包括:In this embodiment, the method for translating webpage content may be executed by a terminal, and a browser (browser application) is installed on the terminal. For details, please refer to FIG. 10 , which is a schematic flowchart of a method for translating webpage content provided by the present application. , web page content translation methods may include:
301、在浏览器页面显示网页内容。301. Display webpage content on a browser page.
参见图11,用户想要通过浏览器浏览网页,浏览器在接收到用户发起针对网页的浏览请求后,可以向网页内容提供商请求网页内容,网页内容提供商可以使用扩展的HTML/Js生成网页内容的代码,并在接收到浏览器所在终端发送的请求网页内容的信息时,向终端发返回 其所请求的网页内容的代码,浏览器可以对网页内容的代码进行解析,并根据解析结果进行页面渲染,从而在浏览器页面显示网页内容,使得用户可以查看网页内容。Referring to Figure 11, the user wants to browse the webpage through the browser, and the browser can request the webpage content from the webpage content provider after receiving the webpage browsing request initiated by the user, and the webpage content provider can use the extended HTML/Js to generate the webpage The code of the content, and when receiving the information requesting the content of the webpage sent by the terminal where the browser is located, it will send back the code of the requested webpage content to the terminal, and the browser can analyze the code of the content of the webpage, and perform Page rendering, so as to display the webpage content on the browser page, so that the user can view the webpage content.
302、当接收到针对网页内容的翻译请求时,对网页内容的代码进行解析。302. When a translation request for the webpage content is received, analyze the code of the webpage content.
参见图11,用户在查看网页内容时,想要浏览器对网页内容进行自动翻译,比如,用户点击浏览器页面上的翻译按钮,浏览器可以响应用户针对翻译按钮的点击操作,对网页内容的代码进行解析。Referring to Figure 11, when the user views the webpage content, he wants the browser to automatically translate the webpage content. For example, if the user clicks the translation button on the browser page, the browser can respond to the user's click operation on the translation button and automatically translate the webpage content. The code is parsed.
303、当解析到针对网页内容中目标内容的保留指令时,通过浏览器翻译引擎对网页内容中的第一内容进行翻译,得到第一内容的翻译内容,在浏览器页面显示网页内容的翻译结果,翻译结果包括目标内容和第一内容的翻译内容,第一内容不包括目标内容。303. When the retention instruction for the target content in the webpage content is parsed, translate the first content in the webpage content through the browser translation engine, obtain the translated content of the first content, and display the translation result of the webpage content on the browser page , the translation result includes the target content and the translated content of the first content, and the first content does not include the target content.
参见图11,包含扩展HTML或Js API可以包括:包含扩展HTML标签(如dt)的保留指令、或包括Js API(如dt.Keep)的保留指令,比如,保留指令可以为<dt id="id1"style="bold">万里河山</dt>,该保留指令包含dt标签,该dt标签标识“万里河山”,又比如,保留指令可以为dt.Keep(a),该保留指令包括dt.Keep,dt.Keep的输入值为变量a。Referring to Figure 11, the extended HTML or Js API may include: a reserved instruction including extended HTML tags (such as dt), or a reserved instruction including a Js API (such as dt.Keep). For example, the reserved instruction may be <dt id=" id1"style="bold">Wanli Rivers and Mountains</dt>, the reserved instruction includes a dt tag, and the dt tag identifies "Wanli Rivers and Mountains". For another example, the reserved instruction can be dt.Keep(a), and the reserved instruction includes dt .Keep, the input value of dt.Keep is variable a.
可以不对保留指令中的目标内容进行翻译,通过浏览器的翻译引擎对网页内容中除目标内容外的其他内容进行翻译,在浏览器页面显示其他内容的翻译结果以及原本的目标内容。It is possible not to translate the target content in the reservation instruction, but to translate other content in the webpage content except the target content through the translation engine of the browser, and display the translation results of other content and the original target content on the browser page.
在一些实施例中,网页内容的部分代码可以如下:In some embodiments, part of the code of the web page content may be as follows:
在本代码示例中,可以读取来自用户、终端、网页内容提供商等至少一个对象的输入数据(通过dt.Read),数据可以包括专有名词、特定文本等,终端可以在对网页内容进行翻译之前,对比目标内容中是否存在与任意输入数据相同的目标内容,若存在,则通过浏览器的翻译引擎对网页内容中的第一内容进行翻译。In this code example, the input data (via dt.Read) from at least one object such as the user, terminal, and web content provider can be read. The data can include proper nouns, specific text, etc., and the terminal can perform Before translating, compare whether there is target content identical to any input data in the target content, and if so, translate the first content in the web page content through the translation engine of the browser.
304、当未解析到针对网页内容中任意内容的保留指令时,对网页内容进行识别,确定网页内容中的目标内容。304. When the retention instruction for any content in the webpage content is not resolved, identify the webpage content, and determine the target content in the webpage content.
在一些实施例中,当未解析到针对网页内容中任意内容的保留指令时,对网页内容进行检测,得到多个内容区域,根据每个内容区域内的部分内容的标签代码,确定多个内容区域 中存在的目标内容区域,目标内容区域包括目标内容。In some embodiments, when the retention instruction for any content in the webpage content is not parsed, the webpage content is detected to obtain multiple content areas, and the multiple content areas are determined according to the label codes of part of the content in each content area The target content area that exists in the zone, the target content area includes the target content.
参见图11,网页内容的代码不包含扩展HTML或Js API,即不包含保留指令时,根据样式确定保留的原文可以包括:通过文本检测算法确定网页内容的多个内容区域,结合每个内容区域内文本的标签代码,确定包含以特殊格式显示的目标内容所在的目标内容区域。Referring to Figure 11, when the code of the web page content does not contain extended HTML or Js API, that is, when it does not contain a reserved instruction, determining the original text to be retained according to the style may include: determining multiple content areas of the web page content through a text detection algorithm, and combining each content area A tag code for the inner text that identifies the target content area that contains the target content displayed in a special format.
在一些实施例中,当未解析到针对网页内容中任意内容的保留指令时,对网页内容进行识别,当识别到网页内容中包括预设字符或预设控件时,确定在浏览器页面中与预设字符或预设控件满足相邻位置关系的区域为目标内容区域。In some embodiments, when the retention instruction for any content in the webpage content is not resolved, the webpage content is identified, and when it is recognized that the webpage content includes preset characters or preset controls, it is determined that the browser page matches the The area where the preset character or preset control satisfies the adjacent positional relationship is the target content area.
参见图11,网页内容的代码不包含扩展HTML或Js API,即不包含保留指令时,根据上下文确定保留的原文可以包括:对网页内容进行识别,确定是否包含如“如下”、“以下”、“或是”、“如是”、“:”等预设字符和/或按钮、文本框等预设控件,若存在,则确定浏览器页面中与预设字符或预设控件满足相邻位置关系的区域为目标内容区域,确定目标内容区域内的部分内容为目标内容。Referring to Figure 11, when the code of the web page content does not contain extended HTML or Js API, that is, when it does not contain a reserved instruction, determining the original text to retain according to the context may include: identifying the web page content, determining whether to include such as "below", "below", "Or", "if yes", ":" and other preset characters and/or buttons, text boxes and other preset controls, if they exist, determine that the browser page satisfies the adjacent positional relationship with the preset characters or preset controls The area within is the target content area, and part of the content within the target content area is determined to be the target content.
需要说明的是,上述两种方式是在终端未解析到针对网页内容中任意内容的保留指令时执行的,这只是一种可能的实施方式,应用场景中可以需求灵活选择和处理,如在一些实施例中,终端解析到针对网页内容中目标内容的保留指令时,也可以通过对网页内容检测,得到多个内容区域,根据每个内容区域内的部分内容的标签代码,和/或识别网页内容中是否存在预设字符或预设控件等方式,得到网页内容中的目标内容所在的目标内容区域。It should be noted that the above two methods are executed when the terminal does not resolve the reservation instruction for any content in the webpage content. This is only a possible implementation method, and flexible selection and processing can be required in application scenarios. For example, in some In the embodiment, when the terminal parses the retention instruction for the target content in the webpage content, it can also obtain multiple content areas by detecting the webpage content, and identify the webpage according to the tag code of part of the content in each content area. Whether there are preset characters or preset controls in the content, etc., to obtain the target content area where the target content in the web page content is located.
305、在浏览器页面显示针对目标内容区域中目标内容的翻译提示信息和翻译决策控件,翻译提示信息用于提示用户是否翻译目标内容。305. Display translation prompt information and translation decision control for the target content in the target content area on the browser page, where the translation prompt information is used to prompt the user whether to translate the target content.
在一些实施例中,终端可以响应于用户针对翻译决策控件的否定操作,通过浏览器的翻译引擎对网页内容中第一容进行翻译,得到第一内容的翻译内容,在浏览器页面显示目标内容和第一内容的翻译内容,第一内容不包括目标内容。In some embodiments, in response to the user's negative operation on the translation decision control, the terminal can use the browser's translation engine to translate the first content in the webpage content, obtain the translated content of the first content, and display the target content on the browser page and the translated content of the first content, the first content does not include the target content.
应理解的是,以上控件仅是举例,控件的设计、交互的方法可以根据需求和设备形态做出适应性改变。It should be understood that the above controls are only examples, and the design and interaction method of the controls can be adaptively changed according to requirements and device forms.
306、响应于用户针对翻译决策控件的确定操作,在浏览器页面显示针对目标内容的类型选择控件,类型选择控件包括至少一个可选类型。306. In response to the user's determination operation on the translation decision control, display a type selection control for the target content on the browser page, where the type selection control includes at least one optional type.
307、响应于用户针对类型选择控件的至少一个可选类型中目标类型的选中操作,确定目标内容的内容类型为目标类型,在浏览器页面显示针对目标类型的翻译引擎的使用提示信息和使用决策控件,使用提示信息用于提示用户是否使用目标类型的翻译引擎对目标内容进行翻译。307. In response to the user's selection operation of the target type in at least one of the selectable types of the type selection control, determine that the content type of the target content is the target type, and display the usage prompt information and usage decision of the translation engine for the target type on the browser page The control uses the prompt information to prompt the user whether to use the translation engine of the target type to translate the target content.
在一些实施例中,终端相应于用户针对使用决策控件的否定操作,通过浏览器的翻译引擎对全部网页内容进行翻译,得到并在浏览器页面显示网页内容的翻译结果。In some embodiments, in response to the user's negative operation on using the decision control, the terminal translates all webpage content through the translation engine of the browser, and obtains and displays the translation result of the webpage content on the browser page.
308、响应于用户针对使用决策控件的确定操作,通过目标类型的翻译引擎对目标内容进行翻译、以及通过浏览器翻译引擎对网页内容中的第一内容进行翻译,分别得到目标内容的翻译内容和第一内容的翻译内容。308. In response to the user's determination operation on using the decision-making control, translate the target content through the translation engine of the target type, and translate the first content in the webpage content through the browser translation engine, and obtain the translated content and the translated content of the target content respectively. The translated content of the first content.
309、在浏览器页面显示网页内容的翻译结果,翻译结果包括目标内容的翻译内容和第一内容的翻译内容。309. Display the translation result of the webpage content on the browser page, where the translation result includes the translated content of the target content and the translated content of the first content.
本申请可以对网页内容进行分析,确定其中存在的无需翻译、或需要专业翻译的目标内容,且设置多个与用户交互的控件,根据用户的需求为用户提供不同的翻译服务,有效提升用户在使用翻译功能过程中的体验感。This application can analyze the content of the webpage, determine the target content that does not need to be translated or needs professional translation, and set up multiple controls that interact with the user to provide different translation services for the user according to the needs of the user, effectively improving the user's The sense of experience in the process of using the translation function.
参考图12,为本申请提供的计算机设备100的硬件结构示意图。如图12所示,计算机设备100可以包括屏幕1001、处理器1002、存储器1003及通信总线1004。存储器1003用于存储一个或多个计算机程序1005。一个或多个计算机程序1005被配置为被该处理器1002执行。该一个或多个计算机程序1005包括指令,上述指令可以用于实现在计算机设备100中执行室内停车场定位方法的全部或部分步骤。Referring to FIG. 12 , it is a schematic diagram of a hardware structure of a
可以理解的是,本实施例示意的结构并不构成对计算机设备100的具体限定。在另一些实施例中,计算机设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。例如,计算机设备100还可以包括摄像头。It can be understood that the structure shown in this embodiment does not constitute a specific limitation on the
处理器1002与可以包括一个或多个处理单元,例如:处理器1002可以包括应用处理器(application processor,AP),调制解调器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The
处理器1002还可以设置有存储器,用于存储指令和数据。在一些实施例中,处理器1002中的存储器为高速缓冲存储器。该存储器可以保存处理器1002刚用过或循环使用的指令或数据。如果处理器1002需要再次使用该指令或数据,可从该存储器中直接调用。避免了重复存取,减少了处理器1002的等待时间,因而提高了系统的效率。The
在一些实施例中,处理器1002可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,SIM接口,和/或USB接口等。In some embodiments,
在一些实施例中,存储器1003可以包括高速随机存取存储器,还可以包括非易失性存储器,例如硬盘、内存、插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)、至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。In some embodiments, the
本实施例还提供一种计算机存储介质,该计算机存储介质中存储有计算机指令,当该计算机指令在电子设备上运行时,使得电子设备执行上述相关方法步骤实现上述实施例中的室内停车场定位方法。This embodiment also provides a computer storage medium, in which computer instructions are stored, and when the computer instructions are run on the electronic equipment, the electronic equipment executes the steps of the above-mentioned related methods to realize the positioning of the indoor parking lot in the above-mentioned embodiments. method.
本实施例还提供了一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述相关步骤,以实现上述实施例中的室内停车场定位方法。This embodiment also provides a computer program product, which, when running on a computer, causes the computer to execute the above related steps, so as to realize the indoor parking lot positioning method in the above embodiment.
另外,本申请的实施例还提供一种装置,这个装置具体可以是芯片,组件或模块,该装置可包括相连的处理器和存储器;其中,存储器用于存储计算机执行指令,当装置运行时,处理器可执行存储器存储的计算机执行指令,以使芯片执行上述各方法实施例中的室内停车场定位方法。In addition, an embodiment of the present application also provides a device, which may specifically be a chip, a component or a module, and the device may include a connected processor and a memory; wherein the memory is used to store computer-executable instructions, and when the device is running, The processor can execute the computer-executable instructions stored in the memory, so that the chip executes the indoor parking lot positioning method in the above method embodiments.
其中,本实施例提供的计算机设备、计算机存储介质、计算机程序产品或芯片均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。Wherein, the computer equipment, computer storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding method provided above, therefore, the beneficial effects it can achieve can refer to the corresponding method provided above The beneficial effects in the method will not be repeated here.
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。Through the description of the above embodiments, those skilled in the art can clearly understand that for the convenience and brevity of the description, only the division of the above-mentioned functional modules is used as an example for illustration. In practical applications, the above-mentioned functions can be allocated according to needs It is completed by different functional modules, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例是示意性的,例如,该模块或单元的划分,为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed devices and methods may be implemented in other ways. For example, the device embodiments described above are schematic. For example, the division of the modules or units is a logical function division. In actual implementation, there may be other division methods, for example, multiple units or components may be combined or may be integrated into another device, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
该作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是一个物理单元或多个物理单元,即可以位于一个地方,或者也可以分布到多个不同地方。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The unit described as a separate component may or may not be physically separated, and a component displayed as a unit may be one physical unit or multiple physical units, that is, it may be located in one place, or may be distributed to multiple different places. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
该集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the essence of the technical solution of this application or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium. Several instructions are included to make a device (which may be a single-chip microcomputer, a chip, etc.) or a processor (processor) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disc and other media that can store program codes. .
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。The above is only a specific implementation of the application, but the protection scope of the application is not limited thereto, and any changes or replacements within the technical scope disclosed in the application should be covered within the protection scope of the application .
Claims (15)
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111204211.3A CN115983291A (en) | 2021-10-15 | 2021-10-15 | Web page content translation method, computer equipment, storage medium and program product |
| CN202111204211.3 | 2021-10-15 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2023061020A1 true WO2023061020A1 (en) | 2023-04-20 |
Family
ID=85964847
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2022/111902 Ceased WO2023061020A1 (en) | 2021-10-15 | 2022-08-11 | Web content translation method, computer device, storage medium, and program product |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN115983291A (en) |
| WO (1) | WO2023061020A1 (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119002742A (en) * | 2023-11-20 | 2024-11-22 | 北京字跳网络技术有限公司 | Method, apparatus, device and storage medium for information interaction |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20020188435A1 (en) * | 2001-06-07 | 2002-12-12 | Microsoft Corporation | Interface for submitting richly-formatted documents for remote processing |
| CN107577676A (en) * | 2017-09-15 | 2018-01-12 | 北京彩彻区明科技有限公司 | Web page translation method, apparatus and system |
| CN110147555A (en) * | 2019-04-17 | 2019-08-20 | 维沃移动通信有限公司 | Method and terminal device for translating content |
| CN112988255A (en) * | 2019-12-02 | 2021-06-18 | 腾讯科技(深圳)有限公司 | Data processing method, device and computer readable storage medium |
| US20210200964A1 (en) * | 2020-07-15 | 2021-07-01 | Beijing Baidu Netcom Science And Technology Co., Ltd. | Method, apparatus, device and storage medium for outputting information |
-
2021
- 2021-10-15 CN CN202111204211.3A patent/CN115983291A/en active Pending
-
2022
- 2022-08-11 WO PCT/CN2022/111902 patent/WO2023061020A1/en not_active Ceased
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20020188435A1 (en) * | 2001-06-07 | 2002-12-12 | Microsoft Corporation | Interface for submitting richly-formatted documents for remote processing |
| CN107577676A (en) * | 2017-09-15 | 2018-01-12 | 北京彩彻区明科技有限公司 | Web page translation method, apparatus and system |
| CN110147555A (en) * | 2019-04-17 | 2019-08-20 | 维沃移动通信有限公司 | Method and terminal device for translating content |
| CN112988255A (en) * | 2019-12-02 | 2021-06-18 | 腾讯科技(深圳)有限公司 | Data processing method, device and computer readable storage medium |
| US20210200964A1 (en) * | 2020-07-15 | 2021-07-01 | Beijing Baidu Netcom Science And Technology Co., Ltd. | Method, apparatus, device and storage medium for outputting information |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119002742A (en) * | 2023-11-20 | 2024-11-22 | 北京字跳网络技术有限公司 | Method, apparatus, device and storage medium for information interaction |
Also Published As
| Publication number | Publication date |
|---|---|
| CN115983291A (en) | 2023-04-18 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11475588B2 (en) | Image processing method and device for processing image, server and storage medium | |
| CN109933733A (en) | Method and device for displaying pages | |
| US20130132361A1 (en) | Input method for querying by using a region formed by an enclosed track and system using the same | |
| CN107656922A (en) | Translation method, translation device, translation terminal and storage medium | |
| WO2023087934A1 (en) | Voice control method, apparatus, device, and computer storage medium | |
| CN103842993A (en) | Systems and methods for contextual personalized searching | |
| WO2020187117A1 (en) | Figure page display method and apparatus, and text page display method and apparatus | |
| CN104808903B (en) | Text selection method and device | |
| CN115033153B (en) | Application recommendation methods and electronic devices | |
| CN112631437A (en) | Information recommendation method and device and electronic equipment | |
| CN108304412B (en) | Cross-language search method and device for cross-language search | |
| WO2020125345A1 (en) | Electronic book note processing method, handwriting reading device, and storage medium | |
| CN107491477A (en) | A kind of emoticon searching method and device | |
| CN107861948B (en) | Label extraction method, device, equipment and medium | |
| WO2020019220A1 (en) | Method for displaying service information in preview interface, and electronic device | |
| US20180151178A1 (en) | Interactive question-answering apparatus and method thereof | |
| US20140278961A1 (en) | Information processing device and program | |
| KR102551343B1 (en) | Electric apparatus and method for control thereof | |
| CN107977155B (en) | A kind of handwriting recognition method, device, equipment and storage medium | |
| CN113360127B (en) | Audio playing method and electronic equipment | |
| US12242526B2 (en) | Systems and methods for generating interactable elements in text strings relating to media assets | |
| WO2023061020A1 (en) | Web content translation method, computer device, storage medium, and program product | |
| JP2024064941A (en) | Display method, device, pen-type electronic dictionary, electronic device, and storage medium | |
| CN109145241B (en) | Browser and content display management method of browser | |
| CN107239209B (en) | Photographing search method, device, terminal and storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22879967 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 22879967 Country of ref document: EP Kind code of ref document: A1 |