Natural Language Processing (NLP) (10%)
自然語言處理(英語:Natural Language Processing,縮寫作 NLP)是人工智慧和語言學領域的分支學科。此領域探討如何處理及運用自然語言;自然語言處理包括多方面和步驟,基本有認知、理解、生成等部分。
Development Life Cycle (開發生命周期)
Named Entity Recognition (NER) (實體識別)
Parsing (句法分析)
Text-proofing (文字校對)
Information retrieval (信息檢索)
Text summarization (文本摘要)
Natural language generation (自然語言生成)
Speech synthesis (語音合成)
Development Life Cycle
NLP 開發生命周期
理解問題
收集數據/語料
數據/語料分折
Data pre-processing (數據預處理)
特徵工程
決定使用的計算技術 (Rules base, machine learning ...)
應用計算技術
測試和評估系統結果
優化調整參數
持續此過程直到得到滿意的結果
Chinese Text Segmentation
Part-of-speech tagging (詞性標示)
Named Entity Recognition (NER) (實體識別)
Reference
於 Conda run Stanford Corenlp
Text Classification (文本分類)
Sentence Similarity (句子相似度計算)
REF
https://github.com/AIPractice/SentenceDistance
Numpy Array Similarity
#相似度计算,inA、inB都是行向量
import numpy as np
from numpy import linalg as la
#欧式距离
def euclidSimilar(inA,inB):
return 1.0/(1.0+la.norm(inA-inB))
#皮尔逊相关系数
def pearsonSimilar(inA,inB):
if len(inA)<3:
return 1.0
return 0.5+0.5*np.corrcoef(inA,inB,rowvar=0)[0][1]
#余弦相似度
def cosSimilar(inA,inB):
inA=np.mat(inA)
inB=np.mat(inB)
num=float(inA*inB.T)
denom=la.norm(inA)*la.norm(inB)
return 0.5+0.5*(num/denom)
>>> inA=array([1,2,3])
>>> inB=array([2,4,6])
>>> euclidSimilar(inA,inB)
0.21089672205953397
>>> pearsonSimilar(inA,inB)
1.0
>>> cosSimilar(inA,inB)
1.0
作者:严昕 链接:https://www.zhihu.com/question/29978268/answer/456219359 来源:知乎 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
从大类上分,计算句子相似度的方法可以分为两类:
1)无监督的方法,即不使用额外的标注数据,常用的方法有:
(1)对句子中所有词的word vector求平均,获得sentence embedding
(2)以每个词的tf-idf为权重,对所有词的word vector加权平均,获得sentence embedding
(3)以smooth inverse frequency[1](简称SIF)为权重,对所有词的word vector加权平均,最后从中减掉principal component,得到sentence embedding
(4)通过Word Mover’s Distance[2](简称WMD),直接度量句子之间的相似度
2)有监督的方法,需要额外的标注数据,常见的有监督任务有:
(1)分类任务,例如训练一个CNN的文本分类器[3],取最后一个hidden layer的输出作为sentence embedding,其实就是取分类器的前几层作为预训练的encoder
(2)sentence pair的等价性/等义性判定([4][5]),这种方法的好处是不仅可以得到sentence embedding,还可以直接学习到距离度量函数里的参数
SentenceDistance Example
https://hk.saowen.com/a/b9c735db0ccf1984d71b9d381dca1de29a108c901272c4b9a38eaac0b4399a6b
https://github.com/AIPractice/SentenceDistance
Information extraction (信息抽取)
Question answering (問答系統)
Sentiment analysis (情感分析)
Speech recognition (語音識別)
Text to speech (文本朗讀)
Reference
REF:
Sentiment Classification from Keras to the Browser
https://medium.com/@alyafey22/sentiment-classification-from-keras-to-the-browser-7eda0d87cdc6
Parsing

Paper (論文)
AAAI2019 | 騰訊AI Lab詳解自然語言處理領域三大研究方向及入選論文
Last updated