foreach ($round_suggestions_w_occurrences[$round] as $word => $occur) { $encWord = encode_word($word); $context_array[$word] = recycle_window_link("show_good_word_suggestions_detail.php?projectid={$projectid}&word={$encWord}", _("Context"), "context"); } $round_suggestions_w_occurrences[$round]["[[TITLE]]"] = _("Times Suggested"); $round_suggestions_w_occurrences[$round]["[[STYLE]]"] = "text-align: right;"; $round_string = sprintf(_("Round %s"), $round); $page_num_string = sprintf(_("Number of pages with suggestions: %d"), $round_page_count[$round]); echo "<h2>{$round_string}</h2>"; echo "<p>{$page_num_string}</p>"; if (count($round_suggestions_w_freq[$round]) == 0) { echo "<p>" . _("None of the suggested words remain in the saved text for this round.") . "</p>"; continue; } $word_checkbox = build_checkbox_array($round_suggestions_w_freq[$round], $round); echo_checkbox_selects(count($round_suggestions_w_freq[$round]), $round); echo_checkbox_form_submit($submit_label); printTableFrequencies($initialFreq, $cutoffOptions, $round_suggestions_w_freq[$round], $instances--, array($round_suggestions_w_occurrences[$round], $context_array), $word_checkbox); echo_checkbox_form_submit($submit_label); } echo_checkbox_form_end(); //--------------------------------------------------------------------------- // supporting page functions function _get_word_list($projectid, $timeCutoff) { $messages = array(); // load the suggestions $suggestions = load_project_good_word_suggestions($projectid, $timeCutoff); if (!is_array($suggestions)) { $messages[] = sprintf(_("Unable to load suggestions: %s"), $suggestions); return array(array(), array(), array(), array(), array(), array(), $messages);
$initialFreq = getInitialCutoff($freqCutoff, $cutoffOptions, $bad_words_w_freq); // echo page support text, like JS and stylesheets echo_cutoff_script($cutoffOptions, $instances); echo_word_freq_style(); echo "<p>{$page_text}</p>"; echo "<p>{$page_text2}</p>"; echo_page_instruction_text("bad", $format); echo_download_text($projectid, $format); echo_any_warnings_errors($messages); echo_cutoff_text($initialFreq, $cutoffOptions); $context_array = build_context_array_links($bad_words_w_freq, $projectid); $context_array["[[TITLE]]"] = _("Show Context"); $word_checkbox = build_checkbox_array($bad_words_w_freq); $checkbox_form["projectid"] = $projectid; $checkbox_form["freqCutoff"] = $freqCutoff; echo_checkbox_selects(count($bad_words_w_freq)); echo_checkbox_form_start($checkbox_form); echo_checkbox_form_submit(_("Add selected words to Bad Words List")); printTableFrequencies($initialFreq, $cutoffOptions, $bad_words_w_freq, $instances--, $context_array, $word_checkbox); echo_checkbox_form_submit(_("Add selected words to Bad Words List")); echo_checkbox_form_end(); //--------------------------------------------------------------------------- // supporting page functions function _get_word_list($projectid) { $messages = array(); // get the latest project text of all pages up to last possible round $last_possible_round = get_Round_for_round_number(MAX_NUM_PAGE_EDITING_ROUNDS); $pages_res = page_info_query($projectid, $last_possible_round->id, 'LE'); $all_words_w_freq = get_distinct_words_in_text(get_page_texts($pages_res)); // load site word lists for project languages
$instances_changed_to["[[TITLE]]"] = _("Last changed to"); $instances_changed_to["[[CLASS]]"] = "mono"; $instances_changed["[[TITLE]]"] = _("# Changed"); $instances_changed["[[STYLE]]"] = "text-align: right;"; $instances_left["[[TITLE]]"] = _("# Left"); $instances_left["[[STYLE]]"] = "text-align: right;"; $instances_total["[[TITLE]]"] = _("# in OCR"); $instances_total["[[STYLE]]"] = "text-align: right;"; $context_array["[[TITLE]]"] = _("Show Context"); prep_numeric_keys_for_multisort($instances_changed_to); prep_numeric_keys_for_multisort($instances_changed); prep_numeric_keys_for_multisort($instances_left); prep_numeric_keys_for_multisort($instances_total); prep_numeric_keys_for_multisort($context_array); prep_numeric_keys_for_multisort($word_notes); echo_checkbox_selects(count($percent_changed)); $checkbox_form["projectid"] = $projectid; echo_checkbox_form_start($checkbox_form); echo_checkbox_form_submit(_("Add selected words to Bad Words List")); printTableFrequencies($initialFreq, $cutoffOptions, $percent_changed, $instances--, array($instances_changed_to, $instances_changed, $instances_left, $instances_total, $context_array, $word_notes), $word_checkbox); echo_checkbox_form_submit(_("Add selected words to Bad Words List")); echo_checkbox_form_end(); //--------------------------------------------------------------------------- // supporting page functions function _get_word_list($projectid) { global $aspell_temp_dir; $ocr_filename = "{$aspell_temp_dir}/{$projectid}_ocr.txt"; $latest_filename = "{$aspell_temp_dir}/{$projectid}_latest.txt"; $messages = array(); // get the OCR text
// if there are no suggestions since the cutoff, skip it if (!count($suggestions)) { continue; } // get the data list($suggestions_w_freq, $suggestions_w_occurrences, $messages) = _get_word_list($projectid, $suggestions); // if no words are returned (probably because something was // suggested but is no longer in the text) skip this project if (count($suggestions_w_freq) == 0) { continue; } $projectsNeedingAttention++; echo "<hr>"; echo "<h3>{$projectname}</h3>"; echo "<p><b>" . _("State:") . "</b> {$projectstate}</p>"; echo_checkbox_selects(count($suggestions_w_freq), $projectid); echo_any_warnings_errors($messages); $count = 0; foreach ($suggestions_w_freq as $word => $freq) { $encWord = encode_word($word); $context_array[$word] = "<a href='show_good_word_suggestions_detail.php?projectid={$projectid}&word={$encWord}&timeCutoff={$timeCutoffActual}' target='detailframe'>" . _("Context") . "</a>"; $word_checkbox[$word] = "<input type='checkbox' id='cb_{$projectid}_{$count}' name='cb_{$projectid}_{$count}' value='{$encWord}'>"; $count++; } $suggestions_w_occurrences['[[TITLE]]'] = _("Sugg"); $suggestions_w_occurrences['[[STYLE]]'] = "text-align: right;"; $context_array['[[TITLE]]'] = _("Show Context"); printTableFrequencies($initialFreq, $cutoffOptions, $suggestions_w_freq, $instances--, array($suggestions_w_occurrences, $context_array), $word_checkbox); echo "<p><input type='submit' value='{$submitLabel}'></p>"; } if ($projectsNeedingAttention == 0) {