talk-generator icon indicating copy to clipboard operation
talk-generator copied to clipboard

The conceptnet bug

Open korymath opened this issue 4 years ago • 3 comments

Traceback (most recent call last):
  File "/Users/korymath/Documents/code/talk-generator/venv/bin/talkgenerator", line 33, in <module>
    sys.exit(load_entry_point('talkgenerator', 'console_scripts', 'talkgenerator')())
  File "/Users/korymath/Documents/code/talk-generator/talkgenerator/run.py", line 13, in main_cli
    main(args)
  File "/Users/korymath/Documents/code/talk-generator/talkgenerator/run.py", line 6, in main
    presentations, slide_deck, output_file = generator.generate_presentation_using_cli_arguments(
  File "/Users/korymath/Documents/code/talk-generator/talkgenerator/generator.py", line 34, in generate_presentation_using_cli_arguments
    return generate_presentation(
  File "/Users/korymath/Documents/code/talk-generator/talkgenerator/generator.py", line 99, in generate_presentation
    presentation, slide_deck = presentation_schema.generate_presentation(
  File "/Users/korymath/Documents/code/talk-generator/talkgenerator/schema/presentation_schema.py", line 92, in generate_presentation
    self._generate_slide_deck_parallel(
  File "/Users/korymath/Documents/code/talk-generator/talkgenerator/schema/presentation_schema.py", line 141, in _generate_slide_deck_parallel
    all_slide_results = pool.map(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/pool.py", line 364, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/pool.py", line 771, in get
    raise self._value
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "/Users/korymath/Documents/code/talk-generator/talkgenerator/schema/presentation_schema.py", line 398, in __call__
    return self.presentation_schema.generate_slide(
  File "/Users/korymath/Documents/code/talk-generator/talkgenerator/schema/presentation_schema.py", line 278, in generate_slide
    slide_result = generator.generate(presentation_context, used_elements)
  File "/Users/korymath/Documents/code/talk-generator/talkgenerator/datastructures/slide_generator_data.py", line 74, in generate
    slide_results = self._generator.generate_slide(
  File "/Users/korymath/Documents/code/talk-generator/talkgenerator/slide/slide_generator_types.py", line 34, in generate_slide
    generated = self._slide_content_generator(presentation_context)
  File "/Users/korymath/Documents/code/talk-generator/talkgenerator/sources/chart.py", line 280, in generate_location_pie
    result = generate_location_data(presentation_context)
  File "/Users/korymath/Documents/code/talk-generator/talkgenerator/sources/chart.py", line 253, in generate_location_data
    return _generate_conceptnet_data(
  File "/Users/korymath/Documents/code/talk-generator/talkgenerator/sources/chart.py", line 231, in _generate_conceptnet_data
    conceptnet_relations = conceptnet_function(seed)
  File "/Users/korymath/Documents/code/talk-generator/talkgenerator/sources/conceptnet.py", line 162, in get_weighted_related_locations
    edges = _get_edges(word, _LOCATION_ARGUMENTS)
  File "/Users/korymath/Documents/code/talk-generator/talkgenerator/sources/conceptnet.py", line 109, in _get_edges
    return data["edges"]
KeyError: 'edges'

korymath avatar Nov 24 '21 02:11 korymath

Well covered in our tests/ suite:

FAILED tests/test_conceptnet.py::ConceptNetTest::test_conceptnet_multiword - KeyError: 'edges'
FAILED tests/test_conceptnet.py::ConceptNetTest::test_conceptnet_only_english - KeyError: 'edges'
FAILED tests/test_conceptnet.py::ConceptNetTest::test_conceptnet_standard - KeyError: 'edges'
FAILED tests/test_specific_text_generators.py::SpecificTextGeneratorTest::test_talk_title_generator - KeyError: 'edges'
FAILED tests/test_talkgenerator.py::TestTalkGenerator::test_all_slide_generators - KeyError: 'edges'

From chat:

Maybe we can use some better backup generators in case conceptnet keeps erroring, instead of now just using the default topic (e.g. using wikidata links, or wordnet relations or something like that)

korymath avatar Nov 24 '21 02:11 korymath

https://api.conceptnet.io/c/en/lap?limit=10 This is the issue, the page itself is giving a 500 Here is their live issue: https://github.com/commonsense/conceptnet5/issues/313

korymath avatar Nov 24 '21 03:11 korymath

I followed these instructions, and had a conceptnet up in 5 minutes. https://github.com/commonsense/conceptnet5/wiki/Running-your-own-copy

Then I ran the simple test here: https://github.com/commonsense/conceptnet5/wiki/API

import requests

obj = requests.get('http://18.215.180.62/c/en/example').json()

http://18.215.180.62/c/en/hotdogs

korymath avatar Nov 24 '21 03:11 korymath