How to use revscoring - 10 common examples

To help you get started, we’ve selected a few revscoring examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wikimedia / revscoring / tests / languages / test_polish.py View on Github external
def test_dictionary():
    cache = {revision_oriented.revision.text:
             'obrębie znamion barwnikowych  worngly.'}
    assert (solve(polish.dictionary.revision.datasources.dict_words, cache=cache) ==
            ["obrębie", "znamion", "barwnikowych"])
    assert (solve(polish.dictionary.revision.datasources.non_dict_words,
                  cache=cache) ==
            ["worngly"])

    assert polish.dictionary == pickle.loads(pickle.dumps(polish.dictionary))
github wikimedia / revscoring / tests / languages / test_greek.py View on Github external
def test_stopwords():
    cache = {r_text: 'Αυτό είναι γραμμένο λθος. '}
    assert (solve(greek.stopwords.revision.datasources.stopwords, cache=cache) ==
            ["Αυτό", "είναι"])
    assert (solve(greek.stopwords.revision.datasources.non_stopwords,
                  cache=cache) ==
            ["γραμμένο", "λθος"])

    assert greek.stopwords == pickle.loads(pickle.dumps(greek.stopwords))
github wikimedia / revscoring / tests / languages / test_latvian.py View on Github external
def test_dictionary():
    cache = {revision_oriented.revision.text:
             'novirze no ilggadējiem vidējiem  worngly.'}
    assert (solve(latvian.dictionary.revision.datasources.dict_words, cache=cache) ==
            ["novirze", "no", "ilggadējiem", "vidējiem"])
    assert (solve(latvian.dictionary.revision.datasources.non_dict_words,
                  cache=cache) ==
            ["worngly"])

    assert latvian.dictionary == pickle.loads(pickle.dumps(latvian.dictionary))
github wikimedia / revscoring / tests / languages / test_english.py View on Github external
def test_dictionary():
    cache = {r_text: 'This color colour is spelled worngly. '}
    assert (solve(english.dictionary.revision.datasources.dict_words, cache=cache) ==
            ["This", "color", "colour", "is", "spelled"])
    assert (solve(english.dictionary.revision.datasources.non_dict_words,
                  cache=cache) ==
            ["worngly"])

    assert english.dictionary == pickle.loads(pickle.dumps(english.dictionary))
github wikimedia / revscoring / tests / languages / test_greek.py View on Github external
def test_dictionary():
    cache = {r_text: 'Αυτό είναι γραμμένο λθος. '}
    assert (solve(greek.dictionary.revision.datasources.dict_words, cache=cache) ==
            ["Αυτό", "είναι", "γραμμένο"])
    assert (solve(greek.dictionary.revision.datasources.non_dict_words,
                  cache=cache) ==
            ["λθος"])

    assert greek.dictionary == pickle.loads(pickle.dumps(greek.dictionary))
github wikimedia / revscoring / tests / languages / test_french.py View on Github external
def test_stopwords():
    cache = {r_text: "Est un projet principe du worngly. "}
    assert (solve(french.stopwords.revision.datasources.stopwords, cache=cache) ==
            ["Est", "un", "du"])
    assert (solve(french.stopwords.revision.datasources.non_stopwords,
                  cache=cache) ==
            ["projet", "principe", "worngly"])

    assert french.stopwords == pickle.loads(pickle.dumps(french.stopwords))
github wikimedia / revscoring / tests / languages / test_estonian.py View on Github external
def test_dictionary():
    cache = {r_text: "Tal olid nooremad, vennad worngly. "}
    assert solve(estonian.dictionary.revision.datasources.dict_words,
                 cache=cache) == ["Tal", "olid", "nooremad", "vennad"]
    assert solve(estonian.dictionary.revision.datasources.non_dict_words,
                 cache=cache) == ["worngly"]

    assert estonian.dictionary == pickle.loads(
        pickle.dumps(estonian.dictionary))
github wikimedia / revscoring / tests / languages / test_icelandic.py View on Github external
def test_dictionary():
    cache = {r_text: 'belgíska konungsríkisins auk worngly. '}
    assert (solve(icelandic.dictionary.revision.datasources.dict_words,
                  cache=cache) ==
            ["belgíska", "konungsríkisins", "auk"])
    assert (solve(icelandic.dictionary.revision.datasources.non_dict_words,
                  cache=cache) ==
            ["worngly"])

    assert icelandic.dictionary == pickle.loads(
        pickle.dumps(icelandic.dictionary))
github wikimedia / revscoring / tests / languages / test_hungarian.py View on Github external
def test_stopwords():
    cache = {
        revision_oriented.revision.text:
            'játszótérnek még helyett park jól'
    }
    assert (solve(hungarian.stopwords.revision.datasources.stopwords,
            cache=cache) == ['még', 'jól'])
    assert (solve(hungarian.stopwords.revision.datasources.non_stopwords,
                  cache=cache) ==
            ['játszótérnek', 'helyett', 'park'])

    assert hungarian.stopwords == pickle.loads(
        pickle.dumps(hungarian.stopwords))
github wikimedia / revscoring / tests / features / test_functions.py View on Github external
def test_trim():

    d1 = Datasource("derp1")
    f1 = Feature("foobar1", returns=int)
    f2 = Feature("foobar2", returns=int, depends_on=[d1])
    c = Constant(value=5)
    fv = FeatureVector("foobar3", returns=int, depends_on=[c])

    assert list(trim(f1)) == [f1]
    assert list(trim([f1, f2, fv])) == [f1, f2, fv]
    assert list(trim([f1, f2, f1 + f2, fv])) == [f1, f2, fv]
    assert (list(trim(log(max(f1 - f2, 1)))) ==
            [f1, f2])