Chinese substring extraction method and system, and storage medium and electronic device

By splitting text, establishing full-text index, calculating similarity and verifying words, the problem of low substring extraction efficiency and insufficient accuracy in the existing technology is solved, and efficient and accurate fuzzy substring positioning and extraction are achieved.

WO2024198343A1PCT designated stage expired Publication Date: 2024-10-03SHANGHAI MIDU INFORMATION TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/128097
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-27
Filing Date
2023-10-31
Publication Date
2024-10-03

AI Technical Summary

Technical Problem

Existing technology is difficult to handle fuzzy writing methods such as typos, multiple characters, few characters, and sequence exchanges in substring extraction. Accurate matching is inefficient, fuzzy search cannot locate specific locations, and regular expression configuration is cumbersome and inefficient.

Method used

By splitting the Chinese text into sentences, establishing a full-text index, extracting target substrings related to the sentences, calculating the similarity of the split substrings, generating effective fuzzy substrings, and calculating the similarity using character, pinyin and Bi-Gram array weights. Verify and complete words to achieve generalized positioning.

Benefits of technology

It achieves efficient and accurate substring extraction, reduces system load, improves matching accuracy and speed, and overcomes the shortcomings of precise matching and regular expression matching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023128097_03102024_PF_FP_ABST
    Figure CN2023128097_03102024_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the present invention are a Chinese substring extraction method and system, and a storage medium and an electronic device. The method comprises the following steps: splitting Chinese text into a plurality of sentences; extracting, from a set of target substrings, a preset number of target substrings related to the sentences; extracting a plurality of split substrings from each sentence; for each target substring, calculating the similarity between each target substring and each split substring, and when the maximum similarity is greater than a preset threshold, taking, as a fuzzy substring, a split substring corresponding to the maximum similarity; and verifying the fuzzy substring to generate a valid fuzzy substring. In the Chinese substring extraction method and system, storage medium and electronic device of the present invention, the position of a fuzzy substring is quickly positioned in a generalized manner by setting target substrings, thereby implementing efficient and accurate substring extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Chinese substring extraction method, system, storage medium and electronic device Technical Field

[0001] The present invention belongs to the technical field of character recognition, and in particular relates to a Chinese substring extraction method, system, storage medium and electronic equipment. Background Art

[0002] Any subsequence of consecutive characters in a string is called a substring of the string. In the prior art, the following two methods are usually used to extract substrings:

[0003] (1) Using precise matching method

[0004] The KMP algorithm is an improved exact string matching algorithm. Its core approach is to leverage information from failed matches to minimize the number of matches between the pattern and the main string, achieving rapid matching. It is characterized by its high speed and the absence of backtracking during the main string. However, existing exact matching algorithms cannot find the target substring when the search substring contains typos, extra characters, missing characters, or a swapped character sequence. This is because exact matching can only be performed by enumerating fuzzy substrings, but fuzzy substrings are difficult to exhaustively enumerate, making generalized extraction impossible. For example: if the target substring is "learn history to understand reason, learn history to increase faith, learn history to respect morality, and learn history to put it into practice", the corresponding fuzzy substrings may be "learn to understand etiquette, learn history to increase faith, learn history to respect morality, and learn history to put it into practice"; "learn to understand etiquette, learn history to increase faith, learn history to respect morality, and learn history to put it into practice"; "learn to understand etiquette, learn history to believe, learn history to follow morality, and learn history to put it into practice"; "learn to understand etiquette, learn history to increase faith, learn history to respect morality, and learn history to practice"; "learn to understand reason, learn history to increase faith, learn history to put it into practice, and learn history to respect morality", which makes it impossible to accurately match and locate.

[0005] (2) Using fuzzy search method

[0006] Fuzzy search returns results based on the number of occurrences of each character in a word, but cannot pinpoint the exact location of the word. Using regular expressions requires configuring a regular expression for each character in the word, resulting in a large number of regular expressions and ineffective generalized search, resulting in low efficiency and accuracy.

[0007] Summary of the Invention

[0008] In view of the shortcomings of the prior art described above, the purpose of the present invention is to provide a Chinese substring extraction method, system, storage medium and electronic device, which can quickly locate the position of the fuzzy substring in a generalized manner by setting the target substring, thereby achieving efficient and accurate substring extraction.

[0009] In a first aspect, the present invention provides a Chinese substring extraction method, which includes the following steps: splitting a Chinese text into multiple sentences; extracting a preset number of target substrings related to the sentences from a target substring set; extracting multiple split substrings in each sentence; for each target substring, calculating the similarity with each split substring, and when the maximum similarity is greater than a preset threshold, using the split substring corresponding to the maximum similarity as a fuzzy substring; and verifying the fuzzy substrings to generate valid fuzzy substrings.

[0010] In an implementation of the first aspect, splitting the Chinese text into multiple sentences includes the following steps:

[0011] Obtaining a sentence based on a period in the Chinese text;

[0012] Obtaining a sentence based on a question mark in the Chinese text;

[0013] A sentence is obtained based on an exclamation mark in the Chinese text.

[0014] In an implementation of the first aspect, extracting a preset number of target substrings related to the sentence from the target substring set includes the following steps:

[0015] Establishing a full-text index for the Chinese text according to Chinese characters for the target substrings in the target substring set;

[0016] Searching for a target substring matching the sentence based on the full-text index;

[0017] A preset number of target substrings matching the sentence are selected.

[0018] In an implementation of the first aspect, extracting multiple split substrings from each sentence includes the following steps:

[0019] Segmenting the sentence to obtain multiple words;

[0020] The split substring is obtained by combining the words before and after, and the length of the split substring is within a preset proportional interval of the length of the target substring.

[0021] In an implementation of the first aspect, calculating the similarity with each split substring includes the following steps:

[0022] Extract the characters, pinyin and Bi-Gram arrays of the target substring and the split substrings;

[0023] Obtain an equal number of characters, an equal number of pinyins, and an equal number of Bi-Gram arrays of the target substring and the split substring;

[0024] Punctuation weight is calculated according to punctuation weight = (number of punctuation in target substring - number of punctuation in source substring) / 4.0;

[0025] Calculate the character weight, pinyin weight, and Bi-Gram array weight, where character weight = 2.0 * (equal number of characters + punctuation weight) / (target substring length + split substring length), pinyin weight = 2.0 * (equal number of pinyin + punctuation weight) / (target substring length + split substring length), and Bi-Gram array weight = 1.0 * (equal number of Bi-Gram arrays + punctuation weight * 2) / (target substring length + split substring length);

[0026] The similarity is calculated according to similarity=character weight*pinyin weight*Bi-Gram array weight.

[0027] In an implementation of the first aspect, when the target substring and the split substring have the same first and last characters, the Bi-Gram array weight is updated to Bi-Gram array weight = 0.4 + 0.6 * (equal number of Bi-Gram arrays + punctuation weight * 2) / (target substring length + split substring length).

[0028] In an implementation of the first aspect, verifying the fuzzy substring includes the following steps:

[0029] When the fuzzy substring has one less character than the target substring, and the adjacent segmented words of the fuzzy substring are single characters, performing supplementary alignment on the single characters;

[0030] When two target substrings correspond to the same fuzzy substring, the target substring with a higher similarity will be selected to correspond to the fuzzy substring.

[0031] In a second aspect, the present invention provides a Chinese substring extraction system, comprising a splitting module, a first extraction module, a second extraction module, a calculation module, and a verification module;

[0032] The splitting module is used to split the Chinese text into multiple sentences;

[0033] The first extraction module is used to extract a preset number of target substrings related to the sentence from the target substring set;

[0034] The second extraction module is used to extract multiple split substrings in each sentence;

[0035] The calculation module is used to calculate the similarity between each target substring and each split substring, and when the maximum similarity is greater than a preset threshold, the split substring corresponding to the maximum similarity is used as the fuzzy substring;

[0036] The verification module is used to verify the fuzzy substring and generate a valid fuzzy substring.

[0037] In a third aspect, the present invention provides an electronic device, comprising: a processor and a memory.

[0038] The memory is used to store computer programs;

[0039] The processor is configured to execute the computer program stored in the memory, so as to enable the electronic device to perform the above-mentioned Chinese substring extraction method.

[0040] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the program implements the above-mentioned Chinese substring extraction method when executed by an electronic device.

[0041] As described above, the Chinese substring extraction method, system, storage medium, and electronic device of the present invention have the following beneficial effects:

[0042] The Chinese substring extraction method, system, storage medium and electronic device described in the present invention locate the position of fuzzy substrings in a generalized manner, which is fast and efficient, reducing the system load; overcome the problems caused by the precise matching of substrings and regular expression matching in the existing technology, and effectively improve the accuracy and speed of substring matching. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] FIG1 is a schematic diagram showing a scenario of an electronic device in an embodiment of the present invention;

[0044] FIG2 is a flow chart showing a method for extracting Chinese substrings according to an embodiment of the present invention;

[0045] FIG3 is a schematic structural diagram of a Chinese substring extraction system according to an embodiment of the present invention;

[0046] FIG. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.

[0047] Component number description

[0048] 11. Cell Phone

[0049] 12 tablets

[0050] 13 laptops

[0051] 31 Split Module

[0052] 32 First extraction module

[0053] 33 Second extraction module

[0054] 34 Computing Module

[0055] 35 Verification Module

[0056] 41 processing units

[0057] 42 Memory

[0058] 421 Random Access Memory

[0059] 422 Cache Memory

[0060] 423 Storage System

[0061] 424 Programs / Utilities

[0062] 4241 Program Module

[0063] 43 bus

[0064] 44 Input / Output Interfaces

[0065] 45 Network Adapter DETAILED DESCRIPTION

[0066] The following describes the embodiments of the present invention through specific examples. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments. The details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other unless they conflict.

[0067] It should be noted that the illustrations provided in the following embodiments are merely schematic illustrations of the basic concept of the present invention. Therefore, the illustrations only show components related to the present invention and are not drawn according to the number, shape, and size of components in actual implementation. In actual implementation, the type, quantity, and proportion of each component may be changed arbitrarily, and the component layout may also be more complex.

[0068] The following embodiments of the present invention provide a Chinese substring extraction method, which can be applied to the electronic device shown in Figure 1. The electronic device in the present invention may include a mobile phone 11 with a wireless charging function, a tablet computer 12, a laptop computer 13, a wearable device, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc. The embodiments of the present invention do not impose any restrictions on the specific type of electronic device.

[0069] For example, the electronic device may be a station (STAION, ST) in a WLAN with a wireless charging function, a cellular phone, a cordless phone, a Session Initiation Protocol (SIP) phone, a Wireless Local Loop (WLL) station, a Personal Digital Assistant (PDA) device, a handheld device with a wireless charging function, a computing device or other processing device, a computer, a laptop computer, a handheld communication device, a handheld computing device, and / or other devices for communicating on a wireless system and a next-generation communication system, such as a mobile terminal in a 5G network, a mobile terminal in a future-evolved Public Land Mobile Network (PLMN), or a mobile terminal in a future-evolved Non-terrestrial Network (NTN).

[0070] For example, the electronic device can communicate with a network and other devices via wireless communication. The wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS can include Global Positioning System (GPS), Global Navigation Satellite System (GLONASS), BeiDou navigation Satellite System (BDS), Quasi-Zenith Satellite System (QZSS) and / or Satellite Based Augmentation Systems (SBAS).

[0071] The technical solutions in the embodiments of the present invention will be described in detail below with reference to the accompanying drawings in the embodiments of the present invention.

[0072] As shown in FIG2 , in one embodiment, the Chinese substring extraction method of the present invention includes the following steps:

[0073] Step S1: Split the Chinese text into multiple sentences.

[0074] Specifically, the Chinese text is segmented based on periods, question marks, and exclamation marks in the Chinese text, thereby obtaining a plurality of independent sentences. It should be noted that if the Chinese text is an HTML text, the tags are removed before sentence segmentation.

[0075] Step S2: extracting a preset number of target substrings related to the sentence from the target substring set.

[0076] Specifically, the target substrings to be extracted are combined to form a target substring set. For each sentence, a preset number of target substrings, such as 5 or 10, that are most relevant to it need to be found. In the present invention, full-text indexing technology, also known as inverted document technology, is used to search for target substrings. The principle of the full-text index is to first define a vocabulary, and then search for the frequency and position of each term in the article, and summarize such frequency and position information according to the order of the vocabulary, which is equivalent to establishing an index for the file with the vocabulary as the directory, so that when searching for a certain word, the position where the word appears can be quickly located. Preferably, the full-text indexing technology adopts the Lucene algorithm.

[0077] Preferably, extracting a preset number of target substrings related to the sentence from the target substring set comprises the following steps:

[0078] 21) Establishing a full-text index for the Chinese text according to Chinese characters for the target substrings in the target substring set.

[0079] The full-text index of the target substring for the Chinese text is constructed based on a full-text indexing technology, wherein the index of the full-text index adopts the position subscript of each sentence in the Chinese text.

[0080] 22) Searching for a target substring matching the sentence based on the full-text index.

[0081] For each sentence, a matching target substring is searched based on the full-text index.

[0082] 23) Selecting a preset number of target substrings that match the sentence.

[0083] Step S3: extract multiple split substrings from each sentence.

[0084] Specifically, extracting multiple split substrings in each sentence includes the following steps:

[0085] 31) Segment the sentence to obtain multiple words.

[0086] Among them, word segmentation refers to splitting a text into a series of words. After the words are concatenated, they are equal to the original text and have semantic rationality and complete vocabulary sequence. Preferably, the word segmentation is performed using the Conditional Random Field (CRF) word segmentation algorithm, the N-shortest path word segmentation algorithm, etc.

[0087] 32) The words are combined before and after to obtain the split substrings, wherein the length of the split substrings is within a preset proportional interval of the length of the target substring.

[0088] By combining the words before and after, several substrings can be obtained and used as split substrings. Preferably, the length of the split substring is limited to between 1 / 2 the length of the target substring and the length plus 3. For example, if the length of the target substring is preset to 10, then the minimum length of the split substring is 1 / 2 the length = 5, and the maximum length is the length + 3 = 13. Therefore, the length of the split substring is between 5 and 13.

[0089] Step S4: For each target substring, calculate the similarity with each split substring, and when the maximum similarity is greater than a preset threshold, use the split substring corresponding to the maximum similarity as the fuzzy substring.

[0090] Specifically, for each target substring, traverse each split substring and calculate the similarity between the two. Calculating the similarity with each split substring includes the following steps:

[0091] 41) Extract the characters, pinyin and Bi-Gram arrays of the target substring and the split substrings.

[0092] The N-Gram model applies a sliding window of size N to the text content, forming a sequence of character segments of length N. This is a statistical language model representing a sentence. Each byte segment is called a Gram. The frequency of occurrence of all Grams is counted and filtered according to a pre-set threshold to form a key Gram list, which is the vector feature space of the text. Each Gram in the list is a feature vector dimension. The Gram model is based on the assumption that the occurrence of the Nth word is only related to the previous N-1 words and not to any other words. The probability of the entire sentence is the product of the probabilities of each word. These probabilities can be obtained by directly counting the number of times N words appear simultaneously in the corpus. Bi-Gram refers to the binary Gram model.

[0093] 42) Obtain the equal number of characters, equal number of phonetic symbols, and equal number of Bi-Gram arrays of the target substring and the split substring. For example, if the target substring is "shu zi cha cuo" and the split substring is "shu zi cha cuo", then the equal number of characters and phonetic symbols of the two is 3 and 4, respectively.

[0094] Among them, the default pinyin has equal flat and retroflex tones.

[0095] 43) Calculate the punctuation weight according to punctuation weight = (number of punctuation marks in the target substring - number of punctuation marks in the source substring) / 4.0.

[0096] 44) Calculate the character weight, pinyin weight, and Bi-Gram array weight, where character weight = 2.0*(equal number of characters + punctuation weight) / (target substring length + split substring length), pinyin weight = 2.0*(equal number of pinyin + punctuation weight) / (target substring length + split substring length), and Bi-Gram array weight = 1.0*(equal number of Bi-Gram arrays + punctuation weight*2) / (target substring length + split substring length).

[0097] 45) Calculate the similarity according to similarity = character weight * pinyin weight * Bi-Gram array weight.

[0098] Preferably, when the target substring and the split substring have the same first and last characters, the target substring and the split substring are considered more similar, and the Bi-Gram array weight should be increased. Therefore, the Bi-Gram array weight is updated to Bi-Gram array weight = 0.4 + 0.6 * (the number of equal Bi-Gram array characters + punctuation weight * 2) / (target substring length + split substring length).

[0099] After the similarity calculation is completed, the maximum similarity is selected. If the maximum similarity is greater than the preset threshold, the split substring corresponding to the maximum similarity is used as the fuzzy substring.

[0100] Step S5: verify the fuzzy substring to generate a valid fuzzy substring.

[0101] Specifically, after obtaining the fuzzy substring, further verification is required to obtain a more accurate and valid fuzzy substring.

[0102] In one embodiment, verifying the fuzzy substring includes the following steps:

[0103] 51) When the fuzzy substring is one character less than the target substring, and the adjacent segmented words of the fuzzy substring are single characters, performing supplementary alignment on the single characters.

[0104] Among them, single-word processing is a boundary processing problem. For example, the original sentence is: Medical and health system reform draft, the target substring is: Medical and health system reform, and the fuzzy substring is: Medical and health system reform, then the fuzzy substring needs to be verified. Then fill in the adjacent single word, and after the fuzzy substring is verified, it is: Medical and health system reform draft. "Reform" is not a word, which is a typo in Wubi, so only the adjacent single word is filled in. If the original sentence is: Medical and health system reform draft, and the adjacent "draft" is a word instead of a single word, then no filling is performed. For another example, the original sentence is: Museum visit plan, the target substring is: Museum visit regulations, and the fuzzy substring is: Museum visit regulations, then after the fuzzy substring is verified, it is: Museum visit plan. Among them, according to the subscript position of the fuzzy substring in the sentence, it is found that the participle corresponding to the end position of the fuzzy substring is a word "planning", and the independent participle situation at the end of the fuzzy substring is supplemented.

[0105] 52) When two target substrings correspond to the same fuzzy substring, the target substring with a higher similarity will be selected to correspond to the fuzzy substring.

[0106] When two fuzzy substrings overlap, for example, if the two target substrings are "Class Labor Order Table" and "Guangming Middle School Class Labor Order Table," when "Guangming Middle School Class Labor Order Table" appears in the Chinese text, it can be used as a fuzzy substring of both target substrings. In this case, the target substring "Guangming Middle School Class Labor Order Table" is selected to correspond to the fuzzy substring "Guangming Middle School Class Labor Order Table."

[0107] The protection scope of the Chinese substring extraction method described in the embodiment of the present invention is not limited to the execution order of the steps listed in this embodiment. All solutions implemented by adding, reducing, or replacing steps in the prior art based on the principles of the present invention are included in the protection scope of the present invention.

[0108] An embodiment of the present invention further provides a Chinese substring extraction system, which can implement the Chinese substring extraction method described in the present invention. However, the implementation device of the Chinese substring extraction system described in the present invention includes but is not limited to the structure of the Chinese substring extraction system listed in this embodiment. All structural variations and replacements of the prior art made according to the principles of the present invention are included in the protection scope of the present invention.

[0109] As shown in FIG3 , in one embodiment, the Chinese substring extraction system of the present invention includes a splitting module 31 , a first extraction module 32 , a second extraction module 33 , a calculation module 34 and a verification module 35 .

[0110] The splitting module 31 is used to split the Chinese text into multiple sentences.

[0111] The first extraction module 32 is connected to the splitting module 31 and is configured to extract a preset number of target substrings related to the sentence from the target substring set.

[0112] The second extraction module 33 is connected to the splitting module 31 and is used to extract multiple split substrings in each sentence.

[0113] The calculation module 34 is connected to the first extraction module 32 and the second extraction module 33, and is used to calculate the similarity between each target substring and each split substring, and when the maximum similarity is greater than a preset threshold, the split substring corresponding to the maximum similarity is used as a fuzzy substring.

[0114] The verification module 35 is connected to the calculation module 34 and is used to verify the fuzzy substring and generate a valid fuzzy substring.

[0115] The structures and principles of the splitting module 31 , the first extraction module 32 , the second extraction module 33 , the calculation module 34 and the verification module 35 correspond to the steps in the above-mentioned Chinese substring extraction method, and thus will not be described in detail here.

[0116] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices or methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules / units is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules or units, which can be electrical, mechanical or other forms.

[0117] Modules / units described as separate components may or may not be physically separate, and components displayed as modules / units may or may not be physical modules, that is, they may be located in one place or distributed across multiple network elements. Some or all of the modules / units may be selected based on actual needs to achieve the objectives of the embodiments of the present invention. For example, the functional modules / units in various embodiments of the present invention may be integrated into a single processing module, each module / unit may exist physically separately, or two or more modules / units may be integrated into a single module / unit.

[0118] Those skilled in the art should further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the composition and steps of each example according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0119] The embodiment of the present invention also provides a computer-readable storage medium. A person skilled in the art will understand that all or part of the steps in the method for implementing the above embodiment can be completed by instructing a processor through a program, and the program can be stored in a computer-readable storage medium, and the storage medium is a non-transitory medium, such as a random access memory, a read-only memory, a flash memory, a hard disk, a solid-state drive, a magnetic tape, a floppy disk, an optical disc, and any combination thereof. The above storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (DVD)), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0120] An embodiment of the present invention further provides an electronic device comprising a processor and a memory.

[0121] The memory is used to store computer programs.

[0122] The memory includes various media that can store program codes, such as ROM, RAM, magnetic disk, USB flash drive, memory card or optical disk.

[0123] The processor is connected to the memory and is used to execute the computer program stored in the memory, so that the electronic device executes the above-mentioned Chinese substring extraction method.

[0124] Preferably, the processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0125] As shown in Figure 4, the electronic device of the present invention is implemented as a general-purpose computing device. Components of the electronic device may include, but are not limited to, one or more processors or processing units 41, a memory 42, and a bus 43 connecting various system components (including the memory 42 and the processing unit 41).

[0126] Bus 43 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. Examples of these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.

[0127] Electronic devices typically include a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device, including volatile and non-volatile media, removable and non-removable media.

[0128] The memory 42 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 621 and / or cache memory 422. The electronic device may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 423 may be used to read and write non-removable, non-volatile magnetic media (not shown in FIG. 4 , commonly referred to as a “hard drive”). Although not shown in FIG. 4 , a magnetic disk drive for reading and writing to a removable non-volatile magnetic disk (e.g., a “floppy disk”) and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 43 via one or more data media interfaces. The memory 42 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of various embodiments of the present invention.

[0129] A program / utility 424 having a set (at least one) of program modules 4241 may be stored, for example, in memory 42. Such program modules 4241 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may include an implementation of a network environment. Program modules 4241 generally implement the functions and / or methods of the embodiments described herein.

[0130] The electronic device may also communicate with one or more external devices (e.g., a keyboard, a pointing device, a display, etc.), one or more devices that enable a user to interact with the electronic device, and / or any device that enables the electronic device to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication may occur via an input / output (I / O) interface 44. Furthermore, the electronic device may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 45. As shown in FIG4 , the network adapter 45 communicates with other modules of the electronic device via a bus 43. It should be understood that, although not shown in the figures, other hardware and / or software modules may be used in conjunction with the electronic device, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0131] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the present invention. Anyone skilled in the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by one of ordinary skill in the art without departing from the spirit and technical principles disclosed herein are intended to be covered by the claims of the present invention.

Claims

1. A Chinese substring extraction method, It is characterized in that The method comprises the following steps: Split Chinese text into sentences; Extracting a preset number of target substrings related to the sentence from the target substring set; Extract multiple split substrings in each sentence; For each target substring, calculate the similarity with each split substring, and when the maximum similarity is greater than a preset threshold, take the split substring corresponding to the maximum similarity as the fuzzy substring; The fuzzy substring is verified to generate a valid fuzzy substring.

2. The Chinese substring extraction method according to claim 1, Features: Splitting Chinese text into sentences involves the following steps: Acquire a sentence based on the period in the Chinese text; Acquire a sentence based on the question mark in the Chinese text; A sentence is obtained based on the exclamation mark in the Chinese text.

3. The Chinese substring extraction method according to claim 1, Features: Extracting a preset number of target substrings related to the sentence from the target substring set comprises the following steps: Establishing a full-text index for the Chinese text according to Chinese characters for the target substring in the target substring set; Searching for a target substring matching the sentence based on the full-text index; A preset number of target substrings matching the sentence are selected.

4. The Chinese substring extraction method according to claim 1, Features: Extracting multiple split substrings in each sentence includes the following steps: Segmenting the sentence to obtain multiple words; The split substring is obtained by combining the words before and after, and the length of the split substring is within a preset proportional interval of the length of the target substring.

5. The Chinese substring extraction method according to claim 1, Features: Calculating the similarity with each split substring includes the following steps: Extract the characters, pinyin and Bi-Gram arrays of the target substring and the split substring; Obtaining an equal number of characters, an equal number of pinyins, and an equal number of Bi-Gram arrays of the target substring and the split substring; Calculate the punctuation weight according to punctuation weight = (number of punctuation in target substring - number of punctuation in source substring) / 4.0; Calculate the character weight, pinyin weight and Bi-Gram array weight, where character weight = 2.0*(equal number of characters + punctuation weight) / (target substring length + split substring length), pinyin weight = 2.0*(equal number of pinyin + punctuation weight) / (target substring length + split substring length), Bi-Gram array weight = 1.0*(equal number of Bi-Gram array + punctuation weight*2) / (target substring length + split substring length); The similarity is calculated according to similarity=character weight*pinyin weight*Bi-Gram array weight.

6. The Chinese substring extraction method according to claim 5, Features: When the first and last characters of the target substring and the split substring are the same, the Bi-Gram array weight is updated to Bi-Gram array weight = 0.4 + 0.6 * (Bi-Gram array equal number + punctuation weight * 2) / (target substring length + split substring length).

7. The Chinese substring extraction method according to claim 1, Features: Verifying the fuzzy substring includes the following steps: When the fuzzy substring is one character less than the target substring, and the adjacent segmented words of the fuzzy substring are single characters, supplementary alignment is performed on the single characters; When two target substrings correspond to the same fuzzy substring, the target substring with a higher similarity will be selected to correspond to the fuzzy substring.

8. A Chinese substring extraction system, It is characterized in that It includes a splitting module, a first extraction module, a second extraction module, a calculation module and a verification module; The splitting module is used to split the Chinese text into multiple sentences; The first extraction module is used to extract a preset number of target substrings related to the sentence from the target substring set; The second extraction module is used to extract multiple split substrings in each sentence; The calculation module is used to calculate the similarity between each target substring and each split substring, and when the maximum similarity is greater than a preset threshold, the split substring corresponding to the maximum similarity is used as a fuzzy substring; The verification module is used to verify the fuzzy substring and generate a valid fuzzy substring.

9. An electronic device, It is characterized in that The electronic device includes: a processor and a memory. The memory is used to store computer programs; The processor is used to execute the computer program stored in the memory, so that the electronic device executes the Chinese substring extraction method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the program is executed by an electronic device, the Chinese substring extraction method described in claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Method and device for finding substring

    CN104750846A

  • A string processing method and device

    CN106033416A

  • Data resource labeling method and device, storage medium and electronic equipment

    CN111930792A

  • Data identification method and device for Internet of Things terminal firmware security detection

    CN114781008A

  • Domain-oriented parallel large-scale text duplicate checking method

    CN115544999A