WO2024045399A1 - 一种基于文本特征相似度的用户名黑名单模糊匹配方法 - Google Patents

一种基于文本特征相似度的用户名黑名单模糊匹配方法 Download PDF

Info

Publication number
WO2024045399A1
WO2024045399A1 PCT/CN2022/136824 CN2022136824W WO2024045399A1 WO 2024045399 A1 WO2024045399 A1 WO 2024045399A1 CN 2022136824 W CN2022136824 W CN 2022136824W WO 2024045399 A1 WO2024045399 A1 WO 2024045399A1
Authority
WO
WIPO (PCT)
Prior art keywords
string
blacklist
strings
short
feature
Prior art date
Application number
PCT/CN2022/136824
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 WO2024045399A1 publication Critical patent/WO2024045399A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/38Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis

Definitions

  • the invention relates to the field of electronic information technology, and in particular to a user name blacklist fuzzy matching method based on text feature similarity.
  • the blacklist database In order to accurately and quickly identify, the usual method is to establish a blacklist database for sensitive strings. When confirming whether the input string is legal, the blacklist database will be queried. If the string is in the blacklist, the application will be rejected. Traditional methods often split the string and query the resulting small strings or character pairs for matching. However, some fraud groups will modify some strings in order to avoid the blacklist. For example, if "Zhang San” becomes variant strings such as "Zhang San 1", “Zhang San a”, “Zhang _ San”, etc., then the traditional method will often fail.
  • the purpose of the present invention is to provide a user name blacklist fuzzy matching method based on text feature similarity, which can quickly provide corresponding similar characters that may exist in the blacklist, and return possible Correlating blacklist results has a wider range of usage scenarios, has a certain degree of real-time performance, and is easy to promote and use.
  • a user name blacklist fuzzy matching method based on text feature similarity the steps of which are:
  • the blacklist string preprocessing module notifies non-English strings that are too short in the existing blacklist offline, then removes all space characters and changes all English characters to lowercase characters;
  • the blacklist string segmentation module divides each string in the preprocessed blacklist according to different lengths offline to obtain the corresponding short string group, and finally merges the short string groups to obtain A string group that has been segmented corresponding to the original string;
  • the blacklist text feature training coding module conducts feature training on the segmented string groups offline to obtain a feature coding library, and codes the preprocessed strings in the blacklist based on the feature coding library;
  • the data collection preprocessing module receives the string input online, and uses the same rules as step (1) to phoneticize the non-English string if it is too short, and then performs the same string segmentation method on the string as in step (2). Get the corresponding string group;
  • the similarity retrieval and output module calculates the cosine similarity between the characteristics of the input string obtained in step (4) and each string encoding in the blacklist, and then sorts them by the size of the obtained values to select the smallest one. Ten strings to get the final fuzzy matching result.
  • the step (1) includes:
  • the step (2) includes:
  • the step (3) includes:
  • the step (4) includes:
  • step (2) 2Same as step (2), and then divide Merge to obtain the corresponding divided string group X1.
  • the step (5) includes:
  • This method can quickly provide corresponding similar characters that may exist in the blacklist, discover illegal strings that may exist in the credit application process, and return possible associated blacklist results to discover possible blacklists.
  • the product group has a wider range of usage scenarios, has a certain real-time nature, and has broad application prospects.
  • Figure 1 is a flow chart of the present invention
  • FIG. 2 is a flow chart of the blacklist string preprocessing module of the present invention.
  • FIG. 3 is a flow chart of the blacklist string segmentation module of the present invention.
  • Figure 4 is an example diagram of string segmentation according to the present invention.
  • Figure 5 is a flow chart of the blacklist text feature training coding module of the present invention.
  • Figure 6 is a flow chart of the data collection preprocessing module of the present invention.
  • Figure 7 is a flow chart of the input string feature encoding module of the present invention.
  • Figure 8 is a flow chart of the similarity retrieval and output module of the present invention.
  • this specific implementation adopts the following technical solution: a username blacklist fuzzy matching method based on text feature similarity, the steps of which are:
  • the blacklist string preprocessing module notifies non-English strings that are too short in the existing blacklist offline, then removes all space characters and changes all English characters to lowercase characters.
  • the blacklist string segmentation module divides each string in the preprocessed blacklist according to different lengths offline to obtain the corresponding short string group, and finally merges the short string groups to obtain A string group that is divided corresponding to the original string.
  • the blacklist text feature training and encoding module conducts feature training on the segmented string groups offline to obtain a feature encoding library, and encodes the preprocessed strings in the blacklist based on the feature encoding library.
  • the data collection preprocessing module receives the string input online, and uses the same rules as step (1) to phoneticize the non-English string if it is too short, and then performs the same string segmentation method on the string as in step (2). Get the corresponding string group.
  • step (2) 2Same as step (2), and then divide Merge to obtain the corresponding divided string group X1.
  • the similarity retrieval and output module calculates the cosine similarity between the characteristics of the input string obtained in step (4) and each string encoding in the blacklist, and then sorts them by the size of the obtained values to select the smallest Ten strings to get the final fuzzy matching result.
  • This specific implementation method first uses English phonetic notation to semantically supplement non-English strings with a small number of characters, removes space characters and unifies the case, and then uses the method of cutting strings at intervals of different lengths and then merging the cutting results for word segmentation, and uses Deep learning technology realizes the encoding of strings, completes the encoding of blacklist features offline, and obtains the encoding dictionary.
  • the input string is subjected to the same string segmentation operation and encoded according to the encoding dictionary.
  • cosine similarity is used to find the 10 most similar words encoded in the blacklist to complete a fuzzy matching.
  • This method combines string segmentation and feature training to provide batches of string candidates similar to the strings in the blacklist in real time.
  • a consistent string segmentation method is first used to obtain only the string candidates containing Shorter strings, and then conduct feature training to make the string feature information richer.
  • a deep learning method is used to extract string features, and cosine distance is used to determine the string similarity, which can find out all possible characters in real time. Similar strings in the blacklist also have strong detection capabilities for variant strings. Its technical advantages are:
  • a consistent string segmentation method can be used for any string, not limited to the semantics and length of the word, allowing this method to be used in a wider range of scenarios.
  • the deep learning used in this method trains the decomposed string features, and then aggregates all the decomposed string features, so that the extracted original string features have multiple semantics, so as to find out what is similar to the blacklist but not necessarily Exactly the same string.
  • Embodiment 1 A fuzzy matching method for username blacklist based on text feature similarity.
  • the blacklist is first preprocessed offline, and then the string is divided to train the encoding and generate a blacklist feature library. and string feature dictionary library. Then when receiving the string in real time, it first preprocesses the string, then encodes the string according to the generated string feature dictionary, and finally compares the blacklist feature library to find the 10 words with the largest cosine similarity and output them.
  • the blacklist string preprocessing module notifies non-English strings that are too short in the existing blacklist offline, then removes all space characters and changes all English characters to lowercase characters.
  • the name strings in some languages may be too short.
  • Chinese, Japanese, etc. often have only 3 to 5 characters in their names.
  • Chinese names and Japanese names have relatively high character specificity, and some characters appear less frequently.
  • Homophones may appear in the blacklist to replace the original characters, which is not conducive to subsequent feature training.
  • space characters will affect the results of the segmentation process, and will also increase the total length of the segmented string, which is not conducive to training. Therefore, all space characters are directly deleted from all strings in A, and all English characters are capitalized. The characters are changed to lowercase characters, and the obtained string is replaced with the original string to reach blacklist A2.
  • the blacklist string segmentation module divides each string in the preprocessed blacklist according to different lengths offline to obtain the corresponding short string group. Finally, the short string group is merged to obtain the A string group that is divided correspondingly to the original string.
  • the strings in the blacklist are traversed, and the long string Z taken out each time is divided into different lengths to obtain short string groups of various lengths, which enriches the semantic information of the string and converts the obtained several strings into The short string groups are combined to obtain the corresponding short string group Z2 after the original long string Z is divided.
  • the schematic diagram of segmenting the preprocessed data output by S1 includes the following steps:
  • the short string groups of four lengths ⁇ a, b, c, d, e ⁇ , ⁇ a, b, c, d, e ⁇ , respectively, are 1, 2, 3, 4. ab, bc, cd, de ⁇ , ⁇ abc, bcd, cde ⁇ , ⁇ abcd, bcde ⁇ .
  • S2.2 Combine the four short string groups z1, z2, z3, and z4 of S1.2 to obtain the divided string group Z2 corresponding to the original string Z1.
  • the list text feature training and encoding module conducts feature training on the segmented string groups offline to obtain a feature encoding library, and encodes the strings in the preprocessed blacklist based on the feature encoding library.
  • the schematic diagram of coding the segmented data output by S2 includes the following steps:
  • S3.1 Use the deep learning method to conduct feature training on the segmented string groups obtained in S2.2, and obtain the feature encoding dictionary D of each short string.
  • x, y are the feature vectors obtained in S4.2, and then the cross-entropy loss function is used to update the features.
  • the specific formula is as follows:
  • yi is the label of sample i, which is 1 or 0.
  • p i is the predicted cosine similarity.
  • the data collection preprocessing module receives online input strings and phoneticizes non-English strings that are too short, similar to the S1 rule. Then perform the same string segmentation method on the string as S2 to obtain the corresponding string group.
  • the received string X is preprocessed and segmented in the same way as the previous blacklist, and the short string group X1 corresponding to the string is obtained.
  • the process is similar to the previous blacklist creation process.
  • English phonetic notations are added directly after the string, spaces are deleted, and English characters are changed to lowercase.
  • string X is split into string group X1.
  • the similarity retrieval and output module calculates the cosine similarity between the characteristics of the input string obtained in S4 and the encoding of each string in the blacklist, and then sorts them by the size of the obtained values to select the ten smallest strings. , get the final fuzzy matching result.
  • cosine similarity is used to match the 10 most similar features, the corresponding blacklist text is found, and the cosine similarity is output together as the result of fuzzy matching.
  • the cosine similarity is calculated for all the features in C4 obtained in S5.2 and B obtained in S2.2, and the value R is obtained, and is sorted according to the size of R.
  • the first ten values r1, r2,..., r10 and the corresponding strings y1, y2,..., y10, y1 to y10 and the corresponding scores r1 to r10 are output as the final result.

Landscapes

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

Abstract

本发明公开了一种基于文本特征相似度的用户名黑名单模糊匹配方法,它涉及电子信息技术领域。首先使用英文注音针对字符量较少的非英文字符串进行语义补充,去除空格字符统一大小写,然后使用按不同长度的间隔切割字符串再合并切割结果的方法进行分词,并使用深度学习技术实现字符串的编码,在离线情况下完成黑名单特征的编码,并获得编码字典。在实时运作时,将输入的字符串进行相同的字符串分割操作,并根据编码字典进行编码,最后并使用余弦相似度找出在黑名单中编码最相似的单词,完成一次模糊匹配。本发明能够快速给出在黑名单中可能存在的对应相似字符,并且返回可能的关联黑名单结果,使用场景更宽泛,具有一定实时性。

Description

一种基于文本特征相似度的用户名黑名单模糊匹配方法 技术领域
本发明涉及的是电子信息技术领域,具体涉及一种基于文本特征相似度的用户名黑名单模糊匹配方法。
背景技术
在数字信贷中如何侦测出注册文字是否存在违规字样是一个非常重要的问题。用户在申请贷款的过程中,往往需要填写姓名、出生地、居住地等信息,而针对某些出现过问题的历史客户,或者一些可疑的用户信息,往往需要在贷前就发送提醒给审核人员。
为了精准快速识别,通常的方法会针对敏感的字符串建立一个黑名单库。当确认输入字符串是否合法时,会查询一遍黑名单库,若字符串在黑名单中,则会拒绝申请。传统的方法往往对字符串进行分割并对产生的小字符串或字符两两匹配进行查询。但是有些欺诈团伙为了躲避黑名单会修改部分字符串。比如“张三”,变成“张三1”、“张三a”、“张_三”等变种字符串,那么传统方法会往往会失效。
现在主流的对抗方法有如使用模糊代码等方法对字符串进行编码,再进行匹配,但是这种编码方式对字符串分割的方法有限制,针对不同场景需要进行不同的字符串分割策略调整,同时如果字符串中同时还有多种语言的字符,也会提高字符串分割的难度。所以针对黑名单匹配的主要难点在于:(1)如何对各种语言的字符串进行字符串分割;(2)如何对不同种类的文字编码使其可以在通用场景下运作;(3)如何在大规模的数据下实时匹配到目标字符串;(4)如何提高针对变种字符串的抗干扰能力。基于此,开发一种基于文本特征相似度的用户名黑名单模糊匹配方 法尤为必要。
发明内容
针对现有技术上存在的不足,本发明目的是在于提供一种基于文本特征相似度的用户名黑名单模糊匹配方法,能够快速给出在黑名单中可能存在的对应相似字符,并且返回可能的关联黑名单结果,使用场景更宽泛,具有一定实时性,易于推广使用。
为了实现上述目的,本发明是通过如下的技术方案来实现:一种基于文本特征相似度的用户名黑名单模糊匹配方法,其步骤为:
(1)黑名单字符串预处理模块,在离线情况下对已有的黑名单中过短的非英文字符串进行注音,再去除所有空格字符,并将所有英文字符全部变为小写字符;
(2)黑名单字符串分割模块,在离线情况下将预处理后的黑名单中每个字符串按不同长度进行文字分割,得到对应的短字符串组,最后将短字符串组合并,得到与原字符串对应地分割完的字符串组;
(3)黑名单文字特征训练编码模块,在离线情况下对分割完的字符串组进行特征训练,得到特征编码库,并根据特征编码库对预处理后黑名单中的字符串进行编码;
(4)数据采集预处理模块,接收在线输入的字符串,并类似步骤(1)规则若是过短的非英文字符串则注音,再将字符串进行与步骤(2)相同的字符串分割方法得到对应字符串组;
(5)输入字符串特征编码模块,将步骤(3)得到的字符串组根据离线情况下获得的特征编码库D中寻找每个字符串对应的特征并累加,最后再把累加得到的特征进行归一化;
(6)相似度检索与输出模块,将步骤(4)得到的输入字符串的特征,与黑名单的每个字符串编码计算余弦相似度,再按得到的值的大小排序, 选出最小的十个字符串,得到最后的模糊匹配结果。
作为优选,所述的步骤(1)包括:
①将已有的黑名单A中的少于8个字符的字符串(不包括空格字符)通过音译,统一在原名单后加上英文注音;
②对处理后的黑名单,再直接删除所有空格字符,并且把所有英文字符变为中文,得到预处理后的黑名单A2。
作为优选,所述的步骤(2)包括:
①将黑名单A2中每个字符串Z1视为一组,分别以1,2,3,4个字符为间隔进行文字分割,得到四个对应的四种长度的短字符串组z1,z2,z3,z4;
②将四个短字符串组z1,z2,z3,z4合并,得到与原字符串Z1对应的分割完的字符串群组Z2。
作为优选,所述的步骤(3)包括:
①使用深度学习的方法将步骤(2)得到的分割完的字符串组进行特征训练,得到每个短字符串的特征编码字典D;
②将Z2所有的短字符串找到D中对应的编码,并把编码全部相加,得到Z1的编码C1,再将C1进行L2归一化,得到Z1的最终编码C2,把A2的全部字符串对应的编码保存成编码集合B,同时保存特征编码字典D。
作为优选,所述的步骤(4)包括:
①接收输入的字符串X,并同步骤(1)的步骤,若输入字符串少于8个字符,则在原字符串后加上英文注音,再去除空格;
②同步骤(2)的步骤,再把X分别以1,2,3,4个字符为间隔进行文字分割,得到四个对应的四种长度的短字符串组x1,x2,x3,x4并合并,得到对应的分割完的字符串群组X1。
作为优选,所述的步骤(5)包括:
①得到的字符串组X1中的每个短字符串x,在特征编码字典D中寻找对应的特征c,若不在特征编码库D中则记为0;
②将每个短字符串x的特征c直接相加,得到X的特征编码C3,再将C3进行L2归一化,得到X的最终编码C4。
本发明的有益效果:本方法能够快速给出在黑名单中可能存在的对应相似字符,发现在信贷申请过程中可能存在的非法字符串,并且返回可能的关联黑名单结果,以便发现可能的黑产团伙,使用场景更宽泛,具有一定实时性,应用前景广阔。
附图说明
下面结合附图和具体实施方式来详细说明本发明;
图1为本发明的流程图;
图2为本发明黑名单字符串预处理模块的流程图;
图3为本发明黑名单字符串分割模块的流程图;
图4为本发明字符串分割示例图;
图5为本发明黑名单文字特征训练编码模块的流程图;
图6为本发明数据采集预处理模块的流程图;
图7为本发明输入字符串特征编码模块的流程图;
图8为本发明相似度检索与输出模块的流程图。
具体实施方式
为使本发明实现的技术手段、创作特征、达成目的与功效易于明白了解,下面结合具体实施方式,进一步阐述本发明。
参照图1-8,本具体实施方式采用以下技术方案:一种基于文本特征相似度的用户名黑名单模糊匹配方法,其步骤为:
(1)黑名单字符串预处理模块,在离线情况下对已有的黑名单中过短 的非英文字符串进行注音,再去除所有空格字符,并将所有英文字符全部变为小写字符。
①将已有的黑名单A中的少于8个字符的字符串(不包括空格字符)通过音译,统一在原名单后加上英文注音;
②对处理后的黑名单,再直接删除所有空格字符,并且把所有英文字符变为中文,得到预处理后的黑名单A2。
(2)黑名单字符串分割模块,在离线情况下将预处理后的黑名单中每个字符串按不同长度进行文字分割,得到对应的短字符串组,最后将短字符串组合并,得到与原字符串对应地分割完的字符串组。
①将黑名单A2中每个字符串Z1视为一组,分别以1,2,3,4个字符为间隔进行文字分割,得到四个对应的四种长度的短字符串组z1,z2,z3,z4;
②将四个短字符串组z1,z2,z3,z4合并,得到与原字符串Z1对应的分割完的字符串群组Z2。
(3)黑名单文字特征训练编码模块,在离线情况下对分割完的字符串组进行特征训练,得到特征编码库,并根据特征编码库对预处理后黑名单中的字符串进行编码。
①使用深度学习的方法将步骤(2)得到的分割完的字符串组进行特征训练,得到每个短字符串的特征编码字典D;
②将Z2所有的短字符串找到D中对应的编码,并把编码全部相加,得到Z1的编码C1,再将C1进行L2归一化,得到Z1的最终编码C2,把A2的全部字符串对应的编码保存成编码集合B,同时保存特征编码字典D。
(4)数据采集预处理模块,接收在线输入的字符串,并类似步骤(1)规则若是过短的非英文字符串则注音,再将字符串进行与步骤(2)相同的字符串分割方法得到对应字符串组。
①接收输入的字符串X,并同步骤(1)的步骤,若输入字符串少于8个字符,则在原字符串后加上英文注音,再去除空格;
②同步骤(2)的步骤,再把X分别以1,2,3,4个字符为间隔进行文字分割,得到四个对应的四种长度的短字符串组x1,x2,x3,x4并合并,得到对应的分割完的字符串群组X1。
(5)输入字符串特征编码模块,将步骤(3)得到的字符串组根据离线情况下获得的特征编码库D中寻找每个字符串对应的特征并累加,最后再把累加得到的特征进行归一化。
①得到的字符串组X1中的每个短字符串x,在特征编码字典D中寻找对应的特征c,若不在特征编码库D中则记为0;
②将每个短字符串x的特征c直接相加,得到X的特征编码C3,再将C3进行L2归一化,得到X的最终编码C4。
(6)相似度检索与输出模块,将步骤(4)得到的输入字符串的特征,与黑名单的每个字符串编码计算余弦相似度,再按得到的值的大小排序,选出最小的十个字符串,得到最后的模糊匹配结果。
本具体实施方式首先使用英文注音针对字符量较少的非英文字符串进行语义补充,去除空格字符统一大小写,然后使用按不同长度的间隔切割字符串再合并切割结果的方法进行分词,并使用深度学习技术实现字符串的编码,在离线情况下完成黑名单特征的编码,并获得编码字典。在实时运作时,将输入的字符串进行相同的字符串分割操作,并根据编码字典进行编码,最后并使用余弦相似度找出在黑名单中编码最相似的10个单词,完成一次模糊匹配。
本方法通过字符串分割与特征训练相结合,能实时给出批量的与黑名单内字符串相似的字符串候选,在提取字符串特征前,先通使用一致的字符串分割方法,得到只含有较短字符串,再进行特征训练,使得字 符串特征信息更加丰富,此外,对于提取字符串的特征使用了深度学习的方法,并且同时使用余弦距离判断字符串相似度,能够实时找出所有可能的在黑名单中相似的字符串,对变体的字符串也有很强的侦查能力。其技术优势在于:
(1)可以对任意字符串使用一致的字符串分割方法,而不局限于词语的语义和长度,使得本方法能在更加广泛的场景被使用。
(2)本方法使用的深度学习训练被分解的字符串特征,再聚合所有被分解的字符串特征,从而使得提炼出的原字符串特征具有多重语义,从而找出与黑名单相似又不一定完全相同的字符串。
(3)在匹配环节使用余弦距离判断字符串之间的相似度,能够进行大批量的计算,批量返回可能的相似结果,具有一定实时性。通过该步骤可以协助检测人员快速寻找可疑的字符串。
实施例1:一种基于文本特征相似度的用户名黑名单模糊匹配方法,具体实施时,先在离线情况下对黑名单进行预处理,然后分割字符串用以训练编码,生成黑名单特征库和字符串特征字典库。然后实时接收字符串时,先预处理字符串,再根据生成的字符串特征字典库对字符串编码,最后对比黑名单特征库,找出余弦相似度最大的10个词语并输出。
根据图1所示的在信贷场景下使用基于文本特征相似度的黑名单模糊匹配方法的流程图,其具体包括以下步骤:
S1.黑名单字符串预处理模块,在离线情况下对已有的黑名单中过短的非英文字符串进行注音,再去除所有空格字符,并将所有英文字符全部变为小写字符。
具体的,由于黑名单中可能出现多种语言,而某些语言的名字字符串可能过短,如中文,日文等往往名字仅有3到5个字。同时中文名、日文名字符特异性比较高,有些字符的出现频率不高。在黑名单中又可 能出现同音字代替原字符,导致不利于后面的特征训练。
根据图2所示的黑名单字符串预处理模块,其包括如下步骤:
S1.1:将已有的黑名单A中的少于8个字符的字符串(不包括空格字符)通过音译,统一在原名单后加上英文注音。
具体的,遍历黑名单A中的所有字符串,若字符串长度少于8则为其添加英文注音,直接与原字符串拼接。并取代A中原字符串。
S1.2:针对S1.1处理后的黑名单,再直接删除所有空格字符,得到预处理后的黑名单A2。
具体的,空格字符会影响分割过程中的结果,同时也会使分割后的字符串总长度增加,不利于训练,因此对A中所有的字符串直接删除所有空格字符,同时把所有的英语大写字符变为小写字符,并把得到的字符串代替原字符串,达到黑名单A2。
S2.黑名单字符串分割模块,在离线情况下将预处理后的黑名单中每个字符串按不同长度进行文字分割,得到对应的短字符串组,最后将短字符串组合并,得到与原字符串对应地分割完的字符串组。
具体的,遍历黑名单中的字符串,针对每次取出的长字符串Z,采取不同长度的分割,得到多种长度的短字符串组,丰富了字符串的语义信息,并把得到的几个短字符串组合并,得到原长字符串Z分割后的对应短字符串组Z2。
根据图3所示的黑名单字符串分割模块,对S1输出的预处理数据进行分割的示意图,其包括如下步骤:
S2.1:将黑名单A2中每个字符串Z1视为一组,分别以1,2,3,4个字符为间隔进行文字分割,得到四个对应的四种长度的短字符串组z1,z2,z3,z4。
具体的,如图4所示,假设输入单词Z1为‘abcde’,则分别按1,2, 3,4,四个长度的短字符串组{a,b,c,d,e},{ab,bc,cd,de},{abc,bcd,cde},{abcd,bcde}。
S2.2:将S1.2的四个短字符串组z1,z2,z3,z4合并,得到与原字符串Z1对应的分割完的字符串群组Z2。
具体的,如图四所示,把S2.1得到的{a,b,c,d,e},{ab,bc,cd,de},{abc,bcd,cde},{abcd,bcde}合并起来成为{a,b,c,d,e,ab,bc,cd,de,abc,bcd,cde,abcd,bcde}作为Z1对应的短字符串组。
S3:名单文字特征训练编码模块,在离线情况下对分割完的字符串组进行特征训练,得到特征编码库,并根据特征编码库对预处理后黑名单中的字符串进行编码。
具体的,使用深度学习的方法,给每个短字符串训练特征,再把这些短字符串整合成一个特征编码字典D。然后通过Z2所有对应的编码相加归一化后,获得Z1的编码,最后整合成黑名单编码库。
根据图5所示的黑名单文字特征训练编码模块,对S2输出的分割后的数据进行编码示意图,其包括如下步骤:
S3.1:使用深度学习的方法将S2.2得到的分割完的字符串组进行特征训练,得到每个短字符串的特征编码字典D。
具体的,先将S2.2获得的所有短字符串组整合成一个没有重复字符串的字典,给所有的短字符串赋予一个随机的长度为128维的向量。再把这些短字符串整合成一个特征编码字典D,然后遍历Z2,取出每个短字符串组Q,把Q里的短字符串标记为1,其余在D中的短字符串标记为0。然后计算Q中短字符串与D中的短字符串的余弦相似度。具体公式如下:
Figure PCTCN2022136824-appb-000001
其中,x,y是S4.2中得到特征向量,然后使用交叉熵损失损失函数更新特征。具体公式如下:
Figure PCTCN2022136824-appb-000002
其中,y i是样本i的标记,为1或0。p i为预测出来的余弦相似度。
S3.2:将Z2所有的短字符串找到D中对应的编码,并把编码全部相加,得到Z1的编码C1,再将C1进行L2归一化,得到Z1的最终编码C2,把A2的全部字符串对应的编码保存成编码集合B。同时保存特征编码字典D。
具体的,Z2所有的短字符串在D中都会找到一个对应的编码,然后把这些编码直接线性相加,得到一个128维的向量,再使用L2归一化,使得向量的模长都为1。这样就得到了Z1的最终编码C2。把所有的Z1和对应编码集合起来就变成了黑名单特征库B。
S4.数据采集预处理模块,接收在线输入的字符串,并类似S1规则若是过短的非英文字符串则注音。再将字符串进行与S2相同的字符串分割方法得到对应字符串组。
具体的,接收到的字符串X对它作与之前黑名单一样的预处理和分割,获得字符串对应的短字符串组X1。
根据图6所示的数据采集预处理模块,其包括如下步骤:
S4.1:接收输入的字符串X,并同S1.1,S1.2的步骤,若输入字符串少于8个字符,则在原字符串后加上英文注音,再去除空格,把英文字符变为小写。
具体的,同之前黑名单制作的过程相似,直接在字符串后补充英文注音,并删除空格,英文字符变为小写。
S4.2:同S2.1,S2.2步骤,再把X分别以1,2,3,4个字符为间隔进行文字分割,得到四个对应的四种长度的短字符串组x1,x2,x3,x4并合并,得到对应的分割完的字符串群组X1。
具体的,同之前黑名单制作的过程相似,拆分字符串X变为字符串群组X1。
S5.输入字符串特征编码模块,将S3得到的字符串组根据离线情况下获得的特征编码库D中寻找每个字符串对应的特征并累加,最后再把累加得到的特征进行归一化。
具体的,利用S3得到的特征编码字典D,让X1找到对应的特征并且相加,获得字符串特征编码C4。
根据图7所示的数据采集预处理模块,其包括如下步骤:
S5.1:S4.2得到的字符串组X1中的每个短字符串x,在特征编码字典D中寻找对应的特征c,若不在特征编码字典D中则记为0。
具体的,针对字符串组X1的每个短字符串x,若在特征编码字典D中没有对应x的编码,则x对应的编码则为0,最后所有的对应特征编码全部取出保存。
S5.2:将每个短字符串x的特征c直接相加,得到X的特征编码C3,再将C3进行L2归一化,得到X的最终编码C4。
具体的,若短字符串编码为0,则相加后的结果不变,最后得到的特征编码C3,再进行L2归一化,得到X的最终编码C4。
S6.相似度检索与输出模块,将S4得到的输入字符串的特征,与黑名单的每个字符串编码计算余弦相似度,再按得到的值的大小排序,选出最小的十个字符串,得到最后的模糊匹配结果。
具体的,由于编码存在不稳定性的情况,使用余弦相似度匹配最相似的10个特征,找到对应的黑名单文字,将余弦相似度一起作为模糊匹配的结果输出。
根据图8所示的相似度检索与输出模块,将S5.2得到的C4和S2.2中得到的B中的所有特征分别计算余弦相似度,得到值R,并且按R的大 小排序,取前十个值r1,r2,...,r10和对应的字符串y1,y2,...,y10,将y1到y10与对应分值r1到r10输出作为最终结果。
以上显示和描述了本发明的基本原理和主要特征和本发明的优点。本行业的技术人员应该了解,本发明不受上述实施例的限制,上述实施例和说明书中描述的只是说明本发明的原理,在不脱离本发明精神和范围的前提下,本发明还会有各种变化和改进,这些变化和改进都落入要求保护的本发明范围内。本发明要求保护范围由所附的权利要求书及其等效物界定。

Claims (6)

  1. 一种基于文本特征相似度的用户名黑名单模糊匹配方法,其特征在于,其步骤为:
    (1)黑名单字符串预处理模块,在离线情况下对已有的黑名单中过短的非英文字符串进行注音,再去除所有空格字符,并将所有英文字符全部变为小写字符;
    (2)黑名单字符串分割模块,在离线情况下将预处理后的黑名单中每个字符串按不同长度进行文字分割,得到对应的短字符串组,最后将短字符串组合并,得到与原字符串对应地分割完的字符串组;
    (3)黑名单文字特征训练编码模块,在离线情况下对分割完的字符串组进行特征训练,得到特征编码库,并根据特征编码库对预处理后黑名单中的字符串进行编码;
    (4)数据采集预处理模块,接收在线输入的字符串,并类似步骤(1)规则若是过短的非英文字符串则注音,再将字符串进行与步骤(2)相同的字符串分割方法得到对应字符串组;
    (5)输入字符串特征编码模块,将步骤(3)得到的字符串组根据离线情况下获得的特征编码库D中寻找每个字符串对应的特征并累加,最后再把累加得到的特征进行归一化;
    (6)相似度检索与输出模块,将步骤(4)得到的输入字符串的特征,与黑名单的每个字符串编码计算余弦相似度,再按得到的值的大小排序,选出最小的十个字符串,得到最后的模糊匹配结果。
  2. 根据权利要求1所述的一种基于文本特征相似度的用户名黑名单模糊匹配方法,其特征在于,所述的步骤(1)包括:
    ①将已有的黑名单A中的少于8个字符的字符串(不包括空格字符)通过音译,统一在原名单后加上英文注音;
    ②对处理后的黑名单,再直接删除所有空格字符,并且把所有英文字符变为中文,得到预处理后的黑名单A2。
  3. 根据权利要求1所述的一种基于文本特征相似度的用户名黑名单模糊匹配方法,其特征在于,所述的步骤(2)包括:
    ①将黑名单A2中每个字符串Z1视为一组,分别以1,2,3,4个字符为间隔进行文字分割,得到四个对应的四种长度的短字符串组z1,z2,z3,z4;
    ②将四个短字符串组z1,z2,z3,z4合并,得到与原字符串Z1对应的分割完的字符串群组Z2。
  4. 根据权利要求1所述的一种基于文本特征相似度的用户名黑名单模糊匹配方法,其特征在于,所述的步骤(3)包括:
    ①使用深度学习的方法将步骤(2)得到的分割完的字符串组进行特征训练,得到每个短字符串的特征编码字典D;
    ②将Z2所有的短字符串找到D中对应的编码,并把编码全部相加,得到Z1的编码C1,再将C1进行L2归一化,得到Z1的最终编码C2,把A2的全部字符串对应的编码保存成编码集合B,同时保存特征编码字典D。
  5. 根据权利要求1所述的一种基于文本特征相似度的用户名黑名单模糊匹配方法,其特征在于,所述的步骤(4)包括:
    ①接收输入的字符串X,并同步骤(1)的步骤,若输入字符串少于8个字符,则在原字符串后加上英文注音,再去除空格;
    ②同步骤(2)的步骤,再把X分别以1,2,3,4个字符为间隔进行文字分割,得到四个对应的四种长度的短字符串组x1,x2,x3,x4并合并,得到对应的分割完的字符串群组X1。
  6. 根据权利要求1所述的一种基于文本特征相似度的用户名黑名单模糊匹配方法,其特征在于,所述的步骤(5)包括:
    ①得到的字符串组X1中的每个短字符串x,在特征编码字典D中寻找对应的特征c,若不在特征编码库D中则记为0;
    ②将每个短字符串x的特征c直接相加,得到X的特征编码C3,再将C3进行L2归一化,得到X的最终编码C4。
PCT/CN2022/136824 2022-08-29 2022-12-06 一种基于文本特征相似度的用户名黑名单模糊匹配方法 WO2024045399A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211041839.0 2022-08-29
CN202211041839 2022-08-29

Publications (1)

Publication Number Publication Date
WO2024045399A1 true WO2024045399A1 (zh) 2024-03-07

Family

ID=90100228

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/136824 WO2024045399A1 (zh) 2022-08-29 2022-12-06 一种基于文本特征相似度的用户名黑名单模糊匹配方法

Country Status (1)

Country Link
WO (1) WO2024045399A1 (zh)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105912514A (zh) * 2016-04-28 2016-08-31 吴国华 基于指纹特征的文本复制检测系统及方法
CN106776539A (zh) * 2016-11-09 2017-05-31 武汉泰迪智慧科技有限公司 一种多维度短文本特征提取方法及系统
CN112395877A (zh) * 2020-11-04 2021-02-23 苏宁云计算有限公司 字符串检测方法、装置、计算机设备和存储介质

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105912514A (zh) * 2016-04-28 2016-08-31 吴国华 基于指纹特征的文本复制检测系统及方法
CN106776539A (zh) * 2016-11-09 2017-05-31 武汉泰迪智慧科技有限公司 一种多维度短文本特征提取方法及系统
CN112395877A (zh) * 2020-11-04 2021-02-23 苏宁云计算有限公司 字符串检测方法、装置、计算机设备和存储介质

Similar Documents

Publication Publication Date Title
CN112507065B (zh) 一种基于注释语义信息的代码搜索方法
KR100630886B1 (ko) 문자 스트링 식별
WO2021114745A1 (zh) 一种基于词缀感知的社交媒体命名实体识别方法
CN111737496A (zh) 一种电力设备故障知识图谱构建方法
Zhou et al. Resolving surface forms to wikipedia topics
Bellare et al. Learning extractors from unlabeled text using relevant databases
CN111209749A (zh) 一种将深度学习应用于中文分词的方法
Ye et al. Unknown Chinese word extraction based on variety of overlapping strings
CN113076748B (zh) 弹幕敏感词的处理方法、装置、设备及存储介质
CN112835894A (zh) 一种基于地址编码和相似计算的地址匹配方法
Wang et al. Combining self-supervised learning and active learning for disfluency detection
CN112528653B (zh) 短文本实体识别方法和系统
WO2019064137A1 (en) EXPRESSION OF EXPRESSION FOR TREATMENT OF NATURAL LANGUAGE
CN110705295B (zh) 基于关键词提取的实体名消岐方法
Celebi et al. Segmenting hashtags using automatically created training data
CN115577269A (zh) 一种基于字符串文本特征相似度的黑名单模糊匹配方法
WO2024045399A1 (zh) 一种基于文本特征相似度的用户名黑名单模糊匹配方法
CN111062208A (zh) 一种文件审核的方法、装置、设备及存储介质
Orlando et al. Seed: A framework for extracting social events from press news
JPH06282587A (ja) 文書の自動分類方法及び装置並びに分類用の辞書作成方法及び装置
Lu et al. Learning Chinese word embeddings by discovering inherent semantic relevance in sub-characters
Mishra et al. Similarity Search based on Text Embedding Model for detection of Near Duplicates
CN107491423B (zh) 一种基于数值-字符串混合编码的中文文档基因量化与表征方法
CN112632216B (zh) 一种基于深度学习的长文本检索系统及方法
CN114461760A (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: 22957211

Country of ref document: EP

Kind code of ref document: A1