Skip to content
This repository was archived by the owner on Aug 9, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ datasets/
models/*.model

# Distribution / packaging
.vscode/
.Python
env/
bin/
Expand Down
2 changes: 1 addition & 1 deletion revscoring/features/wikitext/datasources/tokenized.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ def tokenized(text_datasource, name=None, tok_strategy="Latin"):
Constructs a :class:`revision.Datasource` that generates a list of tokens
"""
if name is None:
name = "{0}({1})".format("tokenized", text_datasource)
name = "{0}({1!r}, {2!r})".format("tokenized", text_datasource, tok_strategy)

if tok_strategy == "Latin":
return Datasource(
Expand Down
21 changes: 21 additions & 0 deletions tests/features/wikitext/tests/test_tokenized.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,24 @@ def test_cjk_tokens_features():
def test_tokens_diff_features():
assert (solve(revision.diff.token_delta_increase, cache={r_text: text, p_text: p_text_text}) == 0)
assert (solve(revision.diff.token_delta_decrease, cache={r_text: text, p_text: p_text_text}) == -4)


# related to https://github.com/wikimedia/editquality/pull/232
def test_cjk_tokenization_naming_01():
r_text = revision_oriented.revision.text
r_text_text = 'れた'

cache = {r_text: r_text_text}

assert (list(solve([revision.cjk_chars, revision.cjk.tokens], cache=cache)) ==
[2, 2.0])


def test_cjk_tokenization_naming_02():
r_text = revision_oriented.revision.text
r_text_text = 'れた'

cache = {r_text: r_text_text}

assert (list(solve([revision.cjk.tokens, revision.cjk_chars], cache=cache)) ==
[2.0, 2])