Skip to content

Commit 625e198

Browse files
committed
update jekyll
1 parent 2709a4c commit 625e198

File tree

4 files changed

+60
-83
lines changed

4 files changed

+60
-83
lines changed

Gemfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
source "https://rubygems.org"
2-
ruby RUBY_VERSION
32

43
# Hello! This is where you manage which Jekyll version is used to run.
54
# When you want to use a different version, change it below, save the
@@ -9,7 +8,7 @@ ruby RUBY_VERSION
98
#
109
# This will help ensure the proper Jekyll version is running.
1110
# Happy Jekylling!
12-
gem "jekyll", "3.4.2"
11+
gem "jekyll", "~> 3.8.5"
1312

1413
# This is the default theme for new Jekyll sites. You may change this to anything you like.
1514
gem "minima", "~> 2.0"
@@ -20,9 +19,12 @@ gem "minima", "~> 2.0"
2019

2120
# If you have any plugins, put them here!
2221
group :jekyll_plugins do
23-
gem "jekyll-feed", "~> 0.6"
22+
gem "jekyll-feed", "~> 0.6"
2423
end
2524

2625
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
27-
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
26+
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
27+
28+
# Performance-booster for watching directories on Windows
29+
gem "wdm", "~> 0.1.0" if Gem.win_platform?
2830

Gemfile.lock

Lines changed: 46 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,74 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
addressable (2.5.0)
5-
public_suffix (~> 2.0, >= 2.0.2)
4+
addressable (2.5.2)
5+
public_suffix (>= 2.0.2, < 4.0)
66
colorator (1.1.0)
7-
ffi (1.9.18)
7+
concurrent-ruby (1.1.4)
8+
em-websocket (0.5.1)
9+
eventmachine (>= 0.12.9)
10+
http_parser.rb (~> 0.6.0)
11+
eventmachine (1.2.7)
12+
ffi (1.9.25)
813
forwardable-extended (2.6.0)
9-
jekyll (3.4.2)
14+
http_parser.rb (0.6.0)
15+
i18n (0.9.5)
16+
concurrent-ruby (~> 1.0)
17+
jekyll (3.8.5)
1018
addressable (~> 2.4)
1119
colorator (~> 1.0)
20+
em-websocket (~> 0.5)
21+
i18n (~> 0.7)
1222
jekyll-sass-converter (~> 1.0)
13-
jekyll-watch (~> 1.1)
14-
kramdown (~> 1.3)
15-
liquid (~> 3.0)
23+
jekyll-watch (~> 2.0)
24+
kramdown (~> 1.14)
25+
liquid (~> 4.0)
1626
mercenary (~> 0.3.3)
1727
pathutil (~> 0.9)
18-
rouge (~> 1.7)
28+
rouge (>= 1.7, < 4)
1929
safe_yaml (~> 1.0)
20-
jekyll-feed (0.9.1)
30+
jekyll-feed (0.11.0)
2131
jekyll (~> 3.3)
22-
jekyll-sass-converter (1.5.0)
32+
jekyll-sass-converter (1.5.2)
2333
sass (~> 3.4)
24-
jekyll-watch (1.5.0)
25-
listen (~> 3.0, < 3.1)
26-
kramdown (1.13.2)
27-
liquid (3.0.6)
28-
listen (3.0.8)
34+
jekyll-seo-tag (2.5.0)
35+
jekyll (~> 3.3)
36+
jekyll-watch (2.1.2)
37+
listen (~> 3.0)
38+
kramdown (1.17.0)
39+
liquid (4.0.1)
40+
listen (3.1.5)
2941
rb-fsevent (~> 0.9, >= 0.9.4)
3042
rb-inotify (~> 0.9, >= 0.9.7)
43+
ruby_dep (~> 1.2)
3144
mercenary (0.3.6)
32-
minima (2.1.0)
33-
jekyll (~> 3.3)
34-
pathutil (0.14.0)
45+
minima (2.5.0)
46+
jekyll (~> 3.5)
47+
jekyll-feed (~> 0.9)
48+
jekyll-seo-tag (~> 2.1)
49+
pathutil (0.16.2)
3550
forwardable-extended (~> 2.6)
36-
public_suffix (2.0.5)
37-
rb-fsevent (0.9.8)
38-
rb-inotify (0.9.8)
39-
ffi (>= 0.5.0)
40-
rouge (1.11.1)
51+
public_suffix (3.0.3)
52+
rb-fsevent (0.10.3)
53+
rb-inotify (0.10.0)
54+
ffi (~> 1.0)
55+
rouge (3.3.0)
56+
ruby_dep (1.5.0)
4157
safe_yaml (1.0.4)
42-
sass (3.4.23)
58+
sass (3.7.2)
59+
sass-listen (~> 4.0.0)
60+
sass-listen (4.0.0)
61+
rb-fsevent (~> 0.9, >= 0.9.4)
62+
rb-inotify (~> 0.9, >= 0.9.7)
4363

4464
PLATFORMS
4565
ruby
4666

4767
DEPENDENCIES
48-
jekyll (= 3.4.2)
68+
jekyll (~> 3.8.5)
4969
jekyll-feed (~> 0.6)
5070
minima (~> 2.0)
5171
tzinfo-data
5272

53-
RUBY VERSION
54-
ruby 2.3.0p0
55-
5673
BUNDLED WITH
57-
1.14.6
74+
1.16.2

_config.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,17 @@ title: iosdevlog
1717
email: iosdevlog@iosdevlog.com
1818
description: > # this means to ignore newlines until "baseurl:"
1919
iosdevlog.com
20-
baseurl: "" # the subpath of your site, e.g. /blog
20+
baseurl: ""
2121
url: "http://iosdevlog.com" # the base hostname & protocol for your site, e.g. http://example.com
2222
twitter_username: iosdevlog
2323
github_username: iosdevlog
2424

25-
paginate: 50
26-
2725
# Build settings
2826
markdown: kramdown
2927
theme: minima
30-
gems:
28+
plugins:
3129
- jekyll-feed
32-
exclude:
33-
- Gemfile
34-
- Gemfile.lock
3530

3631
# Google Analytics
3732
google_analytics: UA-104431384-1
33+

_posts/2019-01-03-nlp.md

Lines changed: 5 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@ tags: []
1111
# 自然语言处理简介
1212

1313
现在,让我们先从介绍自然语言处理(NLP)开始吧。众所周知,语言是人们日常生 活的核心部分,任何与语言问题相关的工作都会显得非常有意思。希望这本书能带你领略 到 NLP 的风采,并引起学习 NLP 的兴趣。首先,我们需要来了解一下该领域中的一些令 人惊叹的概念,并在工作中实际尝试一些具有挑战性的 NLP 应用。
14+
1415
在英语环境中,语言处理研究这一领域通常被简称为 NLP。对语言有深入研究的人通 常被叫作语言学家,而“计算机语言学家”这个专用名词则指的是将计算机科学应用于语 言处理领域的人。因此从本质上来说,一个计算机语言学家应该既有足够的语言理解能力, 同时还可以用其计算机技能来模拟出语言的不同方面。虽然计算机语言学家主要研究的是 语言处理理论,但 NLP 无疑是对计算机语言学的具体应用。
16+
1517
NLP 多数情况下指的是计算机上各种大同小异的语言处理应用,以及用 NLP 技术所构 建的实际应用程序。在实践中,NLP 与教孩子学语言的过程非常类似。其大多数任务(如 对单词、语句的理解,形成语法和结构都正确的语句等)对于人类而言都是非常自然的能 力。但对于 NLP 来说,其中有一些任务就必须要转向标识化处理、语块分解、词性标注、 语法解析、机器翻译及语音识别等这些领域的一部分,且这些任务有一大部分还仍是当前 计算机领域中非常棘手的挑战。在本书中,我们将更侧重于讨论 NLP 的实用方面,因此我 们会假设读者在 NLP 上已经有了一些背景知识。所以,读者最好在最低限度上对编程语言 有一点了解,并对 NLP 和语言学有一定的兴趣。
1618

1719
目前,NLP 已被认为是业界最为稀缺的技能之一。自大数据 的概念问世之后,我们所面对的主要挑战是——业界需要越来越多不仅能处理结构化数据, 同时也能处理半结构化或非结构化数据的人才。对于我们所生产出来的那些博客、微博、 Facebook 订阅、聊天信息、E-mail 以及网络评论等,各公司都在致力于收集所有不同种类 的数据,以便建立更好的客户针对性,形成有意义的见解。而要想处理所有的这些非结构 化数据源,我们就需要掌握一些 NLP 技能的人员。
20+
1821
身处信息时代,我们甚至不能想象生活中没有 Google 会是什么样子。我们会因一些最基本的事情而用到 Siri;我们会需要用垃圾过滤器来过滤垃圾邮件;我们会需要在自己的 Word 文档中用到拼写检查器等。在现实世界中所要用到的 NLP 应用数不胜数。
1922

2023
在这里,我们可以再列举一些令人惊叹的 NLP 应用实例。虽然你很可能已经用过它们,
24+
2125
但未必知道这些应用是基于 NLP 技术的。
2226

2327
• 拼写校正(MS Word/其他编辑器)
@@ -205,7 +209,7 @@ SVM 属于非概率分类器。SVM 会在无限维空间中构造出一组超平
205209

206210
事实上,它比较适 合用于在各种数据集的子样本上构建多决策树型的分类器。另外,该森林中的每个树结构都建立 在一个随机的最佳特征子集上。最后,启用这些树结构的动作也找出了所有随机特征子集中的最 佳子集。总而言之,随机森林是当前众多分类算法中表现最佳的算法之一
207211

208-
# 示例 饭店评论
212+
# 示例 分析 饭店评论
209213

210214

211215
```python
@@ -233,10 +237,6 @@ dataset.head()
233237
dtypes: int64(1), object(1)
234238
memory usage: 15.7+ KB
235239

236-
237-
238-
239-
240240
<div>
241241
<style scoped>
242242
.dataframe tbody tr th:only-of-type {
@@ -324,15 +324,10 @@ for i in range(0, 1000):
324324
[nltk_data] /Users/iosdevlog/nltk_data...
325325
[nltk_data] Package stopwords is already up-to-date!
326326

327-
328-
329327
```python
330328
corpus[:10]
331329
```
332330

333-
334-
335-
336331
['wow love place',
337332
'crust good',
338333
'tasti textur nasti',
@@ -344,9 +339,6 @@ corpus[:10]
344339
'fri great',
345340
'great touch']
346341

347-
348-
349-
350342
```python
351343
# Creating the Bag of Words model
352344
from sklearn.feature_extraction.text import CountVectorizer
@@ -357,52 +349,34 @@ y = dataset.iloc[:, 1].values
357349
X[:5]
358350
```
359351

360-
361-
362-
363352
array([[0, 0, 0, ..., 0, 0, 0],
364353
[0, 0, 0, ..., 0, 0, 0],
365354
[0, 0, 0, ..., 0, 0, 0],
366355
[0, 0, 0, ..., 0, 0, 0],
367356
[0, 0, 0, ..., 0, 0, 0]], dtype=int64)
368357

369-
370-
371-
372358
```python
373359
# Splitting the dataset into the Training set and Test set
374360
from sklearn.model_selection import train_test_split
375361
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.20, random_state = 0)
376362
X_train[:5]
377363
```
378364

379-
380-
381-
382365
array([[0, 0, 0, ..., 0, 0, 0],
383366
[0, 0, 0, ..., 0, 0, 0],
384367
[0, 0, 0, ..., 0, 0, 0],
385368
[0, 0, 0, ..., 0, 0, 0],
386369
[0, 0, 0, ..., 0, 0, 0]], dtype=int64)
387370

388-
389-
390-
391371
```python
392372
# Fitting Naive Bayes to the Training set
393373
from sklearn.naive_bayes import GaussianNB
394374
classifier = GaussianNB()
395375
classifier.fit(X_train, y_train)
396376
```
397377

398-
399-
400-
401378
GaussianNB(priors=None, var_smoothing=1e-09)
402379

403-
404-
405-
406380
```python
407381
# Predicting the Test set results
408382
# Looking at first 5 testing data, we can see we predicted the first 3 incorrectly as positive reviews, and last 2 correctly as negative review
@@ -417,26 +391,14 @@ print(cv.inverse_transform(X_test[:5]))
417391
[0 0 0 0 0]
418392
[array(['aw', 'food', 'present'], dtype='<U17'), array(['food', 'servic', 'worst'], dtype='<U17'), array(['dine', 'never', 'place'], dtype='<U17'), array(['disgrac', 'guess', 'mayb', 'night', 'went'], dtype='<U17'), array(['avoid', 'lover', 'mean', 'place', 'sushi'], dtype='<U17')]
419393

420-
421-
422394
```python
423395
# Making the Confusion Matrix
424396
from sklearn.metrics import confusion_matrix
425397
cm = confusion_matrix(y_test, y_pred)
426398
cm
427399
```
428400

429-
430-
431-
432401
array([[55, 42],
433402
[12, 91]])
434403

435-
436-
437404
> 参考资料:《NLTK基础教程》,《机器学习 A-Z》
438-
439-
440-
```python
441-
442-
```

0 commit comments

Comments
 (0)