-
Notifications
You must be signed in to change notification settings - Fork 0
/
index4.cfm
374 lines (307 loc) · 16.4 KB
/
index4.cfm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-51496341-1', 'bestwordplay.com');
ga('send', 'pageview');
</script>
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<!--- DataTables/jQuery CSS --->
<link rel="stylesheet" type="text/css" href="https://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="http://cdn.datatables.net/1.10.0/css/jquery.dataTables.css">
<!--- <link rel="stylesheet" type="text/css" href="http://datatables.net/release-datatables/extensions/ColVis/css/dataTables.colVis.css"> --->
<!--- Local CSS --->
<link rel="stylesheet" type="text/css" href="kbtbc.css">
<!--- jQuery --->
<script type="text/javascript" charset="utf8" src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type="text/javascript" charset="utf8" src="http://code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script>
<!---<script src="http://cdn.jquerytools.org/1.2.7/full/jquery.tools.min.js"></script>--->
<!--- DataTables --->
<script type="text/javascript" charset="utf8" src="http://cdn.datatables.net/1.10.0/js/jquery.dataTables.js"></script>
<!--- <script type="text/javascript" charset="utf8" src="http://datatables.net/release-datatables/extensions/ColVis/js/dataTables.colVis.js"></script> --->
<script type="text/javascript" charset="utf8" src="http://cdn.datatables.net/plug-ins/be7019ee387/integration/jqueryui/dataTables.jqueryui.js"></script>
<script type="text/javascript"><!--- Datatables --->
$(document).ready(function() {
$('#wordList').dataTable({
"paging": false,
"order": [[ 3, "desc" ]],
"columns": [ { "orderable": false }, null, { "orderable": false }, null ],
"searching": false
} );
$('.tooltip').tooltipster({
contentAsHTML: true,
maxWidth: 400,
position: 'left',
interactive: true
} );
} );
</script>
<!--- Tooltips --->
<script type="text/javascript" src="jquery.tooltipster.min.js"></script>
<link rel="stylesheet" type="text/css" href="tooltipster.css" />
<title>Most Common Ruzzle Words - by kbtbc</title>
</head>
<cfsilent>
<cfparam name="RequestTimeout" default ="5000">
<cfparam name="topcount" default="10"><cfif topcount gt 30><cfset topcount =30></cfif>
<cfparam name="Minwordlength" default="2">
<cfparam name="Maxwordlength" default="12">
<cfparam name="prefix" default =""> <cfset prefix = #UCase(REReplace(prefix,"[^A-Za-z/, ]", "", "all"))#>
<cfparam name="suffix" default =""> <cfset suffix = #UCase (REReplace(suffix,"[^A-Za-z/, ]","","all"))#>
<cfparam name="contains1" default =""> <cfset contains1 = #UCase(REReplace(contains1,"[^A-Za-z ]","","all"))#>
<cfparam name="reversal" default ="no">
<cfparam name="semor" default ="no">
<cfparam name="palin" default ="no">
<cfparam name="taut" default ="no">
<cfparam name="SupDef" default = "no">
<cfparam name="anagram" default = "no">
<cfparam name="FrontHooksInfo" default = "">
<cfparam name="BackHooksInfo" default = "">
<cfparam name="AnagramContainsKey" default = "">
<!--- If Contains Anywhere is selected, create AnagramContainsKey --->
<cfif contains1 neq "" AND anagram eq "yes">
<!--- Create an array of all the letters --->
<cfset letters = reMatchNoCase("\w", contains1) />
<!--- Create a stucture to count the letters --->
<cfset letterCount = StructNew()>
<cfloop index="letter" array="#letters#">
<cfif structKeyExists(letterCount, letter)>
<cfset letterCount[letter]++>
<cfelse>
<cfset letterCount[letter] = 1>
</cfif>
</cfloop>
<!--- Set Anagram Key --->
<cfloop list="#listSort(structKeyList(letterCount),"text")#" index="key">
<cfloop from="1" to="#letterCount[key]#" index =i>
<cfset AnagramContainsKey = listAppend(AnagramContainsKey,'#key##i#') >
</cfloop>
</cfloop>
</cfif>
<!--- put all words into memeory, cached for one hour --->
<cfquery name="AllWords" datasource="ruzzle" cachedwithin="#CreateTimeSpan(0,1,0,0)#">
SELECT RuzzleWords.Word, RuzzleWords.Frequency, RuzzleWords.AnagramKey, Ruzzlewords.WordLength FROM RuzzleWords;
</cfquery>
<cfquery name="Top100" datasource="ruzzle">
SELECT Top #topcount# RuzzleWords.Word, RuzzleWords.Frequency, RuzzleWords.OWLDef, RuzzleWords.FrontHooks, RuzzleWords.BackHooks, RuzzleWords.InnerHooks, RuzzleWords.AnagramKey, RuzzleWords.Nearby
FROM Ruzzlewords
WHERE <cfif (MaxWordLength - MinWordLength) eq 10> 1=1 <cfelse> ((Len([RuzzleWords.Word])) BETWEEN (#MinWordLength#) AND (#MaxWordLength#)) </cfif>
<cfif prefix neq ""><cfoutput> AND RuzzleWords.Word LIKE '#prefix#%' </cfoutput> </cfif>
<cfif suffix neq ""><cfoutput> AND RuzzleWords.Word LIKE '%#suffix#' </cfoutput> </cfif>
<cfif contains1 neq "" AND reversal eq "no" AND anagram eq "no"><cfoutput> AND RuzzleWords.Word LIKE '%#contains1#%' </cfoutput> </cfif>
<cfif contains1 neq "" AND reversal eq "yes"><cfoutput> AND ((RuzzleWords.Word LIKE '%#contains1#%') OR (RuzzleWords.Word LIKE '%#Reverse(contains1)#%')) </cfoutput> </cfif>
<cfif contains1 neq "" AND anagram eq "yes"><cfloop list="#AnagramContainsKey#" index ="key"><cfoutput> AND (RuzzleWords.AnagramKey LIKE '%#key#%')</cfoutput></cfloop> </cfif>
<cfif semor eq "yes">AND IsSemordnilap = true</cfif>
<cfif palin eq "yes">AND IsPalindrome = true</cfif>
<cfif taut eq "yes">AND IsTautonym = true</cfif>
ORDER BY RuzzleWords.Frequency DESC;
</cfquery>
</cfsilent>
<body >
<cfif ReFind(#prefix#,",")> Comma <cfelse> No Comma
</cfif><hr>
<div class="container">
<section>
<table align=center cellspacing=10 >
<tr><td align=left valign=top>
<img src="logo.gif">
<p align="center"><span><b>Improve your game by learning <br>the most common Ruzzle words!</b></span>
<br> <br>
<form action = "/" METHOD="POST" >
<table > <tr><td colspan=2><i>Options:</i> </td></tr>
<tr><td> # of Words to Return: </td>
<td> <input type="text" name="topcount" value="<cfoutput>#topcount#</cfoutput>" default="30" size=4> </td> </tr>
<tr><td> Min Word Length:</td>
<td>
<select name="MinWordLength" >
<cfloop from="2" to="12" index="WordCnt"> <option value="<cfoutput>#WordCnt#</cfoutput>" <cfif MinWordLength EQ WordCnt>selected="selected"</cfif> >
<cfoutput>#WordCnt#</cfoutput></option></cfloop>
</select> </td> </tr>
<tr><td> Max Word Length:</td>
<td>
<select name="MaxWordLength" >
<cfloop from="2" to="12" index="WordCnt"> <option value="<cfoutput>#WordCnt#</cfoutput>" <cfif MaxWordLength EQ WordCnt>selected="selected"</cfif> >
<cfoutput>#WordCnt#</cfoutput></option></cfloop>
</select></td> </tr>
<tr><td> Prefix: </td><td> <input type="text" name="prefix" value="<cfoutput>#prefix#</cfoutput>" default ="" size=6> </td> </tr>
<tr><td> Suffix: </td><td> <input type="text" name="suffix" value="<cfoutput>#suffix#</cfoutput>" default ="" size=6> </td> </tr>
<tr><td> Contains:</td><td> <input type="text" name="contains1" value="<cfoutput>#contains1#</cfoutput>" default ="" size=6>
</td> </tr>
<tr> <td colspan=2 align=center><button type="submit" value="Submit">Get Words!</button></td></tr>
<tr><td colspan=2 > <br> </td></tr>
<tr><td colspan=2><i>More Options:</i> </td></tr>
<tr><td>Match Contains Reversed</td>
<td><input type="checkbox" name="reversal" value="yes" <cfif reversal eq "yes">checked</cfif> > </td></tr>
<tr><td>Match Contains Anywhere</td>
<td><input type="checkbox" name="anagram" value="yes" <cfif anagram eq "yes">checked</cfif> > </td></tr>
<tr><td>Semordnilaps</td>
<td> <input type="checkbox" name="semor" value="yes" <cfif semor eq "yes">checked</cfif> > </td></tr>
<tr><td>Palindromes</td>
<td> <input type="checkbox" name="palin" value="yes" <cfif palin eq "yes">checked</cfif> > </td></tr>
<tr><td>Tautonyms</td>
<td> <input type="checkbox" name="taut" value="yes" <cfif taut eq "yes">checked</cfif> > </td></tr>
<tr><td><a href="/"><p>Reset Form</a></td></tr>
<input type="hidden" name="qtype" value="topwords"> </form>
</table>
</td>
<td>
<p> </p>
<table>
<tr><td >
<cfoutput>
<cfif prefix neq "">Prefix: #UCase(prefix)#- </cfif>
<cfif suffix neq "">Suffix: -#UCase(suffix)# </cfif>
<cfif contains1 neq "">Contains: #UCase(contains1)#
<cfif reversal eq "yes">, #UCase(Reverse(contains1))#</cfif>
<cfif anagram eq "yes"> (anywhere in word)</cfif>
</cfif>
<cfif prefix eq "" AND suffix eq "" AND contains1 eq ""><cfelse><br></cfif>
Showing the top #Top100.RecordCount#
<cfif semor eq "yes"> semordnilaps </cfif>
<cfif palin eq "yes"> palindromes </cfif>
<cfif taut eq "yes"> tautonyms </cfif>
<cfif semor eq "no" AND palin eq "no" AND taut eq "no"> words </cfif>
<cfif (MaxWordLength - MinWordLength) eq 10> of any length.
<cfelseif Maxwordlength eq MinWordLength> #MaxWordLength# characters long.
<cfelse> between #MinWordLength# and #MaxWordLength# characters long.</cfif>
</cfoutput>
<table id="wordList" class="display" cellspacing="0" width="100%">
<thead>
<th>Front</th>
<th>Word</th>
<th>Back</th>
<!--- <th>Definition</th> --->
<th>Freq</th>
</thead>
<tbody>
<cfloop query="Top100"> <!--- Output Words! ---->
<tr height="25">
<td align=right><cfoutput>#UCase(FrontHooks)#</cfoutput></td>
<!--- Find Anagrams --->
<!--- Create Anagram Key --->
<cfset AllAnagrams = "" >
<cfset WordAnagramArray = ListToArray(AnagramKey) /> <!--- Convert Word Key to Array --->
<cfif len(word) eq 2 OR len(word) eq 3 > <cfset loopstart = 2> <!--- Subanagrams up to two word lengths down --->
<cfelse> <cfset loopstart = '#(len(word)-2)#' >
</cfif>
<cfloop from="#loopstart#" to="#len(word)#" index="i">
<cfquery name="FindAnagrams" dbtype="query" >
SELECT AllWords.Word, AllWords.AnagramKey
FROM AllWords
WHERE AllWords.WordLength = #i#
</cfquery>
<cfset AnagramList ="">
<cfloop query="FindAnagrams">
<cfif WordAnagramArray.containsAll(ListToArray ( #AnagramKey# ))>
<cfset AnagramList = listAppend(AnagramList, '#Word#')>
</cfif>
</cfloop>
<cfset AnagramListSorted = listSort(AnagramList, "text")>
<cfset AllAnagrams = listPrepend(AllAnagrams, '#AnagramListSorted#', '|')>
</cfloop>
<!---- Start setting tooltip Content --->
<cfset wordinfo = "<b>#Word#</b> - <i> #OWLDef#</i> #HTMLEditFormat ("<a target=""_blank"" href=""http://www.google.com/search?q=define+#lCase(Word)#"">»</a>")# " >
<cfset wordinfo = wordinfo & "<p> Nearby: ">
<cfloop list="#Nearby#" index="NearbyWord">
<cfset wordinfo = wordinfo & "#NearbyWord# ">
</cfloop>
<cfset wordinfo = wordinfo & " <p> Anagrams: ">
<cfloop from="1" to="#listlen(AllAnagrams,'|')#" index="i">
<cfif i eq 1 >
<cfloop list="#ListGetAt(AllAnagrams, i ,'|')#" index = "Anaword">
<cfset wordinfo = wordinfo & "#AnaWord# ">
</cfloop>
<cfelseif i eq 2> <cfset wordinfo = wordinfo & "<p> Subliminals: ">
<cfloop list="#ListGetAt(AllAnagrams, i ,'|')#" index = "Anaword">
<cfset wordinfo = wordinfo & "#AnaWord# ">
</cfloop>
<cfelse>
<cfloop list="#ListGetAt(AllAnagrams, i ,'|')#" index = "Anaword">
<cfset wordinfo = wordinfo & "#AnaWord# ">
</cfloop>
</cfif>
</cfloop>
<cfsilent>
<!--- Get words that Start, Ends and contains word --->
<cfquery name="TopStartWith" dbtype="query" maxrows="15">
SELECT AllWords.Word
FROM AllWords
WHERE AllWords.Word LIKE '#Word#%'
AND AllWords.Word <> '#Word#'
ORDER BY AllWords.Frequency DESC;
</cfquery>
<cfset wordinfo = wordinfo & " <p> As prefix: ">
<cfloop query = "TopStartWith">
<cfset wordinfo = wordinfo & "#TopStartWith.Word# ">
</cfloop>
<cfquery name="TopEndsWith" dbtype="query" maxrows="15">
SELECT AllWords.Word, AllWords.Frequency
FROM AllWords
WHERE AllWords.Word LIKE '%#Word#'
AND AllWords.Word <> '#Word#'
ORDER BY AllWords.Frequency DESC;
</cfquery>
<cfset wordinfo = wordinfo & " <p> As suffix: ">
<cfloop query = "TopEndsWith">
<cfset wordinfo = wordinfo & "#TopEndsWith.Word# ">
</cfloop>
<cfquery name="TopContains" dbtype="query" maxrows="30" >
SELECT AllWords.Word, AllWords.Frequency
FROM AllWords
WHERE AllWords.Word LIKE '%#Word#%'
AND AllWords.Word <> '#Word#'
ORDER BY AllWords.Frequency DESC;
</cfquery>
<cfset wordinfo = wordinfo & " <p> Contained in: ">
<cfloop query = "TopContains">
<cfif reFind('#Word#', "#wordinfo#") eq False>
<cfset wordinfo = wordinfo & "#TopContains.Word# "> </cfif>
</cfloop>
<cfquery name="TopReversals" dbtype="query" maxrows="15" >
SELECT AllWords.Word, AllWords.Frequency
FROM AllWords
WHERE AllWords.Word LIKE '%#Reverse(Word)#%'
AND AllWords.Word <> '#Word#'
ORDER BY AllWords.Frequency DESC;
</cfquery>
<cfset wordinfo = wordinfo & " <p> Reversed in: ">
<cfloop query = "TopReversals">
<cfif reFind('#Word#', "#wordinfo#") eq False >
<cfset wordinfo = wordinfo & "#TopReversals.Word# "> </cfif>
</cfloop>
--->
</cfsilent>
<td align=center><cfoutput>
<a class="tooltip" href="?anagram=yes&MaxWordLength=#MaxWordLength#&topcount=#topcount#&MinWordLength=#MinWordLength#&contains1=#Word#"
title="#wordinfo#">#InnerHooks#</a>
</cfoutput></td>
<td><cfoutput>#UCase(BackHooks)#</cfoutput></td>
<!--- <td><cfoutput>#OWLDef#</cfoutput></td> --->
<td><cfoutput>#NumberFormat(Frequency * 100, '99.99')#</cfoutput>%</td>
</tr>
</cfloop>
</tbody>
</table>
</td></tr>
</table>
</td></tr>
<tr><td> <p></p></td></tr>
<tr ><td colspan =2 align="center">
<table style="border:1px solid #eee;border-collapse:collapse;" > <tr><td style="padding:10px;">
<p style="text-align:center;">Instructions</p> The results show the most common Ruzzle words, sorted by frequency of appearance. You can simply begin exploring words by hovering over any word for more information or clicking any word to build into other words. <p>
The filters on the left will control the data results. All filters are optional, and less filters will return more results. <p>
First try only changing the Min Word Length to '5' and also Max Word Length to '5' and leave the rest of the fields blank -- this will show you the most frequent 5 letter Ruzzle words only. To show the top 5 letter words that start with 'S', run the same query with 'S' entered as a Prefix. To show all words of 5 characters <i>or longer</i>, change the Max Word Length to 12 (so far the longest Ruzzle words are 12 characters long), and this will return all words 5 characters or longer. <p>
The 'Match Contains Reversed' option will also match words that have the reversal of whatever is entered into the 'Contains' field. For example, if you enter 'ART' in the Contains field and select 'Include Reverse Contains' (leave the other fields blank), you will get back words that contain both 'ART' and 'TRA' in them. <p>
The 'Match Contains Anywhere' option will match words that have all letters entered into the 'Contains' field anywhere in the word. For example, to find all the words that contains two 'A's anywhere in the word, enter 'AA' in the Contains field, and select this option. Also, clicking on any word in the results list will automatically reload the database with these options using the letters from the word selected.<p>
The Semordnilaps option will restrict the results to only words that are Semordnilaps (ie. TRAM <--> MART). Likewiese for the Palindrome and Tautonym options. (These options are best used without other filters.) <p>
Thanks for stopping by! <p> <font size="1"> BestWordPlay.com was created by Ruzzle player <b>kbtbc</b> and is based on the statistics from just over 6000 games as published by the <a href="http://www.ruzzleleague.com/">Ruzzle League</a>. </font>
</td></tr></table>
</td></tr>
</table>
</body>
</head>
</html>