主要内容

FastTextWordembedding

预处理的fastText单词嵌入

描述

例子

Emb= fastTextwordembeddingreturns a 300-dimensional pretrained word embedding for 1 million English words.

此功能需要Text Analytics Toolbox™模型对于FastText英语160亿个令牌单词嵌入金宝app支持包。如果未安装此支持金宝app软件包,则该功能提供了下载链接。

例子

全部收缩

下载并安装文本分析工具箱模型对于FastText英语160亿个令牌单词嵌入金宝app支持包。

类型FastTextWordembedding在命令行。

FastTextWordembedding

如果是文本分析工具箱模型对于FastText英语160亿个令牌单词嵌入support package is not installed, then the function provides a link to the required support package in the Add-On Explorer. To install the support package, click the link, and then click安装。Check that the installation is successful by typingEmb= fastTextwordembedding在命令行。

Emb= fastTextwordembedding
EMB =具有属性的Wordembedding:维度:300词汇:[1×1000000字符串]

如果安装了所需的支持软件包,则该金宝app功能返回Wordembedding目的。

加载预贴的单词嵌入FastTextWordembedding。此功能需要文本分析工具箱™模型对于FastText英语160亿个令牌单词嵌入金宝app支持包。如果未安装此支持金宝app包,则该功能提供了下载链接。

Emb= fastTextwordembedding
EMB =具有属性的Wordembedding:维度:300词汇:[1×1000000字符串]

Map the words "Italy", "Rome", and "Paris" to vectors usingWord2Vec

意大利= Word2Vec(Emb,“意大利”);rome = word2vec(emb,“罗马”);巴黎= Word2Vec(Emb,“巴黎”);

绘制向量意大利 - 罗马 +巴黎一个词使用vec2word

word = vec2word(Emb,意大利-Rome + Paris)
字=“法国”

使用验证的单词嵌入,将一系列令牌化文档转换为单词向量的序列。

加载预贴的单词嵌入FastTextWordembedding功能。此功能需要文本分析工具箱™模型对于FastText英语160亿个令牌单词嵌入金宝app支持包。如果未安装此支持金宝app包,则该功能提供了下载链接。

EMB = FastTextWordembedding;

加载工厂报告数据并创建一个tokenizedDocument大批。

文件名=“factoryReports.csv”;data =可读取(文件名,'texttype',,,,'细绳');textdata = data.description;documents = tokenizedDocument(textData);

使用文档将文档转换为单词向量的序列DOC2序列。TheDOC2序列默认情况下,函数左键将序列具有相同的长度。当使用高维单词嵌入转换大量文档时,填充可能需要大量的内存。为防止功能填充数据,请设置“ paddingDirection”option to'没有任何'。或者,您可以使用'Length'option.

序列= doc2序列(EMB,文档,“ paddingDirection”,,,,'没有任何');

查看前10个序列的大小。每个序列是d-经过-smatrix, whered是嵌入尺寸,并且s是序列中的单词向量的数量。

sequences(1:10)
ans =10×1 cell array{300×10单} {300×11单} {300×11单} {300×6单} {300×5单} {300×10 single} {300×8单} {300×9单} {300×9单} {300×7单} {300×13单}

输出参数

全部收缩

预处理的单词嵌入,返回Wordembedding目的。

在R2018A中引入