Commit 9b734a57 authored by Simon Will's avatar Simon Will
Browse files

Fix bugs in create_corpus.py

parent 70c924a2
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ def main(corpus_specification, top_in_dir, top_out_dir):
    os.makedirs(top_out_dir, exist_ok=True)
    for split in ['train', 'dev', 'test']:
        print('Split {}'.format(split))
        split_file = os.path.join(top_out_dir, split)
        split_file = os.path.join(top_out_dir, '{}.json'.format(split))
        instances = []
        for meter_name, paths in spec[split].items():
            print('Processing meter {}'.format(meter_name))
@@ -36,8 +36,8 @@ def main(corpus_specification, top_in_dir, top_out_dir):
                            verses.append(verse)
                for verse in verses:
                    print('    Processing verse {}'.format(verse.text))
                    matches = meter.match_reading(verse.readings[0])
                    instances.append([meter_name, verse, matches])
                    matches = bool(meter.match_reading(verse.readings[0]))
                    instances.append([meter_name, verse.to_json(), matches])
        with open(split_file, 'w') as f:
            json.dump(instances, f)