//- 💫 DOCS > MODELS > COMPARISON

include ../_includes/_mixins

p
    |  This experimental tool helps you compare spaCy's statistical models
    |  by features, accuracy and speed. This can be especially useful to get an
    |  idea of the trade-offs between larger and smaller models of the same
    |  type. For example, #[code lg] models tend to be more accurate than
    |  the corresponding #[code sm] versions – but they're often significantly
    |  larger in file size and memory usage.

- TPL = "compare"

+grid.o-box
    for i in [1, 2]
        +grid-col("half", "no-gutter")
            label.u-heading.u-text-label.u-text-center.u-color-theme(for="model#{i}") Model #{i}
            .o-field.o-grid.o-grid--vcenter.u-padding-small
                select.o-field__select.u-text-small(id="model#{i}" data-tpl=TPL data-tpl-key="model#{i}")
                    option(selected="" disabled="" value="") Select model...
                    for models, _ in MODELS
                        for model in models
                            option(value=model)=model

div(data-tpl=TPL data-tpl-key="error")
    +infobox
        |  Unable to load model details and accuracy figures from GitHub to
        |  compare the models. For details of the individual models, see the
        |  overview of the
        |  #[+a(gh("spacy-models") + "/releases") latest model releases].

div(data-tpl=TPL data-tpl-key="result" hidden="")
    +chart("compare_accuracy", 350)

    +aside-code("Download", "text")
        for i in [1, 2]
            span(data-tpl=TPL data-tpl-key="download#{i}")

    +table.o-block-small(data-tpl=TPL data-tpl-key="table")
        +row("head")
            +head-cell
            for i in [1, 2]
                +head-cell(style="width: 40%")
                    a(data-tpl=TPL data-tpl-key="link#{i}")
                        code(data-tpl=TPL data-tpl-key="table-head#{i}" style="text-transform: initial; font-weight: normal")

        for label, id in {lang: "Language", type: "Type", genre: "Genre"}
            +row
                +cell #[+label=label]
                for i in [1, 2]
                    +cell(data-tpl=TPL data-tpl-key="#{id}#{i}") n/a

        for label in ["Version", "Size", "Pipeline", "Vectors", "Sources", "Author", "License"]
            - var field = label.toLowerCase()
            if field == "vectors"
                - field = "vecs"
            +row
                +cell.u-nowrap
                    +label=label
                        if MODEL_META[field]
                            |  #[+help(MODEL_META[field]).u-color-subtle]
                for i in [1, 2]
                    +cell
                        span(data-tpl=TPL data-tpl-key=field + i) #[em n/a]

        +row
            +cell #[+label Description]
            for i in [1, 2]
                +cell.u-text-tiny(data-tpl=TPL data-tpl-key="desc#{i}") n/a

        for benchmark, _ in MODEL_BENCHMARKS
            - var counter = 0
            for label, field in benchmark
                +row((counter == 0) ? "divider" : null)
                    +cell.u-nowrap
                        +label=label
                            if MODEL_META[field]
                                |  #[+help(MODEL_META[field]).u-color-subtle]
                    for i in [1, 2]
                        +cell
                            span(data-tpl=TPL data-tpl-key=field + i) n/a
                - counter++