diff --git a/tutorials/application/source_en/nlp/sentiment_analysis.md b/tutorials/application/source_en/nlp/sentiment_analysis.md index 4fff69e2e404aa90a30540505dd73ceb025bba80..8fe0e0e5e3094b9fb8a3fa3e27ce19769c124d1b 100644 --- a/tutorials/application/source_en/nlp/sentiment_analysis.md +++ b/tutorials/application/source_en/nlp/sentiment_analysis.md @@ -264,7 +264,8 @@ Word segmentation is performed on the IMDB dataset loaded by the loader, but the - Use the Vocab to convert all tokens to index IDs. - The length of the text sequence is unified. If the length is insufficient, `` is used to supplement the length. If the length exceeds the limit, the excess part is truncated. -Here, the API provided in `mindspore.dataset` is used for preprocessing. The APIs used here are designed for MindSpore high-performance data engines. The operations corresponding to each API are considered as a part of the data pipeline. For details, see [MindSpore Data Engine](https://www.mindspore.cn/docs/programming_guide/en/master/design/data_engine.html). +Here, the API provided in `mindspore.dataset` is used for preprocessing. The APIs used here are designed for MindSpore high-performance data engines. The operations corresponding to each API are considered as a part of the data pipeline. For details, see [MindSpore Data Engine](https://www.mindspore.cn/docs/en/master/design/data_engine.html). + For the table query operation from a token to an index ID, use the `text.Lookup` API to load the built vocabulary and specify `unknown_token`. The `PadEnd` API is used to unify the length of the text sequence. This API defines the maximum length and padding value (`pad_value`). In this example, the maximum length is 500, and the padding value corresponds to the index ID of `` in the vocabulary. > In addition to pre-processing the `text` data in the dataset, the `label` data needs to be converted to the float32 format to meet the subsequent model training requirements. @@ -328,17 +329,17 @@ Here, the processed GloVe word vector matrix is used. `embedding_table` of `nn.E RNN is a type of neural network that uses sequence data as an input, performs recursion in the evolution direction of a sequence, and connects all nodes (circulating units) in a chain. The following figure shows the general RNN structure. -![RNN-0](https://gitee.com/mindspore/docs/raw/tutorials-develop/tutorials/application/source_zh_cn/nlp/images/0-RNN-0.png) +![RNN-0](https://mindspore-website.obs.cn-north-4.myhuaweicloud.com/website-images/master/tutorials/application/source_zh_cn/nlp/images/0-RNN-0.png) > The left part of the figure shows an RNN Cell cycle, and the right part shows the RNN chain connection. Actually, there is only one Cell parameter regardless of a single RNN Cell or an RNN network, and the parameter is updated in continuous cyclic calculation. The recurrent feature of the RNN matches the sequence feature (a sentence is a sequence composed of words) of the natural language text. Therefore, the RNN is widely used in the research of natural language processing. The following figure shows the disassembled RNN structure. -![RNN](https://gitee.com/mindspore/docs/raw/tutorials-develop/tutorials/application/source_zh_cn/nlp/images/0-RNN.png) +![RNN](https://mindspore-website.obs.cn-north-4.myhuaweicloud.com/website-images/master/tutorials/application/source_zh_cn/nlp/images/0-RNN.png) A structure of a single RNN Cell is simple, causing the gradient vanishing problem. Specifically, when a sequence in the RNN is relatively long, information of a sequence header is basically lost at a tail of the sequence. To solve this problem, the long short term memory (LSTM) is proposed. The gating mechanism is used to control the retention and discarding of information flows in each cycle. The following figure shows the disassembled LSTM structure. -![LSTM](https://gitee.com/mindspore/docs/raw/tutorials-develop/tutorials/application/source_zh_cn/nlp/images/0-LSTM.png) +![LSTM](https://mindspore-website.obs.cn-north-4.myhuaweicloud.com/website-images/master/tutorials/application/source_zh_cn/nlp/images/0-LSTM.png) In this section, the LSTM variant instead of the classic RNN is used for feature extraction to avoid the gradient vanishing problem and obtain a better model effect. The formula corresponding to `nn.LSTM` in MindSpore is as follows: diff --git a/tutorials/application/source_en/nlp/sequence_labeling.md b/tutorials/application/source_en/nlp/sequence_labeling.md index d8713abfdeeb21e676984561223bf652d44600eb..36e8132e1664182329f488b4ddad5ee13a8d077d 100644 --- a/tutorials/application/source_en/nlp/sequence_labeling.md +++ b/tutorials/application/source_en/nlp/sequence_labeling.md @@ -1,6 +1,6 @@ # Sequence Labeling Implementation Using LSTM+CRF - + ## Overview