WO2022141860A1 - 文本去重方法、装置、电子设备及计算机可读存储介质 - Google Patents

文本去重方法、装置、电子设备及计算机可读存储介质 Download PDF

Info

Publication number
WO2022141860A1
WO2022141860A1 PCT/CN2021/083711 CN2021083711W WO2022141860A1 WO 2022141860 A1 WO2022141860 A1 WO 2022141860A1 CN 2021083711 W CN2021083711 W CN 2021083711W WO 2022141860 A1 WO2022141860 A1 WO 2022141860A1
Authority
WO
WIPO (PCT)
Prior art keywords
text
deduplicated
texts
segmentation
word
Prior art date
Application number
PCT/CN2021/083711
Other languages
English (en)
French (fr)
Inventor
何友鑫
彭琛
汪伟
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2022141860A1 publication Critical patent/WO2022141860A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/194Calculation of difference between files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • G06F40/211Syntactic parsing, e.g. based on context-free grammar [CFG] or unification grammars
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/237Lexical tools

Definitions

  • the present application relates to the technical field of speech semantics, and in particular, to a text deduplication method, apparatus, electronic device, and computer-readable storage medium.
  • Text deduplication is a very important part of the field of natural language processing. There are a large number of duplicate content pages on the Internet, whether it is for web page deduplication and filtering of search engines, content anti-piracy and tracking of content websites such as news novels, or texts such as social media. Deduplication and clustering both require deduplication of web pages or texts.
  • the inventor realizes that the commonly used text deduplication methods are mostly text deduplication algorithms based on text similarity, which analyze the text content based on a natural language processing model, and then screen out texts with high similarity.
  • this method takes up a lot of computing resources when analyzing and calculating the overall content of the text, the deduplication efficiency is low when deduplicating massive texts, and only analyzing and deduplicating the entire text cannot deduplicate the text.
  • the overlapping of details leads to the inaccuracy of deduplication.
  • a text deduplication method including:
  • the multiple texts to be deduplicated are overlapped and deduplicated according to the text fingerprint to obtain a plurality of preliminary deduplicated texts;
  • Sectioning is performed on each text in the plurality of preliminary de-duplicated texts to obtain text clauses of each preliminary de-duplicated text;
  • a text deduplication device includes:
  • a text acquisition module configured to acquire a plurality of texts to be deduplicated, and collect the plurality of texts to be deduplicated into a corpus
  • a text segmentation module configured to perform word segmentation processing on each of the multiple texts to be deduplicated to obtain a text segmentation corresponding to each to-be deduplicated text
  • a fingerprint construction module configured to construct a text fingerprint of the text to be deduplicated corresponding to the text segmentation according to the corpus
  • a first deduplication module configured to perform overlapping and deduplication on the multiple texts to be deduplicated according to the text fingerprints to obtain a plurality of preliminary deduplication texts
  • a sentence-cutting module is used for sentence-cutting each text in the plurality of preliminary de-duplicated texts to obtain text clauses of each preliminary de-duplicated text;
  • Coincident word strength calculation module for calculating the coincidence word granularity between each of the text clauses
  • the second deduplication module performs range deduplication on the plurality of preliminary deduplicated texts according to the granularity of the overlapping words to obtain a deduplicated text set.
  • An electronic device comprising:
  • a processor that executes the instructions stored in the memory to achieve the following steps:
  • the multiple texts to be deduplicated are overlapped and deduplicated according to the text fingerprint to obtain a plurality of preliminary deduplicated texts;
  • Sectioning is performed on each text in the plurality of preliminary de-duplicated texts to obtain text clauses of each preliminary de-duplicated text;
  • a computer-readable storage medium having at least one instruction stored in the computer-readable storage medium, the at least one instruction being executed by a processor in an electronic device to implement the following steps:
  • the multiple texts to be deduplicated are overlapped and deduplicated according to the text fingerprint to obtain a plurality of preliminary deduplicated texts;
  • Sectioning is performed on each text in the plurality of preliminary de-duplicated texts to obtain text clauses of each preliminary de-duplicated text;
  • the present application can solve the problems of low efficiency and precision when deduplicating a large amount of text.
  • FIG. 1 is a schematic flowchart of a text deduplication method provided by an embodiment of the present application
  • FIG. 2 is a functional block diagram of a text deduplication device provided by an embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of an electronic device implementing the text deduplication method provided by an embodiment of the present application.
  • the execution body of the text deduplication method includes, but is not limited to, at least one of electronic devices that can be configured to execute the method provided by the embodiments of the present application, such as a server and a terminal.
  • the text deduplication method can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform.
  • the server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
  • the text deduplication method includes:
  • the multiple texts to be deduplicated may be any textual texts, for example, news texts of multiple pieces of news.
  • a python statement with a data capture function can be used to obtain the text to be deduplicated from the blockchain node used for storing the text to be deduplicated, and the high throughput of the blockchain node for data can be used. Improve the efficiency of obtaining text to be deduplicated.
  • collecting the multiple texts to be deduplicated into a corpus that is, collecting the contents of the multiple texts to be deduplicated to obtain a corpus containing all the contents of the texts to be deduplicated, for example, a plurality of texts to be deduplicated
  • the heavy text includes text A, text B and text C, then the contents of text A, text B and text C are collected to obtain a corpus.
  • the word segmentation processing is performed on each of the multiple texts to be deduplicated, and the text segmentation corresponding to each text to be deduplicated is obtained, including:
  • the pre-set standard thesaurus is used to perform word segmentation on the text to be deduplicated after the stop words are deleted, and the text segmentation is obtained.
  • the preset stop thesaurus and the preset standard thesaurus are thesaurus containing multiple word segmentations.
  • the preset stop word database stores word segmentations of multiple stop words, for example, “Sur” and “Ruci”.
  • the preset standard thesaurus contains multiple non-stop word segmentations, for example, "eat”, “sleep”.
  • This embodiment of the present application performs word segmentation processing on the text to be deduplicated, and can divide multiple texts with large lengths to be deduplicated into text word segmentation, and processing multiple word segmentations is more efficient than directly processing multiple texts to be deduplicated. and higher accuracy.
  • the construction of the text fingerprint of the text to be deduplicated corresponding to the text word segmentation according to the corpus includes:
  • a preset number of text word segmentations are screened as fingerprint word segmentation
  • Hash conversion is performed on the fingerprint word segmentation to obtain a text fingerprint.
  • the word segmentation frequency analysis is performed on the text segmentation according to the text to be deduplicated corresponding to the text segmentation, that is, the frequency of the text segmentation corresponding to the text segmentation is calculated by using a preset first frequency algorithm. The frequency of occurrences in the text to be deduplicated.
  • the word segmentation frequency analysis is performed on the text segmentation according to the text to be deduplicated corresponding to the text segmentation, and the word frequency of the segmentation is obtained, including:
  • tf m is the word frequency of the m-th text segment
  • n is the number of times the m-th text segment appears in the text to be deduplicated corresponding to the m-th text segment
  • k is the m-th text The number of all text word segmentations in the text to be deduplicated corresponding to the word segmentation.
  • the word frequency of word segmentation may indicate the importance of the text word segmentation in the text to be deduplicated corresponding to the text segmentation. The greater the word frequency of word segmentation, the more important the word segmentation of the text is.
  • the document frequency analysis is performed on the text word segmentation according to the corpus, that is, the frequency of occurrence of the text word segmentation in all the texts to be deduplicated in the corpus is calculated by using a preset second frequency algorithm .
  • the document frequency analysis is performed on the text word segmentation according to the corpus to obtain the document word frequency, including:
  • idf m is the document word frequency of the mth text segment
  • is the number of texts to be deduplicated in the corpus
  • is the number of texts to be deduplicated including the mth text segment
  • is the pre- Set the offset correction coefficient, usually 1.
  • the word segmentation index for constructing the text word segmentation according to the word segmentation word frequency and the document word frequency includes:
  • index algorithm is used to calculate the word segmentation index of each word segment in the multiple text word segments:
  • tf_idf m is the word segmentation index
  • tf m is the word frequency of the m-th text segmentation
  • idf m is the document word frequency of the m-th text segmentation.
  • the word segmentation index may represent the representativeness of the text corresponding to the text segmentation in all the texts in the corpus, that is, when the word segmentation index is larger, it indicates that the text segmentation corresponds to the text segmentation. The more representative the deduplicated text is.
  • a preset number of text segmentations are selected as fingerprint segmentation, that is, all text segmentations are sorted according to the size of the word segmentation index, and a preset number of word segmentations are selected sequentially from front to back.
  • Text segmentation is fingerprint segmentation. For example, there are text segmentation 1, text segmentation 2, text segmentation 3, text segmentation 4, text segmentation 5, and text segmentation 6.
  • the segmentation index of text segmentation 1 is 80, and the segmentation index of text segmentation 2 is 70, the segmentation index of text segmentation 3 is 60, the segmentation index of text segmentation 4 is 50, the segmentation index of text segmentation 5 is 40, and the segmentation index of text segmentation 6 is 30.
  • the preset number is 3, select text segmentation 1. Text segmentation 2 and text segmentation 3 are used as fingerprint segmentation.
  • performing hash conversion on the fingerprint word segmentation to obtain a text fingerprint includes: using a preset hash algorithm to calculate the fingerprint word segmentation, and using the calculated hash value of the text word segmentation as The text fingerprint of the text to be deduplicated corresponding to the text word segmentation.
  • the hash algorithm includes but is not limited to MD3 value algorithm and MD5 value algorithm.
  • the multiple texts to be deduplicated are overlapped and deduplicated according to the text fingerprint to obtain a plurality of preliminary deduplicated texts, including:
  • the text fingerprint is divided into fingerprints at equal intervals to obtain four fingerprint segments of "1010", “1101”, “0011” and “0110”, and the fingerprints are divided in order.
  • the segment is position-coded to obtain four coded segments: position 1: “1010", position 2: “1101”, position 3: “0011”, position 4: "0110".
  • the calculation of the degree of coincidence between the coding segments coded at the same position includes:
  • R is any one of the encoded segments
  • S is an encoded segment with the same position encoding as R
  • Pearson is a similarity operation
  • Sim is the degree of coincidence between R and S.
  • the duplicate texts in the multiple texts to be deduplicated are deleted to obtain a plurality of preliminary deduplicated texts, including:
  • each text in the plurality of preliminary de-duplicated texts is segmented to obtain a text clause of each preliminary de-duplicated text, including:
  • the plurality of preliminary deduplicated texts are segmented according to the positions of the clauses, so as to obtain text segments of each preliminary deduplicated text.
  • the clause can be preset, for example, a comma "," in a plurality of preliminary deduplicated texts is used as a clause, or a period ".” in a plurality of deduplicated texts is used as a clause character, so as to realize the segmentation of multiple preliminary deduplication texts.
  • the text fingerprints are used to deduplicate multiple texts to be deduplicated to obtain a plurality of preliminary deduplicated texts, and only the texts in the multiple to-be-duplicated texts can be removed.
  • There is an overall overlap for example, there are text A, text B and text C, where the text fingerprint of text A is consistent with the text fingerprint of text B, then delete text A and text B with shorter text lengths. Therefore, in this embodiment of the present application, the obtained multiple preliminary deduplicated texts are segmented into sentences, so as to implement sentence-grained text deduplication for the multiple preliminary deduplicated texts, and improve the accuracy of text deduplication.
  • the calculating the granularity of overlapping words between each of the text clauses includes:
  • the coincidence word granularity of the target sentence and the unselected sentence in the text sentence is calculated.
  • Z is the granularity of the overlapping words
  • T is the total number of words in the target clause
  • t i is the number of words in the unselected i-th clause in the text clause that overlaps with the target clause.
  • the range deduplication refers to deduplication of overlapping sentences existing in the plurality of preliminary deduplicated texts according to the calculated overlapping word granularity, thereby improving the accuracy of deduplication.
  • the range deduplication is performed on the plurality of preliminary deduplicated texts according to the coincident word granularity to obtain a deduplicated text set, including:
  • preliminary de-duplicated text A includes text clause a
  • preliminary de-duplicated text B includes text clause b
  • preliminary de-duplicated text A includes text clause b
  • text C contains text clause c, wherein the coincidence word granularity between text clause a and text clause b is 80, and the coincidence word granularity between text clause a and text clause c is 30.
  • word granularity threshold is 50
  • filter out text clause a and text clause b and traverse the text clause a and text clause b to obtain the sentence length of text clause a and the sentence length of text clause b.
  • the length is 7.
  • the preset sentence length threshold is 6, the text clause a is deleted and the text clause b is retained to obtain the deduplicated text set.
  • the embodiment of the present application also includes using a preset event argument model to extract optional events from the deduplicated text set, and find out the texts in the deduplicated text set that are inconsistent in expression but have consistent actual semantics according to the event extraction result, so as to identify the text in the deduplicated text set.
  • the deduplicated text set is further deduplicated.
  • the event argument metamodel includes, but is not limited to, the Event Extraction model, the nlp model and the lstm-crf model.
  • the event argument metamodel can be used to extract events from the deduplicated text set.
  • de-duplicated text A and de-duplicated text B there are de-duplicated text A and de-duplicated text B in the de-duplicated text set, and the event argument model is used to extract events from de-duplicated text A and de-duplicated text B. Both describe the award information, all the winners are Xiao Zhang, and the awards are all three-good students. If it is determined that the deduplicated text A and the deduplicated text B are coincident, then any text in the deduplicated text A and the deduplicated text B will be checked. delete.
  • FIG. 2 it is a functional block diagram of a text deduplication device provided by an embodiment of the present application.
  • the text deduplication apparatus 100 described in this application can be installed in an electronic device.
  • the text deduplication device 100 may include a text acquisition module 101, a text segmentation module 102, a fingerprint construction module 103, a first deduplication module 104, a sentence cutting module 105, a coincident word strength calculation module 106, a first deduplication module 104, a The second deduplication module 107 .
  • the modules described in this application may also be referred to as units, which refer to a series of computer program segments that can be executed by the processor of an electronic device and can perform fixed functions, and are stored in the memory of the electronic device.
  • each module/unit is as follows:
  • the text obtaining module 101 is configured to obtain a plurality of texts to be deduplicated, and collect the plurality of texts to be deduplicated into a corpus.
  • the multiple texts to be deduplicated may be any textual texts, for example, news texts of multiple pieces of news.
  • a python statement with a data capture function can be used to obtain the text to be deduplicated from the blockchain node used for storing the text to be deduplicated, and the high throughput of the blockchain node for data can be used. Improve the efficiency of obtaining text to be deduplicated.
  • collecting the multiple texts to be deduplicated into a corpus that is, collecting the contents of the multiple texts to be deduplicated to obtain a corpus containing all the contents of the texts to be deduplicated, for example, a plurality of texts to be deduplicated
  • the heavy text includes text A, text B and text C, then the contents of text A, text B and text C are collected to obtain a corpus.
  • the text word segmentation module 102 is configured to perform word segmentation processing on each of the multiple texts to be deduplicated, and obtain a text segmentation corresponding to each text to be deduplicated.
  • the text word segmentation module 102 is specifically used for:
  • the pre-set standard thesaurus is used to perform word segmentation on the text to be deduplicated after the stop words are deleted, and the text segmentation is obtained.
  • the preset stop thesaurus and the preset standard thesaurus are thesaurus containing multiple word segmentations.
  • the preset stop word database stores word segmentations of multiple stop words, for example, “Sur” and “Ruci”.
  • the preset standard thesaurus contains multiple non-stop word segmentations, for example, "eat”, “sleep”.
  • This embodiment of the present application performs word segmentation processing on the text to be deduplicated, and can divide multiple texts with large lengths to be deduplicated into text word segmentation, and processing multiple word segmentations is more efficient than directly processing multiple texts to be deduplicated. and higher accuracy.
  • the fingerprint construction module 103 is configured to construct a text fingerprint of the text to be deduplicated corresponding to the text segmentation according to the corpus.
  • the fingerprint construction module 103 is specifically used for:
  • a preset number of text word segmentations are screened as fingerprint word segmentation
  • Hash conversion is performed on the fingerprint word segmentation to obtain a text fingerprint.
  • the word segmentation frequency analysis is performed on the text segmentation according to the text to be deduplicated corresponding to the text segmentation, that is, the frequency of the text segmentation corresponding to the text segmentation is calculated by using a preset first frequency algorithm. The frequency of occurrences in the text to be deduplicated.
  • the word segmentation frequency analysis is performed on the text segmentation according to the text to be deduplicated corresponding to the text segmentation, and the word frequency of the segmentation is obtained, including:
  • tf m is the word frequency of the m-th text segment
  • n is the number of times the m-th text segment appears in the text to be deduplicated corresponding to the m-th text segment
  • k is the m-th text The number of all text word segmentations in the text to be deduplicated corresponding to the word segmentation.
  • the word frequency of word segmentation may indicate the importance of the text word segmentation in the text to be deduplicated corresponding to the text segmentation. The greater the word frequency of word segmentation, the more important the word segmentation of the text is.
  • the document frequency analysis is performed on the text word segmentation according to the corpus, that is, the frequency of occurrence of the text word segmentation in all the texts to be deduplicated in the corpus is calculated by using a preset second frequency algorithm .
  • the document frequency analysis is performed on the text word segmentation according to the corpus to obtain the document word frequency, including:
  • idf m is the document word frequency of the mth text segment
  • is the number of texts to be deduplicated in the corpus
  • is the number of texts to be deduplicated including the mth text segment
  • is the pre- Set the offset correction coefficient, usually 1.
  • the word segmentation index for constructing the text word segmentation according to the word segmentation word frequency and the document word frequency includes:
  • index algorithm is used to calculate the word segmentation index of each word segment in the multiple text word segments:
  • tf_idf m is the word segmentation index
  • tf m is the word frequency of the m-th text segmentation
  • idf m is the document word frequency of the m-th text segmentation.
  • the word segmentation index may represent the representativeness of the text corresponding to the text segmentation in all the texts in the corpus, that is, when the word segmentation index is larger, it indicates that the text segmentation corresponds to the text segmentation. The more representative the deduplicated text is.
  • a preset number of text segmentations are selected as fingerprint segmentation, that is, all text segmentations are sorted according to the size of the word segmentation index, and a preset number of word segmentations are selected sequentially from front to back.
  • Text segmentation is fingerprint segmentation. For example, there are text segmentation 1, text segmentation 2, text segmentation 3, text segmentation 4, text segmentation 5, and text segmentation 6.
  • the segmentation index of text segmentation 1 is 80, and the segmentation index of text segmentation 2 is 70, the segmentation index of text segmentation 3 is 60, the segmentation index of text segmentation 4 is 50, the segmentation index of text segmentation 5 is 40, and the segmentation index of text segmentation 6 is 30.
  • the preset number is 3, select text segmentation 1. Text segmentation 2 and text segmentation 3 are used as fingerprint segmentation.
  • performing hash conversion on the fingerprint word segmentation to obtain a text fingerprint includes: using a preset hash algorithm to calculate the fingerprint word segmentation, and using the calculated hash value of the text word segmentation as The text fingerprint of the text to be deduplicated corresponding to the text word segmentation.
  • the hash algorithm includes but is not limited to MD3 value algorithm and MD5 value algorithm.
  • the first deduplication module 104 is configured to perform overlapping and deduplication on the plurality of texts to be deduplicated according to the text fingerprint to obtain a plurality of preliminary deduplication texts.
  • the first deduplication module 104 is specifically used for:
  • the text fingerprint is divided into fingerprints at equal intervals to obtain four fingerprint segments of "1010", “1101”, “0011” and “0110”, and the fingerprints are divided in order.
  • the segment is position-coded to obtain four coded segments: position 1: “1010", position 2: “1101”, position 3: “0011”, position 4: "0110".
  • the calculation of the degree of coincidence between the coding segments coded at the same position includes:
  • R is any one of the encoded segments
  • S is an encoded segment with the same position encoding as R
  • Pearson is a similarity operation
  • Sim is the degree of coincidence between R and S.
  • the duplicate texts in the multiple texts to be deduplicated are deleted to obtain a plurality of preliminary deduplicated texts, including:
  • the sentence-cutting module 105 is used for sentence-cutting each text in the plurality of preliminary deduplicated texts to obtain a text sentence of each preliminary deduplicated text.
  • the sentence cutting module 105 is specifically used for:
  • the plurality of preliminary deduplicated texts are segmented according to the positions of the clauses, so as to obtain text segments of each preliminary deduplicated text.
  • the clause can be preset, for example, a comma "," in a plurality of preliminary deduplicated texts is used as a clause, or a period ".” in a plurality of deduplicated texts is used as a clause character, so as to realize the segmentation of multiple preliminary deduplication texts.
  • the text fingerprints are used to deduplicate multiple texts to be deduplicated to obtain a plurality of preliminary deduplicated texts, and only the texts in the multiple to-be-duplicated texts can be removed.
  • There is an overall overlap for example, there are text A, text B and text C, where the text fingerprint of text A is consistent with the text fingerprint of text B, then delete text A and text B with shorter text lengths. Therefore, in this embodiment of the present application, the obtained preliminary deduplicated texts are segmented into sentences, so as to implement sentence-granularity text deduplication for the plurality of preliminary deduplicated texts, thereby improving the accuracy of text deduplication.
  • the overlapping word strength calculation module 106 is configured to calculate the overlapping word granularity between each of the text clauses.
  • the overlapping character strength calculation module 106 is specifically used for:
  • the coincidence word granularity of the target sentence and the unselected sentence in the text sentence is calculated.
  • Z is the granularity of the overlapping words
  • T is the total number of words in the target clause
  • t i is the number of words in the unselected i-th clause in the text clause that overlaps with the target clause.
  • the second deduplication module 107 performs range deduplication on the plurality of preliminary deduplicated texts according to the coincident word granularity to obtain a deduplicated text set.
  • the range deduplication refers to deduplication of overlapping sentences existing in the plurality of preliminary deduplicated texts according to the calculated overlapping word granularity, thereby improving the accuracy of deduplication.
  • the second deduplication module 107 is specifically used for:
  • preliminary de-duplicated text A includes text clause a
  • preliminary de-duplicated text B includes text clause b
  • preliminary de-duplicated text A includes text clause b
  • text C contains text clause c, wherein the coincidence word granularity between text clause a and text clause b is 80, and the coincidence word granularity between text clause a and text clause c is 30.
  • word granularity threshold is 50
  • filter out text clause a and text clause b and traverse the text clause a and text clause b to obtain the sentence length of text clause a and the sentence length of text clause b.
  • the length is 7.
  • the preset sentence length threshold is 6, the text clause a is deleted and the text clause b is retained to obtain the deduplicated text set.
  • the embodiment of the present application also includes using a preset event argument model to extract optional events from the deduplicated text set, and find out the texts in the deduplicated text set that are inconsistent in expression but have consistent actual semantics according to the event extraction result, so as to identify the texts in the deduplicated text set.
  • the deduplicated text set is further deduplicated.
  • the event argument metamodel includes, but is not limited to, the Event Extraction model, the nlp model and the lstm-crf model.
  • the event argument metamodel can be used to extract events from the deduplicated text set.
  • de-duplicated text A and de-duplicated text B there are de-duplicated text A and de-duplicated text B in the de-duplicated text set, and the event argument model is used to extract events from de-duplicated text A and de-duplicated text B. Both describe the award information, all the winners are Xiao Zhang, and the awards are all three-good students. If it is determined that the deduplicated text A and the deduplicated text B are coincident, then any text in the deduplicated text A and the deduplicated text B will be checked. delete.
  • FIG. 3 it is a schematic structural diagram of an electronic device for implementing a method for deduplicating text provided by an embodiment of the present application.
  • the electronic device 1 may include a processor 10 , a memory 11 and a bus, and may also include a computer program stored in the memory 11 and executable on the processor 10 , such as a text deduplication program 12 .
  • the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, magnetic disk, CD etc.
  • the memory 11 may be an internal storage unit of the electronic device 1 in some embodiments, such as a mobile hard disk of the electronic device 1 .
  • the memory 11 may also be an external storage device of the electronic device 1, such as a pluggable mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital) equipped on the electronic device 1. , SD) card, flash memory card (Flash Card), etc.
  • the memory 11 may also include both an internal storage unit of the electronic device 1 and an external storage device.
  • the memory 11 can not only be used to store application software installed in the electronic device 1 and various types of data, such as the code of the text deduplication program 12, etc., but also can be used to temporarily store data that has been output or will be output.
  • the processor 10 may be composed of integrated circuits, for example, may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits packaged with the same function or different functions, including one or more integrated circuits.
  • Central Processing Unit CPU
  • microprocessor digital processing chip
  • graphics processor and combination of various control chips, etc.
  • the processor 10 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect the various components of the entire electronic device, by running or executing programs or modules (such as text) stored in the memory 11. Deduplication programs, etc.), and call data stored in the memory 11 to perform various functions of the electronic device 1 and process data.
  • the bus may be a peripheral component interconnect (PCI for short) bus or an extended industry standard architecture (Extended industry standard architecture, EISA for short) bus or the like.
  • PCI peripheral component interconnect
  • EISA Extended industry standard architecture
  • the bus can be divided into address bus, data bus, control bus and so on.
  • the bus is configured to implement connection communication between the memory 11 and at least one processor 10 and the like.
  • FIG. 3 only shows an electronic device with components. Those skilled in the art can understand that the structure shown in FIG. 3 does not constitute a limitation on the electronic device 1, and may include fewer or more components than those shown in the figure. components, or a combination of certain components, or a different arrangement of components.
  • the electronic device 1 may also include a power source (such as a battery) for powering the various components, preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power source can be managed by the power source.
  • the device implements functions such as charge management, discharge management, and power consumption management.
  • the power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and any other components.
  • the electronic device 1 may further include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
  • the electronic device 1 may also include a network interface, optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used in the electronic device 1 Establish a communication connection with other electronic devices.
  • a network interface optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used in the electronic device 1 Establish a communication connection with other electronic devices.
  • the electronic device 1 may further include a user interface, and the user interface may be a display (Display), an input unit (eg, a keyboard (Keyboard)), optionally, the user interface may also be a standard wired interface or a wireless interface.
  • the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, and the like.
  • the display may also be appropriately called a display screen or a display unit, for displaying information processed in the electronic device 1 and for displaying a visual user interface.
  • the text deduplication program 12 stored in the memory 11 in the electronic device 1 is a combination of multiple instructions, and when running in the processor 10, it can realize:
  • the multiple texts to be deduplicated are overlapped and deduplicated according to the text fingerprint to obtain a plurality of preliminary deduplicated texts;
  • Sectioning is performed on each text in the plurality of preliminary de-duplicated texts to obtain text clauses of each preliminary de-duplicated text;
  • the modules/units integrated in the electronic device 1 may be stored in a computer-readable storage medium.
  • the computer-readable storage medium may be volatile or non-volatile.
  • the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a removable hard disk, a magnetic disk, an optical disc, a computer memory, a read-only memory (ROM, Read-Only). Memory).
  • the present application also provides a computer-readable storage medium.
  • the computer-readable storage medium may be volatile or non-volatile.
  • the readable storage medium stores a computer program, and the computer program is stored in the When executed by the processor of the electronic device, it can achieve:
  • the multiple texts to be deduplicated are overlapped and deduplicated according to the text fingerprint to obtain a plurality of preliminary deduplicated texts;
  • Sectioning is performed on each text in the plurality of preliminary de-duplicated texts to obtain text clauses of each preliminary de-duplicated text;
  • modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware, or can be implemented in the form of hardware plus software function modules.
  • the blockchain referred to in this application is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • Blockchain essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify its Validity of information (anti-counterfeiting) and generation of the next block.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种文本去重方法、装置、电子设备以及计算机可读存储介质,用于解决大量文本去重时效率和精确度不高的问题。方法包括:获取多个待去重文本,将多个待去重文本汇集为语料库(S1);对多个待去重文本进行分词得到文本分词(S2);根据语料库构建文本分词对应的待去重文本的文本指纹(S3);根据文本指纹对多个待去重文本进行重合去重,得到多个初步去重文本(S4);对多个初步去重文本中各文本进行分句,得到每个初步去重文本的文本分句(S5);计算每个文本分句间的重合字粒度(S6);根据重合字粒度对多个初步去重文本进行范围去重,得到去重文本集(S7)。

Description

文本去重方法、装置、电子设备及计算机可读存储介质
本申请要求于2020年12月31日提交中国专利局、申请号为CN202011637850.4,发明名称为“文本去重方法、装置、电子设备及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及语音语义技术领域,尤其涉及一种文本去重方法、装置、电子设备及计算机可读存储介质。
背景技术
文本去重是自然语言处理领域非常重要的一个部分,互联网存在大量的重复内容网页,无论对于搜索引擎的网页去重和过滤、新闻小说等内容网站的内容反盗版和追踪、还是社交媒体等文本去重和聚类,都需要对网页或者文本进行去重。
发明人意识到目前常用的文本去重方法多为基于文本相似度的文本去重算法,该算法基于自然语言处理模型对文本内容进行分析,进而筛选出相似度较高的文本。但由于该方法对文本的整体内容进行分析计算时会占用大量的计算资源,导致在对海量文本进行去重时,去重的效率低下,且仅对文本整体进行分析去重无法去重文本中细节处的重合,导致了去重的精确度不高。
发明内容
一种文本去重方法,包括:
获取多个待去重文本,将所述多个待去重文本汇集为语料库;
对所述多个待去重文本中各文本进行分词处理,得到每个待去重文本对应的文本分词;
根据所述语料库构建所述文本分词对应的待去重文本的文本指纹;
根据所述文本指纹对所述多个待去重文本进行重合去重,得到多个初步去重文本;
对所述多个初步去重文本中各文本进行分句切割,得到每个初步去重文本的文本分句;
计算每个所述文本分句间的重合字粒度;
根据所述重合字粒度对所述多个初步去重文本进行范围去重,得到去重文本集。
一种文本去重装置,所述装置包括:
文本获取模块,用于获取多个待去重文本,将所述多个待去重文本汇集为语料库;
文本分词模块,用于对所述多个待去重文本中各文本进行分词处理,得到每个待去重文本对应的文本分词;
指纹构建模块,用于根据所述语料库构建所述文本分词对应的待去重文本的文本指纹;
第一去重模块,用于根据所述文本指纹对所述多个待去重文本进行重合去重,得到多个初步去重文本;
分句切割模块,用于对所述多个初步去重文本中各文本进行分句切割,得到每个初步去重文本的文本分句;
重合字力度计算模块,用于计算每个所述文本分句间的重合字粒度;
第二去重模块,根据所述重合字粒度对所述多个初步去重文本进行范围去重,得到去重文本集。
一种电子设备,所述电子设备包括:
存储器,存储至少一个指令;及
处理器,执行所述存储器中存储的指令以实现如下步骤:
获取多个待去重文本,将所述多个待去重文本汇集为语料库;
对所述多个待去重文本中各文本进行分词处理,得到每个待去重文本对应的文本分词;
根据所述语料库构建所述文本分词对应的待去重文本的文本指纹;
根据所述文本指纹对所述多个待去重文本进行重合去重,得到多个初步去重文本;
对所述多个初步去重文本中各文本进行分句切割,得到每个初步去重文本的文本分句;
计算每个所述文本分句间的重合字粒度;
根据所述重合字粒度对所述多个初步去重文本进行范围去重,得到去重文本集。
一种计算机可读存储介质,所述计算机可读存储介质中存储有至少一个指令,所述至少一个指令被电子设备中的处理器执行以实现如下步骤:
获取多个待去重文本,将所述多个待去重文本汇集为语料库;
对所述多个待去重文本中各文本进行分词处理,得到每个待去重文本对应的文本分词;
根据所述语料库构建所述文本分词对应的待去重文本的文本指纹;
根据所述文本指纹对所述多个待去重文本进行重合去重,得到多个初步去重文本;
对所述多个初步去重文本中各文本进行分句切割,得到每个初步去重文本的文本分句;
计算每个所述文本分句间的重合字粒度;
根据所述重合字粒度对所述多个初步去重文本进行范围去重,得到去重文本集。
本申请可以解决大量文本去重时效率和精确度不高的问题。
附图说明
图1为本申请一实施例提供的文本去重方法的流程示意图;
图2为本申请一实施例提供的文本去重装置的功能模块图;
图3为本申请一实施例提供的实现所述文本去重方法的电子设备的结构示意图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请实施例提供一种文本去重方法。所述文本去重方法的执行主体包括但不限于服务端、终端等能够被配置为执行本申请实施例提供的该方法的电子设备中的至少一种。换言之,所述文本去重方法可以由安装在终端设备或服务端设备的软件或硬件来执行,所述软件可以是区块链平台。所述服务端包括但不限于:单台服务器、服务器集群、云端服务器或云端服务器集群等。
参照图1所示,为本申请一实施例提供的文本去重方法的流程示意图。在本实施例中,所述文本去重方法包括:
S1、获取多个待去重文本,将所述多个待去重文本汇集为语料库。
本申请实施例中,所述多个待去重文本可以为任何文字性文本,例如,多条新闻的新闻文本。
详细地,本申请实施例可利用具有数据抓取功能的python语句从用于存储待去重文本的区块链节点中获取待去重文本,利用区块链节点对数据的高吞吐性,可提高获取待去重文本的效率。
具体地,所述将所述多个待去重文本汇集为语料库,即将所述多个待去重文本的内容进行汇集,得到一个包含所有待去重文本内容的语料库,例如,多个待去重文本包括文本A、文本B和文本C,则将文本A、文本B和文本C的内容进行汇集,得到语料库。
S2、对所述多个待去重文本中各文本进行分词处理,得到每个待去重文本对应的文本分词。
本申请实施例中,所述对所述多个待去重文本中各文本进行分词处理,得到每个待去重文本对应的文本分词,包括:
依次从所述多个待去重文本中选取待去重文本;
利用预设停用词库删除被选取的待去重文本中包含的停用词;
利用预设标准词库对删除停用词后的待去重文本进行分词处理,得到文本分词。
具体地,预设停用词库和预设标准词库为包含多个分词的词库。预设停用词库中存储有多个停用词的分词,例如,“率尔”、“如次”。预设标准词库中包含多个非停用词的分词,例如,“吃饭”、“睡觉”。
详细地,每个待去重文本对应的文本分词可以为多个。
本申请实施例对待去重文本进行分词处理,可将长度较大的多个待去重文本划分为文本分词,通过对多个分词进行分析处理相比直接通过多个待去重文本进行处理效率和准确性更高。
S3、根据所述语料库构建所述文本分词对应的待去重文本的文本指纹。
本申请实施例中,所述根据所述语料库构建所述文本分词对应的待去重文本的文本指纹,包括:
根据所述文本分词对应的待去重文本对所述文本分词进行分词频率分析,得到分词词频;
根据所述语料库对所述文本分词进行文件频率分析,得到文件词频;
根据所述分词词频和所述文件词频构建所述文本分词的分词指标;
根据所述分词指标从筛选出预设数量的文本分词为指纹分词;
对所述指纹分词进行哈希转换,得到文本指纹。
本申请实施例中,所述根据所述文本分词对应的待去重文本对所述文本分词进行分词频率分析,即通过预设的第一频率算法计算所述文本分词在所述文本分词对应的待去重文本中出现的频率。
详细地,所述根据所述文本分词对应的待去重文本对所述文本分词进行分词频率分析,得到分词词频,包括:
利用如下第一频率算法计算文本分词的分词词频:
Figure PCTCN2021083711-appb-000001
其中,tf m为第m个文本分词的分词词频,n为所述第m个文本分词在所述第m个文本分词对应的待去重文本中出现的次数,k为所述第m个文本分词对应的待去重文本中所有文本分词的数量。
具体地,所述分词词频可表示文本分词在所述文本分词对应的待去重文本中的重要程度,所述文本分词在所述文本分词对应的待去重文本中出现的次数越多,则分词词频越大,说明所述文本分词越重要。
本申请实施例中,所述根据所述语料库对所述文本分词进行文件频率分析,即通过预设的第二频率算法计算所述文本分词在所述语料库中所有待去重文本中出现的频率。
详细地,所述根据所述语料库对所述文本分词进行文件频率分析,得到文件词频,包括:
利用如下第二频率算法计算文本分词的文件词频:
Figure PCTCN2021083711-appb-000002
其中,idf m为第m个文本分词的文件词频,|D|为所述语料库中待去重文本的数量,|j|为包含第m个文本分词的待去重文本的数量,α为预设偏移校正系数,通常为1。
本申请实施例中,所述根据所述分词词频和所述文件词频构建所述文本分词的分词指标,包括:
利用如下指标算法计算所述多个文本分词中每个分词的分词指标:
tf_idf m=tf m×idf m
其中,tf_idf m为所述分词指标,tf m为第m个文本分词的分词词频,idf m为第m个文本分词的文件词频。
具体地,所述分词指标可表示文本分词在语料库中的所有文本内对文本分词对应的文本的可代表性,即当所述分词指标越大,说明该文本分词对所述文本分词对应的待去重文本的代表性越强。
本申请实施例中,所述根据所述分词指标从筛选出预设数量的文本分词为指纹分词,即按照所述分词指标的大小将所有文本分词进行排序,从前向后依次选取预设数量的文本分词为指纹分词,例如,存在文本分词1、文本分词2、文本分词3、文本分词4、文本分词5和文本分词6,其中,文本分词1的分词指标为80,文本分词2的分词指标为70,文本分词3的分词指标为60,文本分词4的分词指标为50,文本分词5的分词指标为40,文本分词6的分词指标为30,若预设数量为3,则选取文本分词1、文本分词2和文本分词3作为指纹分词。
本申请实施例中,所述对所述指纹分词进行哈希转换,得到文本指纹,包括:利用预设的哈希算法对所述指纹分词进行计算,将计算得到的文本分词的哈希值作为所述文本分词对应的待去重文本的文本指纹。其中,所述哈希算法包括但不限于MD3值算法、MD5值算法。
S4、根据所述文本指纹对所述多个待去重文本进行重合去重,得到多个初步去重文本。
本申请实施例中,所述根据所述文本指纹对所述多个待去重文本进行重合去重,得到多个初步去重文本,包括:
将所述多个待去重文本中每个待去重文本对应的所述文本指纹进行指纹切分,得到指纹分段;
按照切分的顺序将所述指纹分段进行位置编码,得到编码分段;
计算相同位置编码的编码分段之间的重合度;
根据所述重合度对所述多个待去重文本中的重复文本进行删除,得到多个初步去重文本。
例如,存在文本指纹为“1010110100110110”,将该文本指纹按照等间距进行指纹切分,得到“1010”、“1101”、“0011”和“0110”四个指纹分段,并按照顺序将指纹分段进行位置编码得到四个编码分段:位置1:“1010”、位置2:“1101”、位置3:“0011”、位置4:“0110”。
详细地,所述计算相同位置编码的编码分段之间的重合度,包括:
利用如下重合度算法计算相同位置编码的编码分段之间的重合度:
Sim=Pearson(R,S)
其中,R为任一所述编码分段,S为与R具有相同位置编码的编码分段,Pearson为相似运算,Sim为R与S之间的重合度。
进一步地,所述根据所述重合度对所述多个待去重文本中的重复文本进行删除,得到多个初步去重文本,包括:
当相同位置编码的编码分段之间的重合度大于预设的重合阈值时,筛选出所述编码分段对应的待去重文本;
遍历所述编码分段对应的待去重文本,得到每个待去重文本的文本长度;
删除所述编码分段对应的待去重文本中除文本长度小于预设的文本长度阈值的待去重文本之外的所有待去重文本,得到多个初步去重文本。
S5、对所述多个初步去重文本中各文本进行分句切割,得到每个初步去重文本的文本分句。
本申请实施例中,所述对所述多个初步去重文本中各文本进行分句切割,得到每个初步去重文本的文本分句,包括:
遍历所述多个初步去重文本,并确定所述多个初步去重文本中分句符的位置;
根据所述分句符的位置将所述多个初步去重文本进行分句切割,得到每个初步去重文本的文本分句。
详细地,所述分句符可被预先设定,例如,将多个初步去重文本中的逗号“,”作为分句符,或将多个去重文本中的句号“。”作为分句符,以此实现对多个初步去重文本的分句切割。
本申请实施例中,由于文本指纹代表着全文本的特征信息,利用文本指纹对多个待去重文本进行去重,得到多个初步去重文本,只能去除多个待去重文本中文本整体存在重合的情况,例如,存在文本A、文本B和文本C,其中文本A的文本指纹与文本B的文本指纹一致,则删除文本A与文本B中文本长度较短的文本。因此本申请实施例将得到的多个初步去重文本进行分句切割,以实现对多个初步去重文本进行句粒度的文本去重,提高文本去重的精确度。
S6、计算每个所述文本分句间的重合字粒度。
本申请实施例中,所述计算每个所述文本分句间的重合字粒度,包括:
依次从所述文本分句中选取文本分句为目标分句;
利用预设的重合字粒度算法计算所述目标分句与所述文本分句中未被选取的分句的重合字粒度。
例如,存在文本分句1、文本分句2、文本分句3和文本分句4,依次从所述文本分句中选取文本分句1,分别计算文本分句1与文本分句2、文本分句3和文本分句4之间的重合字粒度,再依次选取文本分句2,分别计算文本分句2与文本分句3和文本分句4之间的重合字粒度,再依次选取文本分句3,计算文本分句3与文本分句4之间的重合字粒度。
详细地,所述利用预设的重合字粒度算法计算所述目标分句与所述文本分句中未被选取的分句的重合字粒度,包括:
利用如下重合字粒度算法计算所述目标分句与所述文本分句中未被选取的分句的重合字粒度:
Figure PCTCN2021083711-appb-000003
其中,Z为所述重合字粒度,T为所述目标分句的总字数,t i为所述文本分句中未被选取的第i个分句与所述目标分句重合的字数。
S7、根据所述重合字粒度对所述多个初步去重文本进行范围去重,得到去重文本集。
本申请实施例中,所述范围去重是指根据计算得到的重合字粒度对所述多个初步去重文本中存在的重合语句进行去重,进而提高去重的精确度。
详细地,所述根据所述重合字粒度对所述多个初步去重文本进行范围去重,得到去重文本集,包括:
当所述重合字粒度大于预设的字粒度阈值时,筛选出所述重合字粒度对应的文本分句;
遍历所述重合字粒度对应的文本分句,得到每个文本分句的句子长度;
删除所述重合字粒度对应的文本分句中除句子长度小于预设句子长度阈值的文本分句,得到去重文本集。
例如,存在多个初步去重文本A、初步去重文本B和初步去重文本C,其中,初步去重文本A中包含文本分句a,初步去文本B中包含文本分句b,初步去文本C中包含文本分句c,其中,文本分句a和文本分句b之间的重合字粒度为80,文本分句a与文本分句c之间的重合字粒度为30,当预设的字粒度阈值为50时,筛选出文本分句a和文本分句b,对文本分句a和文本分句b进行遍历,得到文本分句a的句子长度为5,文本分句b的句子长度为7,当预设的句子长度阈值为6时,删除文本分句a,保留文本分句b,得到去重文本集。
进一步地,本申请实施例还包括利用预设的事件论元模型对去重文本集可选事件提取,根据事件提取结果找出去重文本集中表述方式不一致,但实际语义一致的文本,以对去重文本集进行进一步去重。
详细地,所述事件论元模型包括但不限于Event Extraction模型、nlp模型和lstm-crf模型,利用事件论元模型可实现对去重文本集中事件的提取。
例如,去重文本集中存在去重文本A和去重文本B,利用所述事件论元模型对去重文本A与去重文本B进行事件提取后得到,去重文本A与去重文本B中均描述的是获奖信息,获奖人均是小张,所获奖项均为三好学生,则确定去重文本A和去重文本B重合,则对去重文本A和去重文本B中任一文本进行删除。
本申请实施例通过对待去重文本进行分词处理,可将长度较大的多个待去重文本划分为文本分词,通过对多个分词进行分析处理相比直接通过多个待去重文本进行处理效率和准确性更高;通过构建文本指纹进行重合去重,可去除海量文本中文本整体之间的重合文本,避免对海量文本中各文本进行内容分析,有利于提高对海量文本的去重效率;通过分句切割,计算重合字粒度来对多个初步去重文本中存在的重合语句进行去重,实现了文本中句子粒度的去重,提高去重的精确度。因此本申请提出的文本去重方法,可以解决大量文本去重时效率和精确度不高的问题。
如图2所示,是本申请一实施例提供的文本去重装置的功能模块图。
本申请所述文本去重装置100可以安装于电子设备中。根据实现的功能,所述文本去重装置100可以包括文本获取模块101、文本分词模块102、指纹构建模块103、第一去重模块104、分句切割模块105、重合字力度计算模块106、第二去重模块107。本申请所述模块也可以称之为单元,是指一种能够被电子设备处理器所执行,并且能够完成固定功能的一系列计算机程序段,其存储在电子设备的存储器中。
在本实施例中,关于各模块/单元的功能如下:
所述文本获取模块101,用于获取多个待去重文本,将所述多个待去重文本汇集为语料库。
本申请实施例中,所述多个待去重文本可以为任何文字性文本,例如,多条新闻的新闻文本。
详细地,本申请实施例可利用具有数据抓取功能的python语句从用于存储待去重文本的区块链节点中获取待去重文本,利用区块链节点对数据的高吞吐性,可提高获取待去重文本的效率。
具体地,所述将所述多个待去重文本汇集为语料库,即将所述多个待去重文本的内容进行汇集,得到一个包含所有待去重文本内容的语料库,例如,多个待去重文本包括文本A、文本B和文本C,则将文本A、文本B和文本C的内容进行汇集,得到语料库。
所述文本分词模块102,用于对所述多个待去重文本中各文本进行分词处理,得到每个待去重文本对应的文本分词。
本申请实施例中,所述文本分词模块102具体用于:
依次从所述多个待去重文本中选取待去重文本;
利用预设停用词库删除被选取的待去重文本中包含的停用词;
利用预设标准词库对删除停用词后的待去重文本进行分词处理,得到文本分词。
具体地,预设停用词库和预设标准词库为包含多个分词的词库。预设停用词库中存储有多个停用词的分词,例如,“率尔”、“如次”。预设标准词库中包含多个非停用词的分词,例如,“吃饭”、“睡觉”。
详细地,每个待去重文本对应的文本分词可以为多个。
本申请实施例对待去重文本进行分词处理,可将长度较大的多个待去重文本划分为文本分词,通过对多个分词进行分析处理相比直接通过多个待去重文本进行处理效率和准确 性更高。
所述指纹构建模块103,用于根据所述语料库构建所述文本分词对应的待去重文本的文本指纹。
本申请实施例中,所述指纹构建模块103具体用于:
根据所述文本分词对应的待去重文本对所述文本分词进行分词频率分析,得到分词词频;
根据所述语料库对所述文本分词进行文件频率分析,得到文件词频;
根据所述分词词频和所述文件词频构建所述文本分词的分词指标;
根据所述分词指标从筛选出预设数量的文本分词为指纹分词;
对所述指纹分词进行哈希转换,得到文本指纹。
本申请实施例中,所述根据所述文本分词对应的待去重文本对所述文本分词进行分词频率分析,即通过预设的第一频率算法计算所述文本分词在所述文本分词对应的待去重文本中出现的频率。
详细地,所述根据所述文本分词对应的待去重文本对所述文本分词进行分词频率分析,得到分词词频,包括:
利用如下第一频率算法计算文本分词的分词词频:
Figure PCTCN2021083711-appb-000004
其中,tf m为第m个文本分词的分词词频,n为所述第m个文本分词在所述第m个文本分词对应的待去重文本中出现的次数,k为所述第m个文本分词对应的待去重文本中所有文本分词的数量。
具体地,所述分词词频可表示文本分词在所述文本分词对应的待去重文本中的重要程度,所述文本分词在所述文本分词对应的待去重文本中出现的次数越多,则分词词频越大,说明所述文本分词越重要。
本申请实施例中,所述根据所述语料库对所述文本分词进行文件频率分析,即通过预设的第二频率算法计算所述文本分词在所述语料库中所有待去重文本中出现的频率。
详细地,所述根据所述语料库对所述文本分词进行文件频率分析,得到文件词频,包括:
利用如下第二频率算法计算文本分词的文件词频:
Figure PCTCN2021083711-appb-000005
其中,idf m为第m个文本分词的文件词频,|D|为所述语料库中待去重文本的数量,|j|为包含第m个文本分词的待去重文本的数量,α为预设偏移校正系数,通常为1。
本申请实施例中,所述根据所述分词词频和所述文件词频构建所述文本分词的分词指标,包括:
利用如下指标算法计算所述多个文本分词中每个分词的分词指标:
tf_idf m=tf m×idf m
其中,tf_idf m为所述分词指标,tf m为第m个文本分词的分词词频,idf m为第m个文本分词的文件词频。
具体地,所述分词指标可表示文本分词在语料库中的所有文本内对文本分词对应的文本的可代表性,即当所述分词指标越大,说明该文本分词对所述文本分词对应的待去重文本的代表性越强。
本申请实施例中,所述根据所述分词指标从筛选出预设数量的文本分词为指纹分词,即按照所述分词指标的大小将所有文本分词进行排序,从前向后依次选取预设数量的文本分词为指纹分词,例如,存在文本分词1、文本分词2、文本分词3、文本分词4、文本分词5和文本分词6,其中,文本分词1的分词指标为80,文本分词2的分词指标为70,文 本分词3的分词指标为60,文本分词4的分词指标为50,文本分词5的分词指标为40,文本分词6的分词指标为30,若预设数量为3,则选取文本分词1、文本分词2和文本分词3作为指纹分词。
本申请实施例中,所述对所述指纹分词进行哈希转换,得到文本指纹,包括:利用预设的哈希算法对所述指纹分词进行计算,将计算得到的文本分词的哈希值作为所述文本分词对应的待去重文本的文本指纹。其中,所述哈希算法包括但不限于MD3值算法、MD5值算法。
所述第一去重模块104,用于根据所述文本指纹对所述多个待去重文本进行重合去重,得到多个初步去重文本。
本申请实施例中,所述第一去重模块104具体用于:
将所述多个待去重文本中每个待去重文本对应的所述文本指纹进行指纹切分,得到指纹分段;
按照切分的顺序将所述指纹分段进行位置编码,得到编码分段;
计算相同位置编码的编码分段之间的重合度;
根据所述重合度对所述多个待去重文本中的重复文本进行删除,得到多个初步去重文本。
例如,存在文本指纹为“1010110100110110”,将该文本指纹按照等间距进行指纹切分,得到“1010”、“1101”、“0011”和“0110”四个指纹分段,并按照顺序将指纹分段进行位置编码得到四个编码分段:位置1:“1010”、位置2:“1101”、位置3:“0011”、位置4:“0110”。
详细地,所述计算相同位置编码的编码分段之间的重合度,包括:
利用如下重合度算法计算相同位置编码的编码分段之间的重合度:
Sim=Pearson(R,S)
其中,R为任一所述编码分段,S为与R具有相同位置编码的编码分段,Pearson为相似运算,Sim为R与S之间的重合度。
进一步地,所述根据所述重合度对所述多个待去重文本中的重复文本进行删除,得到多个初步去重文本,包括:
当相同位置编码的编码分段之间的重合度大于预设的重合阈值时,筛选出所述编码分段对应的待去重文本;
遍历所述编码分段对应的待去重文本,得到每个待去重文本的文本长度;
删除所述编码分段对应的待去重文本中除文本长度小于预设的文本长度阈值的待去重文本之外的所有待去重文本,得到多个初步去重文本。
所述分句切割模块105,用于对所述多个初步去重文本中各文本进行分句切割,得到每个初步去重文本的文本分句。
本申请实施例中,所述分句切割模块105具体用于:
遍历所述多个初步去重文本,并确定所述多个初步去重文本中分句符的位置;
根据所述分句符的位置将所述多个初步去重文本进行分句切割,得到每个初步去重文本的文本分句。
详细地,所述分句符可被预先设定,例如,将多个初步去重文本中的逗号“,”作为分句符,或将多个去重文本中的句号“。”作为分句符,以此实现对多个初步去重文本的分句切割。
本申请实施例中,由于文本指纹代表着全文本的特征信息,利用文本指纹对多个待去重文本进行去重,得到多个初步去重文本,只能去除多个待去重文本中文本整体存在重合的情况,例如,存在文本A、文本B和文本C,其中文本A的文本指纹与文本B的文本指纹一致,则删除文本A与文本B中文本长度较短的文本。因此本申请实施例将得到的多个初步去重文本进行分句切割,以实现对多个初步去重文本进行句粒度的文本去重,提高文 本去重的精确度。
所述重合字力度计算模块106,用于计算每个所述文本分句间的重合字粒度。
本申请实施例中,所述重合字力度计算模块106具体用于:
依次从所述文本分句中选取文本分句为目标分句;
利用预设的重合字粒度算法计算所述目标分句与所述文本分句中未被选取的分句的重合字粒度。
例如,存在文本分句1、文本分句2、文本分句3和文本分句4,依次从所述文本分句中选取文本分句1,分别计算文本分句1与文本分句2、文本分句3和文本分句4之间的重合字粒度,再依次选取文本分句2,分别计算文本分句2与文本分句3和文本分句4之间的重合字粒度,再依次选取文本分句3,计算文本分句3与文本分句4之间的重合字粒度。
详细地,所述利用预设的重合字粒度算法计算所述目标分句与所述文本分句中未被选取的分句的重合字粒度,包括:
利用如下重合字粒度算法计算所述目标分句与所述文本分句中未被选取的分句的重合字粒度:
Figure PCTCN2021083711-appb-000006
其中,Z为所述重合字粒度,T为所述目标分句的总字数,t i为所述文本分句中未被选取的第i个分句与所述目标分句重合的字数。
所述第二去重模块107,根据所述重合字粒度对所述多个初步去重文本进行范围去重,得到去重文本集。
本申请实施例中,所述范围去重是指根据计算得到的重合字粒度对所述多个初步去重文本中存在的重合语句进行去重,进而提高去重的精确度。
详细地,所述第二去重模块107具体用于:
当所述重合字粒度大于预设的字粒度阈值时,筛选出所述重合字粒度对应的文本分句;
遍历所述重合字粒度对应的文本分句,得到每个文本分句的句子长度;
删除所述重合字粒度对应的文本分句中除句子长度小于预设句子长度阈值的文本分句,得到去重文本集。
例如,存在多个初步去重文本A、初步去重文本B和初步去重文本C,其中,初步去重文本A中包含文本分句a,初步去文本B中包含文本分句b,初步去文本C中包含文本分句c,其中,文本分句a和文本分句b之间的重合字粒度为80,文本分句a与文本分句c之间的重合字粒度为30,当预设的字粒度阈值为50时,筛选出文本分句a和文本分句b,对文本分句a和文本分句b进行遍历,得到文本分句a的句子长度为5,文本分句b的句子长度为7,当预设的句子长度阈值为6时,删除文本分句a,保留文本分句b,得到去重文本集。
进一步地,本申请实施例还包括利用预设的事件论元模型对去重文本集可选事件提取,根据事件提取结果找出去重文本集中表述方式不一致,但实际语义一致的文本,以对去重文本集进行进一步去重。
详细地,所述事件论元模型包括但不限于Event Extraction模型、nlp模型和lstm-crf模型,利用事件论元模型可实现对去重文本集中事件的提取。
例如,去重文本集中存在去重文本A和去重文本B,利用所述事件论元模型对去重文本A与去重文本B进行事件提取后得到,去重文本A与去重文本B中均描述的是获奖信息,获奖人均是小张,所获奖项均为三好学生,则确定去重文本A和去重文本B重合,则对去重文本A和去重文本B中任一文本进行删除。
本申请实施例通过对待去重文本进行分词处理,可将长度较大的多个待去重文本划分 为文本分词,通过对多个分词进行分析处理相比直接通过多个待去重文本进行处理效率和准确性更高;通过构建文本指纹进行重合去重,可去除海量文本中文本整体之间的重合文本,避免对海量文本中各文本进行内容分析,有利于提高对海量文本的去重效率;通过分句切割,计算重合字粒度来对多个初步去重文本中存在的重合语句进行去重,实现了文本中句子粒度的去重,提高去重的精确度。因此本申请提出的文本去重装置,可以解决大量文本去重时效率和精确度不高的问题。
如图3所示,是本申请一实施例提供的实现文本去重方法的电子设备的结构示意图。
所述电子设备1可以包括处理器10、存储器11和总线,还可以包括存储在所述存储器11中并可在所述处理器10上运行的计算机程序,如文本去重程序12。
其中,所述存储器11至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、移动硬盘、多媒体卡、卡型存储器(例如:SD或DX存储器等)、磁性存储器、磁盘、光盘等。所述存储器11在一些实施例中可以是电子设备1的内部存储单元,例如该电子设备1的移动硬盘。所述存储器11在另一些实施例中也可以是电子设备1的外部存储设备,例如电子设备1上配备的插接式移动硬盘、智能存储卡(Smart Media Card,SMC)、安全数字(Secure Digital,SD)卡、闪存卡(Flash Card)等。进一步地,所述存储器11还可以既包括电子设备1的内部存储单元也包括外部存储设备。所述存储器11不仅可以用于存储安装于电子设备1的应用软件及各类数据,例如文本去重程序12的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。
所述处理器10在一些实施例中可以由集成电路组成,例如可以由单个封装的集成电路所组成,也可以是由多个相同功能或不同功能封装的集成电路所组成,包括一个或者多个中央处理器(Central Processing unit,CPU)、微处理器、数字处理芯片、图形处理器及各种控制芯片的组合等。所述处理器10是所述电子设备的控制核心(Control Unit),利用各种接口和线路连接整个电子设备的各个部件,通过运行或执行存储在所述存储器11内的程序或者模块(例如文本去重程序等),以及调用存储在所述存储器11内的数据,以执行电子设备1的各种功能和处理数据。
所述总线可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。该总线可以分为地址总线、数据总线、控制总线等。所述总线被设置为实现所述存储器11以及至少一个处理器10等之间的连接通信。
图3仅示出了具有部件的电子设备,本领域技术人员可以理解的是,图3示出的结构并不构成对所述电子设备1的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。
例如,尽管未示出,所述电子设备1还可以包括给各个部件供电的电源(比如电池),优选地,电源可以通过电源管理装置与所述至少一个处理器10逻辑相连,从而通过电源管理装置实现充电管理、放电管理、以及功耗管理等功能。电源还可以包括一个或一个以上的直流或交流电源、再充电装置、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。所述电子设备1还可以包括多种传感器、蓝牙模块、Wi-Fi模块等,在此不再赘述。
进一步地,所述电子设备1还可以包括网络接口,可选地,所述网络接口可以包括有线接口和/或无线接口(如WI-FI接口、蓝牙接口等),通常用于在该电子设备1与其他电子设备之间建立通信连接。
可选地,该电子设备1还可以包括用户接口,用户接口可以是显示器(Display)、输入单元(比如键盘(Keyboard)),可选地,用户接口还可以是标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可 以适当的称为显示屏或显示单元,用于显示在电子设备1中处理的信息以及用于显示可视化的用户界面。
应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构的限制。
所述电子设备1中的所述存储器11存储的文本去重程序12是多个指令的组合,在所述处理器10中运行时,可以实现:
获取多个待去重文本,将所述多个待去重文本汇集为语料库;
对所述多个待去重文本中各文本进行分词处理,得到每个待去重文本对应的文本分词;
根据所述语料库构建所述文本分词对应的待去重文本的文本指纹;
根据所述文本指纹对所述多个待去重文本进行重合去重,得到多个初步去重文本;
对所述多个初步去重文本中各文本进行分句切割,得到每个初步去重文本的文本分句;
计算每个所述文本分句间的重合字粒度;
根据所述重合字粒度对所述多个初步去重文本进行范围去重,得到去重文本集。
具体地,所述处理器10对上述指令的具体实现方法可参考图1对应实施例中相关步骤的描述,在此不赘述。
进一步地,所述电子设备1集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读存储介质中。所述计算机可读存储介质可以是易失性的,也可以是非易失性的。例如,所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)。
本申请还提供一种计算机可读存储介质,所述计算机可读存储介质可以是易失性的,也可以是非易失性的,所述可读存储介质存储有计算机程序,所述计算机程序在被电子设备的处理器所执行时,可以实现:
获取多个待去重文本,将所述多个待去重文本汇集为语料库;
对所述多个待去重文本中各文本进行分词处理,得到每个待去重文本对应的文本分词;
根据所述语料库构建所述文本分词对应的待去重文本的文本指纹;
根据所述文本指纹对所述多个待去重文本进行重合去重,得到多个初步去重文本;
对所述多个初步去重文本中各文本进行分句切割,得到每个初步去重文本的文本分句;
计算每个所述文本分句间的重合字粒度;
根据所述重合字粒度对所述多个初步去重文本进行范围去重,得到去重文本集。
在本申请所提供的几个实施例中,应该理解到,所揭露的设备,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。
对于本领域技术人员而言,显然本申请不限于上述示范性实施例的细节,而且在不背离本申请的精神或基本特征的情况下,能够以其他的具体形式实现本申请。
因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申请的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本申请内。不应将权利要求中的任何附关联图标记视为限制所涉及的权利要求。
本申请所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技 术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。
此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。系统权利要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第二等词语用来表示名称,而并不表示任何特定的顺序。
最后应说明的是,以上实施例仅用以说明本申请的技术方案而非限制,尽管参照较佳实施例对本申请进行了详细说明,本领域的普通技术人员应当理解,可以对本申请的技术方案进行修改或等同替换,而不脱离本申请技术方案的精神和范围。

Claims (20)

  1. 一种文本去重方法,其中,所述方法包括:
    获取多个待去重文本,将所述多个待去重文本汇集为语料库;
    对所述多个待去重文本中各文本进行分词处理,得到每个待去重文本对应的文本分词;
    根据所述语料库构建所述文本分词对应的待去重文本的文本指纹;
    根据所述文本指纹对所述多个待去重文本进行重合去重,得到多个初步去重文本;
    对所述多个初步去重文本中各文本进行分句切割,得到每个初步去重文本的文本分句;
    计算每个所述文本分句间的重合字粒度;
    根据所述重合字粒度对所述多个初步去重文本进行范围去重,得到去重文本集。
  2. 如权利要求1所述的文本去重方法,其中,所述对所述多个待去重文本中各文本进行分词处理,得到每个待去重文本对应的文本分词,包括:
    依次从所述多个待去重文本中选取待去重文本;
    利用预设停用词库删除被选取的待去重文本中包含的停用词;
    利用预设标准词库对删除停用词后的待去重文本进行分词处理,得到文本分词。
  3. 如权利要求1所述的文本去重方法,其中,所述根据所述语料库构建所述文本分词对应的待去重文本的文本指纹,包括:
    根据所述文本分词对应的待去重文本对所述文本分词进行分词频率分析,得到分词词频;
    根据所述语料库对所述文本分词进行文件频率分析,得到文件词频;
    根据所述分词词频和所述文件词频构建所述文本分词的分词指标;
    根据所述分词指标从筛选出预设数量的文本分词为指纹分词;
    对所述指纹分词进行哈希转换,得到文本指纹。
  4. 如权利要求1所述的文本去重方法,其中,所述根据所述文本指纹对所述多个待去重文本进行重合去重,得到多个初步去重文本,包括:
    将所述多个待去重文本中每个待去重文本对应的所述文本指纹进行指纹切分,得到指纹分段;
    按照切分的顺序将所述指纹分段进行位置编码,得到编码分段;
    计算相同位置编码的编码分段之间的重合度;
    根据所述重合度对所述多个待去重文本中的重复文本进行删除,得到多个初步去重文本。
  5. 如权利要求4所述的文本去重方法,其中,所述根据所述重合度对所述多个待去重文本中的重复文本进行删除,得到多个初步去重文本,包括:
    当相同位置编码的编码分段之间的重合度大于预设的重合阈值时,筛选出所述编码分段对应的待去重文本;
    遍历所述编码分段对应的待去重文本,得到每个待去重文本的文本长度;
    删除所述编码分段对应的待去重文本中除文本长度小于预设的文本长度阈值的待去重文本之外的所有待去重文本,得到多个初步去重文本。
  6. 如权利要求1至5中任一项所述的文本去重方法,其中,所述对所述多个初步去重文本中各文本进行分句切割,得到每个初步去重文本的文本分句,包括:
    遍历所述多个初步去重文本,并确定所述多个初步去重文本中分句符的位置;
    根据所述分句符的位置将所述多个初步去重文本进行分句切割,得到每个初步去重文本的文本分句。
  7. 如权利要求1至5中任一项所述的文本去重方法,其中,所述计算每个所述文本分句间的重合字粒度,包括:
    依次从所述文本分句中选取文本分句为目标分句;
    利用预设的重合字粒度算法计算所述目标分句与所述文本分句中未被选取的分句的重合字粒度。
  8. 一种文本去重装置,其中,所述装置包括:
    文本获取模块,用于获取多个待去重文本,将所述多个待去重文本汇集为语料库;
    文本分词模块,用于对所述多个待去重文本中各文本进行分词处理,得到每个待去重文本对应的文本分词;
    指纹构建模块,用于根据所述语料库构建所述文本分词对应的待去重文本的文本指纹;
    第一去重模块,用于根据所述文本指纹对所述多个待去重文本进行重合去重,得到多个初步去重文本;
    分句切割模块,用于对所述多个初步去重文本中各文本进行分句切割,得到每个初步去重文本的文本分句;
    重合字力度计算模块,用于计算每个所述文本分句间的重合字粒度;
    第二去重模块,根据所述重合字粒度对所述多个初步去重文本进行范围去重,得到去重文本集。
  9. 一种电子设备,其中,所述电子设备包括:
    至少一个处理器;以及,
    与所述至少一个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如下步骤:
    获取多个待去重文本,将所述多个待去重文本汇集为语料库;
    对所述多个待去重文本中各文本进行分词处理,得到每个待去重文本对应的文本分词;
    根据所述语料库构建所述文本分词对应的待去重文本的文本指纹;
    根据所述文本指纹对所述多个待去重文本进行重合去重,得到多个初步去重文本;
    对所述多个初步去重文本中各文本进行分句切割,得到每个初步去重文本的文本分句;
    计算每个所述文本分句间的重合字粒度;
    根据所述重合字粒度对所述多个初步去重文本进行范围去重,得到去重文本集。
  10. 如权利要求9所述的电子设备,其中,所述对所述多个待去重文本中各文本进行分词处理,得到每个待去重文本对应的文本分词,包括:
    依次从所述多个待去重文本中选取待去重文本;
    利用预设停用词库删除被选取的待去重文本中包含的停用词;
    利用预设标准词库对删除停用词后的待去重文本进行分词处理,得到文本分词。
  11. 如权利要求9所述的电子设备,其中,所述根据所述语料库构建所述文本分词对应的待去重文本的文本指纹,包括:
    根据所述文本分词对应的待去重文本对所述文本分词进行分词频率分析,得到分词词频;
    根据所述语料库对所述文本分词进行文件频率分析,得到文件词频;
    根据所述分词词频和所述文件词频构建所述文本分词的分词指标;
    根据所述分词指标从筛选出预设数量的文本分词为指纹分词;
    对所述指纹分词进行哈希转换,得到文本指纹。
  12. 如权利要求9所述的电子设备,其中,所述根据所述文本指纹对所述多个待去重文本进行重合去重,得到多个初步去重文本,包括:
    将所述多个待去重文本中每个待去重文本对应的所述文本指纹进行指纹切分,得到指纹分段;
    按照切分的顺序将所述指纹分段进行位置编码,得到编码分段;
    计算相同位置编码的编码分段之间的重合度;
    根据所述重合度对所述多个待去重文本中的重复文本进行删除,得到多个初步去重文本。
  13. 如权利要求12所述的电子设备,其中,所述根据所述重合度对所述多个待去重文本中的重复文本进行删除,得到多个初步去重文本,包括:
    当相同位置编码的编码分段之间的重合度大于预设的重合阈值时,筛选出所述编码分段对应的待去重文本;
    遍历所述编码分段对应的待去重文本,得到每个待去重文本的文本长度;
    删除所述编码分段对应的待去重文本中除文本长度小于预设的文本长度阈值的待去重文本之外的所有待去重文本,得到多个初步去重文本。
  14. 如权利要求9至13中任一项所述的电子设备,其中,所述对所述多个初步去重文本中各文本进行分句切割,得到每个初步去重文本的文本分句,包括:
    遍历所述多个初步去重文本,并确定所述多个初步去重文本中分句符的位置;
    根据所述分句符的位置将所述多个初步去重文本进行分句切割,得到每个初步去重文本的文本分句。
  15. 如权利要求9至13中任一项所述的电子设备,其中,所述计算每个所述文本分句间的重合字粒度,包括:
    依次从所述文本分句中选取文本分句为目标分句;
    利用预设的重合字粒度算法计算所述目标分句与所述文本分句中未被选取的分句的重合字粒度。
  16. 一种计算机可读存储介质,存储有计算机程序,其中,所述计算机程序被处理器执行时实现如下步骤:
    获取多个待去重文本,将所述多个待去重文本汇集为语料库;
    对所述多个待去重文本中各文本进行分词处理,得到每个待去重文本对应的文本分词;
    根据所述语料库构建所述文本分词对应的待去重文本的文本指纹;
    根据所述文本指纹对所述多个待去重文本进行重合去重,得到多个初步去重文本;
    对所述多个初步去重文本中各文本进行分句切割,得到每个初步去重文本的文本分句;
    计算每个所述文本分句间的重合字粒度;
    根据所述重合字粒度对所述多个初步去重文本进行范围去重,得到去重文本集。
  17. 如权利要求16所述的计算机可读存储介质,其中,所述对所述多个待去重文本中各文本进行分词处理,得到每个待去重文本对应的文本分词,包括:
    依次从所述多个待去重文本中选取待去重文本;
    利用预设停用词库删除被选取的待去重文本中包含的停用词;
    利用预设标准词库对删除停用词后的待去重文本进行分词处理,得到文本分词。
  18. 如权利要求16所述的计算机可读存储介质,其中,所述根据所述语料库构建所述文本分词对应的待去重文本的文本指纹,包括:
    根据所述文本分词对应的待去重文本对所述文本分词进行分词频率分析,得到分词词频;
    根据所述语料库对所述文本分词进行文件频率分析,得到文件词频;
    根据所述分词词频和所述文件词频构建所述文本分词的分词指标;
    根据所述分词指标从筛选出预设数量的文本分词为指纹分词;
    对所述指纹分词进行哈希转换,得到文本指纹。
  19. 如权利要求16所述的计算机可读存储介质,其中,所述根据所述文本指纹对所述多个待去重文本进行重合去重,得到多个初步去重文本,包括:
    将所述多个待去重文本中每个待去重文本对应的所述文本指纹进行指纹切分,得到指 纹分段;
    按照切分的顺序将所述指纹分段进行位置编码,得到编码分段;
    计算相同位置编码的编码分段之间的重合度;
    根据所述重合度对所述多个待去重文本中的重复文本进行删除,得到多个初步去重文本。
  20. 如权利要求19所述的计算机可读存储介质,其中,所述根据所述重合度对所述多个待去重文本中的重复文本进行删除,得到多个初步去重文本,包括:
    当相同位置编码的编码分段之间的重合度大于预设的重合阈值时,筛选出所述编码分段对应的待去重文本;
    遍历所述编码分段对应的待去重文本,得到每个待去重文本的文本长度;
    删除所述编码分段对应的待去重文本中除文本长度小于预设的文本长度阈值的待去重文本之外的所有待去重文本,得到多个初步去重文本。
PCT/CN2021/083711 2020-12-31 2021-03-30 文本去重方法、装置、电子设备及计算机可读存储介质 WO2022141860A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011637850.4 2020-12-31
CN202011637850.4A CN112733537A (zh) 2020-12-31 2020-12-31 文本去重方法、装置、电子设备及计算机可读存储介质

Publications (1)

Publication Number Publication Date
WO2022141860A1 true WO2022141860A1 (zh) 2022-07-07

Family

ID=75608897

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/083711 WO2022141860A1 (zh) 2020-12-31 2021-03-30 文本去重方法、装置、电子设备及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN112733537A (zh)
WO (1) WO2022141860A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114386423B (zh) * 2022-01-18 2023-07-14 平安科技(深圳)有限公司 文本去重方法和装置、电子设备、存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101645082A (zh) * 2009-04-17 2010-02-10 华中科技大学 基于并行编程模式的相似网页去重系统
US20150142760A1 (en) * 2012-06-30 2015-05-21 Huawei Technologies Co., Ltd. Method and device for deduplicating web page
US20190294588A1 (en) * 2017-04-07 2019-09-26 Tencent Technology (Shenzhen) Company Limited Text deduplication method and apparatus, and storage medium
CN110309446A (zh) * 2019-04-26 2019-10-08 深圳市赛为智能股份有限公司 文本内容快速去重方法、装置、计算机设备及存储介质
CN110738049A (zh) * 2019-10-12 2020-01-31 招商局金融科技有限公司 相似文本的处理方法、装置及计算机可读存储介质
CN111400446A (zh) * 2020-03-11 2020-07-10 中国计量大学 一种标准文本的查重方法及系统

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101645082A (zh) * 2009-04-17 2010-02-10 华中科技大学 基于并行编程模式的相似网页去重系统
US20150142760A1 (en) * 2012-06-30 2015-05-21 Huawei Technologies Co., Ltd. Method and device for deduplicating web page
US20190294588A1 (en) * 2017-04-07 2019-09-26 Tencent Technology (Shenzhen) Company Limited Text deduplication method and apparatus, and storage medium
CN110309446A (zh) * 2019-04-26 2019-10-08 深圳市赛为智能股份有限公司 文本内容快速去重方法、装置、计算机设备及存储介质
CN110738049A (zh) * 2019-10-12 2020-01-31 招商局金融科技有限公司 相似文本的处理方法、装置及计算机可读存储介质
CN111400446A (zh) * 2020-03-11 2020-07-10 中国计量大学 一种标准文本的查重方法及系统

Also Published As

Publication number Publication date
CN112733537A (zh) 2021-04-30

Similar Documents

Publication Publication Date Title
WO2022121171A1 (zh) 相似文本匹配方法、装置、电子设备及计算机存储介质
US10579661B2 (en) System and method for machine learning and classifying data
US9836541B2 (en) System and method of managing capacity of search index partitions
WO2022141861A1 (zh) 情感分类方法、装置、电子设备及存储介质
WO2019174132A1 (zh) 数据处理方法、服务器及计算机存储介质
WO2022160449A1 (zh) 文本分类方法、装置、电子设备及存储介质
WO2022078308A1 (zh) 裁判文书摘要生成方法、装置、电子设备及可读存储介质
WO2022160454A1 (zh) 医疗文献的检索方法、装置、电子设备及存储介质
WO2022142020A1 (zh) 资讯推送方法、装置、电子设备及计算机可读存储介质
WO2022222943A1 (zh) 科室推荐方法、装置、电子设备及存储介质
WO2022048210A1 (zh) 命名实体识别方法、装置、电子设备及可读存储介质
CN113095076A (zh) 敏感词识别方法、装置、电子设备及存储介质
CN113449187A (zh) 基于双画像的产品推荐方法、装置、设备及存储介质
CN110516034A (zh) 日志管理方法、装置、网络设备和可读存储介质
CN115146865A (zh) 基于人工智能的任务优化方法及相关设备
CN111538903B (zh) 搜索推荐词确定方法、装置、电子设备及计算机可读介质
CN114330335A (zh) 关键词抽取方法、装置、设备及存储介质
US9213759B2 (en) System, apparatus, and method for executing a query including boolean and conditional expressions
CN112084448A (zh) 相似信息处理方法以及装置
WO2022141860A1 (zh) 文本去重方法、装置、电子设备及计算机可读存储介质
CN113722472B (zh) 一种技术文献信息提取方法、系统及存储介质
CN113408660A (zh) 图书聚类方法、装置、设备和存储介质
JP2013222418A (ja) パッセージ分割方法、装置、及びプログラム
WO2022141838A1 (zh) 模型置信度分析方法、装置、电子设备及计算机存储介质
CN111444159B (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: 21912630

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: 21912630

Country of ref document: EP

Kind code of ref document: A1