WO2022253138A1 - 文本处理方法、装置和电子设备 - Google Patents
文本处理方法、装置和电子设备 Download PDFInfo
- Publication number
- WO2022253138A1 WO2022253138A1 PCT/CN2022/095648 CN2022095648W WO2022253138A1 WO 2022253138 A1 WO2022253138 A1 WO 2022253138A1 CN 2022095648 W CN2022095648 W CN 2022095648W WO 2022253138 A1 WO2022253138 A1 WO 2022253138A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- text
- character
- character string
- weight
- target
- 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/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/332—Query formulation
- G06F16/3322—Query formulation using system suggestions
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/205—Parsing
- G06F40/216—Parsing using statistical methods
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/279—Recognition of textual entities
- G06F40/289—Phrasal analysis, e.g. finite state techniques or chunking
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
Definitions
- the present application belongs to the technical field of communications, and in particular relates to a text processing method, device and electronic equipment.
- the long text is usually truncated.
- the electronic device can only extract the first N characters of the long text, and then the electronic device can only search for the N characters, so as to achieve the purpose of reducing the search time and improving the search efficiency.
- the above search scheme may cause the electronic device to be unable to search for the information that the user needs, so that the electronic device may not be able to search for the long text.
- the search accuracy rate is low.
- the purpose of the embodiments of the present application is to provide a text processing method, device and electronic device, which can solve the problem of improving search efficiency and search accuracy in the process of searching long texts by electronic devices.
- the embodiment of the present application provides a text processing method, the method includes: obtaining the first text, the first text includes M first characters, M is a positive integer; according to the characteristic information of each first character , to determine the weight of each first character, the weight of any first character is used to characterize the importance of any first character in the first text; delete the target character from the second text to obtain the target text, the first The second text is all or part of the first text, and the target character is the first character whose weight meets the first condition.
- the embodiment of the present application provides a text processing device, which includes: an acquisition module, a determination module, and an execution module, wherein: the acquisition module is used to acquire the first text, and the first text includes M first character, M is a positive integer; the determination module is used to determine the weight of each first character according to the feature information of each first character, and the weight of any first character is used to represent the first character of any first character. The degree of importance in the text; the execution module is used to delete the target character from the second text to obtain the target text, the second text is all or part of the first text, and the target character is the first character whose weight meets the first condition character.
- an embodiment of the present application provides an electronic device, the electronic device includes a processor, a memory, and a program or instruction stored in the memory and operable on the processor, and the program or instruction is The processor implements the steps of the method described in the first aspect when executed.
- an embodiment of the present application provides a readable storage medium, on which a program or an instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented .
- the embodiment of the present application provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions, so as to implement the first aspect the method described.
- the text processing apparatus may determine the weight of each first character according to the feature information of each first character. Then, the text processing device can delete the target character from the second text to obtain the target text.
- the weight of any first character is used to characterize the importance of any first character in the first text
- the second text is all or part of the first text
- the target character has a weight satisfying the first The first character of the condition.
- the text processing device may delete the first characters whose weights satisfy the first condition, so that the first text may be finely simplified in units of words, and important characters in the first text may be reserved.
- the electronic device can only search for important characters in the first text, thereby improving the search efficiency while improving the search accuracy rate.
- FIG. 1 is a schematic flow chart of a text processing method provided in an embodiment of the present application
- FIG. 2 is a schematic diagram of an application interface of a text processing method provided by an embodiment of the present application
- FIG. 3 is a schematic structural diagram of a text processing device provided in an embodiment of the present application.
- FIG. 4 is one of the structural schematic diagrams of an electronic device provided in an embodiment of the present application.
- FIG. 5 is a second schematic structural diagram of an electronic device provided by an embodiment of the present application.
- first”, “second” and the like in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific sequence or sequence. It is to be understood that the data so used are interchangeable under appropriate circumstances such that the embodiments of the application can be practiced in sequences other than those illustrated or described herein.
- the objects distinguished by “first”, “second” and so on are generally one type, and the number of objects is not limited, for example, there may be one first object, or there may be multiple ones.
- “and/or” in the specification and claims means at least one of the connected objects, and the character “/” generally means that the related objects are an "or” relationship.
- Fig. 1 is a schematic flow chart of a text processing method provided by the embodiment of the present application, including steps 201 to 203:
- Step 201 The text processing apparatus acquires the first text.
- the above-mentioned first text includes M first characters, and M is a positive integer.
- the characters in the present application may include at least one of the following: characters, numbers, letters, and symbols.
- the first text may be input by the user through the text processing device, may also be downloaded by the text processing device, or may be obtained by the text processing device in any possible way, and this embodiment of the present application does not make any limited.
- the text processing apparatus may acquire the first text actively, or may acquire the first text passively, which is not limited in this embodiment of the present application.
- the user may input the first text in the search area, at this time, the text processing apparatus may acquire the first text, that is, acquire it actively.
- the user may input the first text in the search area, and then the text processing apparatus may acquire the first text after receiving the user's first input, that is, acquire passively.
- the above-mentioned first input may be: the user's click input on the target control, or a voice command input by the user, or a specific gesture input by the user, which may be specifically determined according to actual usage requirements.
- the target control may be an original control or a newly added control, which is not limited in this embodiment of the present application.
- the specific gesture in the embodiment of the present application may be any one of a click gesture, a sliding gesture, a drag gesture, a pressure recognition gesture, a long press gesture, an area change gesture, a double-press gesture, and a double-click gesture;
- the click input can be single-click input, double-click input, or any number of click inputs, etc., and can also be long-press input or short-press input.
- Step 202 The text processing device determines the weight of each first character according to the feature information of each first character.
- weight of any first character is used to represent the importance of any first character in the first text.
- the above feature information may include one piece of information, or may include multiple pieces of information, which is not limited in the embodiment of the present application.
- the above feature information may include at least one of the following: text information, historical usage information, context information, and language probability information.
- the above text information may include at least one of the following items: the number (or length) of any first character, the number of characters of the first character string in which any first character is located, and the number of characters of any first character. The offset in the first string where the character is located.
- the above-mentioned historical usage information may include at least one of the following items: the number of historical clicks of any first character, and the number of occurrences of any first character in the first text.
- the historical usage information in this application includes but not limited to the above two kinds of information.
- the above context information may include any of the following: all or part of the characters in the first character string where any first character is located, or all or part of the characters in the first text.
- context information in this application includes but not limited to the above two kinds of information.
- the above-mentioned language probability information includes at least one of the following items: the language model probability of the first character string where any first character is located, the first character where any first character is randomly replaced with other characters.
- the language model probability of the string the language model probability of the first text, the language model probability of the first text after randomly replacing any first character with other characters.
- language probability information in this application includes but not limited to the above two kinds of information.
- the text processing device constructs the feature vector of each first character according to the feature information of each first character, and then, the text processing device can use the word weight model to calculate the feature vector of each first character, and obtain The weight of each first character.
- the text processing apparatus may divide the first text into sentences according to punctuation marks such as periods and commas.
- the first text is "iPhone, apples are delicious", and the results after sentence segmentation are "iPhone” and "apples are delicious”.
- the text processing device can perform word segmentation on each sentence after the sentence segmentation.
- the text processing device may separate the sentence “iPhone” into “apple” and "mobile phone”. After completing word segmentation, the text processing device can obtain the following four features:
- the first type of feature is to acquire the text feature of the first character according to the text information.
- the text information of the word “apple” in “Apple is delicious” is a text length of 4, a word length of 2, and an offset of the word in the text of 0, that is, a vector (4, 2, 0) can be constructed, Then, after a linear transformation layer (the output is 1-dimensional), it becomes one-dimensional data, and then an activation function, and the final result is used as a text feature, which can be recorded as v1.
- the second feature is to acquire statistical features of the first character according to historical usage information.
- the text processing apparatus may use the value of term frequency-inverse document frequency (TF-IDF) as a statistical feature.
- TF-IDF term frequency-inverse document frequency
- this embodiment of the present application implements click rate weighting on the basis of the traditional TF-IDF formula.
- the TF-IDF formula for click rate weighting in the embodiment of the present application can be expressed as:
- tf is the number of times the word appears in the text
- n doc is the total number of words in the document
- m is the total number of documents in the corpus
- df is the number of documents containing the word
- CTR is the click-through rate of the word.
- the traditional TF-IDF calculation can refer to the prior art, which will not be repeated here.
- the TF-IDF value obtained from the collected text data and the user's historical click data can be recorded as v2.
- the third feature is to obtain the word embedding (word vector) feature of the first character according to the context information.
- the text processing device may first obtain the context-free vector representation of the word, and the text processing device searches the word vector table to obtain the context-free vector representation of each word after word segmentation.
- the vector of "apple” is (0.1, 0.2, 0.6) and the vector of "mobile phone” is (0.2, 0.2, 0.6).
- the vectors of "apple” in “iPhone” and “apples are delicious” are both (0.1, 0.2, 0.6), which are context-independent.
- the text processing device can then obtain a context-dependent vector representation of the word.
- the text processing device may input the context-independent vector representation of the word into a context-dependent encoder (for example, a transformer encoder) to obtain the context-dependent vector representation of the word.
- a context-dependent encoder for example, a transformer encoder
- the context-dependent vector representation of the word wi is to consider the influence of all words in the context on the word wi when calculating the representation of the word wi.
- the context-dependent vector representation of wi can be At this time, the vector of "apple” in "iPhone” becomes (0.2, 0.3, 0.7), and the vector of "apple” in "apple is delicious” becomes (0.1, 0.4, 0.6).
- the vector representations of the two “apples” become different due to different contexts, that is, they are context-dependent vector representations.
- the text processing device can convert the context-dependent vector representation of the above-mentioned words into a one-dimensional feature through a linear transformation layer (the output is 1-dimensional), denoted as v3, which can be expressed as: Where w j is the j-th dimension component of the word vector, m is the dimension of the word vector, a j is the corresponding weight, and b is the bias item.
- the fourth feature is to acquire the language model feature of the first character according to the language probability information.
- the language model is used to evaluate the rationality of the text
- the text processing device may use an n-gram language model or a neural network language model to evaluate the rationality of the text.
- v4 P(w0,w,w2,...,w,wn)/P(w0,random,w2,...,random,wn), where random represents a word other than w that is randomly replaced.
- the process of using the language model to find the probability of a text sequence first obtain the context-dependent vector representation of the word, then average the context-dependent vector representations of all words in the sentence to obtain the sentence vector representation, and then The vector representation of the sentence is transformed into one-dimensional data by a linear transformation, and then a probability value is obtained through a nonlinear activation function (such as sigmoid).
- a nonlinear activation function such as sigmoid
- V splicing
- a word weight model may be used to obtain the weight score of each first character.
- a word weight model may be used to obtain the weight score of each first character.
- the linear transformation layer the output is 4 dimensions
- the linear transformation The layer formula can be expressed as:
- W is the weight matrix
- Y is a 4-dimensional vector (corresponding to four types of scores) after linear transformation and activation function, and then adds some nonlinearity to the data through an activation function.
- the activation function can be expressed as:
- y j is the jth dimension of Y, corresponding to the possibility of taking the jth class score, and then after Get a probability distribution with a sum of 1, and take the score corresponding to the dimension with the highest probability as the predicted score.
- the final probability distribution is (0.1, 0.0, 0.1, 0.8), which means that the probability of taking a score of 0 is 0.1 , the probability of taking 1 point is 0, the probability of taking 2 points is 0.1, and the probability of taking 3 points is 0.8. Therefore, the text processing device can predict that the word is 3 points.
- the word weight prediction problem is regarded as a 0-3 four-category problem, (1, 0, 0, 0) represents 1 point, and (0, 0, 0, 1) represents 3 points , (1, 0, 0, 0) and (0, 0, 0, 1) are called the real distribution, and (0.1, 0.0, 0.1, 0.8) are called the predicted distribution, and the dimension corresponding to the largest probability in the predicted distribution is taken The score is used as the final prediction score, which is 3 points here.
- the above-mentioned word weight model can be a logistic regression or a tree model (such as LightGBM).
- the training of the word weight model is offline training, and the label during training is 4 grades of manually labeled word weight scores of 0-3 points.
- the goal of the training is to make the word weight distribution predicted by the word weight model based on the input features and Human scoring is as close as possible.
- the user can manually and subjectively judge the importance of each word in the text by collecting a certain amount of text data and user click data, and combine the user click data to score.
- Subjective judgment is important or relatively important with high clicks, the score is 3 (that is, very important); subjective judgment is important but the click-through rate is average, the score is 2 (that is, relatively important); subjective judgment is not important and the click-through rate is low or no clicks , the score is 0 (that is, not important); the rest of the score is 1 (that is, relatively unimportant).
- Step 203 The text processing device deletes the target character from the second text to obtain the target text.
- the above-mentioned second text is all or part of the text in the first text
- the above-mentioned target character is the first character whose weight satisfies the first condition.
- the above-mentioned first condition includes any of the following: the weight is less than the first threshold, the weight is in the first threshold range, and the weight is greater than or equal to the first threshold.
- first characters whose weights are less than a first threshold may be discarded to obtain the target text.
- the target text is not only concise but also retains important first characters, which is more suitable for long text search requirements.
- the text processing device after the text processing device acquires the first text including M first characters, it may determine the weight of each first character according to the characteristic information of each first character. Then, the text processing device can delete the target character from the second text to obtain the target text.
- the weight of any first character is used to characterize the importance of any first character in the first text
- the second text is all or part of the first text
- the target character has a weight satisfying the first The first character of the condition.
- the text processing device may delete the first characters whose weights satisfy the first condition, so that the first text may be finely simplified in units of words, and important characters in the first text may be reserved.
- the electronic device can only search for important characters in the first text, thereby improving the search efficiency while improving the search accuracy rate.
- the electronic device may first perform de-redundancy on the first text in units of character strings (that is, sentences) .
- the method may also include the following steps 203a and 203b:
- Step 203a The text processing device determines the weight of each first character string according to the weight of each first character.
- the weight of any first character string is used to characterize the importance of any first character string in the first text.
- Step 203b The text processing device deletes the target character string from the first text to obtain the second text.
- the above-mentioned target character string is the first character string whose weight satisfies the second condition.
- the above-mentioned second condition includes any of the following: the weight is smaller than the second threshold, the weight is in the second threshold range, and the weight is greater than or equal to the second threshold.
- step 203a may specifically include the following step 203a1:
- Step 203a1 The text processing device performs linear transformation and functional transformation on the weight of each first character corresponding to each first character string to determine the weight of each first character string.
- the text processing device may use a redundant sentence remover to score each sentence.
- the text processing device may first pass the weight of each first character through a linear transformation layer and output it as a 1-dimensional vector, the The formula of the linear transformation layer can be expressed as:
- score(s) is the sentence score
- score(w i ) is the word weight score of the i-th word in the sentence
- ⁇ i is the corresponding weight.
- the text processing device may retain sentences whose weight scores are greater than or equal to a second threshold (such as 0.5), and delete the remaining sentences to obtain the second text.
- a second threshold such as 0.5
- the text processing method provided by the embodiment of the present application can be applied to the scenario of improving the de-redundancy effect.
- the user can first delete the unimportant first character string (ie sentence) in the first text, and then delete the unimportant The first character (that is, the word) is deleted from the second text in the sentence, so that the effect of de-redundancy can be improved, thereby further improving the search efficiency.
- the method may further include the following steps 201a to 201f:
- Step 201a The text processing device performs sentence segmentation processing on the third text to be processed to obtain at least one second character string.
- the text processing apparatus may divide the third text into sentences according to punctuation marks such as periods and commas.
- the third text may be input by the user through the text processing device, may also be downloaded by the text processing device, or may be obtained by the text processing device in any possible way, which is not limited in this embodiment of the present application.
- the text processing apparatus may acquire the third text actively, or may acquire the third text passively, which is not limited in this embodiment of the present application.
- Step 201b The text processing device performs word segmentation processing on each of the at least one second character string to obtain at least one second character.
- the above-mentioned third text includes at least one second character string, and one second character string includes at least one second character.
- Step 201c The text processing device acquires a vector of each second character in the at least one second character.
- the above-mentioned vector of each second character may be understood as a context-dependent vector of each second character.
- the process of the text processing device determining the context-dependent vector of each second character can be specifically referred to in the embodiment of the present application to determine the context-dependent vector of each first character according to the context information of each first character.
- the description of the vector process of will not be repeated here.
- Step 201d The text processing device determines the vector of each second character string according to the vector of each second character corresponding to each second character string.
- the context-dependent vectors of all second characters may be input
- the sentence encoder learns the vector representation of the entire second character string from the vector representation of each second character in any second character string. For example, summation, averaging, or weighted summation may be used.
- the summation formula can be expressed as:
- the formula for averaging can be expressed as:
- the formula for weighted summation can be expressed as: Among them, v s is the vector representation of the sentence, w i is the context-dependent vector representation of the i-th word in the sentence, ⁇ i is the weight, and b is the bias item.
- Step 201e The text processing device performs linear transformation and functional transformation on the vector of each second character string, and determines the weight of each second character string.
- the weight of any second character string is used to represent the importance of the second character string in the third text.
- the text processing device may input the vector representation of any second character string into a sentence classifier, wherein the sentence classifier is composed of a linear transformation layer (with a 1-dimensional output) and an activation function.
- the text processing device can send the vector of the sentence into the linear transformation layer for linear transformation to obtain a one-dimensional value.
- the formula of the linear transformation layer can be expressed as:
- y s is the output of the linear transformation layer
- w j is the j-th dimension component represented by the sentence vector
- ⁇ j is the corresponding weight.
- score is the score of the sentence.
- Step 201f The text processing device deletes the second character string whose weight satisfies the third condition from the third text to obtain the first text.
- the above-mentioned third condition includes any of the following: the weight is less than a third threshold, the weight is in the third threshold range, and the weight is greater than or equal to the third threshold.
- the text processing device can delete sentences with a label of 0 from the third text, and select sentences with a label of 1 to form the first text, that is, perform preliminary de-redundancy on the third text , and then, the text processing device can refine the weight of each first character determined according to the text information, historical use information, context information and language probability information of each first character on the basis of the first text. redundancy. In this way, the effect of removing redundancy from text can be improved, thereby further improving the efficiency of text search.
- a third threshold such as 0.5
- the mobile phone screen displays a main interface 31 of a news application program, and the search box of this main interface 31 displays text 1 "country Z is a great country, why should I ask why?" So great?
- the land is vast and rich, with 9.6 million square kilometers of land.
- the user wants to search for the long text, the user can click the "Search" control.
- the mobile phone can search for the The text is divided into sentences, which are divided into sentence 1 "country Z is a great country.”, sentence 2 "why is it so great?", sentence 3 "first of all, it has a vast land and resources," and sentence 4 "has a land of 9.6 million square kilometers.
- Sentence 5 Second, it has a long history
- Sentence 6 Up and down five thousand years.”.
- the mobile phone can perform word segmentation for each sentence in sentence 1 to sentence 6, and determine a context-dependent vector representation of each word in sentence 1 to sentence 6.
- the mobile phone can weight and sum the context-dependent vector representations of all words in sentence 1 to obtain the vector representation of sentence 1, and the mobile phone can perform weighted summation of the context-dependent vector representations of all words in sentence 2 to obtain sentence 2 until the mobile phone can weight and sum the context-dependent vector representations of all words in sentence 6 to obtain the vector representation of sentence 6.
- the mobile phone can determine that the weight scores of sentence 1, sentence 3, and sentence 5 are greater than 0.5, which are labeled as label 1, and the weight scores of sentence 2, sentence 4, and sentence 6 are less than 0.5, and are labeled as label 0.
- the mobile phone can delete sentence 2, sentence 4, and sentence 6 whose labels are 0 from text 1, and only display sentence 1, sentence 3, and sentence 5, and obtain sentence-level deredundancy Text 1. Then, the mobile phone can perform word segmentation on sentence 1, sentence 3 and sentence 5, and sentence 1 can be divided into the words "country Z", "yes", “one”, “great”, “of” and “country”. Then, the mobile phone can jointly determine the weight score of each word according to the text information, historical usage information, context information and language probability information of each word in sentence 1, where the weights of the words "is", "one” and “of” are The score is less than 1 point, and the words "Z country”, "great” and “country” have a weight score greater than 1 point. At this time, the mobile phone can delete the words “yes", “one” and "of” in sentence 1, and reserve the word “ Country Z", "Great” and "National”.
- the text processing apparatus may execute the above step 201a to step 201f under the condition that the above feature information may include text information, historical usage information, context information and language probability information.
- the text processing method provided by the embodiment of the present application can be applied to the scenario of improving the de-redundancy effect, and the text processing device can determine the vector of each second character string according to the vector of each second character in the third text, so that Determine the weight of each second character string according to the vector of each second character string, and delete the second character string whose weight satisfies the third condition from the third text to obtain the first text, so as to implement sentence processing on the third text Level preliminary de-redundancy, and then, the text processing device can perform word-level de-redundancy on the first text obtained by preliminary de-redundancy, so that the effect of de-redundancy on the text can be improved.
- the text processing method provided in the embodiment of the present application may be executed by a text processing device, or a control module in the text processing device for executing the text processing method.
- the text processing device provided in the embodiment of the present application is described by taking the text processing device executing the text processing method as an example.
- Fig. 3 is a schematic diagram of a possible structure of a text processing device provided by the embodiment of the present application.
- the text processing device 400 includes: an acquisition module 401, a determination module 402 and an execution module 403, wherein: , used to obtain the first text, the first text includes M first characters, and M is a positive integer; the determination module 402 is used to determine the weight of each first character according to the feature information of each first character, any The weight of a first character is used to characterize the importance of any first character in the first text; the execution module 403 is used to delete the target character from the second text to obtain the target text, and the second text is the first text All or part of the text, the target character is the first character whose weight meets the first condition.
- the above-mentioned first text includes at least one first character string, the at least one first character string includes the above-mentioned M first characters, and one first character string includes at least one first character;
- the determining module 402 is also used to Determine the weight of each first character string according to the weight of each first character, and the weight of any first character string is used to characterize the importance of any first character string in the first text;
- the determining module 402 is specifically configured to perform linear transformation and functional transformation on the weight of each first character corresponding to each first character string, and determine the weight of each first character string.
- the execution module 403 is further configured to perform sentence segmentation processing on the third text to be processed to obtain at least one second character string; and perform word segmentation processing on each second character string in the at least one second character string, obtain at least one second character; the obtaining module 401 is also used to obtain the vector of each second character in the at least one second character; the determination module 402 is also used to correspond to each second character string obtained according to the obtaining module 401 the vector of each second character, determine the vector of each second string; and carry out linear transformation and function transformation on the vector of each second character string, determine the weight of each second string, any second The weight of the string is used to characterize the importance of any second string in the third text; the execution module 403 is also used to delete the second string whose weight meets the third condition from the third text to obtain the first text.
- the feature information includes at least one of the following: text information, historical usage information, context information, and language probability information.
- the text processing device may determine the weight of each first character according to the characteristic information of each first character. Then, the text processing device can delete the target character from the second text to obtain the target text.
- the weight of any first character is used to characterize the importance of any first character in the first text
- the second text is all or part of the first text
- the target character has a weight satisfying the first The first character of the condition.
- the text processing device may delete the first characters whose weights satisfy the first condition, so that the first text may be finely simplified in units of words, and important characters in the first text may be reserved.
- the electronic device can only search for important characters in the first text, thereby improving the search efficiency while improving the search accuracy rate.
- the text processing device in this embodiment of the present application may be a device, or may be a component, an integrated circuit, or a chip in a terminal.
- the device may be a mobile electronic device or a non-mobile electronic device.
- the mobile electronic device may be a mobile phone, tablet computer, notebook computer, palmtop computer, vehicle electronic device, wearable device, ultra-mobile personal computer (ultra-mobile personal computer, UMPC), netbook or personal digital assistant (personal digital assistant).
- assistant, PDA personal digital assistant
- non-mobile electronic devices can be servers, network attached storage (Network Attached Storage, NAS), personal computer (personal computer, PC), television (television, TV), teller machine or self-service machine, etc., this application Examples are not specifically limited.
- the text processing device in this embodiment of the present application may be a device with an operating system.
- the operating system may be an Android (Android) operating system, an ios operating system, or other possible operating systems, which are not specifically limited in this embodiment of the present application.
- the text processing device provided in the embodiment of the present application can realize various processes realized by the method embodiments in FIG. 1 and FIG. 2 , and details are not repeated here to avoid repetition.
- the embodiment of the present application further provides an electronic device 500, including a processor 501, a memory 502, and programs or instructions stored in the memory 502 and operable on the processor 501,
- an electronic device 500 including a processor 501, a memory 502, and programs or instructions stored in the memory 502 and operable on the processor 501,
- the program or instruction is executed by the processor 501, each process of the above-mentioned text processing method embodiment can be realized, and the same technical effect can be achieved, so in order to avoid repetition, details are not repeated here.
- the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
- FIG. 5 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
- the electronic device 100 includes but is not limited to: a radio frequency unit 101, a network module 102, an audio output unit 103, an input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, a memory 109, and a processor 110, etc. part.
- the electronic device 100 can also include a power supply (such as a battery) for supplying power to various components, and the power supply can be logically connected to the processor 110 through the power management system, so that the management of charging, discharging, and function can be realized through the power management system. Consumption management and other functions.
- a power supply such as a battery
- the structure of the electronic device shown in FIG. 5 does not constitute a limitation to the electronic device.
- the electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange different components, and details will not be repeated here. .
- the processor 110 is used to obtain the first text, the first text includes M first characters, and M is a positive integer; and according to the feature information of each first character, determine the weight of each first character, any The weight of a first character is used to characterize the importance of any first character in the first text; and the target character is deleted from the second text to obtain the target text, and the second text is all or part of the first text text, the target character is the first character whose weight meets the first condition.
- the above-mentioned first text includes at least one first character string, the at least one first character string includes the above-mentioned M first characters, and one first character string includes at least one first character; the processor 110 is further configured to According to the weight of each first character, determine the weight of each first character string, the weight of any first character string is used for characterizing the importance degree of this any first character string in the first text; And from the first The target character string is deleted from the text to obtain the second text, and the target character string is the first character string whose weight satisfies the second condition.
- the processor 110 is specifically configured to perform linear transformation and functional transformation on the weight of each first character corresponding to each first character string to determine the weight of each first character string.
- the processor 110 is further configured to perform sentence segmentation processing on the third text to be processed to obtain at least one second character string; perform word segmentation processing on each second character string in the at least one second character string to obtain at least one second character; obtaining the vector of each second character in the at least one second character; determining the vector of each second character string according to the vector of each second character corresponding to each second character string; Perform linear transformation and function transformation on the vector of each second character string to determine the weight of each second character string, and the weight of any second character string is used to represent the importance of any second character string in the third text degree; and deleting the second character string whose weight satisfies the third condition from the third text to obtain the first text.
- the feature information includes at least one of the following: text information, historical usage information, context information, and language probability information.
- the electronic device after acquiring the first text including M first characters, the electronic device may determine the weight of each first character according to feature information of each first character. Then, the electronic device can delete the target character from the second text to obtain the target text.
- the weight of any first character is used to characterize the importance of any first character in the first text
- the second text is all or part of the first text
- the target character has a weight satisfying the first The first character of the condition.
- the electronic device can delete the first characters whose weights satisfy the first condition, so that the first text can be finely simplified in units of words, and important characters in the first text can be reserved. In this way, in the process of searching a long text, the electronic device can only search for important characters in the first text, thereby improving the search efficiency while improving the search accuracy rate.
- the input unit 104 may include a graphics processor (Graphics Processing Unit, GPU) 1041 and a microphone 1042, and the graphics processor 1041 is used for the image capture device (such as the image data of the still picture or video obtained by the camera) for processing.
- the display unit 106 may include a display panel 1061, and the display panel 1061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like.
- the user input unit 107 includes a touch panel 1071 and other input devices 1072 .
- the touch panel 1071 is also called a touch screen.
- the touch panel 1071 may include two parts, a touch detection device and a touch controller.
- Other input devices 1072 may include, but are not limited to, physical keyboards, function keys (such as volume control keys, switch keys, etc.), trackballs, mice, and joysticks, which will not be repeated here.
- Memory 109 may be used to store software programs as well as various data, including but not limited to application programs and operating systems.
- the processor 110 may integrate an application processor and a modem processor, wherein the application processor mainly processes operating systems, user interfaces, and application programs, and the modem processor mainly processes wireless communications. It can be understood that the foregoing modem processor may not be integrated into the processor 110 .
- the embodiment of the present application also provides a readable storage medium, on which a program or an instruction is stored, and when the program or instruction is executed by a processor, each process of the above-mentioned text processing method embodiment is realized, and the same To avoid repetition, the technical effects will not be repeated here.
- the processor is the processor in the electronic device described in the above embodiments.
- the readable storage medium includes computer readable storage medium, such as computer read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk, etc.
- the embodiment of the present application further provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the above text processing method embodiment Each process can achieve the same technical effect, so in order to avoid repetition, it will not be repeated here.
- chips mentioned in the embodiments of the present application may also be called system-on-chip, system-on-chip, system-on-a-chip, or system-on-a-chip.
- the term “comprising”, “comprising” or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements, It also includes other elements not expressly listed, or elements inherent in the process, method, article, or device. Without further limitations, an element defined by the phrase “comprising a " does not preclude the presence of additional identical elements in the process, method, article, or apparatus comprising that element.
- the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved. Functions are performed, for example, the described methods may be performed in an order different from that described, and various steps may also be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- General Engineering & Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- General Health & Medical Sciences (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Mathematical Physics (AREA)
- Data Mining & Analysis (AREA)
- Probability & Statistics with Applications (AREA)
- Databases & Information Systems (AREA)
- Life Sciences & Earth Sciences (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Evolutionary Computation (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Software Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
Claims (15)
- 一种文本处理方法,所述方法包括:获取第一文本,所述第一文本包括M个第一字符,M为正整数;根据每个第一字符的特征信息,确定所述每个第一字符的权重,任一第一字符的权重用于表征所述任一第一字符在所述第一文本中的重要程度;从第二文本中删除目标字符,得到目标文本,所述第二文本为所述第一文本的全部或部分文本,所述目标字符为权重满足第一条件的第一字符。
- 根据权利要求1所述的方法,其中,所述第一文本包括至少一个第一字符串,所述至少一个第一字符串包括所述M个第一字符,一个第一字符串包括至少一个第一字符;在从第二文本中删除目标字符之前,所述方法还包括:根据所述每个第一字符的权重,确定所述每个第一字符串的权重,任一第一字符串的权重用于表征所述任一第一字符串在所述第一文本中的重要程度;从所述第一文本中删除目标字符串,得到所述第二文本,所述目标字符串为权重满足第二条件的第一字符串。
- 根据权利要求2所述的方法,其中,所述根据所述每个第一字符的权重,确定所述每个第一字符串的权重,包括:将每个第一字符串对应的每个第一字符的权重进行线性变换和函数变换,确定所述每个第一字符串的权重。
- 根据权利要求1至3任一项所述的方法,其中,所述获取第一文本之前,所述方法还包括:对待处理的第三文本执行分句处理,得到至少一个第二字符串;对所述至少一个第二字符串中的每个第二字符串执行分词处理,得到至少一个第二字符;获取所述至少一个第二字符中的每个第二字符的向量;根据所述每个第二字符串对应的每个第二字符的向量,确定所述每个第二字符串的向量;将所述每个第二字符串的向量进行线性变换和函数变换,确定所述每个第二字符串的权重,任一第二字符串的权重用于表征所述任一第二字符串在所述第三文本中的重要程度;从所述第三文本中删除权重满足第三条件的第二字符串,得到所述第一文本。
- 根据权利要求1所述的方法,其中,所述特征信息包括以下至少一项:文本信息,历史使用信息,上下文信息,语言概率信息。
- 一种文本处理装置,所述文本处理装置包括:获取模块、确定模块和执行模块;所述获取模块,用于获取第一文本,所述第一文本包括M个第一字符,M为正整数;所述确定模块,用于根据每个第一字符的特征信息,确定所述每个第一字符的权重,任一第一字符的权重用于表征所述任一第一字符在所述第一文本中的重要程度;所述执行模块,用于从第二文本中删除目标字符,得到目标文本,所述第二文本为所述第一文本的全部或部分文本,所述目标字符为权重满足第一条件的第一字符。
- 根据权利要求6所述的文本处理装置,其中,所述第一文本包括至少一个第一字符串,所述至少一个第一字符串包括所述M个第一字符,一个第一字符串包括至少一个第一字符;所述确定模块,还用于根据所述每个第一字符的权重,确定所述每个第一字符串的权重,任一第一字符串的权重用于表征所述任一第一字符串在所述第一文本中的重要程度;所述执行模块,还用于从所述第一文本中删除目标字符串,得到所述第二文本,所述目标字符串为权重满足第二条件的第一字符串。
- 根据权利要求7所述的文本处理装置,其中,所述确定模块,具体用于将每个第一字符串对应的每个第一字符的权重进行线性变换和函数变换,确定所述每个第一字符串的权重。
- 根据权利要求6至8任一项所述的文本处理装置,其中,所述执行模块,还用于对待处理的第三文本执行分句处理,得到至少一个第二字符串;以及对所述至少一个第二字符串中的每个第二字符串执行分词处理,得到至少一个第二字符;所述获取模块,还用于获取所述至少一个第二字符中的每个第二字符的向量;所述确定模块,还用于根据所述获取模块获取的所述每个第二字符串对应的每个第二字符的向量,确定所述每个第二字符串的向量;以及将所述每个第二字符串的向量进行线性变换和函数变换,确定所述每个第二字符串的权重, 任一第二字符串的权重用于表征所述任一第二字符串在所述第三文本中的重要程度;所述执行模块,还用于从所述第三文本中删除权重满足第三条件的第二字符串,得到所述第一文本。
- 根据权利要求6所述的文本处理装置,其中,所述特征信息包括以下至少一项:文本信息、历史使用信息、上下文信息和语言概率信息。
- 一种电子设备,包括处理器,存储器及存储在所述存储器上并可在所述处理器上运行的程序或指令,所述程序或指令被所述处理器执行时实现如权利要求1至5中任一项所述的文本处理方法的步骤。
- 一种可读存储介质,所述可读存储介质上存储程序或指令,所述程序或指令被处理器执行时实现如权利要求1至5中任一项所述的文本处理方法的步骤。
- 一种计算机程序产品,所述计算机程序产品被至少一个处理器执行以实现如权利要求1-5任一项所述的文本处理方法的步骤。
- 一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现如权利要求1-5任一项所述的文本处理方法的步骤。
- 一种电子设备,所述电子设备被配置成用于执行如权利要求1-5任一项所述的文本处理方法的步骤。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110603987.6A CN113360613A (zh) | 2021-05-31 | 2021-05-31 | 文本处理方法、装置和电子设备 |
| CN202110603987.6 | 2021-05-31 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2022253138A1 true WO2022253138A1 (zh) | 2022-12-08 |
Family
ID=77530559
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2022/095648 Ceased WO2022253138A1 (zh) | 2021-05-31 | 2022-05-27 | 文本处理方法、装置和电子设备 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN113360613A (zh) |
| WO (1) | WO2022253138A1 (zh) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2025140159A1 (zh) * | 2023-12-29 | 2025-07-03 | 维沃移动通信有限公司 | 文本处理方法、装置、电子设备及存储介质 |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113360613A (zh) * | 2021-05-31 | 2021-09-07 | 维沃移动通信有限公司 | 文本处理方法、装置和电子设备 |
Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110232156A (zh) * | 2019-05-31 | 2019-09-13 | 三角兽(北京)科技有限公司 | 基于长文本的信息推荐方法及装置 |
| CN110704621A (zh) * | 2019-09-25 | 2020-01-17 | 北京大米科技有限公司 | 文本处理方法、装置及存储介质和电子设备 |
| US20200050638A1 (en) * | 2018-08-12 | 2020-02-13 | Parker Douglas Hancock | Systems and methods for analyzing the validity or infringment of patent claims |
| CN111680510A (zh) * | 2020-07-07 | 2020-09-18 | 腾讯科技(深圳)有限公司 | 文本处理方法、装置、计算机设备以及存储介质 |
| CN112711695A (zh) * | 2020-12-29 | 2021-04-27 | 网易传媒科技(北京)有限公司 | 基于内容的搜索建议生成方法及装置 |
| CN112784009A (zh) * | 2020-12-28 | 2021-05-11 | 北京邮电大学 | 一种主题词挖掘方法、装置、电子设备及存储介质 |
| CN113360613A (zh) * | 2021-05-31 | 2021-09-07 | 维沃移动通信有限公司 | 文本处理方法、装置和电子设备 |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103886063B (zh) * | 2014-03-18 | 2017-03-08 | 国家电网公司 | 一种文本检索方法和装置 |
| CN111274808B (zh) * | 2020-02-11 | 2023-07-04 | 支付宝(杭州)信息技术有限公司 | 文本检索方法、模型训练方法、文本检索装置及存储介质 |
-
2021
- 2021-05-31 CN CN202110603987.6A patent/CN113360613A/zh active Pending
-
2022
- 2022-05-27 WO PCT/CN2022/095648 patent/WO2022253138A1/zh not_active Ceased
Patent Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20200050638A1 (en) * | 2018-08-12 | 2020-02-13 | Parker Douglas Hancock | Systems and methods for analyzing the validity or infringment of patent claims |
| CN110232156A (zh) * | 2019-05-31 | 2019-09-13 | 三角兽(北京)科技有限公司 | 基于长文本的信息推荐方法及装置 |
| CN110704621A (zh) * | 2019-09-25 | 2020-01-17 | 北京大米科技有限公司 | 文本处理方法、装置及存储介质和电子设备 |
| CN111680510A (zh) * | 2020-07-07 | 2020-09-18 | 腾讯科技(深圳)有限公司 | 文本处理方法、装置、计算机设备以及存储介质 |
| CN112784009A (zh) * | 2020-12-28 | 2021-05-11 | 北京邮电大学 | 一种主题词挖掘方法、装置、电子设备及存储介质 |
| CN112711695A (zh) * | 2020-12-29 | 2021-04-27 | 网易传媒科技(北京)有限公司 | 基于内容的搜索建议生成方法及装置 |
| CN113360613A (zh) * | 2021-05-31 | 2021-09-07 | 维沃移动通信有限公司 | 文本处理方法、装置和电子设备 |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2025140159A1 (zh) * | 2023-12-29 | 2025-07-03 | 维沃移动通信有限公司 | 文本处理方法、装置、电子设备及存储介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN113360613A (zh) | 2021-09-07 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN113378556B (zh) | 提取文本关键字的方法及装置 | |
| US12229499B1 (en) | Computer-implemented presentation of synonyms based on syntactic dependency | |
| EP3958145A1 (en) | Method and apparatus for semantic retrieval, device and storage medium | |
| CN111931501B (zh) | 一种基于人工智能的文本挖掘方法、相关装置及设备 | |
| CN107608532B (zh) | 一种联想输入方法、装置及电子设备 | |
| CN111401033B (zh) | 事件抽取方法、事件抽取装置和电子设备 | |
| CN112560479A (zh) | 摘要抽取模型训练方法、摘要抽取方法、装置和电子设备 | |
| CN112631437B (zh) | 信息推荐方法、装置及电子设备 | |
| CN114417871B (zh) | 模型训练及命名实体识别方法、装置、电子设备及介质 | |
| CN113407738B (zh) | 一种相似文本检索方法、装置、电子设备和存储介质 | |
| CN111339267A (zh) | 基于知识图谱的问答方法及系统、计算机设备及介质 | |
| CN102567509A (zh) | 视觉信息辅助的即时通信方法及系统 | |
| CN112269475A (zh) | 文字显示方法、装置和电子设备 | |
| WO2022257840A1 (zh) | 信息显示方法、装置、电子设备及可读存储介质 | |
| CN108287875A (zh) | 人物共现关系确定方法、专家推荐方法、装置及设备 | |
| CN113822072A (zh) | 关键词抽取方法、装置及电子设备 | |
| CN111858905A (zh) | 模型训练方法、信息识别方法、装置、电子设备及存储介质 | |
| CN113360769A (zh) | 信息查询方法、装置、电子设备以及存储介质 | |
| WO2022253138A1 (zh) | 文本处理方法、装置和电子设备 | |
| CN111538830B (zh) | 法条检索方法、装置、计算机设备及存储介质 | |
| CN113821669A (zh) | 搜索方法、装置、电子设备和存储介质 | |
| CN112417095A (zh) | 语音消息处理方法和装置 | |
| CN113392177B (zh) | 一种关键词获取方法、装置、电子设备及存储介质 | |
| CN112148988B (zh) | 用于生成信息的方法、装置、设备以及存储介质 | |
| CN114443935A (zh) | 内容搜索方法、装置以及电子设备 |
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: 22815184 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: 22815184 Country of ref document: EP Kind code of ref document: A1 |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 07/06/2024) |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 22815184 Country of ref document: EP Kind code of ref document: A1 |


