Skip to content

Commit

Permalink
v1.2.1 (#322)
Browse files Browse the repository at this point in the history
* GH-230: check python version (#320)

* GH-310: handle exception case in sentiment module (#321)

* GH-300: release v1.2.1-alpha.1
  • Loading branch information
rain1024 authored Oct 28, 2020
1 parent a0c19d9 commit ed03192
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
6 changes: 6 additions & 0 deletions tests/sentiment/test_bank.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,9 @@ def test_multi_label_2(self):
actual = [str(label) for label in sentiment(text, domain="bank")]
expected = ['CARD#negative', 'CUSTOMER_SUPPORT#negative']
self.assertEqual(sorted(actual), sorted(expected))

def test_none_label(self):
text = 'Có làm thẻ ngân hàng BIDV miễn phí ko'
actual = sentiment(text, domain="bank")
expected = None
self.assertEqual(expected, actual)
2 changes: 1 addition & 1 deletion underthesea/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.1-alpha
1.2.1-alpha.1
13 changes: 11 additions & 2 deletions underthesea/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
# -*- coding: utf-8 -*-
import os
import sys

__author__ = """Vu Anh"""
__email__ = '[email protected]'
__email__ = '[email protected]'

# Check python version
try:
version_info = sys.version_info
if version_info < (3, 6, 0):
raise RuntimeError("underthesea requires Python 3.6 or later")
except Exception:
pass

###########################################################
# Metadata
# METADATA
###########################################################

# Version
Expand Down
2 changes: 2 additions & 0 deletions underthesea/sentiment/bank/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ def sentiment(text):
sentence = Sentence(text)
classifier.predict(sentence)
labels = sentence.labels
if labels is None:
return None
return [label.value for label in labels]

0 comments on commit ed03192

Please sign in to comment.