Text analysis method and device
By identifying key information about the source language type and using a parsing model to determine the appropriate parsing object in the target language type, the problem of language habit mismatch during text parsing is solved, improving the user's speed of understanding and experience of target language text.
Patent Information
- Application Number
- CN202511430951.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-30
- Publication Date
- 2026-01-27
AI Technical Summary
When parsing text from a source language type to a target language type, the parsed target language text may not match the language conventions of the target language type, making it difficult for users to understand the meaning of the text and affecting the user experience.
By identifying key information about the source language type, the target language type is determined. The parsing model is then used to determine whether the target language type contains a suitable target parsing object. Based on the target parsing object, the target language text is determined to conform to the language habits of the target language type.
It improves the user's speed of understanding and experience of target language text, and ensures that the translation results conform to the usage habits of the target language type.
Smart Images

Figure CN121413601A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a text parsing method and apparatus. Background Technology
[0002] Currently, when parsing text from a source language type to a target language type, the target language type and the source language type usually correspond to different language habits. This can easily lead to a mismatch between the parsed target language text and the language habits of the target language type, making it difficult for users to understand the meaning of the target language text and affecting the user experience. Summary of the Invention
[0003] This application provides a text parsing method, comprising: obtaining source language text input by a user through a first method; identifying key information in the first method, wherein the key information represents the source language type and determining the target language type; parsing the source language text to determine a target information object; based on the source language text and the target information object, determining, through a parsing model, whether the target language type contains a target parsing object adapted to the target information object; if the target language type contains the target parsing object, determining the target language text according to the target parsing object, and outputting the target language text in a second method.
[0004] In some embodiments, determining the target language text based on the target parsing object includes: determining, based on the target information object, a parsing object field corresponding to the target parsing object under the target language type; and determining the target language text based on the parsing object field.
[0005] In some embodiments, the target information object includes a first numerical value and a first unit of measurement, and the target parsing object includes a second unit of measurement different from the first unit of measurement. The step of determining the parsing object field corresponding to the target parsing object under the target language type based on the target information object includes: converting the first numerical value into a second numerical value according to the conversion relationship between the first unit of measurement and the second unit of measurement; and determining the parsing object field based on the second numerical value and the second unit of measurement.
[0006] In some embodiments, before converting the first value to a second value according to the conversion relationship between the first unit of measurement and the second unit of measurement, the method further includes: determining the unit type of the first unit of measurement and the second unit of measurement, wherein the unit type includes a monetary unit or a non-monetary unit; if the unit type is a monetary unit, determining the region name corresponding to the target language type; determining the current exchange rate corresponding to the region name, and determining the conversion relationship based on the current exchange rate.
[0007] In some embodiments, determining the target language text based on the parsing object field includes: converting the source language text into a first target text that conforms to the target language type; determining the target information field in the first target text that corresponds to the target information object; and replacing the target information field based on the parsing object field to determine the target language text.
[0008] In some embodiments, determining the target language text based on the parsing object field includes: converting the source language text into a second target text that conforms to the target language type, wherein the second target text does not include the parsing object field; determining a third target text based on the parsing object field, wherein the third target text is explanatory text for the second target text; and determining the target language text based on the second target text and the third target text.
[0009] In some embodiments, determining whether the target language type contains a target parsing object adapted to the target information object based on the source language text and the target information object through a parsing model includes: determining region-related information corresponding to the target language type; and determining whether the target language type contains the target parsing object based on the source language text, the target information object, and the region-related information through the parsing model.
[0010] In some embodiments, determining the region-related information corresponding to the target language type includes one of the following: obtaining location information selected by a user, and determining the region-related information based on the location information selected by the user; obtaining location information of a target electronic device, and determining the location information of the target electronic device as the region-related information if the location information of the target electronic device matches the target language type; obtaining location information of a base station communicating with the target electronic device, and determining the location information of the base station as the region-related information if the location information of the base station matches the target language type.
[0011] In some embodiments, determining the target language type includes one of the following: obtaining a language type selected by the user, and determining the target language type based on the language type selected by the user; obtaining location information of the target electronic device, and determining the target language type based on the location information of the target electronic device.
[0012] This application embodiment also provides a text parsing device, including: an acquisition module, used to acquire source language text input by a user through a first method; an identification module, used to identify key information in the first method, the key information representing the source language type, and to determine the target language type; a first parsing module, used to parse the source language text and determine a target information object; a second parsing module, used to determine, based on the source language text and the target information object, whether the target language type contains a target parsing object adapted to the target information object through a parsing model; and a determination module, used to determine the target language text according to the target parsing object if the target language type contains the target parsing object, and output the target language text in a second method. Attached Figure Description
[0013] To more clearly illustrate the technical solutions of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0014] Figure 1 This is a flowchart of a file parsing method according to an embodiment of this application;
[0015] Figure 2 The process for determining the target language text in this application embodiment Figure 1 ;
[0016] Figure 3 This is a flowchart illustrating the process of determining the parsing object fields corresponding to the target parsing object in an embodiment of this application;
[0017] Figure 4 This is a flowchart illustrating the determination of the conversion relationship between the first unit of measurement and the second unit of measurement according to an embodiment of this application.
[0018] Figure 5 The process for determining the target language text in this application embodiment Figure 2 ;
[0019] Figure 6 The process for determining the target language text in this application embodiment Figure 3 ;
[0020] Figure 7 This is a flowchart illustrating the process of determining whether a target language type contains a target parsing object, as described in this application embodiment.
[0021] Figure 8 This is a structural block diagram of a file parsing device according to an embodiment of this application. Detailed Implementation
[0022] Various embodiments and features of this application are described herein with reference to the accompanying drawings.
[0023] It should be understood that various modifications can be made to the embodiments described herein. Therefore, the above description should not be considered as limiting, but merely as an example of embodiments. Other modifications within the scope and spirit of this application will be apparent to those skilled in the art.
[0024] The accompanying drawings, which are included in and form part of this specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.
[0025] These and other features of this application will become apparent from the following description of preferred forms of embodiments given as non-limiting examples, with reference to the accompanying drawings.
[0026] It should also be understood that although this application has been described with reference to some specific examples, those skilled in the art can certainly implement many other equivalent forms of this application.
[0027] The above and other aspects, features and advantages of this application will become more apparent when taken in conjunction with the accompanying drawings and in view of the following detailed description.
[0028] Specific embodiments of this application are described thereafter with reference to the accompanying drawings; however, it should be understood that the claimed embodiments are merely examples of this application, which can be implemented in various ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that could obscure the application. Therefore, the specific structural and functional details claimed herein are not intended to be limiting, but merely serve as the basis and representative basis for the claims to teach those skilled in the art to use this application in a variety of substantially any suitable detailed structures.
[0029] This specification may use the phrases “in one embodiment,” “in another embodiment,” “in yet another embodiment,” or “in other embodiments,” all of which may refer to one or more of the same or different embodiments according to this application.
[0030] An embodiment of this application provides a text parsing method that, after obtaining source language text input by a user through a first method, identifies key information representing the source language type in the first method and determines the target language type. The source language text is then parsed to determine the target information object. Based on the source language text and the target information object, a parsing model is used to determine whether the target language type contains a target parsing object that matches the target information object. If the target language type contains a target parsing object, the target language text is determined based on the target parsing object, and the target language text is output in a second method. This method determines the target language text by using the target parsing object contained in the target language type. Since the target parsing object and the target information object are compatible, the portion of the target language text corresponding to the target information object is more consistent with the language habits of the target language type, thereby enabling the user to quickly understand the target language text and improving the user experience.
[0031] like Figure 1 As shown, this text parsing method includes the following steps:
[0032] Step S101: Obtain the source language text input by the user through the first method.
[0033] In this embodiment, the execution subject of the text parsing method can be an electronic device, such as a mobile phone, tablet computer, wearable device, or laptop computer. When a user needs to translate source language text into target language text of the target language type, the source language text can be input into the electronic device through a first method. The electronic device can include a human-computer interaction interface. The first method can be text input, for example, the user can input text through the human-computer interaction interface of the electronic device to input the source language text into the electronic device. The first method can also be voice input, where the electronic device can have voice recognition capabilities, and obtain the source language text by recognizing the user's voice input. The user inputting the source language text can be a first user, and the electronic device can belong to the first user. For example, the first user inputs the source language text into the electronic device through text input, so that the electronic device can perform the translation of the source language text. The user who inputs the source language text can also be a second user, different from the first user. For example, if a user from country A (i.e., the first user) is traveling in country B and uses a mobile phone to communicate with a local person from country B (i.e., the second user), the local person from country B can input the source language text on the user's mobile phone in country A, or directly input the corresponding voice on the user's mobile phone in country A, so that the electronic device can translate the source language text into the language of country A, allowing the user from country A to understand what the local person from country B wants to express.
[0034] Step S102: Identify key information in the first method, wherein the key information represents the source language type, and determine the target language type.
[0035] In this embodiment, key information representing the source language type in the first method is identified. This key information may include the pronunciation features of the source language text, the morphological features of the corresponding characters, or both. For example, if the first method is a voice input method, the key information representing the source language type can be determined by recognizing the pronunciation features of the voice, or the voice can be converted to text, and the key information representing the source language type can be determined based on the morphological features of the text. If the first method is a text input method, the key information representing the source language type can be determined by recognizing the morphological features of the input text, or the input text can be converted to speech, and the key information representing the source language type can be determined based on the obtained pronunciation features. Alternatively, the key information representing the source language type can be determined by recognizing the morphological features of the input text and the obtained pronunciation features. The target language type can be determined based on the fields representing the target language type included in the source language text.
[0036] By identifying key information and the target language type, subsequent translation operations corresponding to the source language text can be performed based on the key information and the target language type.
[0037] Step S103: Parse the source language text to determine the target information object.
[0038] In this embodiment, the target information object can be a field in the source language text that conforms to the target information. The target information object can be pre-specified, and its usage frequency in the target language type is lower than a predetermined frequency. Translating the target information object into the target language type would make the resulting information difficult for users of the target language type to understand. The target information object can be determined by performing semantic recognition on the source language text.
[0039] Step S104: Based on the source language text and the target information object, determine whether the target language type contains a target parsing object that is compatible with the target information object through a parsing model.
[0040] In this embodiment, the parsing model can employ a deep learning model or a large language model. Based on the source language text and the target information object, the parsing model parses the target language type to determine whether the target language type contains a target parsing object that matches the target information object. The target parsing object has a higher usage frequency in the target language type than the target frequency, conforms to the language habits of the target language type, and can express the same or similar meaning as part or all of the target information object.
[0041] In some embodiments of this application, the parsing model adopts a large language model, which can generate target prompt words based on the source language text and the target information object using prompt word templates. Based on the target prompt words, the parsing model determines whether the target language type contains the target parsing object, thereby determining whether the target language type contains the target parsing object more efficiently and accurately.
[0042] Step S105: If the target language type contains the target parsing object, determine the target language text based on the target parsing object, and output the target language text in a second manner.
[0043] In this embodiment, if the target language type contains a target parsing object, the target language text is determined based on the target parsing object. Since the target parsing object is adapted to the target information object and conforms to the language habits of the target language type, the target language text can accurately express the meaning of the source language text while making it more in line with the usage habits of the target language type, thus making it easier for users to understand. After determining the target language text, the target language text is output in a second manner, which can be at least one of the following: displaying it on the screen of an electronic device; or outputting the speech corresponding to the target language text.
[0044] In some embodiments of this application, when the target language type does not contain a target parsing object, the source language text is translated according to the target language type to determine the target language text.
[0045] In this embodiment, since the target language type does not contain the target parsing object, it is not necessary to consider whether the translation result of the target information object conforms to the language habits under the target language type. The source language text is directly translated according to the target language type to determine the target language text, thereby avoiding unnecessary operations and improving the efficiency of text parsing.
[0046] The text parsing method of this application embodiment obtains source language text input by a user through a first method; identifies key information in the first method, whereby the key information represents the source language type and determines the target language type; parses the source language text to determine the target information object; based on the source language text and the target information object, uses a parsing model to determine whether the target language type contains a target parsing object that matches the target information object; if the target language type contains a target parsing object, determines the target language text based on the target parsing object and outputs the target language text in a second method. By determining the target language text through the target parsing object contained in the target language type, and because the target parsing object matches the target information object, the part of the target language text corresponding to the target information object can better conform to the language habits under the target language type, thereby enabling users to quickly understand the target language text and improving the user experience.
[0047] In some embodiments of this application, the step of determining the target language text based on the target parsing object is as follows: Figure 2 As shown, it includes the following steps:
[0048] Step S1051: Based on the target information object, determine the parsing object field corresponding to the target parsing object under the target language type.
[0049] In this embodiment, there may be a conversion relationship between the target information object and the target parsing object. The target information object can be converted through this conversion relationship to determine the parsing object field corresponding to the target parsing object.
[0050] Step S1052: Determine the target language text based on the parsed object fields.
[0051] In this embodiment, the parsing object field conforms to the target language type, and the target language text that conforms to the target language type is determined based on the parsing object field. Since the parsing object field corresponds to the target parsing object, it will also conform to the language habits under the target language type, thereby enabling users to quickly understand the target language text.
[0052] In some embodiments of this application, the target information object includes a first numerical value and a first unit of measurement, and the target parsing object includes a second unit of measurement different from the first unit of measurement. The step of determining the parsing object field corresponding to the target parsing object under the target language type based on the target information object is as follows: Figure 3 As shown, it includes the following steps:
[0053] Step S10511: Convert the first value into the second value according to the conversion relationship between the first unit of measurement and the second unit of measurement.
[0054] In this embodiment, the target information object includes a first numerical value and a first unit of measurement, and the target parsing object includes a second unit of measurement. The second unit of measurement differs from the first unit of measurement. The first unit of measurement has a lower frequency of use in the target language type than the target frequency, and does not conform to the language habits of the target language type. The second unit of measurement has a higher frequency of use in the target language type than the target frequency, and conforms to the language habits of the target language type. There is a conversion relationship between the first and second units of measurement, and they can be converted to each other. The first and second units of measurement can belong to any of the following: length units, mass units, area units, volume units, time units, and angle units. For example, if the source language type is English and the target language type is Chinese, the first unit of measurement can be miles and the second unit of measurement can be kilometers, or the first unit of measurement can be feet and the second unit of measurement can be meters, or the first unit of measurement can be square feet and the second unit of measurement can be square meters, and so on. As another example, if the source language type is British English and the target language type is American English, the first unit of measurement can be Celsius and the second unit of measurement can be Fahrenheit.
[0055] Based on the conversion relationship between the first and second units of measurement, the first value is converted to the second value. For example, if the first unit of measurement is square feet (not commonly used in Chinese and does not conform to Chinese language habits), and the first value is 1000, and the second unit of measurement is square meters (commonly used in Chinese and conforms to Chinese language habits), then based on the conversion relationship between square feet and square meters (1 square foot = 0.0929 square meters), the second value is determined to be 93.
[0056] Step S10512: Determine the parsed object field based on the second numerical value and the second unit of measurement.
[0057] In this embodiment, the second numerical value and the second unit of measurement are combined to determine the parsing object field. For example, for the second numerical value 93 and the second unit of measurement square meters, the parsing object field can be 93 square meters.
[0058] This allows the target information object and the target parsing object to correspond to different units of measurement, making the second unit of measurement corresponding to the parsing object field conform to the language habits of the target language type. This enables users to quickly understand the corresponding measurement data in the target language text, thus improving the user experience.
[0059] In some embodiments of this application, before converting the first value to the second value according to the conversion relationship between the first and second units of measurement, as follows: Figure 4 As shown, it also includes the following steps:
[0060] Step S10513: Determine the unit type of the first unit of measurement and the second unit of measurement, wherein the unit type includes monetary units or non-monetary units.
[0061] In this embodiment, since the exchange rate corresponding to the currency unit changes frequently, the conversion of currency units needs to take the current exchange rate into account. When determining the conversion relationship between the first unit of measurement and the second unit of measurement, the unit type of the first unit of measurement and the second unit of measurement is first determined. The unit type may include currency units or non-currency units.
[0062] Step S10513: If the unit type is a currency unit, determine the region name corresponding to the target language type.
[0063] If both the first and second units of measurement are currency units, then the region name corresponding to the target language type is determined. For example, if the first unit of measurement is Chinese Yuan (RMB), the second unit of measurement is Japanese Yen (JPY), and the target language type is Japanese, then the region name could be Japan. If the first unit of measurement is Chinese Yuan (RMB), the second unit of measurement is Korean Won (KRW), and the target language type is Korean, then the region name could be South Korea.
[0064] Step S10513: Determine the current exchange rate corresponding to the region name, and determine the conversion relationship based on the current exchange rate.
[0065] In this embodiment, the current exchange rate for the region corresponding to the region name can be determined by searching the Internet, and the conversion relationship can be determined based on the current exchange rate, thereby improving the accuracy of the conversion relationship between different currency units and thus improving the accuracy of the target language text.
[0066] It is understandable that, when the unit type is a non-monetary unit, the conversion relationship between the first unit of measurement and the second unit of measurement is determined based on the conversion relationship between the first unit of measurement and the second unit of measurement of the unit value.
[0067] In some embodiments of this application, the step of determining the target language text based on the parsed object field is as follows: Figure 5 As shown, it includes the following steps:
[0068] Step S10521: Convert the source language text into a first target text that conforms to the target language type.
[0069] In this embodiment, the source language text is first translated according to the target language type to generate the first target text. For example, if the source language text is "This apartment is about 1000 square feet", the target language type is Chinese, the target information object is "1000 square feet", the target parsing object in Chinese is "square meters", and the parsing object field is "93 square meters", then the first target text can be "This apartment is about 1000 square feet".
[0070] Step S10522: Determine the target information field in the first target text that corresponds to the target information object.
[0071] In this embodiment, the target information field corresponding to the target information object is determined from the first target text. For example, for the first target text "This apartment is about 1000 square feet", the first target information field is "1000 square feet".
[0072] Step S10523: Replace the target information field with the parsed object field to determine the target language text.
[0073] In this embodiment, the target information field in the first target text is replaced by the parsed object field to determine the target language text. For example, for the first target text "This apartment is about 1000 square feet", replacing "1000 square feet" with "93 square meters" results in the target speech text "This apartment is about 93 square meters". Since "93 square meters" is more in line with Chinese language habits, users can quickly understand the area of the apartment.
[0074] By first translating the source language text into the first target text and then replacing the target information fields in the first target text with parsed object fields, the target language text can conform to the language habits of the target language type. This achieves accurate translation of the source language text while enabling users to quickly understand the first target text, thus improving the user experience.
[0075] In some embodiments of this application, as an alternative, such as Figure 6 As shown, determining the target language text based on the parsed object fields includes the following steps:
[0076] Step S10524: Convert the source language text into a second target text that conforms to the target language type, wherein the second target text does not include the parsed object field.
[0077] In this embodiment, the source language text is first translated according to the target language type to generate a second target text. The second target text does not include the parsed object field. For example, if the source language text is "It is 100 miles from here to New York", its target information object is "100 miles", the target language type is Chinese, the target parsed object in Chinese is "kilometer", and the parsed object field is "161 kilometers", then the first target text can be "There are 100 miles from here to New York", which does not include "161 kilometers".
[0078] Step S10525: Determine the third target text based on the parsed object field. The third target text is a descriptive text for the second target text.
[0079] In this embodiment, the third target text is determined based on the parsed object field. The third target text can be used to describe the second target text. For example, corresponding to the second target text "It is 100 miles from here to New York", the third target text can be "In Chinese, it is about 161 kilometers".
[0080] Step S10526: Determine the target language text based on the second target text and the third target text.
[0081] In this embodiment, the second target text and the third target text are combined to determine the target language text. For example, for the second target text "It is 100 miles from here to New York" and the third target text "In Chinese, it is about 161 kilometers", the target language text can be "It is 100 miles from here to New York, and in Chinese, it is about 161 kilometers". This allows the user to determine the way the distance is expressed in the source language type. At the same time, since "161 kilometers" is more in line with the language habits of Chinese, the user can quickly determine the distance from here to New York.
[0082] By first translating the source language text into a second target text, and then using the parsed object fields to determine the third target text, the user obtains the original translated text corresponding to the source language text, as well as explanatory text for the original translated text. Since the explanatory text conforms to the language habits of the target language type, it achieves accurate translation of the source language text while enabling the user to quickly understand the target language text, thus improving the user experience.
[0083] In some embodiments of this application, the step of determining whether the target language type contains a target parsing object that is compatible with the target information object based on the source language text and the target information object using a parsing model is as follows: Figure 7 As shown, it includes the following steps:
[0084] Step S1041: Determine the region-related information corresponding to the target language type.
[0085] In this embodiment, different countries or regions using the same language may have different language habits, so regional information needs to be considered. For example, both the UK and the US are English-speaking countries, but the UK uses Celsius while the US uses Fahrenheit. Regional information may include country or region names, or country or region codes.
[0086] Step S1042: Based on the source language text, the target information object, and the region-related information, determine whether the target language type contains the target parsing object through the parsing model.
[0087] In this embodiment, based on the source language text, the target information object, and regional information, the target language type is parsed using a parsing model to determine whether the target language type contains a target parsing object that matches the target information object. By taking regional information into account, it is possible to more accurately determine whether the target language type contains a target parsing object that matches the target information object.
[0088] In some embodiments of this application, the parsing model adopts a large language model, which can generate target prompt words based on source language text, target information object and region-related information using prompt word templates. Based on the target prompt words, the parsing model determines whether the target language type contains the target parsing object, thereby determining whether the target language type contains the target parsing object more efficiently and accurately.
[0089] In some embodiments of this application, the region-related information corresponding to the target language type can be determined by one of the following methods.
[0090] Method 1: Obtain the location information selected by the user, and determine the relevant information of the region based on the location information selected by the user.
[0091] In this embodiment, the electronic device can provide multiple optional location information. When the user inputs source language text, the user can select location information on the electronic device, and determine the region-related information based on the selected location information.
[0092] Method 2: Obtain the location information of the target electronic device. If the location information of the target electronic device matches the target language type, determine the location information of the target electronic device as the relevant information of the region.
[0093] In this embodiment, the target electronic device can be a user-held electronic device with positioning capabilities. The system can obtain the target electronic device's positioning information and determine whether the positioning information matches the target language type. If a match is found, the positioning information of the target electronic device is identified as the region-related information. For example, the country corresponding to the positioning information of the target electronic device can be identified as the region-related information.
[0094] Method 3: Obtain the location information of the base station communicating with the target electronic device. If the location information of the base station matches the target language type, determine the location information of the base station as the region-related information.
[0095] In this embodiment, the target electronic device (such as a mobile phone) can communicate with the base station, obtain the location information of the base station communicating with the target electronic device, and determine whether the location information of the base station matches the target language type. If it matches, the location information of the base station is determined as region-related information. For example, the country corresponding to the location information of the base station can be determined as region-related information.
[0096] This allows for the determination of regional information through multiple methods, thus enabling more flexible determination of such information. In some embodiments of this application, regional information can be determined using method one, method two, or method three, depending on user settings, thereby improving the accuracy of the regional information.
[0097] In some embodiments of this application, determining the target language type includes one of the following methods:
[0098] Method 1: Obtain the language type selected by the user, and determine the target language type based on the language type selected by the user.
[0099] In this embodiment, the electronic device can provide optional language types, obtain the language type selected by the user, and accurately determine the target language type based on the language type selected by the user.
[0100] Method 2: Obtain the location information of the target electronic device, and determine the target language type based on the location information of the target electronic device.
[0101] In this embodiment, the target electronic device has a positioning function, which can obtain the location information of the target electronic device and determine the target language type based on the location information of the target electronic device. For example, the target language type can be determined based on the country corresponding to the location information of the target electronic device.
[0102] This allows for more flexible determination of the target language type by using the user-selected language type or the location information of the target electronic device. In some embodiments of this application, the target language type can be determined based on the user's settings, using either the user-selected language type or the location information of the target electronic device, thereby improving the accuracy of the target language type determination.
[0103] This application also proposes a text parsing device, such as... Figure 8 As shown, it includes: an acquisition module for acquiring source language text input by a user through a first method; an identification module for identifying key information in the first method, wherein the key information represents the source language type and determines the target language type; a first parsing module for parsing the source language text and determining the target information object; a second parsing module for determining, based on the source language text and the target information object, whether the target language type contains a target parsing object adapted to the target information object through a parsing model; and a determination module for determining the target language text according to the target parsing object if the target language type contains the target parsing object, and outputting the target language text in a second method.
[0104] In this way, the target language text is determined by the target parsing object contained in the target language type. Since the target parsing object and the target information object are compatible, the part of the target language text that corresponds to the target information object can be more in line with the language habits under the target language type, thereby enabling users to quickly understand the target language text and improving the user experience.
[0105] In specific application scenarios, the determination module is specifically used to: determine the parsing object field corresponding to the target parsing object under the target language type based on the target information object; and determine the target language text based on the parsing object field.
[0106] In a specific application scenario, the target information object includes a first numerical value and a first unit of measurement, and the target parsing object includes a second unit of measurement different from the first unit of measurement. The determining module is further specifically used to: convert the first numerical value into a second numerical value according to the conversion relationship between the first unit of measurement and the second unit of measurement; and determine the parsing object field according to the second numerical value and the second unit of measurement.
[0107] In specific application scenarios, the determining module is further configured to: determine the unit type of the first unit of measurement and the second unit of measurement, wherein the unit type includes a monetary unit or a non-monetary unit; if the unit type is a monetary unit, determine the region name corresponding to the target language type; determine the current exchange rate corresponding to the region name, and determine the conversion relationship based on the current exchange rate.
[0108] In specific application scenarios, the determination module is further used to: convert the source language text into a first target text that conforms to the target language type; determine the target information field in the first target text that corresponds to the target information object; and determine the target language text by replacing the target information field with the parsed object field.
[0109] In specific application scenarios, the determining module is further configured to: convert the source language text into a second target text that conforms to the target language type, wherein the second target text does not include the parsing object field; determine a third target text based on the parsing object field, wherein the third target text is explanatory text for the second target text; and determine the target language text based on the second target text and the third target text.
[0110] In specific application scenarios, the second parsing module is specifically used to: determine the region-related information corresponding to the target language type; and, based on the source language text, the target information object, and the region-related information, determine whether the target language type contains the target parsing object through the parsing model.
[0111] In specific application scenarios, the second parsing module is specifically used to perform one of the following: obtaining location information selected by the user, and determining the region-related information based on the location information selected by the user; obtaining the location information of the target electronic device, and determining the location information of the target electronic device as the region-related information if the location information of the target electronic device matches the target language type; obtaining the location information of the base station communicating with the target electronic device, and determining the location information of the base station as the region-related information if the location information of the base station matches the target language type.
[0112] In specific application scenarios, the recognition module is specifically used to perform one of the following: obtain the language type selected by the user, and determine the target language type based on the language type selected by the user; obtain the location information of the target electronic device, and determine the target language type based on the location information of the target electronic device.
[0113] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive), etc.
[0114] The above embodiments are merely exemplary embodiments of this application and are not intended to limit this application. The scope of protection of this application is defined by the claims. Those skilled in the art can make various modifications or equivalent substitutions to this application within its substance and scope of protection, and such modifications or equivalent substitutions should also be considered to fall within the scope of protection of this application.
Claims
1. A text parsing method, comprising: Obtain the source language text input by the user through the first method; Identify key information in the first method, wherein the key information represents the source language type, and determine the target language type; Parse the source language text to determine the target information object; Based on the source language text and the target information object, the parsing model determines whether the target language type contains a target parsing object that is compatible with the target information object. If the target parsing object is included in the target language type, the target language text is determined based on the target parsing object, and the target language text is output in a second manner.
2. The text parsing method as described in claim 1, wherein determining the target language text based on the target parsing object includes: Based on the target information object, determine the parsing object fields corresponding to the target parsing object under the target language type; The target language text is determined based on the fields of the parsed object.
3. The text parsing method as described in claim 2, wherein the target information object includes a first numerical value and a first unit of measurement, the target parsing object includes a second unit of measurement different from the first unit of measurement, and the step of determining the parsing object field corresponding to the target parsing object under the target language type based on the target information object includes: Based on the conversion relationship between the first unit of measurement and the second unit of measurement, the first value is converted into the second value; The parsed object field is determined based on the second numerical value and the second unit of measurement.
4. The text parsing method as described in claim 3, further comprising, before converting the first numerical value to the second numerical value according to the conversion relationship between the first unit of measurement and the second unit of measurement: Determine the unit type of the first unit of measurement and the second unit of measurement, wherein the unit type includes monetary units or non-monetary units; If the unit type is a currency unit, determine the region name corresponding to the target language type; Determine the current exchange rate corresponding to the region name, and determine the conversion relationship based on the current exchange rate.
5. The text parsing method as described in claim 2, wherein determining the target language text based on the parsing object field comprises: Convert the source language text into a first target text that conforms to the target language type; Determine the target information field in the first target text that corresponds to the target information object; The target language text is determined by replacing the target information field with the parsed object field.
6. The text parsing method as described in claim 2, wherein determining the target language text based on the parsing object field comprises: The source language text is converted into a second target text that conforms to the target language type, wherein the second target text does not include the parsed object field; The third target text is determined based on the parsed object field, and the third target text is explanatory text for the second target text; The target language text is determined based on the second target text and the third target text.
7. The text parsing method as described in claim 1, wherein determining whether the target language type contains a target parsing object adapted to the target information object based on the source language text and the target information object through a parsing model includes: Determine the region-related information corresponding to the target language type; Based on the source language text, the target information object, and the region-related information, the parsing model determines whether the target language type contains the target parsing object.
8. The text parsing method as described in claim 7, wherein determining the region-related information corresponding to the target language type includes one of the following: Obtain the location information selected by the user, and determine the relevant information of the region based on the location information selected by the user; The location information of the target electronic device is obtained, and if the location information of the target electronic device matches the target language type, the location information of the target electronic device is determined to be the region-related information. Obtain the location information of the base station communicating with the target electronic device. If the location information of the base station matches the target language type, determine the location information of the base station as the region-related information.
9. The text parsing method as described in claim 1, wherein determining the target language type includes one of the following: Obtain the language type selected by the user, and determine the target language type based on the language type selected by the user; Obtain the location information of the target electronic device, and determine the target language type based on the location information of the target electronic device.
10. A text parsing apparatus, comprising: The acquisition module is used to acquire the source language text input by the user through the first method; The identification module is used to identify key information in the first method, wherein the key information represents the source language type and determines the target language type; The first parsing module is used to parse the source language text and determine the target information object; The second parsing module is used to determine, based on the source language text and the target information object, whether the target language type contains a target parsing object that is compatible with the target information object through a parsing model. The determination module is used to determine the target language text based on the target parsing object when the target language type contains the target parsing object, and output the target language text in a second manner.