Corpus analysis
nltk包括四种形式的corpora
- Isolate corpus:文本和自然语言的集合,例如gutenberg、webtext等。
- Categorized corpus:这里的文本被打包分类成不同的类别,例如brown包含了news、hobbies、humor等类别。
- Overlapping corpus:这里的类别与类别之间会有重叠区域,例如retuers,比如你认为coconuts是一个类别,你还会看到coconut-oil是其一个子类别,还会有一个cotton-oil的类别,这些类别之间存在重叠。
- 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的库:
- For POS tagging(词性标注):nltk,pycorenlp
- Morph analysis(这里应该指的是构词法):nltk,polyglot
- 生成语法树:nltk,spaCy
context-free-grammer(CFG)上下文无关语法
- 非终结符集合N
- 终结符集合T
- 开始符号S,非终结符
- 产生规则P
Morphological analysis(词法分析)
可以看到GitHub上的例子
Lexical analysis(词性分析)
这个页面也有