How to represent words.

0 .

Native represtation: one-hot vectors

Demision: |all words|

(too large and hard to express senmatic similarity)

Idea:produce dense vector representations based on the context/use of words

So, there are Three main approaches:

1.

Count-based methods

(1) Define a basis vocabulary C(lower than all words dimision) of context words(expect:the、a、of…)

(2) Define a word window size W

(3) Count the basis vocabulary words occurring W words to the left or right of each instance of a target word in the corpus

(4) From a vector represtation of the target word based on these counts

Example-express:

We can calculate the similarity of two words using inner product or cosine.

For instance.

2.

Neural Embedding Models(Main Idea)

To generate an embedding matrix in R(|all words| * |context words|) which looks like:

(count based vectors)

Rows are word vectores.

We can retrieve a certain word vector with one-hot vector.

(One)generic idea behind embedding learning:

(1) Collect instances ti∈inst(t) of a word t of vocab V

(2) For each instance, collect its context word c(ti) (e.g.k-word window)

(3) Define some score function score(ti,c(ti),θ,E) with upper bound on output

(4) Define a loss

(5) Estimate:

(6) Use the estimated E as the embedding matrix

Attention:

Scoring function estimates whether a sentence(or the object word and its context) is said or used normally by a people,so the higher the score,the more likely it is.

3.

C&W

Firstly,we embed all words in a sentence with E.

Then,sentence(w1,w2,w3,w4,w5) goes through a convolution layer(maybe just simpal connection layer).

Then,it goes through a simpal MLP.

Then,it goes through the ‘scorer’layer and output the final Score.

Minimize the loss function(!),and use the parameter matrix of input layer and ..

4. Word2Vec

1) CBoW(contextual bag of words)

2) Skip-gram:

【NLP】How to Generate Embeddings?的更多相关文章

  1. 【NLP】前戏:一起走进条件随机场(一)

    前戏:一起走进条件随机场 作者:白宁超 2016年8月2日13:59:46 [摘要]:条件随机场用于序列标注,数据分割等自然语言处理中,表现出很好的效果.在中文分词.中文人名识别和歧义消解等任务中都有 ...

  2. 【NLP】基于自然语言处理角度谈谈CRF(二)

    基于自然语言处理角度谈谈CRF 作者:白宁超 2016年8月2日21:25:35 [摘要]:条件随机场用于序列标注,数据分割等自然语言处理中,表现出很好的效果.在中文分词.中文人名识别和歧义消解等任务 ...

  3. 【NLP】基于机器学习角度谈谈CRF(三)

    基于机器学习角度谈谈CRF 作者:白宁超 2016年8月3日08:39:14 [摘要]:条件随机场用于序列标注,数据分割等自然语言处理中,表现出很好的效果.在中文分词.中文人名识别和歧义消解等任务中都 ...

  4. 【NLP】基于统计学习方法角度谈谈CRF(四)

    基于统计学习方法角度谈谈CRF 作者:白宁超 2016年8月2日13:59:46 [摘要]:条件随机场用于序列标注,数据分割等自然语言处理中,表现出很好的效果.在中文分词.中文人名识别和歧义消解等任务 ...

  5. 【NLP】条件随机场知识扩展延伸(五)

    条件随机场知识扩展延伸 作者:白宁超 2016年8月3日19:47:55 [摘要]:条件随机场用于序列标注,数据分割等自然语言处理中,表现出很好的效果.在中文分词.中文人名识别和歧义消解等任务中都有应 ...

  6. 【NLP】Tika 文本预处理:抽取各种格式文件内容

    Tika常见格式文件抽取内容并做预处理 作者 白宁超 2016年3月30日18:57:08 摘要:本文主要针对自然语言处理(NLP)过程中,重要基础部分抽取文本内容的预处理.首先我们要意识到预处理的重 ...

  7. [转]【NLP】干货!Python NLTK结合stanford NLP工具包进行文本处理 阅读目录

    [NLP]干货!Python NLTK结合stanford NLP工具包进行文本处理  原贴:   https://www.cnblogs.com/baiboy/p/nltk1.html 阅读目录 目 ...

  8. 【NLP】Conditional Language Models

    Language Model estimates the probs that the sequences of words can be a sentence said by a human. Tr ...

  9. 【NLP】干货!Python NLTK结合stanford NLP工具包进行文本处理

    干货!详述Python NLTK下如何使用stanford NLP工具包 作者:白宁超 2016年11月6日19:28:43 摘要:NLTK是由宾夕法尼亚大学计算机和信息科学使用python语言实现的 ...

随机推荐

  1. leetcode:Single Number

    public int SingleNumber(int[] nums) { if(nums==null||nums.Length%2==0) return 0; int ret=nums[0]; fo ...

  2. Java Statement PK PrepareStatement

    PreparedStatement是用来执行SQL查询语句的API之一,Java提供了 Statement.PreparedStatement 和 CallableStatement三种方式来执行查询 ...

  3. mongo中的模糊查询

    以下是一个mongo查询的综合应用,即介绍一个生产中实际应用的模糊查询,当然其实也很简单,主要用到mongo中的模糊查询和$or查询,以及并的关系,下面是一个mongo中的一条记录 { "_ ...

  4. [C#] LINQ之SelectMany

    声明:本文为www.cnc6.cn原创,转载时请注明出处,谢谢! 一.第一种用法: public static IEnumerable<TResult> SelectMany<TSo ...

  5. IIS配置Url重写实现http自动跳转https的重定向方法(100%解决)

    引言 本文推荐阅读地址:https://www.52abp.com/BlogDetails/10008 这种文章网上可以说一搜一大把,但是我为什么还要写呢,因为一搜一把没把我气死,都是东抄西挪的东西, ...

  6. new、getInstance()、newInstance()、Class.forName()

    1.对象使用之前通过getinstance()得到而不需要自己定义,用完之后不需要delete: 2.new 一定要生成一个新对象,分配内存:getInstance() 则不一定要再次创建,它可以把一 ...

  7. D1. Great Vova Wall (Version 1)

    链接 [https://codeforces.com/contest/1092/problem/D1] 题意 给你n个位置墙的高度,现在你有2×1 砖块,你可以竖直或者水平放置 问你是否可以使得所有位 ...

  8. [2018福大至诚软工助教]alpha阶段小结

    [2018福大至诚软工助教]alpha阶段小结 一.得分 1. 冲刺(7次 Scrum) 150分 1)第1篇(25分) 项目 评分标准 各个成员在 Alpha 阶段认领的任务 (6分)视详细程度给分 ...

  9. python中map()函数用法

    map函数的原型是map(function, iterable, …),它的返回结果是一个列表. 参数function传的是一个函数名,可以是python内置的,也可以是自定义的. 参数iterabl ...

  10. E: 无法打开锁文件 /var/lib/dpkg/lock-frontend - open (13: 权限不够)E: 无法获取 dpkg 前端锁 (/var/lib/dpkg/lock-frontend),请查看您是否正以 root 用户运行?

    一.解决方案 修改root密码,以root身份安装 sudo pwdroot root  # 输入新密码即可