Skip to content

Commit f8d153f

Browse files
committed
release 0.2.0
1 parent 2c627ef commit f8d153f

File tree

5 files changed

+41
-44
lines changed

5 files changed

+41
-44
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
## [0.2.0] - 2019-12-12
11+
12+
### Changed
13+
14+
- Transfered ownership to [OpenJarbas](https://github.com/OpenJarbas)
15+
- Made a changelog
16+
17+
### Fixed
18+
19+
- updated deprecated mycroft_lang_utils to lingua_franca
20+
21+
[unreleased]: https://github.com/OpenJarbas/simple_NER/tree/dev
22+
[0.1.5]: https://github.com/OpenJarbas/simple_NER/tree/0.1.5

examples/neural.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,15 @@
44
ner.add_rule("name", "my name is {person}")
55

66
for ent in ner.extract_entities("the name is jarbas"):
7-
assert ent.as_json() == {'confidence': 0.5251495787186434,
8-
'data': {},
9-
'entity_type': 'person',
10-
'rules': [{'name': 'name',
11-
'rules': ['my name is {person}']}],
12-
'source_text': 'the name is jarbas',
13-
'spans': [(12, 18)],
14-
'value': 'jarbas'}
7+
assert ent.as_json()["value"] == 'jarbas'
158

169
for ent in ner.extract_entities("name is kevin"):
17-
assert ent.as_json() == {'confidence': 0.8363423970007801,
18-
'data': {},
19-
'entity_type': 'person',
20-
'rules': [{'name': 'name',
21-
'rules': ['my name is {person}']}],
22-
'source_text': 'name is kevin',
23-
'spans': [(8, 13)],
24-
'value': 'kevin'}
10+
# {'confidence': 0.8363423970007801,
11+
# 'data': {},
12+
# 'entity_type': 'person',
13+
# 'rules': [{'name': 'name',
14+
# 'rules': ['my name is {person}']}],
15+
# 'source_text': 'name is kevin',
16+
# 'spans': [(8, 13)],
17+
# 'value': 'kevin'}
18+
assert ent.as_json()["value"] == 'kevin'

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ pyspotlight
55
fann2==1.0.7
66
padatious==0.4.5
77
nltk
8-
mycroft_lang_utils
8+
lingua_franca==0.1.0

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ def package_files(directory):
1414

1515
setup(
1616
name='simple_NER',
17-
version='0.1.14',
17+
version='0.2.0',
1818
packages=['simple_NER', 'simple_NER.rules', 'simple_NER.annotators',
1919
'simple_NER.annotators.remote', 'simple_NER.annotators.utils',
2020
'simple_NER.annotators.utils.keywords'],
21-
url='https://github.com/JarbasAl/simple_NER',
21+
url='https://github.com/OpenJarbas/simple_NER',
2222
package_data={'': extra_files},
2323
include_package_data=True,
2424
license='MIT',
2525
author='jarbasAI',
2626
install_requires=["padaos", "fann2==1.0.7", "padatious", "nltk",
27-
"quantulum3", "requests", "mycroft_lang_utils",
27+
"quantulum3", "requests", "lingua_franca==0.1.0",
2828
"pyspotlight"],
2929
author_email='jarbasai@mailfence.com',
3030
description='rule based NER'

simple_NER/annotators/date.py

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
import re
55
from datetime import timedelta, datetime
66
from dateutil.relativedelta import relativedelta
7-
from mycroft_lang_utils.lang.parse_en import _convert_words_to_numbers, \
7+
from lingua_franca.lang.parse_en import _convert_words_to_numbers_en, \
88
is_numeric, extractnumber_en
9-
from mycroft_lang_utils.format import nice_duration, nice_date
10-
from mycroft_lang_utils.time import now_local
9+
from lingua_franca.format import nice_duration, nice_date
1110

1211

1312
def _annotate_datetime_en(string, dateNow=None, default_time=None):
@@ -37,7 +36,7 @@ def _annotate_datetime_en(string, dateNow=None, default_time=None):
3736
text consumed in the parsing, or None if no
3837
date or time related text was found.
3938
"""
40-
dateNow = dateNow or now_local()
39+
dateNow = dateNow or datetime.now()
4140

4241
def clean_string(s):
4342
# clean unneeded punctuation and capitalization among other things.
@@ -854,7 +853,7 @@ def _annotate_duration_en(text):
854853
}
855854

856855
pattern = r"(?P<value>\d+(?:\.?\d+)?)\s+{unit}s?"
857-
norm_text = _convert_words_to_numbers(text)
856+
norm_text = _convert_words_to_numbers_en(text)
858857
t = norm_text
859858
duration_text = text
860859

@@ -915,7 +914,7 @@ def _annotate_duration_en(text):
915914
class DateTimeNER(NERWrapper):
916915
def __init__(self, anchor_date=None):
917916
super().__init__()
918-
self.anchor_date = anchor_date or now_local()
917+
self.anchor_date = anchor_date or datetime.now()
919918
self.add_detector(self.annotate_datetime)
920919
self.add_detector(self.annotate_duration)
921920

@@ -972,24 +971,6 @@ def annotate(self, text):
972971
}
973972
yield Entity(value, "date", source_text=text, data=data)
974973

975-
def _old_annotate(self, text):
976-
# deprecated
977-
import datefinder
978-
matches = datefinder.find_dates(text, index=True)
979-
for date, span in matches:
980-
value = text[span[0]:span[1]].strip()
981-
data = {
982-
"timestamp": date.timestamp(),
983-
"isoformat": date.isoformat(),
984-
"weekday": date.isoweekday(),
985-
"month": date.month,
986-
"day": date.day,
987-
"hour": date.hour,
988-
"minute": date.minute,
989-
"year": date.year
990-
}
991-
yield Entity(value, "date", source_text=text, data=data)
992-
993974

994975
if __name__ == "__main__":
995976
from pprint import pprint

0 commit comments

Comments
 (0)