Closed JarbasAl closed 7 months ago
feat/infobox_intents
instead of hardcoded strings use .intent files for the duck duck go solver
initial support for infobox parsing for specific questions
infobox
internal .intent files can be added to allow parsing infoboxes returned by duckduckgo
.intent
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
DuckDuckGoSolver.register_from_file
xxx.intent
xxx
then that infobox value will be mapped to that intent file
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
intentsinternal
.intent
files can be added to allow parsing infoboxes returned by duckduckgofirst print the target infobox to inspect the returned results
under
DuckDuckGoSolver.register_from_file
add your newxxx.intent
file, wherexxx
needs to be a key present in the infobox, underscores are replaced with whitespacesthen that infobox value will be mapped to that intent file