Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use multiple entities in Python. #275

Open
swathionchip opened this issue Jul 4, 2019 · 3 comments
Open

How to use multiple entities in Python. #275

swathionchip opened this issue Jul 4, 2019 · 3 comments

Comments

@swathionchip
Copy link

Hi,

How to use multiple entities in Python.

Example:

entities = ['date','time','restaurant']
message = "Reserve me a table today at 6:30pm at Mainland China and on Monday at 7:00pm at Barbeque Nation"

Thanks In advance.

Regards,
Swathi.

@swathionchip
Copy link
Author

Could you please send reply.

@swathionchip
Copy link
Author

Hi,

I wrote Sample Application In python but I am getting Error.

Example :

from ner_v1.chatbot.entity_detection import get_text
from ner_v2.detectors.temporal.date.date_detection import DateAdvancedDetector
from ner_v2.detectors.temporal.time.time_detection import TimeDetector

message = "Reserve me a table today at 6:30pm at Mainland China and on Monday at 7:00pm at Barbeque Nation"
entity_name = ['date','time','restaurant']
structured_value=None
fallback_value=None
bot_message=None
source_language='en'
timezone='UTC'
past_date_referenced=False

output_res = get_text(message=message, entity_name=entity_name[2],
structured_value=structured_value,
fallback_value=fallback_value,
bot_message=bot_message,language=source_language)

detector = TimeDetector(entity_name=entity_name[1], language=source_language,
timezone=timezone)
output_time = detector.detect(message=message, entity_name=entity_name[1],
structured_value=structured_value,
fallback_value=fallback_value)
detector = DateAdvancedDetector(entity_name='date',language=source_language,
timezone=timezone,
past_date_referenced=past_date_referenced)
output_date = detector.detect(message=message, entity_name='date',
structured_value=structured_value,
fallback_value=fallback_value)

Below is the Error of the Above lines:

Traceback (most recent call last):
File "3.py", line 33, in
fallback_value=fallback_value)
File "../ner_v2/detectors/temporal/date/date_detection.py", line 717, in detect
entity_list, original_text_list = self.detect_entity(text=text)
File "../ner_v2/detectors/temporal/date/date_detection.py", line 140, in detect_entity
date_data = self._detect_date()
File "../ner_v2/detectors/temporal/date/date_detection.py", line 161, in _detect_date
date_dict_list = self._detect_any_date()
File "../ner_v2/detectors/temporal/date/date_detection.py", line 396, in _detect_any_date
date_dict_list = self._date_dict_from_text(text=self.processed_text)
File "../ner_v2/detectors/temporal/date/date_detection.py", line 477, in _date_dict_from_text
date_list, original_list = self._date_value(text=text)
File "../ner_v2/detectors/temporal/date/date_detection.py", line 504, in _date_value
date_list, original_list = self.date_detector_object.detect_entity(text)
File "../ner_v2/detectors/temporal/date/date_detection.py", line 828, in detect_entity
self.date, self.original_date_text = self.language_date_detector.detect_date(self.processed_text)
File "../ner_v2/detectors/temporal/date/en/date_detection.py", line 117, in detect_date
date_list, original_list = self.get_exact_date(date_list, original_list)
File "../ner_v2/detectors/temporal/date/en/date_detection.py", line 174, in get_exact_date
date_list, original_list = self._gregorian_month_day_format(date_list, original_list)
File "../ner_v2/detectors/temporal/date/en/date_detection.py", line 710, in _gregorian_month_day_format
if self.now_date.month > mm:
TypeError: '>' not supported between instances of 'int' and 'NoneType'
1.txt: command not found

Regards,
Swathi.

@swathionchip
Copy link
Author

Hi,

Could you please replay ASAP. We are Waiting for your response because we stucked here.

Regards,
Swathi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant