Example #1
0
def test_preprocessor(locale, client_id, sentence, expected):
    preprocessor = getattr(preprocessors, locale.replace('-', ''))
    is_valid, sentence = preprocessors.common(sentence)
    if not is_valid:
        pytest.skip(
            'not supported right now (see https://github.com/mozilla/CorporaCreator/pull/87#issuecomment-466296310 for more info)'
        )
    assert expected == preprocessor(client_id, sentence)
Example #2
0
def common_wrapper(sentence, up_votes, down_votes):
    is_valid, sentence = common(sentence)
    if False == is_valid:
        up_votes = 0
        down_votes = 2
    return pd.Series([sentence, up_votes, down_votes])
Example #3
0
def common_wrapper(sentence, up_votes, down_votes):
    sentence = common(sentence)
    if None == sentence or not sentence.strip():
        up_votes = 0
        down_votes = 2
    return pd.Series([sentence, up_votes, down_votes])