zoukankan      html  css  js  c++  java
  • NLP S实践

    nlp

    词袋

    将文本数据表示为词袋,将字符串用数值表示。分为3个步骤:
    (1) 分词, nltk
    (2) 构建词表,将上一步分词结果构建成一个list
    (3) 编码。sklearn.feature_extraction.CountVetorizer。将单词向量化,对比word2vec。

    减少文本特征

    (1) 删除停用词
    (2) 计算tf-idf,舍弃被认为不重要的特征
    (3) 通过提取词干,词形还原来减少特征
    提取词干
    PorterStemmer
    LancasterStemmer
    SnowballStemmer
    词形还原
    WordNetLemmatizer

    文档主题建模

    输出为主题对应的关键字,如

    Topic 0 ==> 0.037*"cryptography" + 0.037*"lot" + 0.037*"spent" + 0.037*"studying"
    Topic 1 ==> 0.075*"need" + 0.031*"order" + 0.031*"promoting" + 0.031*"talent"
    

    隐含狄利克雷分布
    sklearn.decomposition.LatentDirichletAllocation
    gensim.models.ldamodel.LdaModel

    文字情感分析

    sklearn
    NaiveBayesClassifier

    keras
    全连接网络

    CNN
    LSTM

    gensim

    models.ldamodel.LdaModel 隐含狄利克雷分布
    doc2bow(), Convert document into the bag-of-words (BoW) format = list of (token_id, token_count)

  • 相关阅读:
    [Bootstrap]全局样式(四)
    [Bootstrap]全局样式(三)
    [Bootstrap]全局样式(二)
    [Bootstrap]全局样式(一)
    [Bootstrap]概述
    原生JS-----一个剪刀石头布游戏
    聊聊 ES6 中的箭头函数
    jQuery中的 AJAX
    AJAX封装
    AJAX 初识
  • 原文地址:https://www.cnblogs.com/sunzhuli/p/9696735.html
Copyright © 2011-2022 走看看