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

feat/infobox_intents #24

Merged
merged 7 commits into from
Apr 25, 2024
Merged

feat/infobox_intents #24

merged 7 commits into from
Apr 25, 2024

Conversation

JarbasAl
Copy link
Member

@JarbasAl JarbasAl commented Apr 21, 2024

feat/infobox_intents

instead of hardcoded strings use .intent files for the duck duck go solver

initial support for infobox parsing for specific questions

Adding more infobox intents

internal .intent files can be added to allow parsing infoboxes returned by duckduckgo

first print the target infobox to inspect the returned results

from skill_ovos_ddg import DuckDuckGoSolver
d = DuckDuckGoSolver()
info = d.get_infobox("Stephen Hawking")[0]
print(info)
# {'age at death': '76 years',
#  'born': {'after': 0,
#           'before': 0,
#           'calendarmodel': 'http://www.wikidata.org/entity/Q1985727',
#           'precision': 11,
#           'time': '+1942-01-08T00:00:00Z',
#           'timezone': 0},
#  'children': '3, including Lucy',
#  'died': {'after': 0,
#           'before': 0,
#           'calendarmodel': 'http://www.wikidata.org/entity/Q1985727',
#           'precision': 11,
#           'time': '+2018-03-14T00:00:00Z',
#           'timezone': 0},
#  'education': 'University College, Oxford (BA), Trinity Hall, Cambridge (PhD)',
#  'facebook profile': 'stephenhawking',
#  'fields': 'General relativity, quantum gravity',
#  'imdb id': 'nm0370071',
#  'instance of': {'entity-type': 'item', 'id': 'Q5', 'numeric-id': 5},
#  'institutions': 'University of Cambridge, California Institute of Technology, '
#                  'Perimeter Institute for Theoretical Physics',
#  'official website': 'https://hawking.org.uk',
#  'other academic advisors': 'Robert Berman',
#  'resting place': 'Westminster Abbey',
#  'rotten tomatoes id': 'celebrity/stephen_hawking',
#  'thesis': 'Properties of Expanding Universes (1966)',
#  'wikidata aliases': ['Stephen Hawking',
#                       'Hawking',
#                       'Stephen William Hawking',
#                       'S. W. Hawking',
#                       'stephen'],
#  'wikidata description': 'British theoretical physicist, cosmologist and '
#                          'author (1942–2018)',
#  'wikidata id': 'Q17714',
#  'wikidata label': 'Stephen Hawking',
#  'youtube channel': 'UCPyd4mR0p8zHd8Z0HvHc0fw'}

under DuckDuckGoSolver.register_from_file add your new xxx.intent file, where xxx needs to be a key present in the infobox, underscores are replaced with whitespaces

then that infobox value will be mapped to that intent file

JarbasAl added 2 commits April 9, 2024 01:24
drop the old "ui" folder to avoid warning logs
instead of hardcoded strings use .intent files for the duck duck go solver

initial support for infobox parsing for specific questions
@JarbasAl JarbasAl added the enhancement New feature or request label Apr 21, 2024
@JarbasAl JarbasAl requested review from a team, emphasize and mikejgray April 21, 2024 04:25
instead of hardcoded strings use .intent files for the duck duck go solver

initial support for infobox parsing for specific questions
Copy link
Member

@goldyfruit goldyfruit left a comment

Choose a reason for hiding this comment

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

Works for me!

@JarbasAl JarbasAl merged commit b07db29 into dev Apr 25, 2024
1 of 9 checks passed
@JarbasAl JarbasAl deleted the feat/infobox_intents branch April 25, 2024 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants