A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

123 lines
8.7 KiB

  1. <%include file="/support/header.mako" args="environ=environ, 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. <% lang, orig_lang, project, title, url, bot, 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 = orig_lang if orig_lang 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 = project if project 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 title:
  42. <td><input type="text" name="title" size="60" value="${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 url:
  50. <td><input type="text" name="url" size="120" value="${url | h}" /></td>
  51. % else:
  52. <td><input type="text" name="url" size="120" /></td>
  53. % endif
  54. </tr>
  55. % if query.get("nocache") or (result and result.cached):
  56. <tr>
  57. <td>Bypass cache:</td>
  58. % if query.get("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 project and lang and title and not page:
  71. <div class="divider"></div>
  72. <div id="cv-result-yes">
  73. <p>The given site (project=<b><tt>${project}</tt></b>, language=<b><tt>${lang}</tt></b>) doesn't seem to exist. It may also be closed or private. <a href="//${lang}.${project}.org/">Confirm its URL.</a></p>
  74. </div>
  75. % elif project and lang and title and page and not result:
  76. <div class="divider"></div>
  77. <div id="cv-result-yes">
  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. <li><a id="cv-result-detail-link" href="#cv-result-detail" onclick="copyvio_toggle_details()">Show details:</a></li>
  98. </ul>
  99. <div id="cv-result-detail" style="display: none;">
  100. <ul id="cv-result-detail-list">
  101. <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>
  102. % if result.cached:
  103. % if result.queries:
  104. <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>
  105. % else:
  106. <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>
  107. % endif
  108. % endif
  109. % if result.queries:
  110. <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>
  111. % endif
  112. </ul>
  113. <table id="cv-chain-table">
  114. <tr>
  115. <td>Article: <div class="cv-chain-detail"><p>${highlight_delta(result.article_chain, result.delta_chain)}</p></div></td>
  116. <td>Source: <div class="cv-chain-detail"><p>${highlight_delta(result.source_chain, result.delta_chain)}</p></div></td>
  117. </tr>
  118. </table>
  119. </div>
  120. </div>
  121. % endif
  122. <%include file="/support/footer.mako" args="environ=environ"/>