Restrict the scope of a synonym to a specific entity
See original GitHub issueDescription of Problem:
When a word’s synonyms are defined in the NLU training data, any occurrence of the synonyms are replaced by that word with no regard to what entity it has been recognized as. Essentially, two words that are synonyms in the context of one entity need not necessarily be synonyms in the context of another entity. This can especially be a problem when the volume of NLU training data is large and such conflicts are not easily visible.
Overview of the Solution:
There are currently two ways to define synonyms.
<!-- First -->
## intent:mention_expertise
- [machine learning](expertise:ML)
<!-- Second -->
## intent:mention_expertise
- machine learning
## synonym:ML
- machine learning
While defining synonyms using the first syntax, the current behavior is completely unintuitive since there’s nothing to indicate that it might apply outside the entity to which it has been attached to. With the second syntax, however, the global nature of synonym-mapping is more obvious.
Proposed solution 1: If syntax 1 is used, perform synonym mapping just for that entity. If syntax 2 is used, perform global synonym mapping.
Proposed solution 2: Another alternative could be to list the synonyms to use under an entity in the domain file.
Examples:
Example 1:
## intent:inform
- My name is [Indiana](fname) Jones
- I am from [Indiana](state:IN)
- i come from [indiana](state:IN)
- The name's Jones. [Indiana](fname) Jones.
- My state is [IN](state)
With the above snippet in the training data, if you type in "My name is Indiana Jones"
, the slot value for fname
would be set to "IN"
.
Example 2:
## intent:find_a_professional
- find a [doctor](professional) for me
- get me a [doctor](professional)
- pls find me a [dr](professional:doctor)
## intent:inform_salutation
- [Mrs](salutation)
- Preferred one is [Dr](salutation)
- Use [Mr](salutation)
Similarly, there’ll be an unintended replacement of “Dr” in the second case.
Blockers (if relevant): Might be a breaking change for cases where syntax 1 is deliberately used for global definitions of synonyms.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (7 by maintainers)
Top GitHub Comments
I would like to re-open this issue, because I think this is still a problem (at least I do not know how to solve it). Is there any solution for / progress on this issue?
@wochinge I think we have leave it as
unplanned
for now until we get some more feedback on this problem