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. DOM(二)

    文档信息 document对象还有一些标准的Document对象所没有的属性: title属性:包含着<title>元素中的文本——显示在浏览器窗口的标题栏或标签页上,通过整个属性可以取得 ...

  2. SpringBoot整合Shiro使用Ehcache等缓存无效问题

    前言 整合有缓存.事务的spring boot项目一切正常. 在该项目上整合shiro安全框架,发现部分类的缓存Cache不能正常使用. 然后发现该类的注解基本失效,包括事务Transaction注解 ...

  3. flask登录插件 flask-login

    Flask-Login为Flask提供了用户会话管理,它处理了日常的登入登出且长时间记住用户的会话 使用: 1.配置,初始化 LoginManager 创建实例 loginManger = Login ...

  4. Linux命令(一)

    需要用Xshell连接Linux时: 先在终端输入命令:service  sshd  start(开启ssh服务) 1.netstat -tnl:查看端口状态的命令(如 查看22端口) 2.servi ...

  5. Dockerfile centos7_php5.6.36

    Dockerfile: FROM centos:7 MAINTAINER www.ctnrs.com RUN yum install epel-release -y && \ yum ...

  6. SQL SERVER中的两种常见死锁及解决思路

    在sql server中,死锁都与一种锁有关,那就是排它锁(x锁).由于在同一时间对同一个数据库资源只能有一个数据库进程可以拥有排它锁.因此,一旦多个进程都需要获取某个或者同一个数据库资源的排它访问权 ...

  7. H5 29-div和span标签

    29-div和span标签 --> 努力到无能为力, 拼搏到感动自己 --> 我是div 我是div 我是span 我是span --> --> 我是段落 我是标题 --> ...

  8. c++入门之 深入cin

    cin 表示输入流,但是究其本质,又能认识到什么呢?先上代码: #include "iostream" };//c++11中使用{}进行重新命名 int main() { usin ...

  9. 学习yii2.0——事件

    参考:https://www.yiichina.com/doc/guide/2.0/concept-events 事件 yii框架中的事件定义和JavaScript中的事件定义差不多:为某个事件绑定一 ...

  10. 日志分析工具之goAccess

    在此推荐一款分析日志的工具,方便我们日常对于网站的访问状况有一个较为清晰的了解  一.安装 官网: https://goaccess.io/download 源码安装: 1. wget http:// ...