# US 2021/0342549 A1 · Method for training semantic analysis model, electronic device and storage medium

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0342549 A1
- Document ID: US20210342549A1
- Status: Published application
- Kind: A1
- Application number: 17/375,156
- Filed: 2021-07-14
- Published: 2021-11-04
- Earliest claimed: 2020-12-09
- Assignees: Beijing Baidu Netcom Science Technology Co., Ltd.
- Applicants: Beijing Baidu Netcom Science and Technology Co., Ltd.
- Inventors: Jiaxiang Liu; Shikun Feng
- Web page: https://patentgrep.com/patent/US20210342549A1

## CPC

- G06F 40/30: Semantic analysis
- G06F 16/9024: {Graphs; Linked lists (G06F16/9027 takes precedence)}
- G06F 40/58: Use of machine translation, e.g. for multi-lingual retrieval, for server-side translation for client devices or for real-time translation
- G06N 3/045: Combinations of networks
- G06N 3/088: Non-supervised learning, e.g. competitive learning
- G06N 3/0895: Weakly supervised learning, e.g. semi-supervised or self-supervised learning
- G06N 3/09: Supervised learning
- G06N 7/01: Probabilistic graphical models, e.g. probabilistic networks
- G06N 20/00: Machine learning
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

The disclosure provides a method for training a semantic analysis model, an electronic device and a storage medium. The method includes: obtaining a plurality of training data, in which each of the plurality of training data comprises a search word, information on at least one text obtained by searching the search word, and at least one associated word corresponding to the at least one text; constructing a graph model based on the training data, and determining target training data from the plurality of training data by using the graph model, the target training data comprising search word samples, information samples and associated word samples; and training a semantic analysis model based on the search word samples, the information samples, and the associated word samples.

## Claims

### Claim 1

A method for training a semantic analysis model, comprising:
obtaining a plurality of training data, wherein each of the plurality of training data comprises a search word, information on at least one text obtained by searching the search word, and at least one associated word corresponding to the at least one text;
constructing a graph model based on the training data, and determining target training data from the plurality of training data by using the graph model, the target training data comprising search word samples, information samples and associated word samples; and
training a semantic analysis model based on the search word samples, the information samples, and the associated word samples.

### Claim 2 (depends on 1)

The method according to claim 1, wherein constructing the graph model based on the training data, and determining the target training data from the plurality of training data by using the graph model, comprises:
obtaining the search word, the information on at least one text obtained by searching based on the search word, and a search correction weight among the at least one associated word corresponding to the at least one text;
constructing an initial graph model based on the plurality of training data, and iteratively training the initial graph model based on the search correlation weight to obtain a target graph model; and
determining the target training data from the plurality of training data by using the target graph model.

### Claim 3 (depends on 2)

The method according to claim 2, wherein the target graph model comprises a plurality of paths, each path connects a plurality of nodes, and each node corresponds to one search word or one associated word or one piece of the information, and the path describes a searching correlation weight among corresponding contents of the nodes connected by the path.

### Claim 4 (depends on 3)

The method according to claim 3, wherein determining the target training data from the plurality of training data by using the target graph model comprises:
determining a target path from the target graph model, the target path connecting a plurality of target nodes; and
determining search words corresponding to the plurality of target nodes as the search word samples, determining associated words corresponding to the plurality of target nodes as the associated word samples, and determining information corresponding to the plurality of target nodes as the information samples.

### Claim 5 (depends on 4)

The method according to claim 4, wherein determining the target path from the target graph model comprises:
determining the target path from the target graph model based on a random walking mode; or
determining the target path from the target graph model based on a breadth-first searching mode.

### Claim 6 (depends on 2)

The method according to claim 2, wherein training the semantic analysis model based on the search word samples, the information samples, and the associated word samples comprises:
obtaining a predicted context semantic output by the semantic analysis model by inputting the search word samples, the information samples, the associated word samples, and the searching correlation weight among the associated words into the semantic analysis model; and
training the semantic analysis model based on the predicted context semantic and an annotated context semantic.

### Claim 7 (depends on 6)

The method according to claim 6, wherein training the semantic analysis model based on the predicted context semantic and the annotated context semantic comprises:
determining a loss value between the predicted context semantic and the annotated context semantic; and
determining that training of the semantic analysis model is completed in response to the loss value meeting a reference loss value.

### Claim 8 (depends on 1)

The method according to claim 1, wherein the semantic analysis model is a Bidirectional Encoder Representation from Transformer (BERT) based on machine translation.

### Claim 9

An electronic device, comprising:
at least one processor; and
a memory communicatively connected with the at least one processor; wherein,
the memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is caused to:
obtain a plurality of training data, wherein each of the plurality of training data comprises a search word, information on at least one text obtained by searching the search word, and at least one associated word corresponding to the at least one text;
construct a graph model based on the training data, and determining target training data from the plurality of training data by using the graph model, the target training data comprising se arch word samples, information samples and associated word samples; and
train a semantic analysis model based on the search word samples, the information samples, and the associated word samples.

### Claim 10 (depends on 9)

The electronic device according to claim 9, wherein the at least one processor is configured to:
obtaining the search word, the information on at least one text obtained by searching based on the search word, and a search correction weight among the at least one associated word corresponding to the at least one text;
constructing an initial graph model based on the plurality of training data, and iteratively training the initial graph model based on the search correlation weight to obtain a target graph model; and
determining the target training data from the plurality of training data by using the target graph model.

### Claim 11 (depends on 10)

The electronic device according to claim 10, wherein the target graph model comprises a plurality of paths, each path connects a plurality of nodes, and each node corresponds to one search word or one associated word or one piece of the information, and the path describes a searching correlation weight among corresponding contents of the nodes connected by the path.

### Claim 12 (depends on 11)

The electronic device according to claim 11, wherein the at least one processor is configured to:
determine a target path from the target graph model, the target path connecting a plurality of target nodes; and
determine search words corresponding to the plurality of target nodes as the search word samples, determine associated words corresponding to the plurality of target nodes as the associated word samples, and determine information corresponding to the plurality of target nodes as the information samples.

### Claim 13 (depends on 12)

The electronic device according to claim 12, wherein the at least one processor is configured to:
determining the target path from the target graph model based on a random walking mode; or
determining the target path from the target graph model based on a breadth-first searching mode.

### Claim 14 (depends on 10)

The electronic device according to claim 10, wherein the at least one processor is configured to:
obtain a predicted context semantic output by the semantic analysis model by inputting the search word samples, the information samples, the associated word samples, and the searching correlation weight among the associated words into the semantic analysis model; and
train the semantic analysis model based on the predicted context semantic and an annotated context semantic.

### Claim 15 (depends on 14)

The electronic device according to claim 14, wherein the at least one processor is configured to:
determine a loss value between the predicted context semantic and the annotated context semantic; and
determine that training of the semantic analysis model is completed in response to the loss value meeting a reference loss value.

### Claim 16 (depends on 9)

The electronic device according to claim 9, wherein the semantic analysis model is a Bidirectional Encoder Representation from Transformer (BERT) based on machine translation.

### Claim 17

A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are configured to make the computer execute a method for training a semantic analysis model, and the method comprises:
obtaining a plurality of training data, wherein each of the plurality of training data comprises a search word, information on at least one text obtained by searching the search word, and at least one associated word corresponding to the at least one text;
constructing a graph model based on the training data, and determining target training data from the plurality of training data by using the graph model, the target training data comprising search word samples, information samples and associated word samples; and
training a semantic analysis model based on the search word samples, the information samples, and the associated word samples.

### Claim 18 (depends on 17)

The non-transitory computer-readable storage medium according to claim 17, wherein constructing the graph model based on the training data, and determining the target training data from the plurality of training data by using the graph model, comprises:
obtaining the search word, the information on at least one text obtained by searching based on the search word, and a search correction weight among the at least one associated word corresponding to the at least one text;
constructing an initial graph model based on the plurality of training data, and iteratively training the initial graph model based on the search correlation weight to obtain a target graph model; and
determining the target training data from the plurality of training data by using the target graph model.

### Claim 19 (depends on 18)

The non-transitory computer-readable storage medium according to claim 18, wherein the target graph model comprises a plurality of paths, each path connects a plurality of nodes, and each node corresponds to one search word or one associated word or one piece of the information, and the path describes a searching correlation weight among corresponding contents of the nodes connected by the path.

### Claim 20 (depends on 19)

The non-transitory computer-readable storage medium according to claim 19, wherein determining the target training data from the plurality of training data by using the target graph model comprises:
determining a target path from the target graph model, the target path connecting a plurality of target nodes; and
determining search words corresponding to the plurality of target nodes as the search word samples, determining associated words corresponding to the plurality of target nodes as the associated word samples, and determining information corresponding to the plurality of target nodes as the information samples.
