<commit_before><!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>The Search For Inner[Text] Peace</title>
  <link rel="stylesheet" href="lib/bootstrap/css/bootstrap.min.css" />
  <link rel="stylesheet" href="css/app.css"/>
</head>
<body>
  <script src="lib/jquery/jquery-1.8.3.min.js"></script>
  <script src="lib/bootstrap/js/bootstrap.min.js"></script>
  <script src="lib/angular/angular.js"></script>
  <!-- In production use:
  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script>
  -->

  <!-- Allows for coffeescript compiling on the fly.                                    -->
  <!-- Not recommended for production use. See http://coffeescript.org/#scripts.        -->
  <script src="lib/coffeescript/coffee-script.js"></script>
  <script src="lib/dmp/diff_match_patch.js"></script>
  <script src="lib/dmp/dmp.coffee" type="text/coffeescript"></script>
  <script src="lib/dmp/dmp_angular.coffee" type="text/coffeescript"></script>
  <script src="lib/domsearcher/domsearcher.coffee" type="text/coffeescript"></script>
  <script src="lib/domsearcher/domsearcher_angular.coffee" type="text/coffeescript"></script>

  <script src="coffee/services.coffee" type="text/coffeescript"></script>
  <script src="coffee/controllers.coffee" type="text/coffeescript"></script>
  <script src="coffee/filters.coffee" type="text/coffeescript"></script>
  <script src="coffee/directives.coffee" type="text/coffeescript"></script>
  <script src="coffee/app.coffee" type="text/coffeescript"></script>

  <h1>The Search for Inner[Text] Peace</h1>

  <div ng-controller="SearchController" ng-cloak>

    <div ng-show="!compatibility.ok">{{compatibility.message}}</div>

    <div id="demo-app" ng-show="compatibility.ok">
      <form class="form-horizontal">
	<div class="control-group">
	  <label class="control-label">HTML input source</label>
	  <div class="controls">
	    <select ng-model="sourceMode">
	      <option value="local">Input HTML source manually</option>
	      <option value="page">Use this page</option>
	      <option value="sample1">Use sample article 1</option>
	    </select>
	  </div>
	</div>
      </form>
      
      <div id="source-spec" ng-show="sourceModeNeedsInput" ng-switch on="sourceMode">
	<div ng-switch-when="local"> 
	  <h3>Test html source:</h3>
	  <textarea ng-model="localSource" class="input-block-level"></textArea>
	  <button class="btn btn-primary" type="button" ng-click="render()">Render it!</button>
	</div>

	<div ng-switch-when="page">
	  <p>OK, so you want to test out the stuff on this very page.</p>
	  <p>Feel free to do so, but please note that the content below this point will not be accessible.</p>
	</div>
      </div>

      <div id="search-input" ng-show="canSearch">
	<h3>Search</h3>
	<form name="searchForm" ng-submit="search()" class="form-horizontal">
	  <input type="text" name="searchTerm" ng-model="searchTerm" required="true" class="input-xxlarge search-query" placeholder="Enter search term"/>
	  <button type="submit" ng-disabled="!searchForm.$valid" class="btn btn-primary">
	    <i class="icon-search"></i>
	    Search
	  </button>
	  <button type="button" ng-click="advancedSearch = !advancedSearch" class="btn">
	    <i class="icon-wrench"></i>
	    Settings
	  </button>
	  <div ng-show="advancedSearch">
	    <br />
	    <div class="control-group">
	      <label class="control-label">DOM element to scan</label>
	      <div class="controls">
		<select ng-model="selectedPath" ng-options="path.path as path.path + ' (' + path.length +' chars)' for path in paths"></select>
	      </div>
	    </div>
	    <div class="control-group">
	      <label class="control-label">Search position</label>
	      <div class="controls">
		<input type="number" ng-model="searchPos" min="0" class="input-mini"/>
	      </div>
	    </div>
	    <div class="control-group">
	      <label class="control-label">Match distance</label>
	      <div class="controls">
		<input type="number" ng-model="matchDistance" min="0" class="input-mini"/>
		<a id="help1" href="#" class="btn btn-info btn-mini" rel="popover" data-content="{{distanceExplanation}}" data-original-title="Match Distance property" data-trigger="hover">?</a>
	      </div>
	    </div>
	    <div class="control-group">
	      <label class="control-label">Match threshold</label>
	      <div class="controls">
		<input type="number" ng-model="matchThreshold" min="0" max="100" class="input-mini"/>
		<a id="help2" href="#" class="btn btn-info btn-mini" rel="popover" data-content="{{thresholdExplanation}}" data-original-title="Match Threshold property" data-trigger="hover">?</a>
	      </div>
	    </div>
	    <div class="control-group">
	      <label class="control-label">What to do with result?</label>
	      <div class="controls">
		<select ng-model="foundAction" class="input-xxlarge">
		  <option value="nothing">Do nothing</option>
		  <option value="select">Select it (by creating a Range, and add it to Selection)</option>
		  <option value="hilite">Highlight it (using SPANs)</option>
		</select>
	      </div>
	    </div>
	  </div>
	</form>

	<div ng-show="searchResults.length>0 || detailedResults.length>0">
	  <h3>Search results</h3>
	  <div>
	    <strong>
	      {{searchResults}}
	    </strong>
	  </div>
	  <button class="btn btn-mini" ng-click="showDetailedResults = true" ng-show="!showDetailedResults">
	    <i class="icon-zoom-in"></i>
	    Show details...
	  </button>
	  <div id="search-matching-elements" ng-show="showDetailedResults && detailedResults.length>0">
	    <button class="btn btn-mini" ng-click="showDetailedResults = false">
	      <i class="icon-zoom-out"></i>
	      Hide details
	    </button>
	    <p>Involved elements:</p>
	    <table border="1">
	      <thead>
		<tr>
		  <th rowspan="2">Path</th>
		  <th rowSpan="2">Full</th>
		  <th colSpan="4">Displayed text</th>
		  <th colSpan="4">Actual HTML source text</th>
		</tr>
		<tr>
		  <th>Text</th>
		  <th>Wanted</th>
		  <th>From</th>
		  <th>Till</th>
		  <th>Text</th>
		  <th>From</th>
		  <th>Till</th>
		  <th>Yields</th>
		</tr>
	      </thead>
	      <tbody>
		<tr ng-repeat="match in detailedResults">
		  <td>{{match.element.path}}</td>
		  <td>{{match.full | booleanCheckmark}}</td>
		  <td>'{{match.element.content}}'</td>
		  <td>'{{match.wanted}}'</td>
		  <td>{{match.start}}</td>
		  <td>{{match.end}}</td>
		  <td ng-bind-html-unsafe="match.element.node.data | quoteHTML"></td>
		  <td>{{match.startCorrected}}</td>
		  <td>{{match.endCorrected}}</td>
		  <td ng-bind-html-unsafe="match.yields | quoteHTML"></td>
		</tr>
	      </tbody>
	    </table>
	  </div>
	</div>
      </div>

      <div ng-show="renderSource" id="sandbox">
	<h3>DOM rendered as:</h3>
	<div id="rendered-dom" ng-bind-html-unsafe="renderSource"></div>
      </div>
    </div>
  </div>
<hr />
Back to <a href="https://github.com/csillag/inner-peace"><i class="icon-home"></i>inner-peace</a>
</body>
</html>
<commit_msg>Added a few required flags to the form<commit_after><!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>The Search For Inner[Text] Peace</title>
  <link rel="stylesheet" href="lib/bootstrap/css/bootstrap.min.css" />
  <link rel="stylesheet" href="css/app.css"/>
</head>
<body>
  <script src="lib/jquery/jquery-1.8.3.min.js"></script>
  <script src="lib/bootstrap/js/bootstrap.min.js"></script>
  <script src="lib/angular/angular.js"></script>
  <!-- In production use:
  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script>
  -->

  <!-- Allows for coffeescript compiling on the fly.                                    -->
  <!-- Not recommended for production use. See http://coffeescript.org/#scripts.        -->
  <script src="lib/coffeescript/coffee-script.js"></script>
  <script src="lib/dmp/diff_match_patch.js"></script>
  <script src="lib/dmp/dmp.coffee" type="text/coffeescript"></script>
  <script src="lib/dmp/dmp_angular.coffee" type="text/coffeescript"></script>
  <script src="lib/domsearcher/domsearcher.coffee" type="text/coffeescript"></script>
  <script src="lib/domsearcher/domsearcher_angular.coffee" type="text/coffeescript"></script>

  <script src="coffee/services.coffee" type="text/coffeescript"></script>
  <script src="coffee/controllers.coffee" type="text/coffeescript"></script>
  <script src="coffee/filters.coffee" type="text/coffeescript"></script>
  <script src="coffee/directives.coffee" type="text/coffeescript"></script>
  <script src="coffee/app.coffee" type="text/coffeescript"></script>

  <h1>The Search for Inner[Text] Peace</h1>

  <div ng-controller="SearchController" ng-cloak>

    <div ng-show="!compatibility.ok">{{compatibility.message}}</div>

    <div id="demo-app" ng-show="compatibility.ok">
      <form class="form-horizontal">
	<div class="control-group">
	  <label class="control-label">HTML input source</label>
	  <div class="controls">
	    <select ng-model="sourceMode">
	      <option value="local">Input HTML source manually</option>
	      <option value="page">Use this page</option>
	      <option value="sample1">Use sample article 1</option>
	    </select>
	  </div>
	</div>
      </form>
      
      <div id="source-spec" ng-show="sourceModeNeedsInput" ng-switch on="sourceMode">
	<div ng-switch-when="local"> 
	  <h3>Test html source:</h3>
	  <textarea ng-model="localSource" class="input-block-level"></textArea>
	  <button class="btn btn-primary" type="button" ng-click="render()">Render it!</button>
	</div>

	<div ng-switch-when="page">
	  <p>OK, so you want to test out the stuff on this very page.</p>
	  <p>Feel free to do so, but please note that the content below this point will not be accessible.</p>
	</div>
      </div>

      <div id="search-input" ng-show="canSearch">
	<h3>Search</h3>
	<form name="searchForm" ng-submit="search()" class="form-horizontal">
	  <input type="text" name="searchTerm" ng-model="searchTerm" required="true" class="input-xxlarge search-query" placeholder="Enter search term"/>
	  <button type="submit" ng-disabled="!searchForm.$valid" class="btn btn-primary">
	    <i class="icon-search"></i>
	    Search
	  </button>
	  <button type="button" ng-click="advancedSearch = !advancedSearch" class="btn">
	    <i class="icon-wrench"></i>
	    Settings
	  </button>
	  <div ng-show="advancedSearch">
	    <br />
	    <div class="control-group">
	      <label class="control-label">DOM element to scan</label>
	      <div class="controls">
		<select ng-model="selectedPath" ng-options="path.path as path.path + ' (' + path.length +' chars)' for path in paths"></select>
	      </div>
	    </div>
	    <div class="control-group">
	      <label class="control-label">Search position</label>
	      <div class="controls">
		<input type="number" ng-model="searchPos" min="0" required="true" class="input-mini"/>
	      </div>
	    </div>
	    <div class="control-group">
	      <label class="control-label">Match distance</label>
	      <div class="controls">
		<input type="number" ng-model="matchDistance" min="0" required="true" class="input-mini"/>
		<a id="help1" href="#" class="btn btn-info btn-mini" rel="popover" data-content="{{distanceExplanation}}" data-original-title="Match Distance property" data-trigger="hover">?</a>
	      </div>
	    </div>
	    <div class="control-group">
	      <label class="control-label">Match threshold</label>
	      <div class="controls">
		<input type="number" ng-model="matchThreshold" min="0" max="100" required="true" class="input-mini"/>
		<a id="help2" href="#" class="btn btn-info btn-mini" rel="popover" data-content="{{thresholdExplanation}}" data-original-title="Match Threshold property" data-trigger="hover">?</a>
	      </div>
	    </div>
	    <div class="control-group">
	      <label class="control-label">What to do with result?</label>
	      <div class="controls">
		<select ng-model="foundAction" class="input-xxlarge">
		  <option value="nothing">Do nothing</option>
		  <option value="select">Select it (by creating a Range, and add it to Selection)</option>
		  <option value="hilite">Highlight it (using SPANs)</option>
		</select>
	      </div>
	    </div>
	  </div>
	</form>

	<div ng-show="searchResults.length>0 || detailedResults.length>0">
	  <h3>Search results</h3>
	  <div>
	    <strong>
	      {{searchResults}}
	    </strong>
	  </div>
	  <button class="btn btn-mini" ng-click="showDetailedResults = true" ng-show="!showDetailedResults">
	    <i class="icon-zoom-in"></i>
	    Show details...
	  </button>
	  <div id="search-matching-elements" ng-show="showDetailedResults && detailedResults.length>0">
	    <button class="btn btn-mini" ng-click="showDetailedResults = false">
	      <i class="icon-zoom-out"></i>
	      Hide details
	    </button>
	    <p>Involved elements:</p>
	    <table border="1">
	      <thead>
		<tr>
		  <th rowspan="2">Path</th>
		  <th rowSpan="2">Full</th>
		  <th colSpan="4">Displayed text</th>
		  <th colSpan="4">Actual HTML source text</th>
		</tr>
		<tr>
		  <th>Text</th>
		  <th>Wanted</th>
		  <th>From</th>
		  <th>Till</th>
		  <th>Text</th>
		  <th>From</th>
		  <th>Till</th>
		  <th>Yields</th>
		</tr>
	      </thead>
	      <tbody>
		<tr ng-repeat="match in detailedResults">
		  <td>{{match.element.path}}</td>
		  <td>{{match.full | booleanCheckmark}}</td>
		  <td>'{{match.element.content}}'</td>
		  <td>'{{match.wanted}}'</td>
		  <td>{{match.start}}</td>
		  <td>{{match.end}}</td>
		  <td ng-bind-html-unsafe="match.element.node.data | quoteHTML"></td>
		  <td>{{match.startCorrected}}</td>
		  <td>{{match.endCorrected}}</td>
		  <td ng-bind-html-unsafe="match.yields | quoteHTML"></td>
		</tr>
	      </tbody>
	    </table>
	  </div>
	</div>
      </div>

      <div ng-show="renderSource" id="sandbox">
	<h3>DOM rendered as:</h3>
	<div id="rendered-dom" ng-bind-html-unsafe="renderSource"></div>
      </div>
    </div>
  </div>
<hr />
Back to <a href="https://github.com/csillag/inner-peace"><i class="icon-home"></i>inner-peace</a>
</body>
</html>

{'fraction_non_alphanumeric': 0.19546135731106828, 'fraction_numerical': 0.0049953614500820665, 'mean_word_length': 3.660458929165281, 'pattern_counts': {'":': 0, '<': 477, '<?xml version=': 0, '>': 483, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2587108', 'n_tokens_mistral': 5136, 'n_tokens_neox': 4695, 'n_words': 912}