Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 49 additions & 1 deletion docs/pythainlp-1-6-thai.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ engine คือ ระบบตัดคำไทย ปัจจุบัน
เช่น text=u'ผมรักคุณนะครับโอเคบ่พวกเราเป็นคนไทยรักภาษาไทยภาษาบ้านเกิด'
```

การใช้งาน
**การใช้งาน**

```python
from pythainlp.tokenize import word_tokenize
Expand Down Expand Up @@ -201,6 +201,54 @@ grammar : คุณ Wittawat Jitkrittum (https://github.com/wittawatj/jtcc/blob/
'/คืน/ความสุข'
```

### summarize

เป็นระบบสรุปเอกสารภาษาไทยแบบง่าย ๆ

summarize_text(text,n,engine='frequency')

text เป็นข้อความ
n คือ จำนวนประโยคสรุป
engine ที่รองรับ
- frequency
**การใช้งาน**

```python
>>> from pythainlp.summarize import summarize_text
>>> summarize_text(text="อาหาร หมายถึง ของแข็งหรือของเหลว ที่กินหรือดื่มเข้าสู่ร่างกายแล้ว จะทำให้เกิดพลังงานและความร้อนยเจริญเติบโต ซ่อมแซมส่วนที่สึกหรอ ควบคุมการเปลี่ยนแปลงต่างๆ ในร่างกาย ช่วยทำให้อวัยวะต่างๆ ทำงานได้อย่างปกติ อาหารจะต้องงกาย",n=1,engine='frequency')
['อาหารจะต้องไม่มีพิษและไม่เกิดโทษต่อร่างกาย']
```

### word_vector

```python
from pythainlp.word_vector import thai2vec
```

word_vector เป็นระบบ word vector ใน PyThaiNLP

ปัจจุบันนี้รองรับเฉพาะ thai2vec (https://github.com/cstorm125/thai2vec)

thai2vec พัฒนาโดยคุณ Charin Polpanumas

#### thai2vec

ความต้องการโมดูล

- gensim
- numpy

##### API

- get_model() - รับข้อมูล model ในรูปแบบของ gensim
- most_similar_cosmul(positive,negative)
- doesnt_match(listdata)
- similarity(word1,word2) - หาค่าความคล้ายกันระหว่าง 2 คำ โดยทั้งคู่เป็น str
- sentence_vectorizer(ss,dim=300,use_mean=False)
- about() - รายละเอียด thai2vec



### keywords

ใช้หา keywords จากข้อความภาษาไทย
Expand Down
2 changes: 1 addition & 1 deletion pythainlp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
__version__ = 1.5
__version__ = 1.6
import six
if six.PY3:
"""
Expand Down
3 changes: 2 additions & 1 deletion pythainlp/word_vector/__init__
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import,unicode_literals
from __future__ import absolute_import,unicode_literals
from .thai2vec import *
2 changes: 1 addition & 1 deletion pythainlp/word_vector/thai2vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def download():
if not os.path.exists(path):
print("Download models...")
from urllib import request
request.urlretrieve("https://github.com/cstorm125/thai2vec/raw/master/data/thaiwiki/models/thai2vec.vec",path)
request.urlretrieve("https://www.dropbox.com/sh/t9qfj2ethst8g20/AAC_vnHM5xmiyz1B9ouz_8Kna/data/thaiwiki/models/thai2vec.vec?dl=1",path)
print("OK.")
return path
def get_model():
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

setup(
name='pythainlp',
version='1.6.0.2',
version='1.6.0.4',
description="Thai natural language processing in Python package.",
long_description=readme,
author='PyThaiNLP',
Expand Down