A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

copyvios.mako 9.5 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <%include file="/support/header.mako" args="environ=environ, cookies=cookies, title='Copyvio Detector', add_css=('copyvios.css',), add_js=('copyvios.js',)"/>\
  2. <%namespace module="toolserver.copyvios" import="main, highlight_delta"/>\
  3. <%namespace module="toolserver.misc" import="urlstrip"/>\
  4. <% query, bot, all_langs, all_projects, page, result = main(environ) %>
  5. <h1>Copyvio Detector</h1>
  6. <p>This tool attempts to detect <a href="//en.wikipedia.org/wiki/WP:COPYVIO">copyright violations</a> in articles. Simply give the title of the page you want to check and hit Submit. The tool will then search for its content elsewhere on the web and display a report if a similar webpage is found. If you also provide a URL, it will not query any search engines and instead display a report comparing the article to that particular webpage, like the <a href="//toolserver.org/~dcoetzee/duplicationdetector/">Duplication Detector</a>. Check out the <a href="//en.wikipedia.org/wiki/User:EarwigBot/Copyvios/FAQ">FAQ</a> for more information and technical details.</p>
  7. <form action="${environ['PATH_INFO']}" method="get">
  8. <table>
  9. <tr>
  10. <td>Site:</td>
  11. <td>
  12. <tt>http://</tt>
  13. <select name="lang">
  14. <% selected_lang = query.orig_lang if query.orig_lang else cookies["EarwigDefaultLang"].value if "EarwigDefaultLang" in cookies else bot.wiki.get_site().lang %>
  15. % for code, name in all_langs:
  16. % if code == selected_lang:
  17. <option value="${code}" selected="selected">${name}</option>
  18. % else:
  19. <option value="${code}">${name}</option>
  20. % endif
  21. % endfor
  22. </select>
  23. <tt>.</tt>
  24. <select name="project">
  25. <% selected_project = query.project if query.project else cookies["EarwigDefaultProject"].value if "EarwigDefaultProject" in cookies else bot.wiki.get_site().project %>
  26. % for code, name in all_projects:
  27. % if code == selected_project:
  28. <option value="${code}" selected="selected">${name}</option>
  29. % else:
  30. <option value="${code}">${name}</option>
  31. % endif
  32. % endfor
  33. </select>
  34. <tt>.org</tt>
  35. </td>
  36. </tr>
  37. <tr>
  38. <td>Page title:</td>
  39. % if page:
  40. <td><input type="text" name="title" size="60" value="${page.title | h}" /></td>
  41. % elif query.title:
  42. <td><input type="text" name="title" size="60" value="${query.title | h}" /></td>
  43. % else:
  44. <td><input type="text" name="title" size="60" /></td>
  45. % endif
  46. </tr>
  47. <tr>
  48. <td>URL (optional):</td>
  49. % if query.url:
  50. <td><input type="text" name="url" size="120" value="${query.url | h}" /></td>
  51. % else:
  52. <td><input type="text" name="url" size="120" /></td>
  53. % endif
  54. </tr>
  55. % if query.nocache or (result and result.cached):
  56. <tr>
  57. <td>Bypass cache:</td>
  58. % if query.nocache:
  59. <td><input type="checkbox" name="nocache" value="1" checked="checked" /></td>
  60. % else:
  61. <td><input type="checkbox" name="nocache" value="1" /></td>
  62. % endif
  63. </tr>
  64. % endif
  65. <tr>
  66. <td><button type="submit">Submit</button></td>
  67. </tr>
  68. </table>
  69. </form>
  70. % if query.project and query.lang and query.title and not page:
  71. <div class="divider"></div>
  72. <div class="red-box">
  73. <p>The given site (project=<b><tt>${query.project}</tt></b>, language=<b><tt>${query.lang}</tt></b>) doesn't seem to exist. It may also be closed or private. <a href="//${query.lang}.${query.project}.org/">Confirm its URL.</a></p>
  74. </div>
  75. % elif query.project and query.lang and query.title and page and not result:
  76. <div class="divider"></div>
  77. <div class="red-box">
  78. <p>The given page doesn't seem to exist: <a href="${page.url}">${page.title | h}</a>.</p>
  79. </div>
  80. % elif page:
  81. <div class="divider"></div>
  82. <div id="cv-result-${'yes' if result.violation else 'no'}">
  83. % if result.violation:
  84. <h2 id="cv-result-header"><a href="${page.url}">${page.title | h}</a> is a suspected violation of <a href="${result.url | h}">${result.url | urlstrip}</a>.</h2>
  85. % else:
  86. <h2 id="cv-result-header">No violations detected in <a href="${page.url()}">${page.title | h}</a>.</h2>
  87. % endif
  88. <ul id="cv-result-list">
  89. <li><b><tt>${round(result.confidence * 100, 1)}%</tt></b> confidence of a violation.</li>
  90. % if result.cached:
  91. <li>Results are <a id="cv-cached" href="#">cached
  92. <span>To save time (and money), this tool will retain the results of checks for up to 72 hours. This includes the URL of the "violated" source, but neither its content nor the content of the article. Future checks on the same page (assuming it remains unchanged) will not involve additional search queries, but a fresh comparison against the source URL will be made. If the page is modified, a new check will be run.</span>
  93. </a> from ${result.cache_time} (${result.cache_age} ago). <a href="${environ['REQUEST_URI'].decode("utf8") | h}&amp;nocache=1">Bypass the cache.</a></li>
  94. % else:
  95. <li>Results generated in <tt>${round(result.tdiff, 3)}</tt> seconds using <tt>${result.queries}</tt> queries.</li>
  96. % endif
  97. % if "EarwigCVShowDetails" in cookies and cookies["EarwigCVShowDetails"].value == "True":
  98. <li><a id="cv-result-detail-link" href="#cv-result-detail" onclick="copyvio_toggle_details()">Hide details:</a></li>
  99. % else:
  100. <li><a id="cv-result-detail-link" href="#cv-result-detail" onclick="copyvio_toggle_details()">Show details:</a></li>
  101. % endif
  102. </ul>
  103. % if "EarwigCVShowDetails" in cookies and cookies["EarwigCVShowDetails"].value == "True":
  104. <div id="cv-result-detail" style="display: block;">
  105. % else:
  106. <div id="cv-result-detail" style="display: none;">
  107. % endif
  108. <ul id="cv-result-detail-list">
  109. <li>Trigrams: <i>Article:</i> <tt>${result.article_chain.size()}</tt> / <i>Source:</i> <tt>${result.source_chain.size()}</tt> / <i>Delta:</i> <tt>${result.delta_chain.size()}</tt></li>
  110. % if result.cached:
  111. % if result.queries:
  112. <li>Retrieved from cache in <tt>${round(result.tdiff, 3)}</tt> seconds (originally generated in <tt>${round(result.original_tdiff, 3)}</tt>s using <tt>${result.queries}</tt> queries; <tt>${round(result.original_tdiff - result.tdiff, 3)}</tt>s saved).</li>
  113. % else:
  114. <li>Retrieved from cache in <tt>${round(result.tdiff, 3)}</tt> seconds (originally generated in <tt>${round(result.original_tdiff, 3)}</tt>s; <tt>${round(result.original_tdiff - result.tdiff, 3)}</tt>s saved).</li>
  115. % endif
  116. % endif
  117. % if result.queries:
  118. <li><i>Fun fact:</i> The Wikimedia Foundation paid Yahoo! Inc. <a href="http://info.yahoo.com/legal/us/yahoo/search/bosspricing/details.html">$${result.queries * 0.0008} USD</a> for these results.</li>
  119. % endif
  120. </ul>
  121. <table id="cv-chain-table">
  122. <tr>
  123. <td>Article: <div class="cv-chain-detail"><p>${highlight_delta(result.article_chain, result.delta_chain)}</p></div></td>
  124. <td>Source: <div class="cv-chain-detail"><p>${highlight_delta(result.source_chain, result.delta_chain)}</p></div></td>
  125. </tr>
  126. </table>
  127. </div>
  128. </div>
  129. % endif
  130. <%include file="/support/footer.mako" args="environ=environ, cookies=cookies"/>