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

fix for 6340 bug #6423

Merged
merged 20 commits into from
Aug 19, 2020
Merged

fix for 6340 bug #6423

merged 20 commits into from
Aug 19, 2020

Conversation

praneethgb
Copy link
Contributor

@praneethgb praneethgb commented Aug 14, 2020

Proposed changes:

If two entities are separated by a single space with U- tags, they are currently detected as one entity.

Example:
my ingredients are eggs lemon juice and milk results in
{'entity': 'eggs lemon juice', 'entity':: 'milk', 'extractor': 'DIETClassifier'}

This PR fixes this. Entities separated by a single space and BILOU tags will be listed as individual entities.
Related post: #6340

Status (please check what you already did):

  • added some tests for the functionality
  • updated the documentation
  • updated the changelog (please check changelog for instructions)
  • reformat files using black (please check Readme for instructions)

@CLAassistant
Copy link

CLAassistant commented Aug 14, 2020

CLA assistant check
All committers have signed the CLA.

@sara-tagger
Copy link
Collaborator

Thanks for submitting a pull request 🚀 @melindaloubser1 will take a look at it as soon as possible ✨

Copy link
Contributor

@tabergma tabergma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks 🚀

rasa/nlu/extractors/extractor.py Outdated Show resolved Hide resolved
tests/nlu/extractors/test_extractor.py Show resolved Hide resolved
rasa/nlu/classifiers/diet_classifier.py Show resolved Hide resolved
Copy link
Contributor

@tabergma tabergma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks for addressing my comments 💯

@tabergma
Copy link
Contributor

@praneethgb You need to sign the Contributor License Agreement. Otherwise I am not able to merge this PR. Thanks.

@praneethgb
Copy link
Contributor Author

@tabergma, Signed. Thanks.

@tabergma tabergma merged commit cfe49f4 into RasaHQ:master Aug 19, 2020
erohmensing pushed a commit that referenced this pull request Aug 21, 2020
* fix for 6340 bug

* DeepSource Styling issues

* BILOU code module change

* adding bilou tagging entites test case

* UNi-gram as new token

* Other tag check for test cases

* review comments

* doc line split

Co-authored-by: Tanja <tabergma@gmail.com>
@erohmensing erohmensing mentioned this pull request Aug 21, 2020
4 tasks
wochinge added a commit that referenced this pull request Aug 21, 2020
@elenaviter
Copy link

elenaviter commented Aug 24, 2020

When use roles, there's still a problem to have the entity tokens B-entity ... L-entity to be collected as a whole because of the condition:

(

group_or_role_changed = (
)
group_or_role_changed = (last_group_tag != current_group_tag or last_role_tag != current_role_tag)
Considering the role and the entity type are both associated with the same token, for me, this works instead

group_or_role_changed = (
                    last_group_tag != current_group_tag or bilou_utils.tag_without_prefix(last_role_tag) != bilou_utils.tag_without_prefix(current_role_tag)
            )

And the rest of the logic to reconstruct the compound entity based on bilou labels of the entity tag ensures the integrity of the approach.

Also the "current_role_tag" under construction of the entity -> bilou_utils.tag_without_prefix(current_role_tag) :

entity = self._create_new_entity(
                    list(tags.keys()),
                    current_entity_tag,
                    current_group_tag,
                    bilou_utils.tag_without_prefix(current_role_tag),
                    token,
                    idx,
                    confidences,
                )

@wochinge
Copy link
Contributor

@tabergma have you seen the message from above?

@tabergma
Copy link
Contributor

It is fixed on master (#6577) and I just created a PR for a minor release.

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

Successfully merging this pull request may close these issues.

6 participants