WO2020107840A1 - 基于机器学习的句子距离映射方法、装置和计算机设备 - Google Patents

基于机器学习的句子距离映射方法、装置和计算机设备 Download PDF

Info

Publication number
WO2020107840A1
WO2020107840A1 PCT/CN2019/089059 CN2019089059W WO2020107840A1 WO 2020107840 A1 WO2020107840 A1 WO 2020107840A1 CN 2019089059 W CN2019089059 W CN 2019089059W WO 2020107840 A1 WO2020107840 A1 WO 2020107840A1
Authority
WO
WIPO (PCT)
Prior art keywords
single sentence
word
sentence
distance
text information
Prior art date
Application number
PCT/CN2019/089059
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 平安科技(深圳)有限公司
Priority to SG11201912523RA priority Critical patent/SG11201912523RA/en
Priority to US16/759,368 priority patent/US20210209311A1/en
Publication of WO2020107840A1 publication Critical patent/WO2020107840A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/237Lexical tools
    • G06F40/247Thesauruses; Synonyms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/237Lexical tools
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • G06F40/35Discourse or dialogue representation

Definitions

  • the present application relates to the field of computers, and in particular to a sentence distance mapping method, device, computer equipment and storage medium based on machine learning.
  • sentence similarity calculation is an important content (that is, calculating the similarity between two sentences). Specifically, it is used in information retrieval, question answering systems, machine translation and other application fields. More frequent.
  • the prior art mostly uses cosine similarity to calculate the similarity of two sentences. This method generally counts the word frequency of the same word between two sentences to form a word frequency vector, and then uses the word frequency vector to calculate the similarity of the two sentences. Since the method in the prior art only uses the word frequency of the same word in two sentences, the accuracy of the calculated similarity is not high.
  • the similarity calculated in the prior art is generally not a scoring system (such as a percentage system) used by humans. Therefore, when the calculated similarity is output, it cannot intuitively reflect how high the similarity between the two sentences is.
  • the main purpose of the present application is to provide a sentence distance mapping method, device, computer equipment and storage medium based on machine learning, aiming to accurately calculate the similarity between sentences and intuitively and accurately reflect the similarity between sentences.
  • this application proposes a sentence distance mapping method based on machine learning, including the following steps:
  • the word vector corresponding to each word in the single-sentence text information using a preset algorithm to calculate the distance between the single-sentence text information and a preset standard single sentence, wherein the preset standard single sentence has undergone at least word segmentation processing;
  • the training data includes a single sentence for training, a standard single sentence for training, a single sentence for training and the training The distance of the standard single sentence and the degree of artificial similarity between the training single sentence and the training standard single sentence.
  • This application provides a sentence distance mapping device based on machine learning, including:
  • Single sentence voice information acquisition unit used to obtain the input single sentence voice information
  • a single sentence text information conversion unit configured to convert the single sentence speech information into single sentence text information
  • a preprocessing unit is used to preprocess the single sentence text information and query a preset word vector library to obtain the word vector corresponding to each word in the preprocessed single sentence text information, wherein the preprocessing is at least Including word segmentation processing;
  • the sentence distance calculation unit is configured to calculate a distance between the single sentence text information and a preset standard single sentence using a preset algorithm according to a word vector corresponding to each word in the single sentence text information, wherein the preset standard single sentence is at least After word segmentation processing;
  • a score mapping unit is used to input the distance into a preset function and map out a score, wherein the preset function is obtained by training with training data, and the training data includes a single sentence for training, a standard single sentence for training, and the training The distance between a single sentence and the standard single sentence for training, and an artificial score for the degree of similarity between the single sentence for training and the standard single sentence for training.
  • the present application provides a computer device, including a memory and a processor.
  • the memory stores a computer program, and when the processor executes the computer program, the steps of any one of the above methods are implemented.
  • the present application provides a computer non-volatile readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the above methods are implemented.
  • the machine learning-based sentence distance mapping method, device, computer equipment and storage medium of the present application convert the acquired single sentence speech information into single sentence text information, and then obtain each word in the preprocessed single sentence text information through preprocessing Corresponding word vector, use the word vector to calculate the distance between the single sentence text information and the preset standard single sentence using a preset algorithm, and input the distance into a preset function to map out the score, which is more accurate and intuitive Technical effect.
  • 1 is a schematic flowchart of a sentence distance mapping method based on machine learning according to an embodiment of the application
  • FIG. 2 is a schematic block diagram of a structure of a sentence distance mapping device based on machine learning according to an embodiment of the application;
  • FIG. 3 is a schematic block diagram of a computer device according to an embodiment of the present application.
  • an embodiment of the present application provides a sentence distance mapping method based on machine learning, including the following steps:
  • Preprocess the single sentence text information and query a preset word vector library to obtain word vectors corresponding to each word in the preprocessed single sentence text information, where the preprocessing includes at least word segmentation processing;
  • the distance is input into a preset function, and a score is mapped, wherein the preset function is obtained through training data training, and the training data includes a single sentence for training, a standard single sentence for training, a single sentence for training and the The distance of the standard single sentence for training and the degree of similarity of the artificial single sentence to the standard single sentence for training.
  • the input single sentence voice information is obtained.
  • This embodiment can be used in scenarios such as vocabulary learning, speech training, and simulated insurance sales. Therefore, first, a single sentence of voice information input by the user must be obtained.
  • the acquisition methods include: using a microphone to collect voice information; using a microphone array to collect voice information, etc.
  • the collected voice information is a single sentence.
  • the single sentence voice information is converted into single sentence text information.
  • the method of voice conversion may be any feasible method, and any mature software on the market may be used to convert the single sentence voice information into single sentence text information.
  • preprocessing includes: word segmentation, word segmentation correction, synonym replacement, and removal of stop words.
  • Word segmentation can use open source word segmentation tools, such as Jieba, SnowNLP, THULAC, NLPIR.
  • Word segmentation methods include: word segmentation based on string matching, word segmentation based on understanding, and word segmentation based on statistics.
  • a preset algorithm is used to calculate the distance between the single sentence text information and a preset standard single sentence.
  • the method for calculating the distance between the single sentence text information and the preset standard single sentence using a preset algorithm includes: using a WMD algorithm (word move's distance), a simhash algorithm, and an algorithm based on cosine similarity to calculate the single sentence text The distance between the information and the preset standard single sentence.
  • the distance is input into a preset function, and a score is mapped, wherein the preset function is obtained by training with training data, and the training data includes a single sentence for training, a standard single sentence for training, and the training The distance between the single sentence and the standard single sentence for training and the degree of similarity of the artificial single sentence to the standard single sentence for training.
  • the preset function is obtained through machine learning, so that the mapped score of the preset function is more accurate.
  • the function of the preset function is to map the distance between the single sentence text information and the preset standard single sentence as a score, so that the user can intuitively understand the similarity between the single sentence text information and the preset standard single sentence.
  • the score is on a 100% scale.
  • the preset function is a quadratic equation of one variable.
  • the step S3 of preprocessing the single sentence text information includes:
  • the word segmentation can use open source word segmentation tools, such as jieba, SnowNLP, THULAC, NLPIR.
  • Word segmentation methods include: word segmentation based on string matching, word segmentation based on understanding, and word segmentation based on statistics.
  • a single sentence is divided into multiple words. For example, "Beijing has good scenery and is a tourist attraction” can be divided into "
  • the preset thesaurus In order to reduce the amount of calculation and increase the accuracy of the meaning of words, by querying the preset thesaurus, it is determined whether there is a synonym group in the word sequence. If there is a synonym group, all words in the synonym group are replaced by Describe any one of the synonym groups.
  • the thesaurus includes multiple synonym entries. If more than two words appear in the same synonym entry in the word sequence, it indicates that the two or more words constitute a synonym group. In general, the replacement of synonyms does not cause the original meaning of a single sentence to change, so the method of replacing synonyms is used to reduce the amount of calculation and data storage. Wherein, the preset thesaurus can be queried to determine whether there is a synonym group in the word sequence.
  • the step S4 of calculating the distance between the single sentence text information and the preset standard single sentence using a preset algorithm according to the word vector corresponding to each word in the single sentence text information includes:
  • Distance (I, R) is the distance between the single sentence I and the single sentence R
  • I is the single sentence text information
  • R is the preset standard single sentence
  • is the number of words with word vectors included in the single sentence text information
  • is the number of words with word vectors included in the preset standard single sentence
  • w is the word vector
  • is to adjust two words
  • the magnification factor of cosine similarity between vectors; max( ⁇ CosDis(w, R)) is the maximum value of the cosine similarity between the word vector corresponding to all words in a single sentence R and the word vector w in a single sentence
  • the distance between the single sentence text information and the preset standard single sentence is calculated using a preset algorithm.
  • the above formula uses the cosine similarity of the word vector.
  • the formula for calculating the cosine similarity is:
  • w1 is the first word vector (the word vector of each word in the single sentence text information);
  • w2 is the second word vector (the word vector of each word in the preset standard single sentence);
  • n is the word vector To calculate the similarity between word vectors w1 and w2. Substituting the cosine similarity calculation formula into the calculation formula for the distance between the single sentence text information and the preset standard single sentence, the distance between the single sentence text information and the preset standard single sentence can be calculated.
  • the step S4 of calculating the distance between the single sentence text information and the preset standard single sentence using a preset algorithm according to the word vector corresponding to each word in the single sentence text information includes:
  • Distance (I, R) is the distance between the single sentence I and the single sentence R
  • I is the single sentence text information
  • R is the preset standard single sentence
  • Tij is the weight transfer of the i-th word in the single sentence I to the j-th word in the single sentence R
  • di is the word frequency of the i-th word in the single sentence I
  • d' j is the word frequency of the j-th word in the single sentence R
  • C(i, j) is the Euclidean distance between the i-th word in the single sentence I and the j-th word in the single sentence R
  • m is the number of words with the word vector in the single sentence I
  • n is the word with the word vector in the single sentence R The number of words.
  • the distance between the single sentence text information and the preset standard single sentence is calculated using a preset algorithm.
  • the above formula uses the Euclidean distance of the word vector.
  • the formula for calculating the Euclidean distance is:
  • n is the dimension of the word vector.
  • the preset function is a quadratic equation of one variable
  • the step of training the preset function by training data includes:
  • S504 Perform average processing on the values of the n/3 groups of parameters a, b, and c to obtain final values of the parameters a, b, and c.
  • the preset function is obtained by training through the training data.
  • manual scoring refers to the degree of similarity between the training single sentence and the standard single sentence, using human feelings to reflect the similarity between the training single sentence and the standard single sentence.
  • the scoring can use a percentage system, that is, a score of 100 indicates complete similarity, and a score of 0 indicates complete dissimilarity. Since the quadratic equation of one variable has three parameters a, b, and c, the exact parameter value can be obtained by using 3 samples, so it is divided into n/3 groups, so that under a certain amount of calculation, we can get n /3 group parameter value.
  • the mean value processing includes: arithmetic average processing, geometric average processing, root mean square average processing, weighted average processing, etc.
  • the preset word vector library is obtained by training with the word2vec tool, and the training method includes:
  • word2vec is a tool for training word vectors, including CBOW (Continuous Bag of Words) and Skip-Gram.
  • CBOW guesses the target words from the original sentences; Skip-Gram guesses the original words from the target words.
  • CBOW is more suitable for small corpus, this application chooses to use CBOW model for word vector training.
  • the step S4 before calculating the distance between the single sentence text information and the preset standard single sentence using a preset algorithm according to the word vector corresponding to each word in the single sentence text information includes:
  • the overlapping word similarity algorithm is calculated according to the cosine similarity of two sentences to reflect the similarity between the two sentences. Because it only uses overlapping words to determine accuracy, it is not accurate enough to judge the similarity of sentences, but it can be used to filter standard single sentences.
  • the similarity algorithm is:
  • A is the word frequency vector of the single sentence text information
  • B is the word frequency vector of the standard single sentence
  • Ai is the number of times the i-th word of the single sentence text information appears in the entire single sentence.
  • the sentence distance mapping method based on machine learning of the present application converts the acquired single sentence speech information into single sentence text information, and then obtains the word vector corresponding to each word in the pre-processed single sentence text information through preprocessing.
  • the word vector uses a preset algorithm to calculate the distance between the single sentence text information and a preset standard single sentence, and further inputs the distance into a preset function to map a score, which has a more accurate and intuitive technical effect.
  • an embodiment of the present application provides a sentence distance mapping device based on machine learning, including:
  • the single-sentence speech information acquiring unit 10 is used to acquire the input single-sentence speech information
  • a single sentence text information conversion unit 20 configured to convert the single sentence speech information into single sentence text information
  • the preprocessing unit 30 is configured to preprocess the single sentence text information and query a preset word vector library to obtain the word vector corresponding to each word in the preprocessed single sentence text information, wherein the preprocessing At least include word segmentation processing;
  • the sentence distance calculation unit 40 is configured to calculate a distance between the single sentence text information and a preset standard single sentence using a preset algorithm according to a word vector corresponding to each word in the single sentence text information, wherein the preset standard single sentence At least after word segmentation processing;
  • the score mapping unit 50 is used to input the distance into a preset function and map out the score, wherein the preset function is obtained by training with training data, the training data includes a single sentence for training, a standard single sentence for training, the training The distance between the single sentence and the standard single sentence for training and the degree of similarity of the artificial single sentence to the standard single sentence for training.
  • the pre-processing unit 30 includes:
  • the word segmentation subunit is used to segment the single sentence text information to obtain a word sequence containing multiple words
  • the synonym group judgment subunit is used to judge whether there is a synonym group in the word sequence by querying a preset thesaurus;
  • the synonym replacement subunit is used to replace all words in the synonym group with any one of the synonym groups if there is a synonym group.
  • the sentence distance calculation unit 40 includes:
  • the first sentence distance calculation unit is used to adopt the formula:
  • Distance (I, R) is the distance between the single sentence I and the single sentence R
  • I is the single sentence text information
  • R is the preset standard single sentence
  • is the number of words with word vectors included in the single sentence text information
  • is the number of words with word vectors included in the preset standard single sentence
  • w is the word vector
  • is to adjust two words
  • the magnification factor of the cosine similarity between vectors; max( ⁇ CosDis(w,R)) is the maximum value of the cosine similarity between the word vector corresponding to all words in a single sentence R and the word vector w in a single sentence I.
  • the sentence distance calculation unit 40 includes:
  • the second sentence distance calculation unit is used to adopt the formula:
  • Distance (I, R) is the distance between the single sentence I and the single sentence R
  • I is the single sentence text information
  • R is the preset standard single sentence
  • Tij is the weight transfer of the i-th word in the single sentence I to the j-th word in the single sentence R
  • di is the word frequency of the i-th word in the single sentence I
  • d' j is the word frequency of the j-th word in the single sentence R
  • C(i, j) is the Euclidean distance between the i-th word in the single sentence I and the j-th word in the single sentence R
  • m is the number of words with the word vector in the single sentence I
  • n is the word with the word vector in the single sentence R The number of words.
  • the preset function is a quadratic equation of one variable
  • the device includes:
  • a sample data obtaining unit used to obtain n sample data, randomly dividing the sample data into n/3 groups, where each group has 3 sample data, the sample data includes the training distance between the training single sentence and the standard single sentence , And the manual scoring result corresponding to the training distance, n is a multiple of 3;
  • the data substitution unit is used to substitute the n/3 sets of data into the unary quadratic equation to obtain the values of the n/3 sets of parameters a, b, and c;
  • the mean value processing unit is configured to perform mean value processing on the values of the n/3 groups of parameters a, b, and c to obtain the final values of the parameters a, b, and c.
  • the preset word vector library is obtained by training with the word2vec tool.
  • the device includes:
  • the word vector training unit is used to use the word2vec tool's CBOW model to perform word vector training on words in a preset corpus to obtain the preset word vector library, where the corpus is a word used to train word vectors Library.
  • the device includes:
  • An overlapping word similarity algorithm calculation unit used to calculate the similarity between the single sentence text information and all standard single sentences in the standard single sentence library by using the overlapping word similarity algorithm;
  • a standard single sentence judgment unit used to judge whether there is a standard single sentence whose similarity is greater than a first threshold
  • the standard single sentence setting unit is configured to, if it exists, set the standard single sentence whose similarity is greater than the first threshold as the preset standard single sentence.
  • the sentence distance mapping device based on machine learning of the present application converts the acquired single sentence speech information into single sentence text information, and then obtains the word vector corresponding to each word in the preprocessed single sentence text information through preprocessing, using the The word vector uses a preset algorithm to calculate the distance between the single sentence text information and a preset standard single sentence, and further inputs the distance into a preset function to map a score, which has a more accurate and intuitive technical effect.
  • an embodiment of the present application further provides a computer device.
  • the computer device may be a server, and its internal structure may be as shown in the figure.
  • the computer device includes a processor, memory, network interface, and database connected by a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system, a computer program, and a database.
  • the memory device provides an environment for operating systems and computer programs in non-volatile storage media.
  • the database of the computer device is used to store data used in the sentence distance mapping method based on machine learning.
  • the network interface of the computer device is used to communicate with external terminals through a network connection.
  • the computer program is executed by the processor to implement a sentence distance mapping method based on machine learning.
  • the above processor executes the above machine learning-based sentence distance mapping method, wherein the method includes steps corresponding to the steps of performing the machine learning-based sentence distance mapping method of the foregoing embodiment one-to-one, which will not be repeated here.
  • the computer device of the present application converts the obtained single sentence speech information into single sentence text information, and then obtains the word vector corresponding to each word in the preprocessed single sentence text information through preprocessing, and uses the word vector to use a preset algorithm
  • the distance between the single sentence text information and the preset standard single sentence is calculated, and the distance is further input into a preset function to map a score, which has a more accurate and intuitive technical effect.
  • An embodiment of the present application further provides a computer non-volatile readable storage medium on which a computer program is stored.
  • a sentence distance mapping method based on machine learning is implemented, wherein the method includes steps They respectively correspond to the steps of executing the sentence distance mapping method based on machine learning in the foregoing embodiment, and will not be repeated here.
  • the computer non-volatile readable storage medium of the present application converts the acquired single sentence speech information into single sentence text information, and then obtains the word vector corresponding to each word in the pre-processed single sentence text information through preprocessing, and uses the
  • the predicate vector uses a preset algorithm to calculate the distance between the single sentence text information and a preset standard single sentence, and further inputs the distance into a preset function to map a score, which has a more accurate and intuitive technical effect.
  • Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory can include random access memory (RAM) or external cache memory.
  • RAM random access memory
  • RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual-speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

Landscapes

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

Abstract

本申请揭示了一种基于机器学习的句子距离映射方法、装置、计算机设备和存储介质,所述方法包括:获取输入的单句语音信息;将所述单句语音信息转换为单句文字信息;对所述单句文字信息进行预处理,并查询预设的词向量库以获取所述预处理后的单句文字信息中各个单词对应的词向量;根据所述单句文字信息中各个单词对应的词向量,使用预设算法计算出所述单句文字信息与预设的标准单句的距离;将所述距离输入预设函数,映射出评分,其中所述预设函数通过训练数据训练得出。从而精确计算出句子间的相似度,具有更准确、更直观的技术效果。

Description

基于机器学习的句子距离映射方法、装置和计算机设备
本申请要求于2018年11月28日提交中国专利局、申请号为201811437243.6,发明名称为“基于机器学习的句子距离映射方法、装置和计算机设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及到计算机领域,特别是涉及到一种基于机器学习的句子距离映射方法、装置、计算机设备和存储介质。
背景技术
自然语言处理领域中,句子相似度计算是其中的一项重要内容(即计算出两个句子之间的相似程度),具体地,在信息检索、问答系统、机器翻译等应用领域中被应用地越来越频繁。但是,现有技术多是余弦相似性,以计算两个句子的相似程度。这种方法一般是统计两个句子间相同的词的词频,以形成词频向量,再利用词频向量以计算两个句子的相似程度。由于现有技术的方法仅是利用两个句子的相同词的词频,因此计算出的相似度准确度不高。另外,现有技术计算出的相似程度一般不为人类习惯用的打分制度(例如百分制),因此将计算出的相似度输出时,不能直观地反映两个句子间究竟有多高的相似程度。
技术问题
本申请的主要目的为提供一种基于机器学习的句子距离映射方法、装置、计算机设备和存储介质,旨在精确计算出句子间的相似度,直观准确地反映句子间的相似度。
技术解决方案
为了实现上述发明目的,本申请提出一种基于机器学习的句子距离映射方法,包括以下步骤:
获取输入的单句语音信息;
将所述单句语音信息转换为单句文字信息;
对所述单句文字信息进行预处理,并查询预设的词向量库以获取所述预处理后的单句文字信息中各个单词对应的词向量,其中,所述预处理至少包括分词处理;
根据所述单句文字信息中各个单词对应的词向量,使用预设算法计算出所述单句文字信息与预设的标准单句的距离,其中所述预设的标准单句至少经过了分词处理;
将所述距离输入预设函数,映射出评分,其中所述预设函数通过训练数据训练得出,所述训练数据包括训练用单句、训练用标准单句、所述训练用单句与所述训练用标准单句的距离、和人为对所述训练 用单句与所述训练用标准单句的相似程度的评分。
本申请提供一种基于机器学习的句子距离映射装置,包括:
单句语音信息获取单元,用于获取输入的单句语音信息;
单句文字信息转换单元,用于将所述单句语音信息转换为单句文字信息;
预处理单元,用于对所述单句文字信息进行预处理,并查询预设的词向量库以获取所述预处理后的单句文字信息中各个单词对应的词向量,其中,所述预处理至少包括分词处理;
句子距离计算单元,用于根据所述单句文字信息中各个单词对应的词向量,使用预设算法计算出所述单句文字信息与预设的标准单句的距离,其中所述预设的标准单句至少经过了分词处理;
评分映射单元,用于将所述距离输入预设函数,映射出评分,其中所述预设函数通过训练数据训练得出,所述训练数据包括训练用单句、训练用标准单句、所述训练用单句与所述训练用标准单句的距离、和人为对所述训练用单句与所述训练用标准单句的相似程度的评分。
本申请提供一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现上述任一项所述方法的步骤。
本申请提供一种计算机非易失性可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述任一项所述的方法的步骤。
有益效果
本申请的基于机器学习的句子距离映射方法、装置、计算机设备和存储介质,通过将获取的单句语音信息转换为单句文字信息,再经由预处理获得所述预处理后的单句文字信息中各个单词对应的词向量,利用所述词向量使用预设算法计算出所述单句文字信息与预设的标准单句的距离,更将所述距离输入预设函数以映射出评分,具有更准确、更直观的技术效果。
附图说明
图1为本申请一实施例的基于机器学习的句子距离映射方法的流程示意图;
图2为本申请一实施例的基于机器学习的句子距离映射装置的结构示意框图;
图3为本申请一实施例的计算机设备的结构示意框图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
本发明的最佳实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
参照图1,本申请实施例提供一种基于机器学习的句子距离映射方法,包括以下步骤:
S1、获取输入的单句语音信息;
S2、将所述单句语音信息转换为单句文字信息;
S3、对所述单句文字信息进行预处理,并查询预设的词向量库以获取所述预处理后的单句文字信息中各个单词对应的词向量,其中,所述预处理至少包括分词处理;
S4、根据所述单句文字信息中各个单词对应的词向量,使用预设算法计算出所述单句文字信息与预设的标准单句的距离,其中所述预设的标准单句至少经过了分词处理;
S5、将所述距离输入预设函数,映射出评分,其中所述预设函数通过训练数据训练得出,所述训练数据包括训练用单句、训练用标准单句、所述训练用单句与所述训练用标准单句的距离、和人为对所述训练用单句与所述训练用标准单句的相似程度的评分。
如上述步骤S1所述,获取输入的单句语音信息。本实施例可在话术学习、演讲试练、模拟保险销售等情景下使用,因此首先要获取用户的输入的单句语音信息。其中,获取的方式包括:采用麦克风采集语音信息;采用麦克风阵列采集语音信息等。在本实施例中,采集的语音信息为单个单句。
如上述步骤S2所述,将所述单句语音信息转换为单句文字信息。语音转换的方法可以为任意可行方法,可以用任意市面上已成熟的软件来实现将所述单句语音信息转换为单句文字信息。
如上述步骤S3所述,对所述单句文字信息进行预处理,并查询预设的词向量库以获取所述预处理后单句文字信息中各个单词对应的词向量,其中,所述预处理至少包括分词处理。从而,将所述单句分为多个单词。其中预处理包括:分词、分词纠正、同义词替换、去除停用词等。分词可使用开源的分词工具,例如jieba、SnowNLP、THULAC、NLPIR。分词方法包括:基于字符串匹配的分词方法、基于理解的分词方法和基于统计的分词方法。
如上述步骤S4所述,根据所述单句文字信息中各个单词对应的词向量,使用预设算法计算出所述单句文字信息与预设的标准单句的距离。其中,使用预设算法计算出所述单句文字信息与预设的标准单句的距离的方法包括:采用WMD算法(word mover’s distance)、simhash算法、基于余弦相似度的算法以计算出所述单句文字信息与预设的标准单句的距离。
如上述步骤S5所述,将所述距离输入预设函数,映射出评分,其中所述预设函数通过训练数据训练得出,所述训练数据包括训练用单句、训练用标准单句、所述训练用单句与所述训练用标准单句的距离、和人为对所述训练用单句与所述训练用标准单句的相似程度的评分。其中,预设函数是通过机器学习获得的,从而预设函数的映射出的评分更为准确。其中,所述预设函数的作用是将所述单句文字信息与预设的标准单句的距离,映射为评分,从而用户可以直观地了解所述单句文字信息与预设的标准单句的相似程度。优选的,所述评分为百分制。优选的,所述预设函数为一元二次方程。
在一个实施方式中,对所述单句文字信息进行预处理的步骤S3,包括;
S301、对所述单句文字信息进行分词,得到包含多个词的单词序列;
S302、通过查询预设的同义词库,判断所述单词序列中是否存在同义词组;
S303、若存在同义词组,则将所述同义词组中所有单词替换为所述同义词组中的任意一个。
如上述步骤S301-S303所述,实现了对所述单句文字信息进行预处理。其中分词可使用开源的分词工具,例如jieba、SnowNLP、THULAC、NLPIR。分词方法包括:基于字符串匹配的分词方法、基于理解的分词方法和基于统计的分词方法。从而将单个单句分为多个词。例如,将“北京风景好,是旅游胜地”,可分为“|北京|风景|好|是|旅游|胜地|”。为了减少计算量,也为了增加词意的准确度,通过查询预设的同义词库,判断所述单词序列中是否存在同义词组,若存在同义词组,则将所述同义词组中所有单词替换为所述同义词组中的任意一个。具体地,同义词库中包括多个同义词条,若在所述单词序列中有两个以上单词出现在同一个同义词条中,表明所述两个以上单词构成了同义词组。一般而言,同义词的替换并不会导致单句的原义发生改变,因此采用同义词替换的方式以减少计算量与数据存储量。其中,可以通过查询预设的同义词库,以判断所述单词序列中是否存在同义词组。
在一个实施方式中,根据所述单句文字信息中各个单词对应的词向量,使用预设算法计算出所述单句文字信息与预设的标准单句的距离的步骤S4,包括:
S401、采用公式:
Figure PCTCN2019089059-appb-000001
计算出所述单句文字信息与预设的标准单句的距离,其中,Distance(I,R)为单句I与单句R的距离;I为所述单句文字信息;R为所述预设的标准单句;|I|是所述单句文字信息所包含具有词向量的单词数;|R|是所述预设的标准单句所包含具有词向量的单词数;w是词向量;α为调整两个词向量间的余弦相似度的放大系数;max(α×Cos Dis(w,R))是计算单句R中所有词对应的词向量与单句I中的词向量w的余弦相似度中的最大值。
如上述步骤S401所述,实现了使用预设算法计算出所述单句文字信息与预设的标准单句的距离。其中,上述公式利用了词向量的余弦相似度。所述余弦相似度的计算公式为:
Figure PCTCN2019089059-appb-000002
其中,w1是第一个词向量(所述单句文字信息中各单词的词向量);w2是第二个词向量(所述预设的标准单句中各单词 的词向量);n为词向量的维度,从而计算词向量w1与w2之间的相似度。将余弦相似度计算公式代入所述单句文字信息与预设的标准单句的距离的计算公式中,即可算出所述单句文字信息与预设的标准单句的距离。
在一个实施方式中,根据所述单句文字信息中各个单词对应的词向量,使用预设算法计算出所述单句文字信息与预设的标准单句的距离的步骤S4,包括:
S402、采用公式:
Figure PCTCN2019089059-appb-000003
,满足
Figure PCTCN2019089059-appb-000004
计算出所述单句文字信息与预设的标准单句的距离;其中Distance(I,R)为单句I与单句R的距离;I为所述单句文字信息;R为所述预设的标准单句;Tij为单句I中第i个词至单句R中的第j个词的权重转移量;di为第i个词在单句I中的词频;d’ j为第j个词在单句R中的词频;c(i,j)为单句I中的第i个词与单句R中第j个词的欧氏距离;m为单句I中具有词向量的单词数量;n为单句R中具有词向量的单词数量。
如上述步骤S402所述,实现了使用预设算法计算出所述单句文字信息与预设的标准单句的距离。其中,上述公式利用了词向量的欧氏距离。所述欧氏距离的计算公式为:
Figure PCTCN2019089059-appb-000005
其中d(x,y)为词向量x=(x1,x2,x3…,xn)与词向量y=(y1,y2,y3…,yn)间的欧氏距离,n为词向量的维度。将欧氏距离计算公式代入所述单句文字信息与预设的标准单句的距离的计算公式中,即可算出所述单句文字信息与预设的标准单句的距离。
在一个实施方式中,所述预设函数为一元二次方程,所述预设函数通过训练数据训练得出的步骤,包括:
S501、建立一元二次方程f(x)=ax 2+bx+c,其中x为代表句子距离的自变量,f(x)为代表映射评分的因变量;
S502、获取数量为n的样本数据,将所述样本数据随机分为n/3组,其中每组具有3个样本数据,所述样本数据包括训练单句与标准单句的训练距离,以及与所述训练距离对应的人工评分结果,n为3的倍数;
S503、将所述n/3组数据代入所述一元二次方程,得到n/3组参数a、b、c的值;
S504、对所述n/3组参数a、b、c的值作均值处理,得到参数a、b、c的最终值。
如上述步骤S501-S504所述,实现了通过训练数据训练得出预设函数。其中人工评分指,对于训练单句与标准单句的相似程度,用人为感受进行评分以反应训练单句与标准单句的相似程度。其中评分可采用百分制,即评分100表示完全相似,评分0表示完全不相似。由于一元二次方程具有三个参数a、b、c,采用3个样本即可得到确切的参数值,因此分为n/3组,从而在一定的计算量的前提下,得到不重复的n/3组参数值。为得到更准确的参数,将所述n/3组参数值做均值处理,作为参数a、b、c的最终值。其中均值处理包括:算术平均处理,几何平均处理,均方根平均处理,加权平均处理等。
在一个实施方式中,预设的词向量库通过word2vec工具训练得到,所述训练方法包括:
S311、使用word2vec工具的CBOW模型(连续词袋模型),对预设的语料库中的单词进行词向量训练,以得到所述预设的词向量库,其中所述语料库是用于训练词向量的单词库。
如上述步骤所述,实现了获得预设的词向量库。word2vec是用于训练词向量的工具,包括CBOW(Continuous Bag of Words,连续词袋模型)和Skip-Gram两种模型。CBOW是从原始语句推测目标字词;而Skip-Gram是从目标字词推测出原始语句。其中,CBOW更适用于小型词料库,本申请选择采用CBOW模型进行词向量训练。
在一个实施方式中,所述根据所述单句文字信息中各个单词对应的词向量,使用预设算法计算出所述单句文字信息与预设的标准单句的距离的步骤S4之前包括:
S31、采用重叠词相似度算法计算所述单句文字信息与标准单句库中所有标准单句的相似度;
S32、判断是否存在所述相似度大于第一阈值的标准单句;
S33、若存在,则将所述相似度大于第一阈值的标准单句设置为所述预设的标准单句。
如上述步骤S31-S33所述,实现了确定预设的标准单句。所述重叠词相似度算法是根据两个句子的余弦相似度进行计算得到,以反应两个句子间的相似程度。由于其仅采用叠词以确定准确度,对于句子的相似程度判断不够准确,但可以用来筛选标准单句。所述相似度算法为:
Figure PCTCN2019089059-appb-000006
其中,A为所述单句文字信息词频向量,B为标准单句的词频向量,Ai为所述单句文字信息的第i个单词在整个单句中出现的次数。据此,可以粗略得出两个单句的相似度。若所述相似度大于第一阈值, 可认为两个单句较为相似,可将其设置为预设的标准单句。其中第一阈值可根据实际需要设置,例如设置为[80%-98%]中的任一数值。
本申请的基于机器学习的句子距离映射方法,通过将获取的单句语音信息转换为单句文字信息,再经由预处理获得所述预处理后的单句文字信息中各个单词对应的词向量,利用所述词向量使用预设算法计算出所述单句文字信息与预设的标准单句的距离,更将所述距离输入预设函数以映射出评分,具有更准确、更直观的技术效果。
参照图2,本申请实施例提供一种基于机器学习的句子距离映射装置,包括:
单句语音信息获取单元10,用于获取输入的单句语音信息;
单句文字信息转换单元20,用于将所述单句语音信息转换为单句文字信息;
预处理单元30,用于对所述单句文字信息进行预处理,并查询预设的词向量库以获取所述预处理后的单句文字信息中各个单词对应的词向量,其中,所述预处理至少包括分词处理;
句子距离计算单元40,用于根据所述单句文字信息中各个单词对应的词向量,使用预设算法计算出所述单句文字信息与预设的标准单句的距离,其中所述预设的标准单句至少经过了分词处理;
评分映射单元50,用于将所述距离输入预设函数,映射出评分,其中所述预设函数通过训练数据训练得出,所述训练数据包括训练用单句、训练用标准单句、所述训练用单句与所述训练用标准单句的距离、和人为对所述训练用单句与所述训练用标准单句的相似程度的评分。
其中上述单元分别用于执行的操作与前述实施方式的基于机器学习的句子距离映射方法的步骤一一对应,在此不再赘述。
在一个实施方式中,预处理单元30,包括;
分词子单元,用于对所述单句文字信息进行分词,得到包含多个词的单词序列;
同义词组判断子单元,用于通过查询预设的同义词库,判断所述单词序列中是否存在同义词组;
同义词替换子单元,用于若存在同义词组,则将所述同义词组中所有单词替换为所述同义词组中的任意一个。
其中上述子单元分别用于执行的操作与前述实施方式的基于机器学习的句子距离映射方法的步骤一一对应,在此不再赘述。
在一个实施方式中,句子距离计算单元40,包括:
第一句子距离计算单元,用于采用公式:
Figure PCTCN2019089059-appb-000007
计算出所述单句文字信息与预设的标准单句的距离,其中,Distance(I,R)为单句I与单句R的距离;I为所述单句文字信息;R为所述预设的标准单句;|I|是所述单句文字信息所包含具有词向量的单词数;|R|是所述预设的标准单句所包含具有词向量的单词数;w是词向量;α为调整两个词向量间的余弦相似度的放大系数;max(α×Cos Dis(w,R))是计算单句R中所有词对应的词向量与单句I中的词向量w的余弦相似度中的最大值。
其中上述子单元分别用于执行的操作与前述实施方式的基于机器学习的句子距离映射方法的步骤一一对应,在此不再赘述。
在一个实施方式中,句子距离计算单元40,包括:
第二句子距离计算单元,用于采用公式:
Figure PCTCN2019089059-appb-000008
,满足
Figure PCTCN2019089059-appb-000009
计算出所述单句文字信息与预设的标准单句的距离;其中Distance(I,R)为单句I与单句R的距离;I为所述单句文字信息;R为所述预设的标准单句;Tij为单句I中第i个词至单句R中的第j个词的权重转移量;di为第i个词在单句I中的词频;d’ j为第j个词在单句R中的词频;c(i,j)为单句I中的第i个词与单句R中第j个词的欧氏距离;m为单句I中具有词向量的单词数量;n为单句R中具有词向量的单词数量。
其中上述子单元分别用于执行的操作与前述实施方式的基于机器学习的句子距离映射方法的步骤一一对应,在此不再赘述。
在一个实施方式中,所述预设函数为一元二次方程,所述装置包括:
方程建立单元,用于建立一元二次方程f(x)=ax 2+bx+c,其中x为代表句子距离的自变量,f(x)为代表映射评分的因变量;
样本数据获取单元,用于获取数量为n的样本数据,将所述样本数据随机分为n/3组,其中每组具有3个样本数据,所述样本数据包括训练单句与标准单句的训练距离,以及与所述训练距离对应的人工评分结果,n为3的倍数;
数据代入单元,用于将所述n/3组数据代入所述一元二次方程,得到n/3组参数a、b、c的值;
均值处理单元,用于对所述n/3组参数a、b、c的值作均值处理,得到参数a、b、c的最终值。
其中上述单元分别用于执行的操作与前述实施方式的基于机器学习的句子距离映射方法的步骤一一对应,在此不再赘述。
在一个实施方式中,预设的词向量库通过word2vec工具训练得到,所述装置,包括:
词向量训练单元,用于使用word2vec工具的CBOW模型,对预设的语料库中的单词进行词向量训练,以得到所述预设的词向量库,其中所述语料库是用于训练词向量的单词库。
其中上述单元分别用于执行的操作与前述实施方式的基于机器学习的句子距离映射方法的步骤一一对应,在此不再赘述。
在一个实施方式中,所述装置,包括:
重叠词相似度算法计算单元,用于采用重叠词相似度算法计算所述单句文字信息与标准单句库中所有标准单句的相似度;
标准单句判断单元,用于判断是否存在所述相似度大于第一阈值的标准单句;
标准单句设置单元,用于若存在,则将所述相似度大于第一阈值的标准单句设置为所述预设的标准单句。
其中上述单元分别用于执行的操作与前述实施方式的基于机器学习的句子距离映射方法的步骤一一对应,在此不再赘述。
本申请的基于机器学习的句子距离映射装置,通过将获取的单句语音信息转换为单句文字信息,再经由预处理获得所述预处理后的单句文字信息中各个单词对应的词向量,利用所述词向量使用预设算法计算出所述单句文字信息与预设的标准单句的距离,更将所述距离输入预设函数以映射出评分,具有更准确、更直观的技术效果。
参照图3,本申请实施例中还提供一种计算机设备,该计算机设备可以是服务器,其内部结构可以如图所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设计的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储基于机器学习的句子距离映射方法所 用数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种基于机器学习的句子距离映射方法。
上述处理器执行上述基于机器学习的句子距离映射方法,其中所述方法包括的步骤分别与执行前述实施方式的基于机器学习的句子距离映射方法的步骤一一对应,在此不再赘述。
本领域技术人员可以理解,图中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定。
本申请的计算机设备,通过将获取的单句语音信息转换为单句文字信息,再经由预处理获得所述预处理后的单句文字信息中各个单词对应的词向量,利用所述词向量使用预设算法计算出所述单句文字信息与预设的标准单句的距离,更将所述距离输入预设函数以映射出评分,具有更准确、更直观的技术效果。
本申请一实施例还提供一种计算机非易失性可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现基于机器学习的句子距离映射方法,其中所述方法包括的步骤分别与执行前述实施方式的基于机器学习的句子距离映射方法的步骤一一对应,在此不再赘述。
本申请的计算机非易失性可读存储介质,通过将获取的单句语音信息转换为单句文字信息,再经由预处理获得所述预处理后的单句文字信息中各个单词对应的词向量,利用所述词向量使用预设算法计算出所述单句文字信息与预设的标准单句的距离,更将所述距离输入预设函数以映射出评分,具有更准确、更直观的技术效果。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机非易失性可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的和实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可以包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双速据率SDRAM(SSRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、装置、物品或者方法不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、装置、物品或者方法所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、装置、物品或者方法中还存在另外的相同要素。
以上所述仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种基于机器学习的句子距离映射方法,其特征在于,包括以下步骤:
    获取输入的单句语音信息;
    将所述单句语音信息转换为单句文字信息;
    对所述单句文字信息进行预处理,并查询预设的词向量库以获取所述预处理后的单句文字信息中各个单词对应的词向量,其中,所述预处理至少包括分词处理;
    根据所述单句文字信息中各个单词对应的词向量,利用预设算法计算出所述单句文字信息与预设的标准单句的距离,其中所述预设的标准单句至少经过了分词处理;
    将所述距离输入预设函数,映射出评分,其中所述预设函数通过训练数据训练得出,所述训练数据包括训练用单句、训练用标准单句、所述训练用单句与所述训练用标准单句的距离、和人为对所述训练用单句与所述训练用标准单句的相似程度的评分。
  2. 根据权利要求1所述的基于机器学习的句子距离映射方法,其特征在于,所述对所述单句文字信息进行预处理,并查询预设的词向量库以获取所述预处理后的单句文字信息中各个单词对应的词向量,其中,所述预处理至少包括分词处理的步骤,包括;
    对所述单句文字信息进行分词处理,得到包含多个单词的单词序列;
    通过查询预设的同义词库,判断所述单词序列中是否存在同义词组;
    若存在同义词组,则将所述同义词组中所有单词替换为所述同义词组中的任意一个。
  3. 根据权利要求1所述的基于机器学习的句子距离映射方法,其特征在于,所述根据所述单句文字信息中各个单词对应的词向量,使用预设算法计算出所述单句文字信息与预设的标准单句的距离的步骤,包括:
    采用公式:
    Figure PCTCN2019089059-appb-100001
    计算出所述单句文字信息与预设的标准单句的距离,其中,Distance(I,R)为单句I与单句R的距离;I为所述单句文字信息;R为所述预设的标准单句;|I|是所述单句文字信息所包含具有词向量的单词数;|R|是所述预设的标准单句所包含具有词向量的单词数;w是词向量;α为调整两个词向量间的余弦相似度的放大系数;max(α×CosDis(w,R))是计算单句R中所有词对应的词向量与单句I中的词向量w的余弦相似度中的最大值。
  4. 根据权利要求1所述的基于机器学习的句子距离映射方法,其特征在于,所述根据所述单句文字信息中各个单词对应的词向量,使用预设算法计算出所述单句文字信息与预设的标准单句的距离的步 骤,包括:
    采用公式:
    Figure PCTCN2019089059-appb-100002
    ,满足
    Figure PCTCN2019089059-appb-100003
    计算出所述单句文字信息与预设的标准单句的距离;其中Distance(I,R)为单句I与单句R的距离;I为所述单句文字信息;R为所述预设的标准单句;Tij为单句I中第i个词至单句R中的第j个词的权重转移量;di为第i个词在单句I中的词频;d’ j为第j个词在单句R中的词频;c(i,j)为单句I中的第i个词与单句R中第j个词的欧氏距离;m为单句I中具有词向量的单词数量;n为单句R中具有词向量的单词数量。
  5. 根据权利要求1所述的基于机器学习的句子距离映射方法,其特征在于,所述预设函数为一元二次方程,所述预设函数通过训练数据训练得出的步骤,包括:
    建立一元二次方程f(x)=ax 2+bx+c,其中x为代表句子距离的自变量,f(x)为代表映射评分的因变量;
    获取数量为n的样本数据,将所述样本数据随机分为n/3组,其中每组具有3个样本数据,所述样本数据包括训练单句与标准单句的训练距离,以及与所述训练距离对应的人工评分结果,n为3的倍数;
    将所述n/3组数据代入所述一元二次方程,得到n/3组参数a、b、c的值;
    对所述n/3组参数a、b、c的值作均值处理,得到参数a、b、c的最终值。
  6. 根据权利要求1所述的基于机器学习的句子距离映射方法,其特征在于,所述预设的词向量库通过产生词向量工具word2vec训练得到,所述词向量库的获得方法包括:
    使用word2vec工具的连续词袋模型,对预设的语料库中的单词进行词向量训练,以得到所述预设的词向量库,其中所述语料库是用于训练词向量的单词库。
  7. 一种基于机器学习的句子距离映射装置,其特征在于,包括:
    单句语音信息获取单元,用于获取输入的单句语音信息;
    单句文字信息转换单元,用于将所述单句语音信息转换为单句文字信息;
    预处理单元,用于对所述单句文字信息进行预处理,并查询预设的词向量库以获取所述预处理后的单句文字信息中各个单词对应的词向量,其中,所述预处理至少包括分词处理;
    句子距离计算单元,用于根据所述单句文字信息中各个单词对应的词向量,使用预设算法计算出所述单句文字信息与预设的标准单句的距离,其中所述预设的标准单句至少经过了分词处理;
    评分映射单元,用于将所述距离输入预设函数,映射出评分,其中所述预设函数通过训练数据训练得出,所述训练数据包括训练用单句、训练用标准单句、所述训练用单句与所述训练用标准单句的距离、 和人为对所述训练用单句与所述训练用标准单句的相似程度的评分。
  8. 根据权利要求7所述的基于机器学习的句子距离映射装置,其特征在于,所述预处理单元,包括;
    分词子单元,用于对所述单句文字信息进行分词处理,得到包含多个词的单词序列;
    同义词组判断子单元,用于通过查询预设的同义词库,判断所述单词序列中是否存在同义词组;
    同义词替换子单元,用于若存在同义词组,则将所述同义词组中所有单词替换为所述同义词组中的任意一个。
  9. 根据权利要求7所述的基于机器学习的句子距离映射装置,其特征在于,所述句子距离计算单元,包括:
    第一句子距离计算单元,用于采用公式:
    Figure PCTCN2019089059-appb-100004
    计算出所述单句文字信息与预设的标准单句的距离,其中,Distance(I,R)为单句I与单句R的距离;I为所述单句文字信息;R为所述预设的标准单句;|I|是所述单句文字信息所包含具有词向量的单词数;|R|是所述预设的标准单句所包含具有词向量的单词数;w是词向量;α为调整两个词向量间的余弦相似度的放大系数;max(α×CosDis(w,R))是计算单句R中所有词对应的词向量与单句I中的词向量w的余弦相似度中的最大值。
  10. 根据权利要求7所述的基于机器学习的句子距离映射装置,其特征在于,所述句子距离计算单元,包括:
    第二句子距离计算单元,用于采用公式:
    Figure PCTCN2019089059-appb-100005
    ,满足
    Figure PCTCN2019089059-appb-100006
    计算出所述单句文字信息与预设的标准单句的距离;其中Distance(I,R)为单句I与单句R的距离;I为所述单句文字信息;R为所述预设的标准单句;Tij为单句I中第i个词至单句R中的第j个词的权重转移量;di为第i个词在单句I中的词频;d’ j为第j个词在单句R中的词频;c(i,j)为单句I中的第i个词与单句R中第j个词的欧氏距离;m为单句I中具有词向量的单词数量;n为单句R中具有词向量的单词数量。
  11. 根据权利要求7所述的基于机器学习的句子距离映射装置,其特征在于,所述预设函数为一元二次方程,所述装置包括:
    方程建立单元,用于建立一元二次方程f(x)=ax 2+bx+c,其中x为代表句子距离的自变量,f(x)为代表映射评分的因变量;
    样本数据获取单元,用于获取数量为n的样本数据,将所述样本数据随机分为n/3组,其中每组具有3个样本数据,所述样本数据包括训练单句与标准单句的训练距离,以及与所述训练距离对应的人工评分结果,n为3的倍数;
    数据代入单元,用于将所述n/3组数据代入所述一元二次方程,得到n/3组参数a、b、c的值;
    均值处理单元,用于对所述n/3组参数a、b、c的值作均值处理,得到参数a、b、c的最终值。
  12. 根据权利要求7所述的基于机器学习的句子距离映射装置,其特征在于,所述预设的词向量库通过word2vec工具训练得到,所述装置,包括:
    词向量训练单元,用于使用word2vec工具的CBOW模型,对预设的语料库中的单词进行词向量训练,以得到所述预设的词向量库,其中所述语料库是用于训练词向量的单词库。
  13. 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现基于机器学习的句子距离映射方法,该基于机器学习的句子距离映射方法,包括:
    获取输入的单句语音信息;
    将所述单句语音信息转换为单句文字信息;
    对所述单句文字信息进行预处理,并查询预设的词向量库以获取所述预处理后的单句文字信息中各个单词对应的词向量,其中,所述预处理至少包括分词处理;
    根据所述单句文字信息中各个单词对应的词向量,利用预设算法计算出所述单句文字信息与预设的标准单句的距离,其中所述预设的标准单句至少经过了分词处理;
    将所述距离输入预设函数,映射出评分,其中所述预设函数通过训练数据训练得出,所述训练数据包括训练用单句、训练用标准单句、所述训练用单句与所述训练用标准单句的距离、和人为对所述训练用单句与所述训练用标准单句的相似程度的评分。
  14. 根据权利要求13所述的计算机设备,其特征在于,所述对所述单句文字信息进行预处理,并查询预设的词向量库以获取所述预处理后的单句文字信息中各个单词对应的词向量,其中,所述预处理至少包括分词处理的步骤,包括;
    对所述单句文字信息进行分词处理,得到包含多个单词的单词序列;
    通过查询预设的同义词库,判断所述单词序列中是否存在同义词组;
    若存在同义词组,则将所述同义词组中所有单词替换为所述同义词组中的任意一个。
  15. 根据权利要求13所述的计算机设备,其特征在于,所述根据所述单句文字信息中各个单词对 应的词向量,使用预设算法计算出所述单句文字信息与预设的标准单句的距离的步骤,包括:
    采用公式:
    Figure PCTCN2019089059-appb-100007
    计算出所述单句文字信息与预设的标准单句的距离,其中,Distance(I,R)为单句I与单句R的距离;I为所述单句文字信息;R为所述预设的标准单句;|I|是所述单句文字信息所包含具有词向量的单词数;|R|是所述预设的标准单句所包含具有词向量的单词数;w是词向量;α为调整两个词向量间的余弦相似度的放大系数;max(α×CosDis(w,R))是计算单句R中所有词对应的词向量与单句I中的词向量w的余弦相似度中的最大值。
  16. 根据权利要求13所述的计算机设备,其特征在于,所述根据所述单句文字信息中各个单词对应的词向量,使用预设算法计算出所述单句文字信息与预设的标准单句的距离的步骤,包括:
    采用公式:
    Figure PCTCN2019089059-appb-100008
    ,满足
    Figure PCTCN2019089059-appb-100009
    计算出所述单句文字信息与预设的标准单句的距离;其中Distance(I,R)为单句I与单句R的距离;I为所述单句文字信息;R为所述预设的标准单句;Tij为单句I中第i个词至单句R中的第j个词的权重转移量;di为第i个词在单句I中的词频;d’ j为第j个词在单句R中的词频;c(i,j)为单句I中的第i个词与单句R中第j个词的欧氏距离;m为单句I中具有词向量的单词数量;n为单句R中具有词向量的单词数量。
  17. 一种计算机非易失性可读存储介质,其上存储有计算机可读指令,其特征在于,所述计算机可读指令被处理器执行时实现基于机器学习的句子距离映射方法,该基于机器学习的句子距离映射方法,包括:
    获取输入的单句语音信息;
    将所述单句语音信息转换为单句文字信息;
    对所述单句文字信息进行预处理,并查询预设的词向量库以获取所述预处理后的单句文字信息中各个单词对应的词向量,其中,所述预处理至少包括分词处理;
    根据所述单句文字信息中各个单词对应的词向量,利用预设算法计算出所述单句文字信息与预设的标准单句的距离,其中所述预设的标准单句至少经过了分词处理;
    将所述距离输入预设函数,映射出评分,其中所述预设函数通过训练数据训练得出,所述训练数据 包括训练用单句、训练用标准单句、所述训练用单句与所述训练用标准单句的距离、和人为对所述训练用单句与所述训练用标准单句的相似程度的评分。
  18. 根据权利要求17所述的计算机非易失性可读存储介质,其特征在于,所述对所述单句文字信息进行预处理,并查询预设的词向量库以获取所述预处理后的单句文字信息中各个单词对应的词向量,其中,所述预处理至少包括分词处理的步骤,包括;
    对所述单句文字信息进行分词处理,得到包含多个单词的单词序列;
    通过查询预设的同义词库,判断所述单词序列中是否存在同义词组;
    若存在同义词组,则将所述同义词组中所有单词替换为所述同义词组中的任意一个。
  19. 根据权利要求17所述的计算机非易失性可读存储介质,其特征在于,所述根据所述单句文字信息中各个单词对应的词向量,使用预设算法计算出所述单句文字信息与预设的标准单句的距离的步骤,包括:
    采用公式:
    Figure PCTCN2019089059-appb-100010
    计算出所述单句文字信息与预设的标准单句的距离,其中,Distance(I,R)为单句I与单句R的距离;I为所述单句文字信息;R为所述预设的标准单句;|I|是所述单句文字信息所包含具有词向量的单词数;|R|是所述预设的标准单句所包含具有词向量的单词数;w是词向量;α为调整两个词向量间的余弦相似度的放大系数;max(α×CosDis(w,R))是计算单句R中所有词对应的词向量与单句I中的词向量w的余弦相似度中的最大值。
  20. 根据权利要求17所述的计算机非易失性可读存储介质,其特征在于,所述根据所述单句文字信息中各个单词对应的词向量,使用预设算法计算出所述单句文字信息与预设的标准单句的距离的步骤,包括:
    采用公式:
    Figure PCTCN2019089059-appb-100011
    ,满足
    Figure PCTCN2019089059-appb-100012
    计算出所述单句文字信息与预设的标准单句的距离;其中Distance(I,R)为单句I与单句R的距离;I为所述单句文字信息;R为所述预设的标准单句;Tij为单句I中第i个词至单句R中的第j个词的权重转移量;di为第i个词在单句I中的词频;d’ j为第j个词在单句R中的词频;c(i,j)为单句I中的第i个词与单句R中第j个词的欧氏距离;m为单句I中具有词向量的单词数量;n为单句R中具有词向量的 单词数量。
PCT/CN2019/089059 2018-11-28 2019-05-29 基于机器学习的句子距离映射方法、装置和计算机设备 WO2020107840A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
SG11201912523RA SG11201912523RA (en) 2018-11-28 2019-05-29 Sentence distance mapping method and apparatus based on machine learning and computer device
US16/759,368 US20210209311A1 (en) 2018-11-28 2019-05-29 Sentence distance mapping method and apparatus based on machine learning and computer device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811437243.6 2018-11-28
CN201811437243.6A CN109740143B (zh) 2018-11-28 2018-11-28 基于机器学习的句子距离映射方法、装置和计算机设备

Publications (1)

Publication Number Publication Date
WO2020107840A1 true WO2020107840A1 (zh) 2020-06-04

Family

ID=66358322

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/089059 WO2020107840A1 (zh) 2018-11-28 2019-05-29 基于机器学习的句子距离映射方法、装置和计算机设备

Country Status (4)

Country Link
US (1) US20210209311A1 (zh)
CN (1) CN109740143B (zh)
SG (1) SG11201912523RA (zh)
WO (1) WO2020107840A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113221530A (zh) * 2021-04-19 2021-08-06 杭州火石数智科技有限公司 一种基于circle loss的文本相似度匹配方法、装置、计算机设备和储存介质
CN113537345A (zh) * 2021-07-15 2021-10-22 中国南方电网有限责任公司 一种通信网设备数据关联的方法及系统
CN113643703A (zh) * 2021-08-06 2021-11-12 西北工业大学 一种语音驱动虚拟人的口令理解方法
CN117390515A (zh) * 2023-11-01 2024-01-12 江苏君立华域信息安全技术股份有限公司 基于深度学习和SimHash的数据分类方法及系统

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109740143B (zh) * 2018-11-28 2022-08-23 平安科技(深圳)有限公司 基于机器学习的句子距离映射方法、装置和计算机设备
CN110362601B (zh) * 2019-06-19 2020-12-18 平安国际智慧城市科技股份有限公司 元数据标准的映射方法、装置、设备及存储介质
CN110569486B (zh) * 2019-07-30 2023-01-03 平安科技(深圳)有限公司 基于双架构的序列标注方法、装置和计算机设备
CN110737751B (zh) * 2019-09-06 2023-10-20 平安科技(深圳)有限公司 基于相似度值的搜索方法、装置、计算机设备和存储介质
US11314950B2 (en) * 2020-03-25 2022-04-26 International Business Machines Corporation Text style transfer using reinforcement learning
US11176186B2 (en) 2020-03-27 2021-11-16 International Business Machines Corporation Construing similarities between datasets with explainable cognitive methods
CN113591473B (zh) * 2021-07-21 2024-03-12 西北工业大学 一种基于BTM主题模型和Doc2vec的文本相似度计算方法
CN114330251B (zh) * 2022-03-04 2022-07-19 阿里巴巴达摩院(杭州)科技有限公司 文本生成方法、模型的训练方法、设备及存储介质
CN115017307B (zh) * 2022-04-29 2023-10-13 清图数据科技(南京)有限公司 一种中文热线的文本数据自动识别与分类的方法
KR102622609B1 (ko) * 2022-06-10 2024-01-09 주식회사 딥브레인에이아이 문자소-음소 변환 장치 및 방법
CN114996466B (zh) * 2022-08-01 2022-11-01 神州医疗科技股份有限公司 一种医学标准映射模型的建立方法、系统及使用方法
CN116433799B (zh) * 2023-06-14 2023-08-25 安徽思高智能科技有限公司 一种基于语义相似度和子图匹配的流程图生成方法和装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104115165A (zh) * 2012-02-15 2014-10-22 阿尔卡特朗讯 使用机器学习来用于映射媒体组件的方法
US20150149155A1 (en) * 2011-09-24 2015-05-28 Lotfi A. Zadeh Methods and Systems for Applications for Z-numbers
CN108717406A (zh) * 2018-05-10 2018-10-30 平安科技(深圳)有限公司 文本情绪分析方法、装置及存储介质
CN109740143A (zh) * 2018-11-28 2019-05-10 平安科技(深圳)有限公司 基于机器学习的句子距离映射方法、装置和计算机设备

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103250149B (zh) * 2010-12-07 2015-11-25 Sk电信有限公司 用于从数学语句提取语义距离并且按照语义距离对数学语句分类的方法和用于该方法的装置
CN105824797B (zh) * 2015-01-04 2019-11-12 华为技术有限公司 一种评价语义相似度的方法、装置和系统
US20160196342A1 (en) * 2015-01-06 2016-07-07 Inha-Industry Partnership Plagiarism Document Detection System Based on Synonym Dictionary and Automatic Reference Citation Mark Attaching System
CN105183714A (zh) * 2015-08-27 2015-12-23 北京时代焦点国际教育咨询有限责任公司 句子相似度计算方法及装置
JP6667855B2 (ja) * 2016-05-20 2020-03-18 日本電信電話株式会社 取得方法、生成方法、それらのシステム、及びプログラム
AU2017290063B2 (en) * 2016-06-28 2022-01-27 Financial & Risk Organisation Limited Apparatuses, methods and systems for relevance scoring in a graph database using multiple pathways
CN106844356B (zh) * 2017-01-17 2020-04-14 中译语通科技股份有限公司 一种基于数据选择改善英中机器翻译质量的方法
CN107451121A (zh) * 2017-08-03 2017-12-08 京东方科技集团股份有限公司 一种语音识别方法及其装置
US10915707B2 (en) * 2017-10-20 2021-02-09 MachineVantage, Inc. Word replaceability through word vectors
CN107729322B (zh) * 2017-11-06 2021-01-12 广州杰赛科技股份有限公司 分词方法及装置、建立句子向量生成模型方法及装置
US10606953B2 (en) * 2017-12-08 2020-03-31 General Electric Company Systems and methods for learning to extract relations from text via user feedback
CN108628825A (zh) * 2018-04-10 2018-10-09 平安科技(深圳)有限公司 文本信息相似度匹配方法、装置、计算机设备及存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150149155A1 (en) * 2011-09-24 2015-05-28 Lotfi A. Zadeh Methods and Systems for Applications for Z-numbers
CN104115165A (zh) * 2012-02-15 2014-10-22 阿尔卡特朗讯 使用机器学习来用于映射媒体组件的方法
CN108717406A (zh) * 2018-05-10 2018-10-30 平安科技(深圳)有限公司 文本情绪分析方法、装置及存储介质
CN109740143A (zh) * 2018-11-28 2019-05-10 平安科技(深圳)有限公司 基于机器学习的句子距离映射方法、装置和计算机设备

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113221530A (zh) * 2021-04-19 2021-08-06 杭州火石数智科技有限公司 一种基于circle loss的文本相似度匹配方法、装置、计算机设备和储存介质
CN113221530B (zh) * 2021-04-19 2024-02-13 杭州火石数智科技有限公司 一种文本相似度匹配方法、装置、计算机设备和储存介质
CN113537345A (zh) * 2021-07-15 2021-10-22 中国南方电网有限责任公司 一种通信网设备数据关联的方法及系统
CN113537345B (zh) * 2021-07-15 2023-01-24 中国南方电网有限责任公司 一种通信网设备数据关联的方法及系统
CN113643703A (zh) * 2021-08-06 2021-11-12 西北工业大学 一种语音驱动虚拟人的口令理解方法
CN113643703B (zh) * 2021-08-06 2024-02-27 西北工业大学 一种语音驱动虚拟人的口令理解方法
CN117390515A (zh) * 2023-11-01 2024-01-12 江苏君立华域信息安全技术股份有限公司 基于深度学习和SimHash的数据分类方法及系统
CN117390515B (zh) * 2023-11-01 2024-04-12 江苏君立华域信息安全技术股份有限公司 基于深度学习和SimHash的数据分类方法及系统

Also Published As

Publication number Publication date
US20210209311A1 (en) 2021-07-08
CN109740143A (zh) 2019-05-10
CN109740143B (zh) 2022-08-23
SG11201912523RA (en) 2020-07-29

Similar Documents

Publication Publication Date Title
WO2020107840A1 (zh) 基于机器学习的句子距离映射方法、装置和计算机设备
WO2020143844A1 (zh) 意图分析方法、装置、显示终端及计算机可读存储介质
WO2020124856A1 (zh) 一种基于词向量的诊断标准化方法及装置
CN111538908B (zh) 搜索排序方法、装置、计算机设备和存储介质
CN108804641B (zh) 一种文本相似度的计算方法、装置、设备和存储介质
WO2021159613A1 (zh) 文本语义相似度的分析方法、装置及计算机设备
WO2019196314A1 (zh) 文本信息相似度匹配方法、装置、计算机设备及存储介质
WO2021000831A1 (zh) 地址匹配方法、装置、计算机设备及存储介质
CN104636466B (zh) 一种面向开放网页的实体属性抽取方法和系统
CN107729322B (zh) 分词方法及装置、建立句子向量生成模型方法及装置
WO2019140863A1 (en) Method of calculating relevancy, apparatus for calculating relevancy, data query apparatus, and non-transitory computer-readable storage medium
WO2021151328A1 (zh) 症状数据处理方法、装置、计算机设备及存储介质
WO2020151310A1 (zh) 文本生成方法、装置、计算机设备及介质
CN109800307A (zh) 产品评价的分析方法、装置、计算机设备及存储介质
WO2015096529A1 (zh) 面向通用机译引擎的个性化翻译方法及装置
JP7430820B2 (ja) ソートモデルのトレーニング方法及び装置、電子機器、コンピュータ可読記憶媒体、コンピュータプログラム
CN110084371B (zh) 基于机器学习的模型迭代更新方法、装置和计算机设备
WO2021027125A1 (zh) 序列标注方法、装置、计算机设备和存储介质
CN108509521A (zh) 一种自动生成文本索引的图像检索方法
CN111611383A (zh) 用户意图的识别方法、装置、计算机设备及存储介质
CN110598210A (zh) 实体识别模型训练、实体识别方法、装置、设备及介质
WO2020034808A1 (zh) 决策数据获取方法、装置、计算机设备和存储介质
WO2021003813A1 (zh) 基于神经网络模型的答案生成方法及相关设备
WO2021237928A1 (zh) 文本相似度识别模型的训练方法、装置及相关设备
CN107229613B (zh) 一种基于向量空间模型的英汉语料提取方法

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 13.09.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 19888517

Country of ref document: EP

Kind code of ref document: A1