NLP
文章平均质量分 89
smallworldxyl
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
tensorflow2.0 预测新文本(二)
之前的文本我们是采用的一个自己输入的data,数据量太小,生成的新闻本效果不好,这次我们采用更多的数据进行预测。1.数据获取数据的格式与之前相同,只不过数据量增大了,下载的数据存储到/tmp/irish-lyrics-eof.txt(可以按照自己需求更改)!wget --no-check-certificate \ https://storage.googleapis.com/laurencemoroney-blog.appspot.com/irish-lyrics-eof.txt \原创 2021-09-25 15:30:00 · 365 阅读 · 0 评论 -
tensorflow2.0 预测新文本(一)
先记录一个报错1.导入库import tensorflow as tffrom tensorflow.keras.preprocessing.sequence import pad_sequencesfrom tensorflow.keras.layers import Embedding, LSTM, Dense, Bidirectionalfrom tensorflow.keras.preprocessing.text import Tokenizerfrom tensorflow.ker原创 2021-09-25 14:49:48 · 757 阅读 · 0 评论 -
Word Embedding 和 Word2Vec详细笔记(未完待更)
一.单词的向量化表示1.one-hot比如有一个1000个词汇的词典,每一个单词可以表示为一个1000*1维大小的向量,其中一个位置为1,其余为0,并且每个单词的1的位置互斥。不过这种表示方式存在很多问题:任意两个词之间都是孤立的,根本无法表示出在语义层面上词语词之间的相关信息如果词典非常大,那么每个单词的维度都是巨大的,这样会造成计算上的困难其得到的特征是离散稀疏的,得到的向量过于稀疏,导致计算和存储的效率不高2. distributed representation它的思路是通过训原创 2021-09-24 22:26:57 · 454 阅读 · 0 评论 -
tensorflow2.0实现IMDB文本数据集学习词嵌入
1. IMDB数据集示例如下所示[ { "rating": 5, "title": "The dark is rising!", "movie": "tt0484562", "review": "It is adapted from the book. I did not read the book and maybe that is why I still enjoyed the movie. There are recent原创 2021-09-24 10:47:22 · 601 阅读 · 0 评论 -
tensorflow2.0使用keras的Tokenizer文本预处理
tokenizer = Tokenizer(num_words=max_words) # 只考虑最常见的前max_words个词tokenizer.fit_on_texts(texts) #使用一系列文档来生成token词典,texts为list类,每个元素为一个文档 sequences =tokenizer.texts_to_sequences(texts) # 将多个文档转换为word下标的向量形式,shape为[len(texts),len(text)] – (文档数,每条文档的长度).原创 2021-09-23 15:28:16 · 2743 阅读 · 0 评论
分享