Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preprocess thousand separator #1094

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions orangecontrib/text/widgets/owcorpusviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ def refresh_search(self):

def on_done(self, res: int):
"""When matches count is done show the result in the label"""
self.n_matches = res if res is not None else "n/a"
self.n_matches = f"{int(res):,}" if res is not None else "n/a"

def on_exception(self, ex):
raise ex
Expand All @@ -613,8 +613,8 @@ def update_info(self):
if self.corpus is not None:
has_tokens = self.corpus.has_tokens()
self.n_matching = f"{self.doc_list.model().rowCount()}/{len(self.corpus)}"
self.n_tokens = self.corpus.count_tokens() if has_tokens else "n/a"
self.n_types = self.corpus.count_unique_tokens() if has_tokens else "n/a"
self.n_tokens = f"{int(self.corpus.count_tokens()):,}" if has_tokens else "n/a"
self.n_types = f"{int(self.corpus.count_unique_tokens()):,}" if has_tokens else "n/a"
else:
self.n_matching = "n/a"
self.n_matches = "n/a"
Expand Down
2 changes: 1 addition & 1 deletion orangecontrib/text/widgets/owpreprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@ def update_preview(self, data):
self.preview = ", ".join(tokens[:5])
n_tokens = data.count_tokens() if data.has_tokens() else ''
n_types = data.count_unique_tokens() if data.has_tokens() else ''
self.output_info = f"Tokens: {n_tokens}\nTypes: {n_types}"
self.output_info = f"Tokens: {n_tokens:,}\nTypes: {n_types:,}"
except StopIteration:
self.preview = ""
self.output_info = ""
Expand Down
Loading