<commit_before>import argparse

from defcon import Font

from .native import SFDFont
from .parser import SFDParser


def main():
    parser = argparse.ArgumentParser(
        prog="sfd2ufo", description="Convert FontForge fonts to UFO.")
    parser.add_argument("sfdfile", metavar="FILE", help="input font to process")
    parser.add_argument("ufofile", metavar="FILE", help="output font to write")
    parser.add_argument("--ignore-uvs", action="store_true",
        help="don’t error if the font uses Unicode variation selectors")

    args = parser.parse_args()

    font = Font()
    parser = SFDParser(args.sfdfile, font, args.ignore_uvs)
    parser.parse()

#   font = SFDFont(args.sfdfile, args.ignore_uvs)
    font.save(args.ufofile)

if __name__ == "__main__":
    main()<commit_msg>A command line option to use the native parser<commit_after>import argparse

from defcon import Font


def main():
    parser = argparse.ArgumentParser(
        prog="sfd2ufo", description="Convert FontForge fonts to UFO.")
    parser.add_argument("sfdfile", metavar="FILE", help="input font to process")
    parser.add_argument("ufofile", metavar="FILE", help="output font to write")
    parser.add_argument("--ignore-uvs", action="store_true",
        help="don’t error if the font uses Unicode variation selectors")
    parser.add_argument("--native", action="store_true",
        help="use FontForge’s native module instead of our own SFD parser")

    args = parser.parse_args()

    if args.native:
        from .native import SFDFont
        font = SFDFont(args.sfdfile, args.ignore_uvs)
    else:
        from .parser import SFDParser
        font = Font()
        parser = SFDParser(args.sfdfile, font, args.ignore_uvs)
        parser.parse()

    font.save(args.ufofile)

if __name__ == "__main__":
    main()
{'fraction_non_alphanumeric': 0.11816675869685257, 'fraction_numerical': 0.0011043622308117063, 'mean_word_length': 3.670103092783505, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6923480', 'n_tokens_mistral': 575, 'n_tokens_neox': 561, 'n_words': 150}