从单词到向量-自然语言处理NLP

-译文,原文链接:Word to Vectors — Natural Language Processing

为什么NLP比较难?

计算机以清晰、准确并且通常是结构化的程序语言与人类交互。然而,人类的语言通常不是那么清晰。有同义词、反义词、反义词还有一些单词在用做名词和动词会表现出不同的含义。这些字词在自然语言中具有上下文相关的意义,人类可以理解和区分它们,而机器则不能。这就是使NLP成为AI中最困难,最有趣的任务之一的原因。

使用NLP可以完成什么工作?

通过使计算机能够“理解”人类语言,可以完成一些任务。我在本文中用于检测拼写和语法的应用就是一个实例。下面这些任务也是NLP正在研究的:

  1. 拼写和语法检测
  2. 同义词反义词的寻找
  3. 从文档和网站提取信息
  4. 理解语句、文档的信息
  5. 机器翻译(例如从英语到德语的翻译)
  6. 回答问题和完成任务(例如安排日程)

如何标识单词?

首先,我们要能够将单词作为机器学习模型的输入,一种表示单词的数学方法是将其表示为向量。英文中大约共有1300万单词,但是他们中的很多是相关的,比如spouse和partner,hotel和motel。所以我们是否有必要为1300万个单词分别使用向量表示?
当然不是,我们必须寻找一个远小于1300万的并且足以编码语言中的所有语义的N维向量空间。我们必须对单词

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Word2Vec.Net 是单词转换成向量形式工具Word2Vec .NET版本。使用示例代码:            var builder = Word2VecBuilder.Create();             if ((i = ArgPos("-train",  args)) > -1)                 builder.WithTrainFile&#40;args[i   1]&#41;;             if ((i = ArgPos("-output", args)) > -1)                 builder.WithOutputFile&#40;args[i   1]&#41;;             //to all other parameters will be set default values             var word2Vec = builder.Build();             word2Vec.TrainModel();             var distance = new Distance(args[i   1]);             BestWord[] bestwords = distance.Search("some_word");或者//more explicit option         string trainfile="C:/data.txt";         string outputFileName = "C:/output.bin";         var word2Vec = Word2VecBuilder.Create()             .WithTrainFile&#40;trainfile&#41;// Use text data to train the model;             .WithOutputFile&#40;outputFileName&#41;//Use to save the resulting word vectors / word clusters             .WithSize(200)//Set size of word vectors; default is 100             .WithSaveVocubFile&#40;&#41;//The vocabulary will be saved to <file>             .WithDebug(2)//Set the debug mode (default = 2 = more info during training)             .WithBinary(1)//Save the resulting vectors in binary moded; default is 0 (off)             .WithCBow(1)//Use the continuous bag of words model; default is 1 (use 0 for skip-gram model)             .WithAlpha(0.05)//Set the starting learning rate; default is 0.025 for skip-gram and 0.05 for CBOW             .WithWindow(7)//Set max skip length between words; default is 5             .WithSample((float) 1e-3)//Set threshold for occurrence of words. Those that appear with higher frequency in the training data twill be randomly down-sampled; default is 1e-3, useful range is (0, 1e-5)             .WithHs(0)//Use Hierarchical Softmax; default is 0 (not used)             .WithNegative(5)//Number of negative examples; default is 5, common values are 3 - 10 (0 = not used)             .WithThreads(5)//Use <int

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值