Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 18:17
    pyup-bot opened #1172
  • 18:17

    jacobtomlinson on pyup-update-dialogflow-0.7.0-to-0.7.2

    Update dialogflow from 0.7.0 to… (compare)

  • 18:17

    jacobtomlinson on pyup-update-dialogflow-0.7.0-to-0.7.2

    (compare)

  • 17:21
    codecov[bot] commented #1166
  • 17:20
    codecov[bot] commented #1166
  • 17:20
    codecov[bot] commented #1166
  • 17:20
    codecov[bot] commented #1166
  • 17:15
    codecov[bot] commented #1166
  • 17:15
    awesome-michael synchronize #1166
  • 14:36
    codecov[bot] commented #1170
  • 14:36
    codecov[bot] commented #1170
  • 14:36
    codecov[bot] commented #1170
  • 14:34
    codecov[bot] commented #1170
  • 14:27
    codecov[bot] commented #1170
  • 14:27
    MIP2000 synchronize #1170
  • 14:00
    paqman85 commented #532
  • 12:14

    FabioRosado on pyup-update-astroid-2.3.1-to-2.3.2

    (compare)

  • 12:14

    FabioRosado on master

    Update astroid from 2.3.1 to 2.… (compare)

  • 12:14
    FabioRosado closed #1171
  • 11:04
    codecov[bot] commented #1171
matrixbot
@matrixbot
Gergely Polonkai i’m with SolarDrew on this. Even a chat service can be unidirectional, if the bot doesn’t reply to commands (although pretty impractical)
matrixbot
@matrixbot
Jacob Tomlinson Ok so connector it is!
matrixbot
@matrixbot
Jacob Tomlinson This was a fun bug to spot opsdroid/demo-bot#3
matrixbot
@matrixbot
FabioRosado Hmm... on watson I might have to use a double for loop to get all the entities since depending of how you send your message you might have 5 different entities πŸ€” or should I just add the whole list?
Jacob Tomlinson I would add anything that looks like an entitiy
Jacob Tomlinson I appreciate we are probably shoe-horning stuff into our own interface here.
FabioRosado they add any entity into a list, so when I ask for stuff like: book an appointment for 18/10/19 at 3pm the entities list looks like this:
[
    {'entity': 'sys-number', 'location': [24, 26], 'value': '18', 'confidence': 1, 'metadata': {'numeric_value': 18}},
    {'entity': 'sys-date', 'location': [24, 32], 'value': '2019-10-18', 'confidence': 1, 'metadata': {'calendar_type': 'GREGORIAN', 'timezone': 'GMT'}},
    {'entity': 'sys-number', 'location': [27, 29], 'value': '10', 'confidence': 1, 'metadata': {'numeric_value': 10}},
    {'entity': 'sys-number', 'location': [30, 32], 'value': '19', 'confidence': 1, 'metadata': {'numeric_value': 19}},
    {'entity': 'sys-time', 'location': [33, 39], 'value': '15:00:00', 'confidence': 1, 'metadata': {'calendar_type': 'GREGORIAN', 'timezone': 'GMT'}}
]
FabioRosado I was not sure about using a double for loop haha
Jacob Tomlinson Bleugh
Jacob Tomlinson It's weird that there are multiple entries for sys-number
Jacob Tomlinson do they have a concept of naming entities?
matrixbot
@matrixbot
Jacob Tomlinson I would maybe be tempted to go through the duplicated entitiy names and rename them with an index on the end sys-number-0 sys-number-1 etc. Then pop them in the opsdroid entities list like that.
Jacob Tomlinson ```
FabioRosado Yeah watson has been interesting to work on to say the list, like how I couldn't connect to the api using aiohttp because I got a bad credentials error all the time but in curl worked fine lol
Jacob Tomlinson for entitiy in entities: await message.update_entity(entity['entity'], entity['value'], entity['confidence'])
matrixbot
@matrixbot

FabioRosado had to use enumerate and change the name of the entity to get the index on it like such:

for index, entity in enumerate(result["output"]['entities']):
    name = '{}-{}'.format(entity['entity'], index)
    await message.update_entity(name, entity['value'], result["output"]['intents'][0]['confidence'])

But this made me think that perhaps we could add yet another optional param (id) to Event.update_entities that way we could add the index of each one as the id and would avoid changing the name of the entity, what do you think?

Jacob Tomlinson Hmm interesting
Jacob Tomlinson So an entity object would look like
Jacob Tomlinson ```
{
Jacob Tomlinson (Grr why is Riot's shortcut keys different to slack)
Jacob Tomlinson Actually while typing thatr I'm not sure I follow

SolarDrew > (Grr why is Riot's shortcut keys <del>different to</del> better than slack)

Fixed that for you πŸ˜›

Cadair > <@jacobtomlinson:matrix.org> (Grr why is Riot's shortcut keys different to slack)

Because its not the same :p

Jacob Tomlinson No way. ctrl+enter makes way more sense that shift+enter for a new line
Jacob Tomlinson ctrl+enter is more common I think. At least it was in my muscle memory already.
Cadair What?!
Cadair Lunacy
Cadair Can't say it's in mine.
matrixbot
@matrixbot
SolarDrew yeah I've definitely made that mistake
FabioRosado haha I'm with cadair shift-enter seems logical :P works with telegram as well haha
FabioRosado I was going to explain by showing you what I mean but.... i don't think it makes sense either <.<
Jacob Tomlinson It's ctrl+enter in Google Sheets to add a new line within a cell. Maybe thats where I get it from.

FabioRosado because I changed it for:

{
    'sys-number-0': {'value': '18', 'confidence': 0.998621940612793},
    'sys-date-1': {'value': '2019-10-18', 'confidence': 0.998621940612793},
    'sys-number-2': {'value': '10', 'confidence': 0.998621940612793},
}

But I could just pass the index as "name" and then use the rest on the entity dict πŸ€”

Jacob Tomlinson Hmm not sure. There is only one sys-date so I woudl expect to get it at event.entities['sys-date'].
FabioRosado True but using your example the dict gets changed to the last entity πŸ€”
FabioRosado The Event.entities I mean
Jacob Tomlinson { 'sys-number-0': {'value': '18', 'confidence': 0.998621940612793}, 'sys-date': {'value': '2019-10-18', 'confidence': 0.998621940612793}, 'sys-number-1': {'value': '10', 'confidence': 0.998621940612793}, }
Jacob Tomlinson I would expect this
matrixbot
@matrixbot
FabioRosado Yeah that makes sense I’m going to write a helper function to deal with this
Jacob Tomlinson I just wrote a helper function to do this, and it's pretty gross. I've put it on Stack Overflow to see if there are better ways of doing it. Feel free to answer!
matrixbot
@matrixbot
FabioRosado okay great I'm going to have a think and play around with it as well
matrixbot
@matrixbot
Jacob Tomlinson The two answers so far are also gross πŸ˜†
matrixbot
@matrixbot

FabioRosado so I was thinking... the sys number seems a bit pointless thing to get anyway, this entity has the position where the number appeared on the string, metadata which seems redundant and the confidence (which can be ignored since i'm using the intents confidence).

The only thing we really care is the value from this. So instead of creating another entity, whi not combine them together and turn the value into a list containing all the values from sys-number? πŸ€”

This potentially could make it weird when getting two dates at the same time though

matrixbot
@matrixbot

FabioRosado in the end I made the decision to just turn the values into a list since if Watson sees two dates or times it will throw another entity into the mixture, that way you can get the whole list of dates/numbers or whatever else in a single command.

Am I wrong thinking this is better than to get a huge list of entities? Also you can always get the response obtained from the api using message.watson

matrixbot
@matrixbot
Jacob Tomlinson True. That all sournds reasonable.
matrixbot
@matrixbot
FabioRosado I'm finally working on the raw_parses, do I need to change anything other than the Event class?
Ive added raw_parses to init following the raw_event but when i use message.raw_parses['watson'] = result I get an exception TypeError: 'NoneType' object does not support item assignment
FabioRosado changing it to just a dict seems to work though not sure if this is what we need to do with the raw_parses or if we should do something else with it? πŸ€”
matrixbot
@matrixbot
Jacob Tomlinson Yeah we need to add raw_parses as a property to the base event class
matrixbot
@matrixbot
FabioRosado Working on this made me realise how bad I am with class and their magic, I've kind of failed with adding raw_parses as property (it was commited and then reverted) so let me know what do you think of the current PR πŸ€”