Input content processing method and system, intelligent terminal and computer readable storage medium
By calculating and smoothing the proportional coefficient between the input text length and the maximum length, the interception length is determined, which solves the problem of error reporting and low efficiency caused by too long input text in large models, achieves a more efficient and reliable interception process, and ensures that large models Efficient acquisition of input information.
Patent Information
- Application Number
- CN202410830084.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2024-09-24
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In large models, when the length of text input by the user exceeds the maximum length supported by the model, traditional solutions are difficult to effectively handle, resulting in unknown reasons for error reporting, low efficiency in obtaining input information, and unstable interception processes.
By calculating the proportional coefficient between the length of the input text and the maximum length, smoothing is performed to determine the interception parameters and the interception length to ensure the efficiency and reliability of the interception process, and the intercepted content is used as new input until the model recognizes no errors and the maximum Keep the original information as much as possible.
It improves the efficiency of large models in acquiring input information, improves the stability and reliability of the interception process, ensures a smooth interception process, and reduces the number of subsequent interceptions.
Smart Images

Figure CN118690729A
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and specifically to an input content processing method and system, an intelligent terminal, and a computer-readable storage medium. Background Art
[0002] With the rapid development of artificial intelligence (AI) technology, large models such as AI models have been widely used in various application scenarios. For example, JiweiGPT can be used as a large model or through the corresponding set model for data processing and / or news recommendation, etc. In some application scenarios, users often need to input text into the set model so that the set model can obtain the corresponding text and respond to the corresponding user needs. Usually, different large models have the longest input length they support. If the length of the text input by the user exceeds the maximum length supported by the large model, the large model cannot run correctly, and the user needs to shorten the length of the input text. In the traditional solution, when the length of the text recognized by the large model exceeds the longest input length it supports, the large model may report an error but do not do other processing. This mechanism makes it difficult for users to know the cause of the error; the large model may also intercept the specified length multiple times. If it is not until the input conditions of the large model are met, and then the content that meets the input conditions is obtained, this mechanism is likely to lead to low efficiency in obtaining input information. Summary of the invention
[0003] In view of this, the present application provides an input content processing method and system, a smart terminal, and a computer-readable storage medium to improve the efficiency of processing input content.
[0004] The present application provides an input content processing method, comprising the following steps:
[0005] When the input text length of the input content is greater than the longest input length supported by the set model, obtaining the input text length of the input content;
[0006] Calculating a proportionality coefficient according to the input text length and the longest input length, the proportionality coefficient being used to characterize the extent to which the input text length exceeds the longest input length;
[0007] Smoothing the proportional coefficient to obtain a smoothing interception parameter;
[0008] Determine the interception length according to the smooth interception parameter;
[0009] The input content is intercepted according to the interception length to obtain retained content.
[0010] Optionally, the input content processing method also includes: inputting the retained content as new input content into the set model; if the set model outputs a prompt message, returning to execute the process of obtaining the input text length of the input content until the set model recognizes the input content, and the prompt message is used to characterize that the input text length of the input content is greater than the longest input length.
[0011] Optionally, the calculation formula of the proportionality coefficient includes: w=x / a-1, where w represents the proportionality coefficient, x represents the input text length, and a represents the longest input length.
[0012] Optionally, the calculation formula of the smoothing interception parameter includes: Where C represents the smoothing intercept parameter.
[0013] Optionally, the calculation formula for the interception length includes: L=C(xa), where L represents the interception length.
[0014] Optionally, the calculation formula for the length of the retained content includes: x'=xL, where x' is the length of the retained content.
[0015] Optionally, the input text length includes the number of characters of the input content.
[0016] The present application also provides an input content processing system, comprising:
[0017] An acquisition module, used for acquiring the input text length of the input content when the input text length of the input content is greater than the longest input length supported by the set model;
[0018] A calculation module, used for calculating a proportionality coefficient according to the input text length and the longest input length, wherein the proportionality coefficient is used to characterize the extent to which the input text length exceeds the longest input length;
[0019] A smoothing processing module, used for smoothing the proportional coefficient to obtain a smoothing interception parameter;
[0020] A first determining module, used to determine the interception length according to the smooth interception parameter;
[0021] The second determining module is used to intercept the input content according to the interception length to obtain the retained content.
[0022] The present application also provides an intelligent terminal, comprising: a memory and a processor, wherein the memory stores an input content processing program, and when the input content processing program is executed by the processor, the steps of any one of the above input content processing methods are implemented.
[0023] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above input content processing methods are implemented.
[0024] The input content processing method and system, intelligent terminal, and computer-readable storage medium of the present application obtain the input text length of the input content when the input text length of the input content is greater than the longest input length supported by the set model, calculate the proportional coefficient according to the input text length and the longest input length, smooth the proportional coefficient to obtain a smoothing interception parameter, and determine the interception length according to the smoothing interception parameter. The interception length can make the longer the input text length x, the longer the interception length, and the shorter the input text length, the shorter the interception length. The efficiency of intercepting or cutting the input content according to the interception length can be improved, thereby improving the efficiency of the set model in obtaining input information, and can also make the interception process smoother, which can improve the reliability of the interception process. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0026] Figure 1 It is a flowchart of an input content processing method according to an embodiment of the present application;
[0027] Figure 2 is a schematic diagram of smoothing interception parameter changes in an embodiment of the present application;
[0028] Figure 3 This is a schematic diagram of the change of the interception length according to an embodiment of the present application;
[0029] Figure 4 is a schematic diagram of the length change after input contents of different input lengths are intercepted in one embodiment of the present application;
[0030] Figure 5 It is a schematic diagram of the structure of an input content processing system according to an embodiment of the present application. DETAILED DESCRIPTION
[0031] The technical solutions in the embodiments of the present application are clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application. In the absence of conflict, the following embodiments and their technical features can be combined with each other.
[0032] The first aspect of the present application provides an input content processing method, which can be executed by an intelligent terminal for determining large model input content. Figure 1 As shown, the above-mentioned input content processing method includes the following steps S110 and S150.
[0033] S110, when the input text length of the input content is greater than the longest input length supported by the set model, obtaining the input text length of the input content.
[0034] The above-mentioned setting models include large models such as AI models, such as relevant large models used in the ICT field (communications, semiconductors, new energy vehicles, artificial intelligence, etc.), and JiweiGPT, etc. Input content is input into the setting model. When the input text length of the input content is greater than the longest input length supported by the setting model, the setting model can output a prompt message to indicate that the input text length of the input content is greater than its longest input length. At this time, it can be determined that the input text length of the input content is greater than the longest input length supported by the setting model.
[0035] Optionally, the input text length may include the number of characters of the input content. Here, characters refer to words, including punctuation marks; the number of characters refers to the number of characters, for example, the number of characters in the sentence "How are you?" is 4. Optionally, the unit of the longest input length used to calculate parameters such as the scale factor may be a unit such as a character that is consistent with the input text length, which may be set according to the relevant features of the corresponding setting model, for example, set to a value such as 3000.
[0036] Optionally, the model is set to usually use token as a word segmentation unit to measure the length of the relevant text or the longest input length it supports. That is to say, after the model is set to obtain the input content, it can identify the input text length of the input content based on the token as a word segmentation unit, and its internal preset longest input length can also be set based on the token as a word segmentation unit, so as to compare and analyze the input text length with the longest input length it supports. When the input text length is less than or equal to the longest input length it supports, the corresponding input content is directly identified. When the input text length is greater than the longest input length it supports, a prompt message is output to indicate that the input text length of the input content is greater than the longest input length. Token means word segmentation of text, and each word is a token. Different models may have different word segmentation methods.
[0037] S120, calculating a proportionality coefficient according to the input text length and the longest input length, the proportionality coefficient being used to characterize the extent to which the input text length exceeds the longest input length. Specifically, the proportionality coefficient may be calculated in a proportional calculation form such as division to eliminate the influence of the unit on the calculated proportionality coefficient.
[0038] In one example, the calculation formula of the proportionality coefficient includes: w=x / a-1, where w represents the proportionality coefficient, x represents the input text length, and a represents the maximum input length. The calculation formula of the proportionality coefficient provided in this example can eliminate the influence of the length measurement unit on the obtained proportionality coefficient, which helps to more accurately calculate the degree to which the input text length exceeds the maximum input length.
[0039] S130, smoothing the proportional coefficient to obtain a smoothing interception parameter, and using the smoothing interception parameter to intercept or process the input content can avoid jumping and the like, and can improve the stability and reliability of the input content processing process.
[0040] In one example, the calculation formula of the smoothing interception parameter includes: Where C represents the smooth interception parameter. By using the calculation formula of the smooth interception parameter provided in this example to smooth the proportional coefficient, the value range of the smooth interception parameter can be between [0,1). Specifically, refer to Figure 2 As shown, Figure 2 The horizontal axis represents the proportional coefficient w, and the vertical axis represents the smoothing interception parameter C. Figure 2 It shows that the larger the proportional coefficient w is, the closer the smooth interception parameter C is to 1, and the longer the length of the subsequent interception of the input content is; the smaller the proportional coefficient w is, the closer the smooth interception parameter C is to 0, and the shorter the length of the subsequent interception of the input content is. This feature of the smooth interception parameter C can both ensure the efficiency of interception and improve the accuracy of the interception operation.
[0041] S140, determining a clipping length according to the smooth clipping parameter, where the clipping length is used to represent the length of the content to be clipped for the current input content.
[0042] In one example, the calculation formula of the interception length includes: L=C(xa), where w represents the proportional coefficient, x represents the input text length, C represents the smooth interception parameter, and L represents the interception length. The calculation formula of the interception length provided in this example can make it so that the longer the input text length x is, the longer the interception length L is, and the shorter the input text length x is, the shorter and smoother the interception length L is, which can improve the efficiency of intercepting the input content according to the interception length L and make the interception process smoother.
[0043] Optionally, refer to Figure 3 As shown, Figure 3 The horizontal axis represents the input text length x, and the vertical axis represents the interception length L. Figure 3 This indicates that the larger the input text length x is, the longer the truncation length L is, so the efficiency of truncation of the input content according to the truncation length L is higher.
[0044] S150, the input content is intercepted according to the interception length to obtain the retained content, which is the new input content after interception. The new input content can be as close as possible to the longest input length a supported by the set model, so that if the new input content meets the length requirement of the set model, as much valid information as possible can be retained to be recognized by the set model, and more original input content can be retained to the maximum extent; if the new input content still exceeds the longest input length a supported by the set model, it has a higher interception efficiency, which can reduce the number of subsequent interceptions for the new input content.
[0045] In one example, the calculation formula for the length of the retained content includes:
[0046] In the formula, x' retains the length of the content, x represents the length of the input text, and L represents the truncated length.
[0047] The above-mentioned input content processing method obtains the input text length x of the input content when the input text length x of the input content is greater than the longest input length a supported by the set model, calculates the proportional coefficient w according to the input text length x and the longest input length a, and smoothes the proportional coefficient w to obtain a smoothing truncation parameter C. The truncation length L is determined according to the smoothing truncation parameter C. The truncation length L can make the longer the input text length x, the longer the truncation length L, and the shorter the input text length x, the shorter the truncation length L. The efficiency of truncation or cropping of the input content according to the truncation length L can be improved, thereby improving the efficiency of the set model in obtaining input information, and can also make the truncation process smoother, which can improve the reliability of the truncation process.
[0048] In one embodiment, the input content processing method further includes: inputting the retained content as new input content into the setting model; if the setting model outputs a prompt message, returning to the process of obtaining the input text length x of the input content, and continuing to calculate the proportional coefficient w according to the input text length x and the longest input length a, smoothing the proportional coefficient w to obtain a smoothing interception parameter C, determining the interception length L according to the smoothing interception parameter C, intercepting the new input content according to the interception length L, and obtaining the retained content as the new input content of the setting model, until the setting model can recognize the input content, that is, the setting model does not output a prompt message, and the new input content is successfully input into the setting model. The prompt message is used to indicate that the input text length of the input content is greater than the longest input length.
[0049] Optionally, the length of the input content after being truncated for different input lengths can refer to Figure 4 As shown, Figure 4 In the figure, the horizontal axis represents the length x of the input text, and the vertical axis represents the length x' of the retained content. Figure 4 It shows that when the input text length x of the input content is greater than the longest input length a supported by the set model, one truncation can make the length of the retained content after truncation close to the longest input length a. When the input text length x of the input content is slightly greater than the longest input length a, the truncation length L will be more cautious and smooth, and the corresponding truncation process will be more reliable.
[0050] In the above input content processing method, when the input text length x of the input content is greater than the longest input length a supported by the set model, the input text length x of the input content is obtained, the proportional coefficient w is calculated according to the input text length x and the longest input length a, the proportional coefficient w is smoothed to obtain the smoothing interception parameter C, and the interception length L is determined according to the smoothing interception parameter C. The interception length L can make the longer the input text length x, the longer the interception length L, and the shorter the input text length x, the shorter the interception length L. The efficiency of intercepting or cutting the input content according to the interception length L can be improved, thereby improving the efficiency of the set model in obtaining input information, and can also make the interception process smoother, which can improve the reliability of the interception process.
[0051] The second aspect of the present application provides an input content processing system, which can be set in an intelligent terminal for determining the input content of a large model, or can be set in a corresponding large model (such as a setting model). Figure 5 As shown, the above-mentioned input content processing system includes:
[0052] The acquisition module 110 is used to acquire the input text length of the input content when the input text length of the input content is greater than the longest input length supported by the set model;
[0053] A calculation module 120, configured to calculate a proportionality coefficient according to the input text length and the longest input length, wherein the proportionality coefficient is used to characterize the extent to which the input text length exceeds the longest input length;
[0054] A smoothing processing module 130, used for smoothing the proportional coefficient to obtain a smoothing interception parameter;
[0055] A first determination module 140, configured to determine a cut length according to the smooth cut parameter;
[0056] The second determining module 150 is configured to intercept the input content according to the interception length to obtain retained content.
[0057] For the specific definition of the input content processing system, please refer to the definition of the input content processing method above, which will not be repeated here. Each module in the above-mentioned input content processing system can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the computing module in the relevant computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the computing module can call and execute the operations corresponding to the above-mentioned units.
[0058] The present application also provides an intelligent terminal, which may include: a memory and a processor, wherein the memory stores an input content processing program, and when the input content processing program is executed by the processor, the steps of the input content processing method described in any of the above embodiments are implemented.
[0059] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the input content processing method described in any of the above embodiments are implemented.
[0060] Although the present application has been shown and described with respect to one or more implementations, equivalent variations and modifications will occur to those skilled in the art based on reading and understanding of this specification and the accompanying drawings. The present application includes all such modifications and variations and is limited only by the scope of the appended claims. In particular, with respect to the various functions performed by the above-mentioned components, the terms used to describe such components are intended to correspond to any component (unless otherwise indicated) that performs the specified function of the component (e.g., it is functionally equivalent), even if it is not structurally equivalent to the disclosed structure that performs the functions in the exemplary implementation of this specification shown herein.
[0061] That is, the above description is only an embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the specification and drawings of the present application, such as the mutual combination of technical features between the embodiments, or direct or indirect application in other related technical fields, are also included in the patent protection scope of the present application.
[0062] In addition, in the description of the present application, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the drawings, which are only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present application. In addition, for structural elements with the same or similar characteristics, the present application may use the same or different reference numerals for identification. In addition, the terms "first" and "second" are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0063] In this application, the word "exemplary" is used to mean "used as an example, illustration or description". Any embodiment described as "exemplary" in this application is not necessarily to be construed as being more preferred or more advantageous than other embodiments. In order to enable any technician in the field to implement and use the present application, the present application provides the above description. In the above description, various details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the present application can be implemented without using these specific details. In other embodiments, well-known structures and processes will not be elaborated in detail to avoid unnecessary details that make the description of the present application obscure. Therefore, the present application is not intended to be limited to the embodiments shown, but is consistent with the widest range of principles and features disclosed in the present application.
Claims
1. A method for processing input content, characterized in that: The input content processing method comprises: When the input text length of the input content is greater than the longest input length supported by the set model, obtaining the input text length of the input content; Calculating a proportionality coefficient according to the input text length and the longest input length, the proportionality coefficient being used to characterize the extent to which the input text length exceeds the longest input length; Smoothing the proportional coefficient to obtain a smoothing interception parameter; Determine the interception length according to the smooth interception parameter; The input content is intercepted according to the interception length to obtain retained content.
2. The input content processing method according to claim 1, characterized in that: The input content processing method further includes: Inputting the reserved content into the setting model as new input content; If the setting model outputs prompt information, the process of obtaining the input text length of the input content is returned to execute until the setting model recognizes the input content, and the prompt information is used to indicate that the input text length of the input content is greater than the longest input length.
3. The input content processing method according to claim 1, characterized in that: The calculation formula of the proportionality coefficient includes: w=x / a-1, In the formula, w represents the proportional coefficient, x represents the input text length, and a represents the maximum input length.
4. The input content processing method according to claim 3, characterized in that: The calculation formula of the smooth interception parameter includes: Where C represents the smoothing intercept parameter.
5. The input content processing method according to claim 4, characterized in that: The calculation formula of the intercept length includes: L=C(xa), Wherein, L represents the cut length.
6. The input content processing method according to claim 5, characterized in that: The calculation formula for the length of the retained content includes: x'=xL, Where x' holds the length of the content.
7. The input content processing method according to claim 1, characterized in that: The length of the text you enter includes the number of characters in the text you enter.
8. An input content processing system, characterized in that: include: An acquisition module, used for acquiring the input text length of the input content when the input text length of the input content is greater than the longest input length supported by the set model; A calculation module, used for calculating a proportionality coefficient according to the input text length and the longest input length, wherein the proportionality coefficient is used to characterize the extent to which the input text length exceeds the longest input length; A smoothing processing module, used for smoothing the proportional coefficient to obtain a smoothing interception parameter; A first determining module, used to determine the interception length according to the smooth interception parameter; The second determining module is used to intercept the input content according to the interception length to obtain the retained content.
9. An intelligent terminal, characterized in that: The intelligent terminal may include: a memory and a processor, wherein the memory stores an input content processing program, and when the input content processing program is executed by the processor, the steps of the input content processing method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the input content processing method according to any one of claims 1 to 7 are implemented.
