Corpus analysis

nltk包括四种形式的corpora

  1. Isolate corpus:文本和自然语言的集合,例如gutenberg、webtext等。
  2. Categorized corpus:这里的文本被打包分类成不同的类别,例如brown包含了news、hobbies、humor等类别。
  3. Overlapping corpus:这里的类别与类别之间会有重叠区域,例如retuers,比如你认为coconuts是一个类别,你还会看到coconut-oil是其一个子类别,还会有一个cotton-oil的类别,这些类别之间存在重叠。
  4. Temporal corpus:这个语料库收集了一个时期内自然语言的使用情况,例如inaugural address,你可以看到某个城市不同年份的就职演说。

练习地址GitHub:

https://github.com/jalajthanaki/NLPython/tree/master/ch2
https://nbviewer.jupyter.org/github/jalajthanaki/NLPython/blob/master/ch2/2_1_Basic_corpus_analysis.html

可以熟悉nltk API,这里使用brown和gutenberg corpora

几个数据集的网站

https://github.com/caesar0301/awesome-public-datasets
https://www.kaggle.com/datasets
https://www.reddit.com/r/datasets/

Chapter 3 Understanding the Structure of a Sentences

作者推荐了几个用于Linguistics branch的库:

  1. For POS tagging(词性标注):nltk,pycorenlp
  2. Morph analysis(这里应该指的是构词法):nltk,polyglot
  3. 生成语法树:nltk,spaCy

context-free-grammer(CFG)上下文无关语法【读书笔记】Python Natural Language Processing by Jalaj Thanaki

  1. 非终结符集合N
  2. 终结符集合T
  3. 开始符号S,非终结符
  4. 产生规则P

Morphological analysis(词法分析)

可以看到GitHub上的例子

https://github.com/jalajthanaki/NLPython/blob/master/ch3/

Lexical analysis(词性分析)

这个页面也有

https://github.com/jalajthanaki/NLPython/blob/master/ch3/

Syntactic analysis(句法分析)(树)

Semantic analysis(语义分析)

相关文章: