US 12,405,989 B2
Method and apparatus for calculating text semantic similarity, device and storage medium
Feng Hong, Beijing (CN)
Assigned to Beijing Hydrophis Network Technology Co., Ltd., Beijing (CN)
Filed by Beijing Hydrophis Network Technology Co., Ltd., Beijing (CN)
Filed on Mar. 8, 2024, as Appl. No. 18/599,490.
Claims priority of application No. 202310686371.9 (CN), filed on Jun. 9, 2023.
Prior Publication US 2024/0411795 A1, Dec. 12, 2024
Int. Cl. G06F 16/00 (2019.01); G06F 16/338 (2019.01); G06F 16/36 (2019.01)
CPC G06F 16/36 (2019.01) [G06F 16/338 (2019.01)] 17 Claims
OG exemplary drawing
 
1. A method for calculating text semantic similarity, wherein the method is based on a computer program stored and executed in an electronic device; in response to content input by a user into a search system or a response system of the electronic device, the method matches a text with a highest similarity to the content, thereby enabling the search system or the response system to perform subsequent operations; the computer program, when executed by a processor of the electronic device, controls the electronic device to perform the following steps of the method:
acquiring a text pair to be compared, and respectively extracting a text structural feature of each text in the text pair to be compared, wherein the text structural feature represents a text structure of the text;
converting the text structural feature of each text into a vector, performing feature scaling and feature standardization processing on the vector to obtain an optimized text structural feature of each text;
acquiring a text plane feature of each text in the text pair to be compared, and combining the optimized text structural feature of each text with a corresponding text plane feature to obtain a structure-plane feature of the each text, wherein the text plane feature refers to a visual two-dimensional representation of the text; and
utilizing a kernel function to learn the structure-plane feature of each text in a pre-set support vector regression model to obtain a text similarity of the text pair to be compared, and scoring the text similarity via a pre-set scoring system to obtain a text similarity score which is used in the search system or the response system;
the combining the optimized text structural feature of each text with a corresponding text plane feature to obtain a structure-plane feature of each text comprises:
acquiring a pre-set multi-layer perceptron, and splicing the optimized text structural feature of each text and the corresponding text plane feature at an input layer of the multi-layer perceptron to obtain two input vectors; and
performing non-linear transformation and feature synthesis on the two input vectors via a hidden layer of the multi-layer perceptron to obtain the structure-plane feature of each text.