Skip to content

Commit c3f223c

Browse files
authored
Merge pull request #349 from PyThaiNLP/fix-ner-tag-2-1
Back port ner fix to 2.1 (update to 2.1.2)
2 parents 8369a21 + dee415e commit c3f223c

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Thai Natural Language Processing in Python.
1717

1818
PyThaiNLP is a Python package for text processing and linguistic analysis, similar to `nltk` but with focus on Thai language.
1919

20-
- This is [2.1.1 stable release](https://github.com/PyThaiNLP/pythainlp/releases). See [change log](https://github.com/PyThaiNLP/pythainlp/issues/181).
20+
- This is [2.1.2 stable release](https://github.com/PyThaiNLP/pythainlp/releases). See [change log](https://github.com/PyThaiNLP/pythainlp/issues/181).
2121
- For latest development, see [`dev`](https://github.com/PyThaiNLP/pythainlp/tree/dev) branch.
2222
- 📫 follow our [PyThaiNLP](https://www.facebook.com/pythainlp/) Facebook page
2323

@@ -119,7 +119,7 @@ PyThaiNLP เป็นไลบารีภาษาไพทอนเพื่
119119

120120
> เพราะโลกขับเคลื่อนต่อไปด้วยการแบ่งปัน
121121
122-
- รุ่นนี้คือรุ่นเสถียร [2.1.1](https://github.com/PyThaiNLP/pythainlp/releases) ดูความเปลี่ยนแปลงในรุ่นนี้ที่ [2.1 change log](https://github.com/PyThaiNLP/pythainlp/issues/181).
122+
- รุ่นนี้คือรุ่นเสถียร [2.1.2(https://github.com/PyThaiNLP/pythainlp/releases) ดูความเปลี่ยนแปลงในรุ่นนี้ที่ [2.1 change log](https://github.com/PyThaiNLP/pythainlp/issues/181).
123123
- สำหรับรุ่นที่กำลังพัฒนา ดูใน [`dev`](https://github.com/PyThaiNLP/pythainlp/tree/dev) branch
124124
- PyThaiNLP 2.1 รองรับ Python 3.6 ขึ้นไป ผู้ใช้ Python 2.7+ ยังสามารถใช้ PyThaiNLP 1.6 ได้
125125
- 📫 ติดตามข่าวสารได้ที่ Facebook [PyThaiNLP](https://www.facebook.com/pythainlp/)

pythainlp/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
__version__ = "2.1.1"
2+
__version__ = "2.1.2"
33

44
thai_consonants = "กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรลวศษสหฬอฮ" # 44 chars
55
thai_vowels = "ฤฦะ\u0e31าำ\u0e34\u0e35\u0e36\u0e37\u0e38\u0e39เแโใไ\u0e45\u0e47" # 19

pythainlp/tag/named_entity.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ def get_ner(
156156
self.temp = ""
157157
self.sent = ""
158158
for idx, (word, ner) in enumerate(self.sent_ner):
159-
if "B-" in ner:
159+
if "B-" in ner and self.temp != "":
160+
self.sent += "</"+self.temp+">"
161+
self.temp = ner.replace("B-", "")
162+
self.sent += "<"+self.temp+">"
163+
elif "B-" in ner:
160164
self.temp = ner.replace("B-", "")
161165
self.sent += "<"+self.temp+">"
162166
elif "O" == ner and self.temp != "":

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 2.1.1
2+
current_version = 2.1.2
33
commit = True
44
tag = True
55

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868

6969
setup(
7070
name="pythainlp",
71-
version="2.1.1",
71+
version="2.1.2",
7272
description="Thai Natural Language Processing library",
7373
long_description=readme,
7474
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)