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.
 
 
 
 
 

132 lines
9.4 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="parse_cookies, urlstrip"/>\
  4. <% query, bot, all_langs, all_projects, page, result = main(environ) %>
  5. <% cookies = parse_cookies(environ) %>
  6. <h1>Copyvio Detector</h1>
  7. <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>
  8. <form action="${environ['PATH_INFO']}" method="get">
  9. <table>
  10. <tr>
  11. <td>Site:</td>
  12. <td>
  13. <tt>http://</tt>
  14. <select name="lang">
  15. <% selected_lang = query.orig_lang if query.orig_lang else bot.wiki.get_site().lang %>
  16. % for code, name in all_langs:
  17. % if code == selected_lang:
  18. <option value="${code}" selected="selected">${name}</option>
  19. % else:
  20. <option value="${code}">${name}</option>
  21. % endif
  22. % endfor
  23. </select>
  24. <tt>.</tt>
  25. <select name="project">
  26. <% selected_project = query.project if query.project else bot.wiki.get_site().project %>
  27. % for code, name in all_projects:
  28. % if code == selected_project:
  29. <option value="${code}" selected="selected">${name}</option>
  30. % else:
  31. <option value="${code}">${name}</option>
  32. % endif
  33. % endfor
  34. </select>
  35. <tt>.org</tt>
  36. </td>
  37. </tr>
  38. <tr>
  39. <td>Page title:</td>
  40. % if page:
  41. <td><input type="text" name="title" size="60" value="${page.title | h}" /></td>
  42. % elif query.title:
  43. <td><input type="text" name="title" size="60" value="${query.title | h}" /></td>
  44. % else:
  45. <td><input type="text" name="title" size="60" /></td>
  46. % endif
  47. </tr>
  48. <tr>
  49. <td>URL (optional):</td>
  50. % if query.url:
  51. <td><input type="text" name="url" size="120" value="${query.url | h}" /></td>
  52. % else:
  53. <td><input type="text" name="url" size="120" /></td>
  54. % endif
  55. </tr>
  56. % if query.nocache or (result and result.cached):
  57. <tr>
  58. <td>Bypass cache:</td>
  59. % if query.nocache:
  60. <td><input type="checkbox" name="nocache" value="1" checked="checked" /></td>
  61. % else:
  62. <td><input type="checkbox" name="nocache" value="1" /></td>
  63. % endif
  64. </tr>
  65. % endif
  66. <tr>
  67. <td><button type="submit">Submit</button></td>
  68. </tr>
  69. </table>
  70. </form>
  71. % if query.project and query.lang and query.title and not page:
  72. <div class="divider"></div>
  73. <div id="cv-result-yes">
  74. <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>
  75. </div>
  76. % elif query.project and query.lang and query.title and page and not result:
  77. <div class="divider"></div>
  78. <div id="cv-result-yes">
  79. <p>The given page doesn't seem to exist: <a href="${page.url}">${page.title | h}</a>.</p>
  80. </div>
  81. % elif page:
  82. <div class="divider"></div>
  83. <div id="cv-result-${'yes' if result.violation else 'no'}">
  84. % if result.violation:
  85. <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>
  86. % else:
  87. <h2 id="cv-result-header">No violations detected in <a href="${page.url()}">${page.title | h}</a>.</h2>
  88. % endif
  89. <ul id="cv-result-list">
  90. <li><b><tt>${round(result.confidence * 100, 1)}%</tt></b> confidence of a violation.</li>
  91. % if result.cached:
  92. <li>Results are <a id="cv-cached" href="#">cached
  93. <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>
  94. </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>
  95. % else:
  96. <li>Results generated in <tt>${round(result.tdiff, 3)}</tt> seconds using <tt>${result.queries}</tt> queries.</li>
  97. % endif
  98. % if "EarwigCVShowDetails" cookies and cookies["EarwigCVShowDetails"] == "True":
  99. <li><a id="cv-result-detail-link" href="#cv-result-detail" onclick="copyvio_toggle_details()">Hide details:</a></li>
  100. % else:
  101. <li><a id="cv-result-detail-link" href="#cv-result-detail" onclick="copyvio_toggle_details()">Show details:</a></li>
  102. % endif
  103. </ul>
  104. % if "EarwigCVShowDetails" cookies and cookies["EarwigCVShowDetails"] == "True":
  105. <div id="cv-result-detail" style="display: block;">
  106. % else:
  107. <div id="cv-result-detail" style="display: none;">
  108. % endif
  109. <ul id="cv-result-detail-list">
  110. <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>
  111. % if result.cached:
  112. % if result.queries:
  113. <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>
  114. % else:
  115. <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>
  116. % endif
  117. % endif
  118. % if result.queries:
  119. <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>
  120. % endif
  121. </ul>
  122. <table id="cv-chain-table">
  123. <tr>
  124. <td>Article: <div class="cv-chain-detail"><p>${highlight_delta(result.article_chain, result.delta_chain)}</p></div></td>
  125. <td>Source: <div class="cv-chain-detail"><p>${highlight_delta(result.source_chain, result.delta_chain)}</p></div></td>
  126. </tr>
  127. </table>
  128. </div>
  129. </div>
  130. % endif
  131. <%include file="/support/footer.mako" args="environ=environ"/>